Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Dec 17, 2024
1 parent 6205f5e commit 313432e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ type revision struct {

// Arbitrum: track the total balance change across all accounts
unexpectedBalanceDelta *big.Int
arbTxFilter bool
}

type mutationType int
Expand Down Expand Up @@ -224,6 +223,10 @@ func (s *StateDB) FilterTx() {
s.arbExtraData.arbTxFilter = true
}

func (s *StateDB) ClearTxFilter() {
s.arbExtraData.arbTxFilter = false
}

func (s *StateDB) IsTxFiltered() bool {
return s.arbExtraData.arbTxFilter
}
Expand Down Expand Up @@ -829,7 +832,7 @@ func (s *StateDB) Copy() *StateDB {
func (s *StateDB) Snapshot() int {
id := s.nextRevisionId
s.nextRevisionId++
s.validRevisions = append(s.validRevisions, revision{id, s.journal.length(), new(big.Int).Set(s.arbExtraData.unexpectedBalanceDelta), s.arbExtraData.arbTxFilter})
s.validRevisions = append(s.validRevisions, revision{id, s.journal.length(), new(big.Int).Set(s.arbExtraData.unexpectedBalanceDelta)})
return id
}

Expand All @@ -845,7 +848,6 @@ func (s *StateDB) RevertToSnapshot(revid int) {
revision := s.validRevisions[idx]
snapshot := revision.journalIndex
s.arbExtraData.unexpectedBalanceDelta = new(big.Int).Set(revision.unexpectedBalanceDelta)
s.arbExtraData.arbTxFilter = revision.arbTxFilter

// Replay the journal to undo changes and remove invalidated snapshots
s.journal.revert(s, snapshot)
Expand Down
1 change: 1 addition & 0 deletions core/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type StateDB interface {

// Arbitrum
FilterTx()
ClearTxFilter()
IsTxFiltered() bool

Deterministic() bool
Expand Down

0 comments on commit 313432e

Please sign in to comment.