mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 15:33:47 +00:00
add code_hash to trace
This commit is contained in:
parent
8ccc10541d
commit
360115e61f
3 changed files with 24 additions and 19 deletions
|
|
@ -1347,9 +1347,10 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
||||||
// Fill blockResult content
|
// Fill blockResult content
|
||||||
func (bc *BlockChain) writeBlockResult(state *state.StateDB, block *types.Block, blockResult *types.BlockResult) {
|
func (bc *BlockChain) writeBlockResult(state *state.StateDB, block *types.Block, blockResult *types.BlockResult) {
|
||||||
coinbase := types.AccountProofWrapper{
|
coinbase := types.AccountProofWrapper{
|
||||||
Address: block.Coinbase(),
|
Address: block.Coinbase(),
|
||||||
Nonce: state.GetNonce(block.Coinbase()),
|
Nonce: state.GetNonce(block.Coinbase()),
|
||||||
Balance: state.GetBalance(block.Coinbase()),
|
Balance: state.GetBalance(block.Coinbase()),
|
||||||
|
CodeHash: state.GetCodeHash(block.Coinbase()),
|
||||||
}
|
}
|
||||||
// Get coinbase address's account proof.
|
// Get coinbase address's account proof.
|
||||||
proof, err := state.GetProof(block.Coinbase())
|
proof, err := state.GetProof(block.Coinbase())
|
||||||
|
|
@ -1369,9 +1370,10 @@ func (bc *BlockChain) writeBlockResult(state *state.StateDB, block *types.Block,
|
||||||
// Get sender's address.
|
// Get sender's address.
|
||||||
from, _ := types.Sender(types.MakeSigner(bc.chainConfig, block.Number()), tx)
|
from, _ := types.Sender(types.MakeSigner(bc.chainConfig, block.Number()), tx)
|
||||||
evmTrace.Sender = &types.AccountProofWrapper{
|
evmTrace.Sender = &types.AccountProofWrapper{
|
||||||
Address: from,
|
Address: from,
|
||||||
Nonce: state.GetNonce(from),
|
Nonce: state.GetNonce(from),
|
||||||
Balance: state.GetBalance(from),
|
Balance: state.GetBalance(from),
|
||||||
|
CodeHash: state.GetCodeHash(from),
|
||||||
}
|
}
|
||||||
// Get sender's account proof.
|
// Get sender's account proof.
|
||||||
proof, err := state.GetProof(from)
|
proof, err := state.GetProof(from)
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,12 @@ type ExtraData struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type AccountProofWrapper struct {
|
type AccountProofWrapper struct {
|
||||||
Address common.Address `json:"address,omitempty"`
|
Address common.Address `json:"address,omitempty"`
|
||||||
Nonce uint64 `json:"nonce,omitempty"`
|
Nonce uint64 `json:"nonce,omitempty"`
|
||||||
Balance *big.Int `json:"balance,omitempty"`
|
Balance *big.Int `json:"balance,omitempty"`
|
||||||
Proof []string `json:"proof,omitempty"`
|
CodeHash common.Hash `json:"code_hash,omitempty"`
|
||||||
Storage *StorageProofWrapper `json:"storage,omitempty"` // StorageProofWrapper can be empty if irrelated to storage operation
|
Proof []string `json:"proof,omitempty"`
|
||||||
|
Storage *StorageProofWrapper `json:"storage,omitempty"` // StorageProofWrapper can be empty if irrelated to storage operation
|
||||||
}
|
}
|
||||||
|
|
||||||
// while key & value can also be retrieved from StructLogRes.Storage,
|
// while key & value can also be retrieved from StructLogRes.Storage,
|
||||||
|
|
|
||||||
|
|
@ -128,10 +128,11 @@ func getWrappedProofForAddr(l *StructLogger, address common.Address) (*types.Acc
|
||||||
}
|
}
|
||||||
|
|
||||||
return &types.AccountProofWrapper{
|
return &types.AccountProofWrapper{
|
||||||
Address: address,
|
Address: address,
|
||||||
Nonce: l.env.StateDB.GetNonce(address),
|
Nonce: l.env.StateDB.GetNonce(address),
|
||||||
Balance: l.env.StateDB.GetBalance(address),
|
Balance: l.env.StateDB.GetBalance(address),
|
||||||
Proof: encodeProof(proof),
|
CodeHash: l.env.StateDB.GetCodeHash(address),
|
||||||
|
Proof: encodeProof(proof),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,10 +148,11 @@ func getWrappedProofForStorage(l *StructLogger, address common.Address, key comm
|
||||||
}
|
}
|
||||||
|
|
||||||
return &types.AccountProofWrapper{
|
return &types.AccountProofWrapper{
|
||||||
Address: address,
|
Address: address,
|
||||||
Nonce: l.env.StateDB.GetNonce(address),
|
Nonce: l.env.StateDB.GetNonce(address),
|
||||||
Balance: l.env.StateDB.GetBalance(address),
|
Balance: l.env.StateDB.GetBalance(address),
|
||||||
Proof: encodeProof(proof),
|
CodeHash: l.env.StateDB.GetCodeHash(address),
|
||||||
|
Proof: encodeProof(proof),
|
||||||
Storage: &types.StorageProofWrapper{
|
Storage: &types.StorageProofWrapper{
|
||||||
Key: key.String(),
|
Key: key.String(),
|
||||||
Value: l.env.StateDB.GetState(address, key).String(),
|
Value: l.env.StateDB.GetState(address, key).String(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue