diff --git a/statediff/builder/builder.go b/statediff/builder/builder.go index 3d30c3c8c..162cabcd7 100644 --- a/statediff/builder/builder.go +++ b/statediff/builder/builder.go @@ -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, } diff --git a/statediff/builder/builder_test.go b/statediff/builder/builder_test.go index 671eaf245..e7bffb7c3 100644 --- a/statediff/builder/builder_test.go +++ b/statediff/builder/builder_test.go @@ -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{}, diff --git a/statediff/builder/struct.go b/statediff/builder/struct.go index 9a4ce5786..75c20edb4 100644 --- a/statediff/builder/struct.go +++ b/statediff/builder/struct.go @@ -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"` diff --git a/statediff/publisher/csv.go b/statediff/publisher/csv.go index 8110f3cf4..163252d64 100644 --- a/statediff/publisher/csv.go +++ b/statediff/publisher/csv.go @@ -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(), diff --git a/statediff/publisher/publisher_test.go b/statediff/publisher/publisher_test.go index ad254ce23..5dae5a2f1 100644 --- a/statediff/publisher/publisher_test.go +++ b/statediff/publisher/publisher_test.go @@ -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), diff --git a/statediff/testhelpers/test_data.go b/statediff/testhelpers/test_data.go index 4439df599..b9e831860 100644 --- a/statediff/testhelpers/test_data.go +++ b/statediff/testhelpers/test_data.go @@ -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, }}