Skip to content

Commit

Permalink
core/state: re-enable verkle witness generation
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Oct 11, 2024
1 parent c2be92f commit bfb09e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
11 changes: 10 additions & 1 deletion core/state/statedb_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,15 @@ func (s *stateDBLogger) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
return s.inner.IntermediateRoot(deleteEmptyObjects)
}

func (s stateDBLogger) SetTxContext(txHash common.Hash, txIndex int) {
func (s *stateDBLogger) SetTxContext(txHash common.Hash, txIndex int) {
s.inner.SetTxContext(txHash, txIndex)
}

// GetTrie returns the account trie.
func (s *stateDBLogger) GetTrie() Trie {
return s.inner.GetTrie()
}

func (s *stateDBLogger) AccessEvents() *AccessEvents {
return s.inner.AccessEvents()
}
9 changes: 3 additions & 6 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,9 @@ func MakeReceipt(evm *vm.EVM, result *ExecutionResult, statedb vm.StateDB, block

// Merge the tx-local access event into the "block-local" one, in order to collect
// all values, so that the witness can be built.
//
// TODO (@holiman): Add this back (but not necessarily _here_)
//
//if statedb.GetTrie().IsVerkle() {
// statedb.AccessEvents().Merge(evm.AccessEvents)
//}
if statedb.GetTrie().IsVerkle() {
statedb.AccessEvents().Merge(evm.AccessEvents)
}

// Set the receipt logs and create the bloom filter.
receipt.Logs = statedb.GetLogs(tx.Hash(), blockNumber.Uint64(), blockHash)
Expand Down
6 changes: 6 additions & 0 deletions core/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/stateless"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -108,6 +109,11 @@ type StateDB interface {
// used when the EVM emits new state logs. It should be invoked before
// transaction execution.
SetTxContext(txHash common.Hash, txIndex int)

// GetTrie returns the account trie. Verkle-related
GetTrie() state.Trie
// AccessEvents returns the access-events collected for verkle-witness processing.
AccessEvents() *state.AccessEvents
}

// CallContext provides a basic interface for the EVM calling conventions. The EVM
Expand Down

0 comments on commit bfb09e7

Please sign in to comment.