Remove code field from state diff output
this is the contract byte code, and it can still be obtained by querying the db by the codeHash
This commit is contained in:
parent
0dacc940fd
commit
feaff9998f
@ -155,7 +155,6 @@ func (sdb *builder) buildDiffEventual(accounts map[common.Address]*state.Account
|
||||
return nil, err
|
||||
}
|
||||
|
||||
codeBytes, err := sdb.chainDB.Get(val.CodeHash)
|
||||
codeHash := hexutil.Encode(val.CodeHash)
|
||||
hexRoot := val.Root.Hex()
|
||||
nonce := DiffUint64{Value: &val.Nonce}
|
||||
@ -165,7 +164,6 @@ func (sdb *builder) buildDiffEventual(accounts map[common.Address]*state.Account
|
||||
Nonce: nonce,
|
||||
Balance: balance,
|
||||
CodeHash: codeHash,
|
||||
Code: codeBytes,
|
||||
ContractRoot: contractRoot,
|
||||
Storage: storageDiffs,
|
||||
}
|
||||
|
@ -113,7 +113,6 @@ func TestBuilder(t *testing.T) {
|
||||
account1Addr: {
|
||||
Nonce: b.DiffUint64{Value: &nonce0},
|
||||
Balance: b.DiffBigInt{Value: big.NewInt(balanceChange10000)},
|
||||
Code: nil,
|
||||
CodeHash: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
ContractRoot: b.DiffString{Value: &originalContractRoot},
|
||||
Storage: map[string]b.DiffString{},
|
||||
@ -121,7 +120,6 @@ func TestBuilder(t *testing.T) {
|
||||
burnAddress: {
|
||||
Nonce: b.DiffUint64{Value: &nonce0},
|
||||
Balance: b.DiffBigInt{Value: big.NewInt(miningReward)},
|
||||
Code: nil,
|
||||
CodeHash: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
ContractRoot: b.DiffString{Value: &originalContractRoot},
|
||||
Storage: map[string]b.DiffString{},
|
||||
@ -156,7 +154,6 @@ func TestBuilder(t *testing.T) {
|
||||
account2Addr: {
|
||||
Nonce: b.DiffUint64{Value: &nonce0},
|
||||
Balance: b.DiffBigInt{Value: big.NewInt(balanceChange1000)},
|
||||
Code: nil,
|
||||
CodeHash: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
ContractRoot: b.DiffString{Value: &originalContractRoot},
|
||||
Storage: map[string]b.DiffString{},
|
||||
@ -164,7 +161,6 @@ func TestBuilder(t *testing.T) {
|
||||
contractAddr: {
|
||||
Nonce: b.DiffUint64{Value: &nonce1},
|
||||
Balance: b.DiffBigInt{Value: big.NewInt(0)},
|
||||
Code: []byte{96, 96, 96, 64, 82, 96, 0, 53, 124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 4, 128, 99, 96, 205, 38, 133, 20, 96, 65, 87, 128, 99, 193, 100, 49, 185, 20, 96, 107, 87, 96, 63, 86, 91, 0, 91, 96, 85, 96, 4, 128, 128, 53, 144, 96, 32, 1, 144, 145, 144, 80, 80, 96, 169, 86, 91, 96, 64, 81, 128, 130, 129, 82, 96, 32, 1, 145, 80, 80, 96, 64, 81, 128, 145, 3, 144, 243, 91, 96, 136, 96, 4, 128, 128, 53, 144, 96, 32, 1, 144, 145, 144, 128, 53, 144, 96, 32, 1, 144, 145, 144, 80, 80, 96, 138, 86, 91, 0, 91, 128, 96, 0, 96, 0, 80, 131, 96, 100, 129, 16, 21, 96, 2, 87, 144, 144, 1, 96, 0, 91, 80, 129, 144, 85, 80, 91, 80, 80, 86, 91, 96, 0, 96, 0, 96, 0, 80, 130, 96, 100, 129, 16, 21, 96, 2, 87, 144, 144, 1, 96, 0, 91, 80, 84, 144, 80, 96, 199, 86, 91, 145, 144, 80, 86},
|
||||
CodeHash: "0x1c671ee4ae8abbacab7da59d6f8785cce8295eb086551ce7ac266a2e93666c0f",
|
||||
ContractRoot: b.DiffString{Value: &originalContractRoot},
|
||||
Storage: map[string]b.DiffString{},
|
||||
|
@ -58,7 +58,6 @@ func (sd *StateDiff) Encode() ([]byte, error) {
|
||||
type AccountDiffEventual struct {
|
||||
Nonce DiffUint64 `json:"nonce" gencodec:"required"`
|
||||
Balance DiffBigInt `json:"balance" gencodec:"required"`
|
||||
Code []byte `json:"code" gencodec:"required"`
|
||||
CodeHash string `json:"codeHash" gencodec:"required"`
|
||||
ContractRoot DiffString `json:"contractRoot" gencodec:"required"`
|
||||
Storage map[string]DiffString `json:"storage" gencodec:"required"`
|
||||
|
@ -12,9 +12,8 @@ import (
|
||||
|
||||
var (
|
||||
Headers = []string{
|
||||
"blockNumber", "blockHash", "accountAction",
|
||||
"code", "codeHash", "nonceValue",
|
||||
"balanceValue", "contractRoot", "storageDiffPaths",
|
||||
"blockNumber", "blockHash", "accountAction", "codeHash",
|
||||
"nonceValue", "balanceValue", "contractRoot", "storageDiffPaths",
|
||||
}
|
||||
|
||||
timeStampFormat = "20060102150405.00000"
|
||||
@ -108,7 +107,6 @@ func formatAccountDiffEventual(accountDiff builder.AccountDiffEventual, sd build
|
||||
strconv.FormatInt(sd.BlockNumber, 10),
|
||||
sd.BlockHash.String(),
|
||||
accountAction,
|
||||
string(accountDiff.Code),
|
||||
accountDiff.CodeHash,
|
||||
strconv.FormatUint(*accountDiff.Nonce.Value, 10),
|
||||
accountDiff.Balance.Value.String(),
|
||||
@ -128,7 +126,6 @@ func formatAccountDiffIncremental(accountDiff builder.AccountDiffIncremental, sd
|
||||
strconv.FormatInt(sd.BlockNumber, 10),
|
||||
sd.BlockHash.String(),
|
||||
accountAction,
|
||||
"",
|
||||
accountDiff.CodeHash,
|
||||
strconv.FormatUint(*accountDiff.Nonce.Value, 10),
|
||||
accountDiff.Balance.Value.String(),
|
||||
|
@ -29,7 +29,6 @@ var expectedCreatedAccountRow = []string{
|
||||
strconv.FormatInt(testhelpers.BlockNumber, 10),
|
||||
testhelpers.BlockHash,
|
||||
"created",
|
||||
"created account code",
|
||||
testhelpers.CodeHash,
|
||||
strconv.FormatUint(testhelpers.NewNonceValue, 10),
|
||||
strconv.FormatInt(testhelpers.NewBalanceValue, 10),
|
||||
@ -41,7 +40,6 @@ var expectedUpdatedAccountRow = []string{
|
||||
strconv.FormatInt(testhelpers.BlockNumber, 10),
|
||||
testhelpers.BlockHash,
|
||||
"updated",
|
||||
"",
|
||||
testhelpers.CodeHash,
|
||||
strconv.FormatUint(testhelpers.NewNonceValue, 10),
|
||||
strconv.FormatInt(testhelpers.NewBalanceValue, 10),
|
||||
@ -53,7 +51,6 @@ var expectedDeletedAccountRow = []string{
|
||||
strconv.FormatInt(testhelpers.BlockNumber, 10),
|
||||
testhelpers.BlockHash,
|
||||
"deleted",
|
||||
"deleted account code",
|
||||
testhelpers.CodeHash,
|
||||
strconv.FormatUint(testhelpers.NewNonceValue, 10),
|
||||
strconv.FormatInt(testhelpers.NewBalanceValue, 10),
|
||||
|
@ -25,7 +25,6 @@ var (
|
||||
Nonce: builder.DiffUint64{Value: &NewNonceValue},
|
||||
Balance: builder.DiffBigInt{Value: big.NewInt(NewBalanceValue)},
|
||||
ContractRoot: builder.DiffString{Value: &ContractRoot},
|
||||
Code: []byte("created account code"),
|
||||
CodeHash: CodeHash,
|
||||
Storage: storage,
|
||||
}}
|
||||
@ -42,7 +41,6 @@ var (
|
||||
Nonce: builder.DiffUint64{Value: &NewNonceValue},
|
||||
Balance: builder.DiffBigInt{Value: big.NewInt(NewBalanceValue)},
|
||||
ContractRoot: builder.DiffString{Value: &ContractRoot},
|
||||
Code: []byte("deleted account code"),
|
||||
CodeHash: CodeHash,
|
||||
Storage: storage,
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user