Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/utils/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,14 @@ func ImportChain(chain *core.BlockChain, fn string) error {
}
i := 0
for ; i < importBatchSize; i++ {
if i == 1907 {
break
Copy link
Owner Author

Choose a reason for hiding this comment

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

this is because the test file I have is truncated

}
var b types.Block
if err := stream.Decode(&b); err == io.EOF {
if err := stream.Decode(&b); errors.Is(err, io.EOF) {
break
} else if err != nil {
fmt.Println(batch, i)
return fmt.Errorf("at block %d: %v", n, err)
}
// don't import first block
Expand Down
2 changes: 1 addition & 1 deletion core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
}
// Create a new context to be used in the EVM environment
blockContext := NewEVMBlockContext(header, bc, author)
istarget := blockContext.BlockNumber.Uint64() == 17366216
istarget := blockContext.BlockNumber.Uint64() == 17165311
Copy link
Owner Author

Choose a reason for hiding this comment

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

error at this location. It doesn't seem like the problem of the nyota costs, even though it's at the same block.

if istarget {
tracer := logger.NewStructLogger(&logger.Config{
Debug: istarget,
Expand Down
12 changes: 10 additions & 2 deletions trie/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,20 @@ func (t *TransitionTrie) UpdateAccount(addr common.Address, account *types.State
// Delete removes any existing value for key from the trie. If a node was not
// found in the database, a trie.MissingNodeError is returned.
func (t *TransitionTrie) DeleteStorage(addr common.Address, key []byte) error {
return t.overlay.DeleteStorage(addr, key)
err := t.overlay.DeleteStorage(addr, key)
if err != nil {
return err
}
return t.base.DeleteStorage(addr, key)
}

// DeleteAccount abstracts an account deletion from the trie.
func (t *TransitionTrie) DeleteAccount(key common.Address) error {
return t.overlay.DeleteAccount(key)
err := t.overlay.DeleteAccount(key)
if err != nil {
return err
}
return t.base.DeleteAccount(key)
}

// Hash returns the root hash of the trie. It does not write to the database and
Expand Down
35 changes: 16 additions & 19 deletions trie/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,17 @@ func (trie *VerkleTrie) UpdateStorage(address common.Address, key, value []byte)
}

func (t *VerkleTrie) DeleteAccount(addr common.Address) error {
var (
err error
values = make([][]byte, verkle.NodeWidth)
stem = t.pointCache.GetTreeKeyVersionCached(addr[:])
)

for i := 0; i < verkle.NodeWidth; i++ {
values[i] = zero[:]
}
switch root := t.root.(type) {
case *verkle.InternalNode:
err = root.InsertValuesAtStem(stem, values, t.FlatdbNodeResolver)
default:
return errInvalidRootType
}
if err != nil {
return fmt.Errorf("DeleteAccount (%x) error: %v", addr, err)
var key = t.pointCache.GetTreeKeyVersionCached(addr[:])

// XXX this only deletes the header account, but for completeness,
// we need to delete everything. This is only a problem pre-cancun
// which unfortunately we are still stuck at.
// NOTE we should also return immediately if we are post-transition.
for i := 0; i < 256; i++ {
key[31] = byte(i)
if root, err := t.root.(*verkle.InternalNode).Delete(key, t.FlatdbNodeResolver); root || err != nil {
return fmt.Errorf("error deleting key %x: %w", err)
}
Comment on lines +213 to +217
Copy link
Owner Author

Choose a reason for hiding this comment

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

need to rebase to get DeleteAtStem

}
return nil
}
Expand All @@ -230,8 +224,11 @@ func (t *VerkleTrie) DeleteAccount(addr common.Address) error {
func (trie *VerkleTrie) DeleteStorage(addr common.Address, key []byte) error {
pointEval := trie.pointCache.GetTreeKeyHeader(addr[:])
k := utils.GetTreeKeyStorageSlotWithEvaluatedAddress(pointEval, key)
var zero [32]byte
return trie.root.Insert(k, zero[:], trie.FlatdbNodeResolver)
deleteRoot, err := trie.root.Delete(k, trie.FlatdbNodeResolver)
if deleteRoot {
return errors.New("trying to delete the root node, that should never happen")
}
return err
}

// Hash returns the root hash of the trie. It does not write to the database and
Expand Down