Skip to content

Commit 4453ba9

Browse files
Merge branch 'master' into add-methodsto-sizeconstrainedcache
2 parents 2b9bafa + 26b4dff commit 4453ba9

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

core/state/statedb.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,18 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
219219
return sdb, nil
220220
}
221221

222+
func (s *StateDB) FilterTx() {
223+
s.arbExtraData.arbTxFilter = true
224+
}
225+
226+
func (s *StateDB) ClearTxFilter() {
227+
s.arbExtraData.arbTxFilter = false
228+
}
229+
230+
func (s *StateDB) IsTxFiltered() bool {
231+
return s.arbExtraData.arbTxFilter
232+
}
233+
222234
// SetLogger sets the logger for account update hooks.
223235
func (s *StateDB) SetLogger(l *tracing.Hooks) {
224236
s.logger = l
@@ -736,6 +748,7 @@ func (s *StateDB) Copy() *StateDB {
736748
recentWasms: s.arbExtraData.recentWasms.Copy(),
737749
openWasmPages: s.arbExtraData.openWasmPages,
738750
everWasmPages: s.arbExtraData.everWasmPages,
751+
arbTxFilter: s.arbExtraData.arbTxFilter,
739752
},
740753

741754
db: s.db,
@@ -1220,6 +1233,9 @@ func (s *StateDB) GetTrie() Trie {
12201233
// The associated block number of the state transition is also provided
12211234
// for more chain context.
12221235
func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool) (common.Hash, error) {
1236+
if s.arbExtraData.arbTxFilter {
1237+
return common.Hash{}, ErrArbTxFilter
1238+
}
12231239
// Short circuit in case any database failure occurred earlier.
12241240
if s.dbErr != nil {
12251241
return common.Hash{}, fmt.Errorf("commit aborted due to earlier error: %v", s.dbErr)

core/state/statedb_arbitrum.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,16 @@ func (s *StateDB) Deterministic() bool {
164164
return s.deterministic
165165
}
166166

167+
var ErrArbTxFilter error = errors.New("internal error")
168+
167169
type ArbitrumExtraData struct {
168170
unexpectedBalanceDelta *big.Int // total balance change across all accounts
169171
userWasms UserWasms // user wasms encountered during execution
170172
openWasmPages uint16 // number of pages currently open
171173
everWasmPages uint16 // largest number of pages ever allocated during this tx's execution
172174
activatedWasms map[common.Hash]ActivatedWasm // newly activated WASMs
173175
recentWasms RecentWasms
176+
arbTxFilter bool
174177
}
175178

176179
func (s *StateDB) SetArbFinalizer(f func(*ArbitrumExtraData)) {

core/vm/interface.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ type StateDB interface {
4848
// Arbitrum: preserve old empty account behavior
4949
CreateZombieIfDeleted(common.Address)
5050

51+
// Arbitrum
52+
FilterTx()
53+
ClearTxFilter()
54+
IsTxFiltered() bool
55+
5156
Deterministic() bool
5257
Database() state.Database
5358

0 commit comments

Comments
 (0)