fix(trace): use correct roots in trace of block with one transaction (#508)

fix: use correct roots in trace of block with one transaction
This commit is contained in:
Péter Garamvölgyi 2023-09-11 12:13:50 +02:00 committed by GitHub
parent 1d824f42bd
commit 9c1433b62a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -58,7 +58,7 @@ type SkippedTransaction struct {
// BlockNumber is the number of the block in which this transaction was skipped. // BlockNumber is the number of the block in which this transaction was skipped.
BlockNumber uint64 BlockNumber uint64
// BlockNumber is the hash of the block in which this transaction was skipped or nil. // BlockHash is the hash of the block in which this transaction was skipped or nil.
BlockHash *common.Hash BlockHash *common.Hash
} }
@ -80,7 +80,7 @@ type SkippedTransactionV2 struct {
// BlockNumber is the number of the block in which this transaction was skipped. // BlockNumber is the number of the block in which this transaction was skipped.
BlockNumber uint64 BlockNumber uint64
// BlockNumber is the hash of the block in which this transaction was skipped or nil. // BlockHash is the hash of the block in which this transaction was skipped or nil.
BlockHash *common.Hash BlockHash *common.Hash
} }

View file

@ -322,7 +322,8 @@ func (env *TraceEnv) getTxResult(state *state.StateDB, index int, block *types.B
// still we have no state root for per tx, only set the head and tail // still we have no state root for per tx, only set the head and tail
if index == 0 { if index == 0 {
txStorageTrace.RootBefore = state.GetRootHash() txStorageTrace.RootBefore = state.GetRootHash()
} else if index == len(block.Transactions())-1 { }
if index == len(block.Transactions())-1 {
txStorageTrace.RootAfter = block.Root() txStorageTrace.RootAfter = block.Root()
} }

View file

@ -24,7 +24,7 @@ import (
const ( const (
VersionMajor = 4 // Major version component of the current release VersionMajor = 4 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release VersionMinor = 4 // Minor version component of the current release
VersionPatch = 4 // Patch version component of the current release VersionPatch = 5 // Patch version component of the current release
VersionMeta = "sepolia" // Version metadata to append to the version string VersionMeta = "sepolia" // Version metadata to append to the version string
) )