Skip to content
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

Filter transaction #377

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Filter transaction #377

wants to merge 10 commits into from

Conversation

ganeshvanahalli
Copy link
Contributor

@ganeshvanahalli ganeshvanahalli commented Nov 22, 2024

This PR enables filtering of malicious transactions and blocks via a stateDB object

Corresponding Nitro PR- OffchainLabs/nitro#2807
Part of NIT-2848

@ganeshvanahalli ganeshvanahalli marked this pull request as ready for review November 22, 2024 15:59
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the PR comment to explain what's going on and why? The link to the Linear ticket is not sufficient for people who want to contribute to the project but don't have access to Linear.

core/state/statedb.go Outdated Show resolved Hide resolved
core/vm/interface.go Show resolved Hide resolved
core/state/statedb.go Outdated Show resolved Hide resolved
eljobe
eljobe previously approved these changes Nov 26, 2024
core/state/statedb.go Outdated Show resolved Hide resolved
@cla-bot cla-bot bot added the s CLA signed label Dec 2, 2024
core/state/statedb.go Outdated Show resolved Hide resolved
core/state/statedb.go Outdated Show resolved Hide resolved
core/state/statedb.go Outdated Show resolved Hide resolved
core/state/statedb.go Outdated Show resolved Hide resolved
@@ -86,6 +90,7 @@ func (m *mutation) isDelete() bool {
// commit states.
type StateDB struct {
arbExtraData *ArbitrumExtraData // must be a pointer - can't be a part of StateDB allocation, otherwise its finalizer might not get called
arbTxFilter bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe statedb also has a Copy or Clone method that also needs modified to copy this field. Also, perhaps it should be in arbExtraData for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved it to arbExtraData for clarity, this also avoids merge conflicts in the future

@PlasmaPower
Copy link
Collaborator

Also, I think this flag might need to survive reverts

@ganeshvanahalli
Copy link
Contributor Author

Also, I think this flag might need to survive reverts

This is handled by persisting the flag in revisions

@PlasmaPower
Copy link
Collaborator

I'm not sure, wouldn't that mean the flag could get reset to false if a contract reverts?

@ganeshvanahalli
Copy link
Contributor Author

ganeshvanahalli commented Dec 11, 2024

I'm not sure, wouldn't that mean the flag could get reset to false if a contract reverts?

if a contract reverts such that it leads to a tx failure, then we dont have to worry about the boolean as statedb would be reset to previous snapshot in the block_processor anyway. and if the contract revert doesn't cause the tx failure then geth would've taken a statedb snapshot before such an execution right? so that it can revert back to it? in which case revisions would persist the boolean's value

Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s CLA signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants