Skip to content

Commit

Permalink
types: fix json field name for execution witness parent state root (#522
Browse files Browse the repository at this point in the history
)

* types: fix json field name for execution witness parent state root

Signed-off-by: Ignacio Hagopian <[email protected]>

* get parent block by hash

Signed-off-by: Ignacio Hagopian <[email protected]>

* use latest alpha stable fixture

Signed-off-by: Ignacio Hagopian <[email protected]>

* fix

Signed-off-by: Ignacio Hagopian <[email protected]>

* target new version of stable fixtures

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign authored Nov 1, 2024
1 parent 054f953 commit ef048e6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stable-spec-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

env:
FIXTURES_TAG: "[email protected]4"
FIXTURES_TAG: "[email protected]8"

jobs:
setup:
Expand Down
2 changes: 1 addition & 1 deletion cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type ExecutionResult struct {
// Verkle witness
VerkleProof *verkle.VerkleProof `json:"verkleProof,omitempty"`
StateDiff verkle.StateDiff `json:"stateDiff,omitempty"`
ParentRoot common.Hash `json:"parentRoot,omitempty"`
ParentRoot common.Hash `json:"parentStateRoot,omitempty"`

// Values to test the verkle conversion
CurrentAccountAddress *common.Address `json:"currentConversionAddress,omitempty" gencodec:"optional"`
Expand Down
6 changes: 3 additions & 3 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
return fmt.Errorf("invalid merkle root (remote: %x local: %x) dberr: %w", header.Root, root, statedb.Error())
}
if blockEw := block.ExecutionWitness(); blockEw != nil {
parent := v.bc.GetHeaderByNumber(header.Number.Uint64() - 1)
parent := v.bc.GetBlockByHash(header.ParentHash)
if parent == nil {
return fmt.Errorf("nil parent header for block %d", header.Number)
}
stateDiff, proof, err := beacon.BuildVerkleProof(header, statedb, parent.Root)
stateDiff, proof, err := beacon.BuildVerkleProof(header, statedb, parent.Root())
if err != nil {
return fmt.Errorf("error building verkle proof: %w", err)
}
ew := types.ExecutionWitness{
StateDiff: stateDiff,
VerkleProof: proof,
ParentStateRoot: parent.Root,
ParentStateRoot: parent.Root(),
}
if err := ew.Equal(blockEw); err != nil {
return fmt.Errorf("invalid execution witness: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (n *BlockNonce) UnmarshalText(input []byte) error {
type ExecutionWitness struct {
StateDiff verkle.StateDiff `json:"stateDiff"`
VerkleProof *verkle.VerkleProof `json:"verkleProof"`
ParentStateRoot common.Hash `json:"parentRoot"`
ParentStateRoot common.Hash `json:"parentStateRoot"`
}

func (ew *ExecutionWitness) Copy() *ExecutionWitness {
Expand Down

0 comments on commit ef048e6

Please sign in to comment.