-
Notifications
You must be signed in to change notification settings - Fork 708
Add ArbFilteredTransactionsManager precompile #4174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eljobe
merged 30 commits into
master
from
create-arbcensoredtransactionsmanager-precompile
Jan 20, 2026
+812
−126
Merged
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
f9bd5a7
Add ArbCensoredTransactionsManager precompile (idle)
MishkaRogachev 89aed0f
Limit access to ArbCensoredTransactionsManager with transaction censors
MishkaRogachev 987a143
Separated kv-storage for censored transactions
MishkaRogachev bbce75c
Rename: censored -> filtered transactions
MishkaRogachev 28feb69
chore: minor fixes
MishkaRogachev 1ad1084
Add a system test for filtered transaction manager
MishkaRogachev 0a6b8bb
Make ArbFilteredTransactionsManager access similar to ArbNativeTokenM…
MishkaRogachev 18a4b46
Add CensorPrecompile wrapper to make transaction filtring free
MishkaRogachev 102cbf9
Add events for filtered transaction
MishkaRogachev cc5818a
Add test for free calls for FilteredTransactionsManager
MishkaRogachev b0085c9
Add limited GetTransactionCensorshipFromTime
MishkaRogachev fb009fe
Finalise limited GetTransactionCensorshipFromTime
MishkaRogachev fa1ca8a
Add TransactionFilteringEnabled to ArbOS state init
MishkaRogachev 64d5725
Improve tests and polish comments
MishkaRogachev d5690a1
Review fixes and polishing
MishkaRogachev 55dea76
Make `IsTransactionFiltered` public
MishkaRogachev b82304e
Add events and public methods for transaction filterers
MishkaRogachev 9d83f9c
tmp: add stubs to compile upstream version
MishkaRogachev bcb35a9
Add test for filterer add/remove event
MishkaRogachev 2058741
Review fixes and minor polishing
MishkaRogachev 614caa6
chore: remove unused arbos state
MishkaRogachev da82012
Review fixes
MishkaRogachev d6c9e07
Use ArbosVersion_TransactionFiltering for precomplie
MishkaRogachev 7919304
Rename TransactionFilterPrecompile to FreeAccessPrecompile
MishkaRogachev 7cd9b17
update go-ethereum pin
MishkaRogachev 53d9af5
Merge remote-tracking branch 'origin/master' into create-arbcensoredt…
MishkaRogachev 7f4a52c
Review fixes
MishkaRogachev e8b5521
Add minor comment
MishkaRogachev e6a42bb
Merge remote-tracking branch 'origin/master' into create-arbcensoredt…
MishkaRogachev 140c32e
Update test-node pin
MishkaRogachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright 2025, Offchain Labs, Inc. | ||
| // For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE.md | ||
|
|
||
| package filteredTransactions | ||
|
|
||
| import ( | ||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/core/vm" | ||
|
|
||
| "github.com/offchainlabs/nitro/arbos/burn" | ||
| "github.com/offchainlabs/nitro/arbos/storage" | ||
| ) | ||
|
|
||
| var presentHash = common.BytesToHash([]byte{1}) | ||
|
|
||
| type FilteredTransactionsState struct { | ||
| store *storage.Storage | ||
| } | ||
|
|
||
| func Open(statedb vm.StateDB, burner burn.Burner) *FilteredTransactionsState { | ||
| return &FilteredTransactionsState{ | ||
| store: storage.FilteredTransactionsStorage(statedb, burner), | ||
| } | ||
| } | ||
|
|
||
| func (s *FilteredTransactionsState) Add(txHash common.Hash) error { | ||
| return s.store.Set(txHash, presentHash) | ||
| } | ||
|
|
||
| func (s *FilteredTransactionsState) Delete(txHash common.Hash) error { | ||
| return s.store.Clear(txHash) | ||
| } | ||
|
|
||
| func (s *FilteredTransactionsState) IsFiltered(txHash common.Hash) (bool, error) { | ||
| value, err := s.store.Get(txHash) | ||
| if err != nil { | ||
| return false, err | ||
| } | ||
| return value == presentHash, nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| ### Added | ||
| - Add new precompile ArbFilteredTransactionsManager to manage filtered transactions | ||
| - Add transaction filterers to ArbOwner to limit access to ArbFilteredTransactionsManager | ||
| - Limit ArbOwners ability to create transaction filterers with TransactionFilteringFromTime | ||
|
||
Submodule precompiles
updated
3 files
| +37 −0 | ArbFilteredTransactionsManager.sol | |
| +40 −0 | ArbOwner.sol | |
| +19 −0 | ArbOwnerPublic.sol |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Copyright 2025, Offchain Labs, Inc. | ||
| // For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE.md | ||
|
|
||
| package precompiles | ||
|
|
||
| import ( | ||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/core/vm" | ||
|
|
||
| "github.com/offchainlabs/nitro/arbos/filteredTransactions" | ||
| ) | ||
|
|
||
| // ArbFilteredTransactionsManager precompile enables ability to filter transactions by authorized callers. | ||
| // Authorized callers are added/removed through ArbOwner precompile. | ||
| type ArbFilteredTransactionsManager struct { | ||
| Address addr // 0x74 | ||
|
|
||
| FilteredTransactionAdded func(ctx, mech, common.Hash) error | ||
| FilteredTransactionAddedGasCost func(common.Hash) (uint64, error) | ||
gligneul marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FilteredTransactionDeleted func(ctx, mech, common.Hash) error | ||
| FilteredTransactionDeletedGasCost func(common.Hash) (uint64, error) | ||
| } | ||
|
|
||
| // Adds a transaction hash to the filtered transactions list | ||
| func (con ArbFilteredTransactionsManager) AddFilteredTransaction(c *Context, evm *vm.EVM, txHash common.Hash) error { | ||
| if !con.hasAccess(c) { | ||
| return c.BurnOut() | ||
| } | ||
|
|
||
| filteredState := filteredTransactions.Open(evm.StateDB, c) | ||
| if err := filteredState.Add(txHash); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| return con.FilteredTransactionAdded(c, evm, txHash) | ||
| } | ||
|
|
||
| // Deletes a transaction hash from the filtered transactions list | ||
| func (con ArbFilteredTransactionsManager) DeleteFilteredTransaction(c *Context, evm *vm.EVM, txHash common.Hash) error { | ||
| if !con.hasAccess(c) { | ||
| return c.BurnOut() | ||
| } | ||
|
|
||
| filteredState := filteredTransactions.Open(evm.StateDB, c) | ||
| if err := filteredState.Delete(txHash); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| return con.FilteredTransactionDeleted(c, evm, txHash) | ||
| } | ||
|
|
||
| // Checks if a transaction hash is in the filtered transactions list | ||
| func (con ArbFilteredTransactionsManager) IsTransactionFiltered(c *Context, evm *vm.EVM, txHash common.Hash) (bool, error) { | ||
| filteredState := filteredTransactions.Open(evm.StateDB, c) | ||
| return filteredState.IsFiltered(txHash) | ||
| } | ||
|
|
||
| func (con ArbFilteredTransactionsManager) hasAccess(c *Context) bool { | ||
| manager, err := c.State.TransactionFilterers().IsMember(c.caller) | ||
| return manager && err == nil | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both fixed