fix(trace): fix contract call's ByteCode (#465)

* fix bug

* update version
This commit is contained in:
maskpp 2023-08-14 18:09:39 +08:00 committed by GitHub
parent 25fe3ba69a
commit 6195e2e77d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -502,14 +502,14 @@ func (env *TraceEnv) fillBlockTrace(block *types.Block) (*types.BlockTrace, erro
for i, tx := range block.Transactions() {
evmTrace := env.ExecutionResults[i]
// probably a Contract Call
if len(tx.Data()) != 0 && tx.To() != nil {
// Contract is created.
if tx.To() == nil {
evmTrace.ByteCode = hexutil.Encode(tx.Data())
} else { // contract call be included at this case, specially fallback call's data is empty.
evmTrace.ByteCode = hexutil.Encode(statedb.GetCode(*tx.To()))
// Get tx.to address's code hash.
codeHash := statedb.GetPoseidonCodeHash(*tx.To())
evmTrace.PoseidonCodeHash = &codeHash
} else if tx.To() == nil { // Contract is created.
evmTrace.ByteCode = hexutil.Encode(tx.Data())
}
}

View file

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