diff --git a/arbitrum/filter/filter_report.go b/arbitrum/filter/filter_report.go index d4c8af2e53..70199ec3e9 100644 --- a/arbitrum/filter/filter_report.go +++ b/arbitrum/filter/filter_report.go @@ -43,7 +43,13 @@ type FilterReason struct { } // lint:require-exhaustive-initialization -type FilteredAddressRecord struct { +type FilteredAddressWithReason struct { Address common.Address `json:"address"` FilterReason } + +// lint:require-exhaustive-initialization +type FilteredAddressRecord struct { + FilterSetID string `json:"filterSetId"` + FilteredAddressWithReason +} diff --git a/core/state/statedb.go b/core/state/statedb.go index cc005b451b..30525806e6 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -222,9 +222,9 @@ func (s *StateDB) SetAddressChecker(checker AddressChecker) { s.arbExtraData.addressChecker = checker } -func (s *StateDB) TouchAddress(record *filter.FilteredAddressRecord) { +func (s *StateDB) TouchAddress(touched *filter.FilteredAddressWithReason) { if s.arbExtraData.addressCheckerState != nil { - s.arbExtraData.addressCheckerState.TouchAddress(record) + s.arbExtraData.addressCheckerState.TouchAddress(touched) } } diff --git a/core/state/statedb_arbitrum.go b/core/state/statedb_arbitrum.go index 8d61192ccc..26e56d9b58 100644 --- a/core/state/statedb_arbitrum.go +++ b/core/state/statedb_arbitrum.go @@ -346,7 +346,9 @@ var ErrArbTxFilter error = errors.New("internal error") // Implementations manage their own synchronization (sync, WaitGroup, channels, etc). type AddressCheckerState interface { // TouchAddress records an address access and checks if it should be filtered. - TouchAddress(record *filter.FilteredAddressRecord) + // The checker is responsible for attaching the filter set ID to produce the + // final FilteredAddressRecord. + TouchAddress(*filter.FilteredAddressWithReason) // IsFiltered returns whether any touched address was filtered and the // list of filtered address records collected during the transaction. diff --git a/core/state/statedb_hooked.go b/core/state/statedb_hooked.go index c8b2b8204a..0dc7ecb3b5 100644 --- a/core/state/statedb_hooked.go +++ b/core/state/statedb_hooked.go @@ -370,8 +370,8 @@ func (s *hookedStateDB) SetAddressChecker(checker AddressChecker) { s.inner.SetAddressChecker(checker) } -func (s *hookedStateDB) TouchAddress(record *filter.FilteredAddressRecord) { - s.inner.TouchAddress(record) +func (s *hookedStateDB) TouchAddress(touched *filter.FilteredAddressWithReason) { + s.inner.TouchAddress(touched) } func (s *hookedStateDB) IsAddressFiltered() (bool, []filter.FilteredAddressRecord) { diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 86cbf9697c..cea4170517 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -924,10 +924,7 @@ func opSelfdestruct(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, error) { return nil, ErrWriteProtection } beneficiary := scope.Stack.pop() - evm.StateDB.TouchAddress(&filter.FilteredAddressRecord{ - Address: beneficiary.Bytes20(), - FilterReason: filter.FilterReason{Reason: filter.ReasonSelfdestructBeneficiary, EventRuleMatch: nil}, - }) + evm.StateDB.TouchAddress(&filter.FilteredAddressWithReason{Address: beneficiary.Bytes20(), FilterReason: filter.FilterReason{Reason: filter.ReasonSelfdestructBeneficiary, EventRuleMatch: nil}}) balance := evm.StateDB.GetBalance(scope.Contract.Address()) evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct) evm.StateDB.SelfDestruct(scope.Contract.Address()) @@ -958,10 +955,7 @@ func opSelfdestruct6780(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, erro } beneficiary := scope.Stack.pop() - evm.StateDB.TouchAddress(&filter.FilteredAddressRecord{ - Address: beneficiary.Bytes20(), - FilterReason: filter.FilterReason{Reason: filter.ReasonSelfdestructBeneficiary, EventRuleMatch: nil}, - }) + evm.StateDB.TouchAddress(&filter.FilteredAddressWithReason{Address: beneficiary.Bytes20(), FilterReason: filter.FilterReason{Reason: filter.ReasonSelfdestructBeneficiary, EventRuleMatch: nil}}) balance := evm.StateDB.GetBalance(scope.Contract.Address()) evm.StateDB.SubBalance(scope.Contract.Address(), balance, tracing.BalanceDecreaseSelfdestruct) evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct) diff --git a/core/vm/interface.go b/core/vm/interface.go index f3a38a4e3c..0b2dabe71e 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -57,7 +57,7 @@ type StateDB interface { ClearTxFilter() IsTxFiltered() bool SetAddressChecker(checker state.AddressChecker) - TouchAddress(record *filter.FilteredAddressRecord) + TouchAddress(*filter.FilteredAddressWithReason) IsAddressFiltered() (bool, []filter.FilteredAddressRecord) Recording() bool diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index af988f2f25..48d6853483 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -286,9 +286,9 @@ func run(ctx context.Context, call *core.Message, opts *Options) (*core.Executio if txFilterer != nil { txFilterer.Setup(dirtyState) - dirtyState.TouchAddress(&filter.FilteredAddressRecord{Address: call.From, FilterReason: filter.FilterReason{Reason: filter.ReasonFrom, EventRuleMatch: nil}}) + dirtyState.TouchAddress(&filter.FilteredAddressWithReason{Address: call.From, FilterReason: filter.FilterReason{Reason: filter.ReasonFrom, EventRuleMatch: nil}}) if call.To != nil { - dirtyState.TouchAddress(&filter.FilteredAddressRecord{Address: *call.To, FilterReason: filter.FilterReason{Reason: filter.ReasonTo, EventRuleMatch: nil}}) + dirtyState.TouchAddress(&filter.FilteredAddressWithReason{Address: *call.To, FilterReason: filter.FilterReason{Reason: filter.ReasonTo, EventRuleMatch: nil}}) } }