Skip to content

Commit

Permalink
remove validateDeleted
Browse files Browse the repository at this point in the history
Not enough to fix recordings.
Specifically, for arbone block 27,199,859
  • Loading branch information
tsahee committed Oct 4, 2022
1 parent 952eb45 commit 78cba65
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
9 changes: 2 additions & 7 deletions arbitrum/recordingdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,11 @@ func (r *RecordingChainContext) GetMinBlockNumberAccessed() uint64 {
return r.minBlockNumberAccessed
}

func PrepareRecording(blockchain *core.BlockChain, lastBlockHeader *types.Header, validateDeleted bool) (*state.StateDB, core.ChainContext, *RecordingKV, error) {
func PrepareRecording(blockchain *core.BlockChain, lastBlockHeader *types.Header) (*state.StateDB, core.ChainContext, *RecordingKV, error) {
rawTrie := blockchain.StateCache().TrieDB()
recordingKeyValue := NewRecordingKV(rawTrie)

trieDbConfig := trie.Config{
Cache: 0,
Preimages: true, // default
ValidateDeleted: validateDeleted,
}
recordingStateDatabase := state.NewDatabaseWithConfig(rawdb.NewDatabase(recordingKeyValue), &trieDbConfig)
recordingStateDatabase := state.NewDatabase(rawdb.NewDatabase(recordingKeyValue))
var prevRoot common.Hash
if lastBlockHeader != nil {
prevRoot = lastBlockHeader.Root
Expand Down
6 changes: 0 additions & 6 deletions trie/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ type Database struct {
childrenSize common.StorageSize // Storage size of the external children tracking
preimagesSize common.StorageSize // Storage size of the preimages cache

validateDeleted bool // Validate nodes when deleting them

lock sync.RWMutex
}

Expand Down Expand Up @@ -268,8 +266,6 @@ type Config struct {
Cache int // Memory allowance (MB) to use for caching trie nodes in memory
Journal string // Journal of clean cache to survive node restarts
Preimages bool // Flag whether the preimage of trie key is recorded

ValidateDeleted bool // Validate nodes when deleting them
}

// NewDatabase creates a new trie database to store ephemeral trie content before
Expand Down Expand Up @@ -297,8 +293,6 @@ func NewDatabaseWithConfig(diskdb ethdb.KeyValueStore, config *Config) *Database
dirties: map[common.Hash]*cachedNode{{}: {
children: make(map[common.Hash]uint16),
}},

validateDeleted: (config != nil) && config.ValidateDeleted,
}
if config == nil || config.Preimages { // TODO(karalabe): Flip to default off in the future
db.preimages = make(map[common.Hash][]byte)
Expand Down
18 changes: 1 addition & 17 deletions trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,7 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
// need to be tracked at all since it's always embedded.
t.tracer.onDelete(prefix)

var err error

if t.db.validateDeleted {
_, _, err = t.delete(n.Val, append(prefix, key...), []byte{})
}

return true, nil, err // remove n entirely for whole matches
return true, nil, nil // remove n entirely for whole matches
}
// The key is longer than n.Key. Remove the remaining suffix
// from the subtrie. Child can never be nil here since the
Expand Down Expand Up @@ -510,16 +504,6 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
}
}
}
if t.db.validateDeleted {
for _, child := range n.Children {
if child != nil {
_, err = t.resolve(child, prefix)
if err != nil {
return false, nil, err
}
}
}
}
if pos >= 0 {
if pos != 16 {
// If the remaining entry is a short node, it replaces
Expand Down

0 comments on commit 78cba65

Please sign in to comment.