-
Notifications
You must be signed in to change notification settings - Fork 697
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
base: master
Are you sure you want to change the base?
Add ArbFilteredTransactionsManager precompile #4174
Conversation
1adc79f to
81f4e5e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4174 +/- ##
==========================================
+ Coverage 33.05% 34.90% +1.85%
==========================================
Files 459 463 +4
Lines 55830 55992 +162
==========================================
+ Hits 18453 19543 +1090
+ Misses 34159 32984 -1175
- Partials 3218 3465 +247 |
❌ 7 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
45fb413 to
67c13f2
Compare
acf9398 to
7b7a735
Compare
7b7a735 to
f56f36c
Compare
Tristan-Wilson
left a comment
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.
Looks good, just a minor comment about consistency of the interface with other precompiles.
| return filteredState.IsFiltered(txHash) | ||
| } | ||
|
|
||
| func (con ArbFilteredTransactionsManager) hasAccess(c *Context) (bool, error) { |
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.
This signature is slightly different to ArbNativeTokenManager which has
func (con ArbNativeTokenManager) hasAccess(c ctx) bool {
manager, err := c.State.NativeTokenOwners().IsMember(c.caller)
return manager && err == nil
}
and therefore the behavior when there is an error is slightly different in this implementation in that if there is an error, then the gas is not burned out.
Unsure if this difference is intentional or not.
|
We should consider making |
@Tristan-Wilson, wdyt about going further: remove ArbNativeToken-style check and return an error right in CensorPrecompile, like in ArbOwner? |
| "github.com/offchainlabs/nitro/solgen/go/precompilesgen" | ||
| ) | ||
|
|
||
| func TestManageTransactionCensors(t *testing.T) { |
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.
Can you please also test that the transactions that should be free are free? You can look at TestArbNativeTokenManager and getGasUsed inside it for inspiration.
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.
I don't really get how to use getGasUsed in this case, since the transaction will still cost something, only the add/delete call is free. I can suggest to use multigas like this:
tx, err = arbFilteredTxs.AddFilteredTransaction(&censorTxOpts, txHash)
require.NoError(t, err)
receipt, err := builder.L2.EnsureTxSucceeded(tx)
require.NoError(t, err)
require.Equal(t, uint64(0), receipt.MultiGasUsed.Get(multigas.ResourceKindStorageAccess))
This somehow proves that tx did not perform any storage operations like set and clear
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.
Could you check the censor account's balance is unchanged after adding/deleting filtered txs?
Fixes NIT-4152
pulls in OffchainLabs/nitro-precompile-interfaces#25
pulls in OffchainLabs/go-ethereum#604
pulls in OffchainLabs/nitro-testnode#169
Changes:
ArbFilteredTransactionsManagerto manage filtered transactionsArbFilteredTransactionsManager