This commit is contained in:
Sina M 2024-11-27 21:54:56 -08:00 committed by GitHub
commit 10237470f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1285 additions and 183 deletions

View file

@ -212,7 +212,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, pa
if params.BeaconRoot != nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("unexpected beacon root"))
}
switch api.eth.BlockChain().Config().LatestFork(params.Timestamp) {
switch api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) {
case forks.Paris:
if params.Withdrawals != nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("withdrawals before shanghai"))
@ -238,7 +238,8 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV3(update engine.ForkchoiceStateV1, pa
if params.BeaconRoot == nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("missing beacon root"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun && api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Cancun &&
api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Prague {
return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun payloads"))
}
}
@ -270,7 +271,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV2(update engine.Forkchoice
if params.BeaconRoot != nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("unexpected beacon root"))
}
switch api.eth.BlockChain().Config().LatestFork(params.Timestamp) {
switch api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) {
case forks.Paris:
if params.Withdrawals != nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("withdrawals before shanghai"))
@ -296,7 +297,8 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV3(update engine.Forkchoice
if params.BeaconRoot == nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("missing beacon root"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun && api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Cancun &&
api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Prague {
return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun payloads"))
}
}
@ -568,7 +570,7 @@ func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.Payl
if api.eth.BlockChain().Config().IsCancun(api.eth.BlockChain().Config().LondonBlock, params.Timestamp) {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("can't use newPayloadV2 post-cancun"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) == forks.Shanghai {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) == forks.Shanghai {
if params.Withdrawals == nil {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil withdrawals post-shanghai"))
}
@ -605,7 +607,7 @@ func (api *ConsensusAPI) NewPayloadV3(params engine.ExecutableData, versionedHas
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil beaconRoot post-cancun"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Cancun {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadV3 must only be called for cancun payloads"))
}
return api.newPayload(params, versionedHashes, beaconRoot, nil, false)
@ -633,7 +635,7 @@ func (api *ConsensusAPI) NewPayloadV4(params engine.ExecutableData, versionedHas
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil executionRequests post-prague"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Prague {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadV4 must only be called for prague payloads"))
}
requests := convertRequests(executionRequests)
@ -655,7 +657,7 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV2(params engine.ExecutableData) (
if api.eth.BlockChain().Config().IsCancun(api.eth.BlockChain().Config().LondonBlock, params.Timestamp) {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("can't use newPayloadV2 post-cancun"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) == forks.Shanghai {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) == forks.Shanghai {
if params.Withdrawals == nil {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil withdrawals post-shanghai"))
}
@ -693,7 +695,7 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV3(params engine.ExecutableData, v
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil beaconRoot post-cancun"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Cancun {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadWithWitnessV3 must only be called for cancun payloads"))
}
return api.newPayload(params, versionedHashes, beaconRoot, nil, true)
@ -722,7 +724,7 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV4(params engine.ExecutableData, v
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil executionRequests post-prague"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Prague {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadWithWitnessV4 must only be called for prague payloads"))
}
requests := convertRequests(executionRequests)
@ -744,7 +746,7 @@ func (api *ConsensusAPI) ExecuteStatelessPayloadV2(params engine.ExecutableData,
if api.eth.BlockChain().Config().IsCancun(api.eth.BlockChain().Config().LondonBlock, params.Timestamp) {
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("can't use newPayloadV2 post-cancun"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) == forks.Shanghai {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) == forks.Shanghai {
if params.Withdrawals == nil {
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil withdrawals post-shanghai"))
}
@ -782,7 +784,7 @@ func (api *ConsensusAPI) ExecuteStatelessPayloadV3(params engine.ExecutableData,
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil beaconRoot post-cancun"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Cancun {
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("executeStatelessPayloadV3 must only be called for cancun payloads"))
}
return api.executeStatelessPayload(params, versionedHashes, beaconRoot, nil, opaqueWitness)
@ -811,7 +813,7 @@ func (api *ConsensusAPI) ExecuteStatelessPayloadV4(params engine.ExecutableData,
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil executionRequests post-prague"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague {
if api.eth.BlockChain().Config().LatestPostLondonFork(params.Timestamp) != forks.Prague {
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("executeStatelessPayloadV4 must only be called for prague payloads"))
}
requests := convertRequests(executionRequests)

View file

@ -0,0 +1,132 @@
// Copyright 2024 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package live
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"testing"
"github.com/ethereum/go-ethereum/tests"
)
type blockTest struct {
bt *tests.BlockTest
Expected []supplyInfo `json:"expected"`
}
func (bt *blockTest) UnmarshalJSON(data []byte) error {
tmp := make(map[string]json.RawMessage)
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
if err := json.Unmarshal(tmp["expected"], &bt.Expected); err != nil {
return err
}
if err := json.Unmarshal(data, &bt.bt); err != nil {
return err
}
return nil
}
// The tests have been filled using the executable at
// eth/tracers/live/tests/supply_filler.go.
func TestSupplyTracerBlockchain(t *testing.T) {
dirPath := filepath.Join("testdata", "supply")
files, err := os.ReadDir(dirPath)
if err != nil {
t.Fatalf("failed to retrieve tracer test suite: %v", err)
}
for _, file := range files {
if !strings.HasSuffix(file.Name(), ".json") {
continue
}
var testcases map[string]*blockTest
var blob []byte
// Tracer test found, read if from disk
if blob, err = os.ReadFile(filepath.Join(dirPath, file.Name())); err != nil {
t.Fatalf("failed to read testcase: %v", err)
}
if err := json.Unmarshal(blob, &testcases); err != nil {
t.Fatalf("failed to parse testcase %s: %v", file.Name(), err)
}
for testname, blockTest := range testcases {
t.Run(fmt.Sprintf("%s/%s", file.Name(), testname),
func(t *testing.T) { runBlockTest(t, blockTest) })
}
}
}
func runBlockTest(t *testing.T, test *blockTest) {
t.Parallel()
traceOutputPath := filepath.ToSlash(t.TempDir())
traceOutputFilename := path.Join(traceOutputPath, "supply.jsonl")
// Load supply tracer
tracer, err := newSupplyTracer(json.RawMessage(fmt.Sprintf(`{"path":"%s"}`, traceOutputPath)))
if err != nil {
t.Fatalf("failed to create tracer: %v", err)
}
if err := test.bt.Run(false, "path", false, tracer, nil); err != nil {
t.Errorf("failed to run test: %v\n", err)
}
// Check and compare the results
file, err := os.OpenFile(traceOutputFilename, os.O_RDONLY, 0666)
if err != nil {
t.Fatalf("failed to open output file: %v", err)
}
defer file.Close()
var (
output []supplyInfo
scanner = bufio.NewScanner(file)
)
for scanner.Scan() {
var info supplyInfo
if err := json.Unmarshal(scanner.Bytes(), &info); err != nil {
t.Fatalf("failed to unmarshal result: %v", err)
}
output = append(output, info)
}
if len(output) != len(test.Expected) {
fmt.Printf("output: %v\n", output)
t.Fatalf("expected %d supply infos, got %d", len(test.Expected), len(output))
}
for i, expected := range test.Expected {
compareAsJSON(t, expected, output[i])
}
}
func compareAsJSON(t *testing.T, expected interface{}, actual interface{}) {
want, err := json.Marshal(expected)
if err != nil {
t.Fatalf("failed to marshal expected value to JSON: %v", err)
}
have, err := json.Marshal(actual)
if err != nil {
t.Fatalf("failed to marshal actual value to JSON: %v", err)
}
if !bytes.Equal(want, have) {
t.Fatalf("incorrect supply info:\nhave: %s\nwant: %s", string(have), string(want))
}
}

View file

@ -0,0 +1,87 @@
{
"eip1559_burn_grayGlacier": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x5208",
"Hash": "0x7891c11e0cc121c578c62c4b42622b909f4ded1a66fea03336c303e6bc8d6f88",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": null,
"ParentHash": "0xc4265421181cafc43e4b97ae4f21530e37e00320f219a13311482c9c552bcdc7",
"ReceiptTrie": "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
"StateRoot": "0x208dc296c4dc37b673a99aed4837174a2ed7f5380ad802d5aed0295e6795241d",
"Timestamp": "0xa",
"TransactionsTrie": "0x4ff793bd96fb3d8d186476e59a5118de9f1813b3f22bd8a64875a535422ac62f",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"ExpectException": "",
"Rlp": "0xf9026cf901faa0c4265421181cafc43e4b97ae4f21530e37e00320f219a13311482c9c552bcdc7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0208dc296c4dc37b673a99aed4837174a2ed7f5380ad802d5aed0295e6795241da04ff793bd96fb3d8d186476e59a5118de9f1813b3f22bd8a64875a535422ac62fa0f78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efab901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018347e7c48252080a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0f86cb86a02f86701800285012a05f20082520894000000000000000000000000000000000000aaaa8080c001a083b46f9cdfcb2c087934d9ae79eedeaa53df39b73c58b7cba5c77d69039bdc64a05af6144d3123f5b9850f9c40fc4b8ce02bf4782f6d6bca3f88e553689d66480bc0",
"UncleHeaders": null
}
],
"expected": [
{
"issuance": {
"genesisAlloc": "0xde0b6b3a7640000"
},
"blockNumber": 0,
"hash": "0xc4265421181cafc43e4b97ae4f21530e37e00320f219a13311482c9c552bcdc7",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"issuance": {
"reward": "0x1bc16d674ec80000"
},
"burn": {
"1559": "0x10b643590600"
},
"blockNumber": 1,
"hash": "0x7891c11e0cc121c578c62c4b42622b909f4ded1a66fea03336c303e6bc8d6f88",
"parentHash": "0xc4265421181cafc43e4b97ae4f21530e37e00320f219a13311482c9c552bcdc7"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0xc4265421181cafc43e4b97ae4f21530e37e00320f219a13311482c9c552bcdc7",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": null,
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x9f88be00eee1114edfd9372f52560aab3980a142efe8b5b39a09644075084275",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"lastblockhash": "7891c11e0cc121c578c62c4b42622b909f4ded1a66fea03336c303e6bc8d6f88",
"network": "GrayGlacier",
"postState": {},
"pre": {
"0x71562b71999873db5b286df957af199ec94617f7": {
"balance": "0xde0b6b3a7640000"
}
},
"sealEngine": ""
}
}

View file

@ -0,0 +1,87 @@
{
"genesis_alloc_grayGlacier": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0x37bb7e9b45f4fb7b311abb5f815e3e00d3382d83a2c39b9b0bd22b717566cd04",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": null,
"ParentHash": "0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x98d03dd72cdfee5c55acc619a1f1bcb1be6d1a10b25b512e7c4e4c4413357940",
"Timestamp": "0xa",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"ExpectException": "",
"Rlp": "0xf901fdf901f8a0bcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2caa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a098d03dd72cdfee5c55acc619a1f1bcb1be6d1a10b25b512e7c4e4c4413357940a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018347e7c4800a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0c0c0",
"UncleHeaders": null
}
],
"expected": [
{
"issuance": {
"genesisAlloc": "0x1bc16d674ec80000"
},
"blockNumber": 0,
"hash": "0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"issuance": {
"reward": "0x1bc16d674ec80000"
},
"blockNumber": 1,
"hash": "0x37bb7e9b45f4fb7b311abb5f815e3e00d3382d83a2c39b9b0bd22b717566cd04",
"parentHash": "0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": null,
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x4eaed1ec95373a6cad785d6b2506606a2c19e2e7c6d7faf4bab3472c21861b27",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"lastblockhash": "37bb7e9b45f4fb7b311abb5f815e3e00d3382d83a2c39b9b0bd22b717566cd04",
"network": "GrayGlacier",
"postState": {},
"pre": {
"0x703c4b2bd70c169f5717101caee543299fc946c7": {
"balance": "0xde0b6b3a7640000"
},
"0x71562b71999873db5b286df957af199ec94617f7": {
"balance": "0xde0b6b3a7640000"
}
},
"sealEngine": ""
}
}

View file

@ -0,0 +1,74 @@
{
"omitted_fields_cancun": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": "0x0",
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x0",
"ExcessBlobGas": "0x0",
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0x2aa3c443e44f958a52d9dc13a3748a23094892675bfedb362afbf6068248572b",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ParentHash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"Timestamp": "0xa",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
},
"ExpectException": "",
"Rlp": "0xf90260f9025aa0c02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080018347e7c4800a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a06036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5fc0c0c0",
"UncleHeaders": null
}
],
"expected": [
{
"blockNumber": 0,
"hash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"blockNumber": 1,
"hash": "0x2aa3c443e44f958a52d9dc13a3748a23094892675bfedb362afbf6068248572b",
"parentHash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": "0x0",
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": "0x0",
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
},
"lastblockhash": "2aa3c443e44f958a52d9dc13a3748a23094892675bfedb362afbf6068248572b",
"network": "Prague",
"postState": {},
"pre": {},
"sealEngine": ""
}
}

View file

@ -0,0 +1,209 @@
{
"selfdestruct_cancun": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": "0x0",
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x0",
"ExcessBlobGas": "0x0",
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0xf6d4",
"Hash": "0x270b395b2ced6d19be0e61583285f5c33aa757f8bf8d1f5054eee932e2883eb2",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ParentHash": "0x9e597272c69b46903e5307d7f68a9026070d61e4e504fd2a96e41e4387466728",
"ReceiptTrie": "0x6bd5a500652764abb50a6bfd441a2f52f9dc2a38644170adb7951804998e0176",
"StateRoot": "0x90899467081bda450d3ef7a6fb0f0c37ddfefea28c810a38323af55f79122c50",
"Timestamp": "0xa",
"TransactionsTrie": "0x8cfce1fa6bf3370d316650ab9ac77c2cfd69c9b3fd4e3def07b9e650769836e0",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
},
"ExpectException": "",
"Rlp": "0xf902cff9025ca09e597272c69b46903e5307d7f68a9026070d61e4e504fd2a96e41e4387466728a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a090899467081bda450d3ef7a6fb0f0c37ddfefea28c810a38323af55f79122c50a08cfce1fa6bf3370d316650ab9ac77c2cfd69c9b3fd4e3def07b9e650769836e0a06bd5a500652764abb50a6bfd441a2f52f9dc2a38644170adb7951804998e0176b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080018347e7c482f6d40a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a06036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5ff86cf86a8085012a05f200830249f094111111111111111111111111111111111111111185012a05f2008026a03c8f16fd94b4c5e56c1c2ff249685a19b2afedb5d6529fc2950a79c3f9c8d599a01a7882a80e333850532a917631347435237f751c9f7a0b810aae8098f5a6225ec0c0",
"UncleHeaders": null
}
],
"expected": [
{
"issuance": {
"genesisAlloc": "0x1bc16d674ec80000"
},
"blockNumber": 0,
"hash": "0x9e597272c69b46903e5307d7f68a9026070d61e4e504fd2a96e41e4387466728",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"burn": {
"1559": "0x32491701df00"
},
"blockNumber": 1,
"hash": "0x270b395b2ced6d19be0e61583285f5c33aa757f8bf8d1f5054eee932e2883eb2",
"parentHash": "0x9e597272c69b46903e5307d7f68a9026070d61e4e504fd2a96e41e4387466728"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": "0x0",
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": "0x0",
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0x9e597272c69b46903e5307d7f68a9026070d61e4e504fd2a96e41e4387466728",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0xb4187a1038a0611c5ca076f45fdbcf3d741c3e126a57b966edd44f844323a72f",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
},
"lastblockhash": "270b395b2ced6d19be0e61583285f5c33aa757f8bf8d1f5054eee932e2883eb2",
"network": "Prague",
"postState": {
"0x0000000000000000000000000000000000000dad": {
"balance": "0xde0b6b3a7640000"
},
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x61face60f01b6000527322222222222222222222222222222222222222226000806002600080855af160008103603457600080fd5b60008060008034865af1905060008103604c57600080fd5b5050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0x12a05f200",
"code": "0x6000357fface000000000000000000000000000000000000000000000000000000000000808203602f57610dad80ff5b5050"
}
},
"pre": {
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x61face60f01b6000527322222222222222222222222222222222222222226000806002600080855af160008103603457600080fd5b60008060008034865af1905060008103604c57600080fd5b5050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0xde0b6b3a7640000",
"code": "0x6000357fface000000000000000000000000000000000000000000000000000000000000808203602f57610dad80ff5b5050"
},
"0x71562b71999873db5b286df957af199ec94617f7": {
"balance": "0xde0b6b3a7640000"
}
},
"sealEngine": ""
},
"selfdestruct_grayGlacier": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0xf6d4",
"Hash": "0xf7f68f34d07d7acc5dad5ba9bbde99c82347a74471801e7c0c22e5b2ed6d0bc6",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": null,
"ParentHash": "0xdd9fbe877f0b43987d2f0cda0df176b7939be14f33eb5137f16e6eddf4562706",
"ReceiptTrie": "0x6bd5a500652764abb50a6bfd441a2f52f9dc2a38644170adb7951804998e0176",
"StateRoot": "0xbd0a2414c9584c14678caa39773fa17db8aab8667f897b251bb3fc025822e449",
"Timestamp": "0xa",
"TransactionsTrie": "0x8cfce1fa6bf3370d316650ab9ac77c2cfd69c9b3fd4e3def07b9e650769836e0",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"ExpectException": "",
"Rlp": "0xf9026cf901faa0dd9fbe877f0b43987d2f0cda0df176b7939be14f33eb5137f16e6eddf4562706a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0bd0a2414c9584c14678caa39773fa17db8aab8667f897b251bb3fc025822e449a08cfce1fa6bf3370d316650ab9ac77c2cfd69c9b3fd4e3def07b9e650769836e0a06bd5a500652764abb50a6bfd441a2f52f9dc2a38644170adb7951804998e0176b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018347e7c482f6d40a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0f86cf86a8085012a05f200830249f094111111111111111111111111111111111111111185012a05f2008026a03c8f16fd94b4c5e56c1c2ff249685a19b2afedb5d6529fc2950a79c3f9c8d599a01a7882a80e333850532a917631347435237f751c9f7a0b810aae8098f5a6225ec0",
"UncleHeaders": null
}
],
"expected": [
{
"issuance": {
"genesisAlloc": "0x1bc16d674ec80000"
},
"blockNumber": 0,
"hash": "0xdd9fbe877f0b43987d2f0cda0df176b7939be14f33eb5137f16e6eddf4562706",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"issuance": {
"reward": "0x1bc16d674ec80000"
},
"burn": {
"1559": "0x32491701df00",
"misc": "0x12a05f200"
},
"blockNumber": 1,
"hash": "0xf7f68f34d07d7acc5dad5ba9bbde99c82347a74471801e7c0c22e5b2ed6d0bc6",
"parentHash": "0xdd9fbe877f0b43987d2f0cda0df176b7939be14f33eb5137f16e6eddf4562706"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0xdd9fbe877f0b43987d2f0cda0df176b7939be14f33eb5137f16e6eddf4562706",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": null,
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0xb4187a1038a0611c5ca076f45fdbcf3d741c3e126a57b966edd44f844323a72f",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"lastblockhash": "f7f68f34d07d7acc5dad5ba9bbde99c82347a74471801e7c0c22e5b2ed6d0bc6",
"network": "GrayGlacier",
"postState": {
"0x0000000000000000000000000000000000000dad": {
"balance": "0xde0b6b3a7640000"
},
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x61face60f01b6000527322222222222222222222222222222222222222226000806002600080855af160008103603457600080fd5b60008060008034865af1905060008103604c57600080fd5b5050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0x0"
}
},
"pre": {
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x61face60f01b6000527322222222222222222222222222222222222222226000806002600080855af160008103603457600080fd5b60008060008034865af1905060008103604c57600080fd5b5050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0xde0b6b3a7640000",
"code": "0x6000357fface000000000000000000000000000000000000000000000000000000000000808203602f57610dad80ff5b5050"
},
"0x71562b71999873db5b286df957af199ec94617f7": {
"balance": "0xde0b6b3a7640000"
}
},
"sealEngine": ""
}
}

View file

@ -0,0 +1,104 @@
{
"selfdestruct_itself_and_revert_grayGlacier": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x97ed",
"Hash": "0x470d8e7af7bebd6c7515f35d2c77c25d003fe814b596557d5943f700b6ede5aa",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": null,
"ParentHash": "0xaf41e72f748de317965454508c749f7e14dc4fe444cd07bca4c981c7e952364d",
"ReceiptTrie": "0x0002d836009201e474b8e616daff83625eb48821fa40b62a5324828c86ccf656",
"StateRoot": "0xe10489118b2484cae44ccf08dbf8312047747a905e1b3888c3569d0b203062e5",
"Timestamp": "0xa",
"TransactionsTrie": "0x35f9144ebabc94d93ed27a6d644cfc8d1e08b5112c85a085fe92f37c273db18b",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"ExpectException": "",
"Rlp": "0xf90267f901faa0af41e72f748de317965454508c749f7e14dc4fe444cd07bca4c981c7e952364da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0e10489118b2484cae44ccf08dbf8312047747a905e1b3888c3569d0b203062e5a035f9144ebabc94d93ed27a6d644cfc8d1e08b5112c85a085fe92f37c273db18ba00002d836009201e474b8e616daff83625eb48821fa40b62a5324828c86ccf656b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018347e7c48297ed0a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0f867f8658085012a05f200830249f0941111111111111111111111111111111111111111808025a01244162a9c8a5aadf0c178eb0fca4b1ef8d0e35506bb2a2c9523222b0241c543a00b2c673143c87b44ab4cf52cacd0ef168d579ff1544c694e31e1efa8b00f5563c0",
"UncleHeaders": null
}
],
"expected": [
{
"issuance": {
"genesisAlloc": "0x7ce66c50e2840000"
},
"blockNumber": 0,
"hash": "0xaf41e72f748de317965454508c749f7e14dc4fe444cd07bca4c981c7e952364d",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"issuance": {
"reward": "0x1bc16d674ec80000"
},
"burn": {
"1559": "0x1ef38c04a1c0",
"misc": "0x4563918244f40000"
},
"blockNumber": 1,
"hash": "0x470d8e7af7bebd6c7515f35d2c77c25d003fe814b596557d5943f700b6ede5aa",
"parentHash": "0xaf41e72f748de317965454508c749f7e14dc4fe444cd07bca4c981c7e952364d"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": null,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": null,
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0xaf41e72f748de317965454508c749f7e14dc4fe444cd07bca4c981c7e952364d",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": null,
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x65dc2cb11746f33989e47548a362f38b6d895960cd11b0c2b950583f276933df",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": null
},
"lastblockhash": "470d8e7af7bebd6c7515f35d2c77c25d003fe814b596557d5943f700b6ede5aa",
"network": "GrayGlacier",
"postState": {},
"pre": {
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x73222222222222222222222222222222222222222273444444444444444444444444444444444444444460006000600060006000865af160006000600060006000865af150505050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0x4563918244f40000",
"code": "0x3080ff50"
},
"0x3333333333333333333333333333333333333333": {
"balance": "0xde0b6b3a7640000",
"code": "0x3080ff50"
},
"0x4444444444444444444444444444444444444444": {
"balance": "0x1bc16d674ec80000",
"code": "0x73333333333333333333333333333333333333333360006000600060006000855af160006000fd5050"
},
"0x71562b71999873db5b286df957af199ec94617f7": {
"balance": "0xde0b6b3a7640000"
}
},
"sealEngine": ""
}
}

View file

@ -0,0 +1,77 @@
{
"withdrawals_cancun": {
"blocks": [
{
"BlockHeader": {
"BaseFeePerGas": "0x342770c0",
"BlobGasUsed": "0x0",
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0100000000000000000000000000000000000000",
"Difficulty": "0x0",
"ExcessBlobGas": "0x0",
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0x917925a8c40111a353a4d27922a1668c9da7ca925c92c8d6109ef9a826c53487",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x1",
"ParentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ParentHash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x6e2ae8cee635793fd04490934e7b7d8f727c74534c5a01e42051116e12ba6a1a",
"Timestamp": "0xa",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": "0xad2dcd8b054415c239ed4cdfff00f865a00f28676fc12e33fec0ce91e4be10d6"
},
"ExpectException": "",
"Rlp": "0xf9027bf9025aa0c02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a06e2ae8cee635793fd04490934e7b7d8f727c74534c5a01e42051116e12ba6a1aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080018347e7c4800a80a0000000000000000000000000000000000000000000000000000000000000000088000000000000000084342770c0a0ad2dcd8b054415c239ed4cdfff00f865a00f28676fc12e33fec0ce91e4be10d68080a00000000000000000000000000000000000000000000000000000000000000000a06036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5fc0c0dbda802a94ee00000000000000000000000000000000000000820539",
"UncleHeaders": null
}
],
"expected": [
{
"blockNumber": 0,
"hash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"issuance": {
"withdrawals": "0x1374b68fa00"
},
"blockNumber": 1,
"hash": "0x917925a8c40111a353a4d27922a1668c9da7ca925c92c8d6109ef9a826c53487",
"parentHash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b"
}
],
"genesisBlockHeader": {
"BaseFeePerGas": "0x3b9aca00",
"BlobGasUsed": "0x0",
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x0000000000000000000000000000000000000000",
"Difficulty": "0x20000",
"ExcessBlobGas": "0x0",
"ExtraData": "0x",
"GasLimit": "0x47e7c4",
"GasUsed": "0x0",
"Hash": "0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b",
"MixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Nonce": "0x0000000000000000",
"Number": "0x0",
"ParentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ParentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ReceiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"StateRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"Timestamp": "0x0",
"TransactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"UncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"WithdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
},
"lastblockhash": "917925a8c40111a353a4d27922a1668c9da7ca925c92c8d6109ef9a826c53487",
"network": "Prague",
"postState": {},
"pre": {},
"sealEngine": ""
}
}

View file

@ -1,4 +1,4 @@
// Copyright 2021 The go-ethereum Authors
// Copyright 2024 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
@ -14,18 +14,18 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package tracetest
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"log/slog"
"math/big"
"os"
"path"
"path/filepath"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@ -37,9 +37,10 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/tests"
// Force-load live packages, to trigger registration
_ "github.com/ethereum/go-ethereum/eth/tracers/live"
)
@ -65,36 +66,85 @@ type supplyInfo struct {
ParentHash common.Hash `json:"parentHash"`
}
func main() {
// Takes a path where the filled tests will be written.
if len(os.Args) < 2 {
fmt.Println("Please provide a path as a command-line argument")
os.Exit(1)
}
path, err := filepath.Abs(os.Args[1])
if err != nil {
fmt.Printf("Error resolving path: %v\n", err)
os.Exit(1)
}
// Create all directories in the path if they don't exist
if err := os.MkdirAll(path, 0755); err != nil {
fmt.Printf("failed to create directory: %v\n", err)
os.Exit(1)
}
if err := fillSupplyOmittedFields(path); err != nil {
fmt.Printf("fillSupplyOmittedFields failed: %v\n", err)
os.Exit(1)
}
if err := fillSupplyGenesisAlloc(path); err != nil {
fmt.Printf("fillSupplyGenesisAlloc failed: %v\n", err)
os.Exit(1)
}
if err := fillSupplyEip1559Burn(path); err != nil {
fmt.Printf("fillSupplyEip1559Burn failed: %v\n")
os.Exit(1)
}
if err := fillSupplyWithdrawals(path); err != nil {
fmt.Printf("fillSupplyWithdrawals failed: %v\n", err)
os.Exit(1)
}
if err := fillSupplySelfdestruct(path); err != nil {
fmt.Printf("fillSupplySelfdestruct failed: %v\n", err)
os.Exit(1)
}
if err := fillSupplySelfdestructItselfAndRevert(path); err != nil {
fmt.Printf("fillSupplySelfdestructItselfAndRevert failed: %v\n", err)
os.Exit(1)
}
}
func emptyBlockGenerationFunc(b *core.BlockGen) {}
func TestSupplyOmittedFields(t *testing.T) {
func fillSupplyOmittedFields(path string) error {
var (
config = *params.MergedTestChainConfig
gspec = &core.Genesis{
Config: &config,
}
expected = []supplyInfo{{
Number: 0,
Hash: common.HexToHash("0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Number: 1,
Hash: common.HexToHash("0x2aa3c443e44f958a52d9dc13a3748a23094892675bfedb362afbf6068248572b"),
ParentHash: common.HexToHash("0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b"),
}}
)
gspec.Config.TerminalTotalDifficulty = big.NewInt(0)
out, _, err := testSupplyTracer(t, gspec, func(b *core.BlockGen) {
out, db, chain, err := testSupplyTracer(gspec, func(b *core.BlockGen) {
b.SetPoS()
})
if err != nil {
t.Fatalf("failed to test supply tracer: %v", err)
return fmt.Errorf("failed to test supply tracer: %v", err)
}
expected := supplyInfo{
Number: 0,
Hash: common.HexToHash("0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
if err := compareAsJSON(expected, out); err != nil {
return err
}
actual := out[expected.Number]
compareAsJSON(t, expected, actual)
if err := writeArtefact(filepath.Join(path, "omitted_fields.json"), "omitted_fields_cancun", db, chain, expected, nil); err != nil {
return err
}
return nil
}
func TestSupplyGenesisAlloc(t *testing.T) {
func fillSupplyGenesisAlloc(path string) error {
var (
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
@ -103,64 +153,44 @@ func TestSupplyGenesisAlloc(t *testing.T) {
eth1 = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
config = *params.AllEthashProtocolChanges
gspec = &core.Genesis{
gspec = &core.Genesis{
Config: &config,
Alloc: types.GenesisAlloc{
addr1: {Balance: eth1},
addr2: {Balance: eth1},
},
}
expected = []supplyInfo{{
Issuance: &supplyInfoIssuance{
GenesisAlloc: (*hexutil.Big)(new(big.Int).Mul(common.Big2, big.NewInt(params.Ether))),
},
Number: 0,
Hash: common.HexToHash("0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Issuance: &supplyInfoIssuance{
Reward: (*hexutil.Big)(new(big.Int).Mul(common.Big2, big.NewInt(params.Ether))),
},
Number: 1,
Hash: common.HexToHash("0x37bb7e9b45f4fb7b311abb5f815e3e00d3382d83a2c39b9b0bd22b717566cd04"),
ParentHash: common.HexToHash("0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca"),
}}
)
expected := supplyInfo{
Issuance: &supplyInfoIssuance{
GenesisAlloc: (*hexutil.Big)(new(big.Int).Mul(common.Big2, big.NewInt(params.Ether))),
},
Number: 0,
Hash: common.HexToHash("0xbcc9466e9fc6a8b56f4b29ca353a421ff8b51a0c1a58ca4743b427605b08f2ca"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}
out, _, err := testSupplyTracer(t, gspec, emptyBlockGenerationFunc)
out, db, chain, err := testSupplyTracer(gspec, emptyBlockGenerationFunc)
if err != nil {
t.Fatalf("failed to test supply tracer: %v", err)
return fmt.Errorf("failed to test supply tracer: %v", err)
}
actual := out[expected.Number]
compareAsJSON(t, expected, actual)
if err := compareAsJSON(expected, out); err != nil {
return err
}
if err := writeArtefact(filepath.Join(path, "genesis_alloc.json"), "genesis_alloc_grayGlacier", db, chain, expected, nil); err != nil {
return err
}
return nil
}
func TestSupplyRewards(t *testing.T) {
var (
config = *params.AllEthashProtocolChanges
gspec = &core.Genesis{
Config: &config,
}
)
expected := supplyInfo{
Issuance: &supplyInfoIssuance{
Reward: (*hexutil.Big)(new(big.Int).Mul(common.Big2, big.NewInt(params.Ether))),
},
Number: 1,
Hash: common.HexToHash("0xcbb08370505be503dafedc4e96d139ea27aba3cbc580148568b8a307b3f51052"),
ParentHash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
}
out, _, err := testSupplyTracer(t, gspec, emptyBlockGenerationFunc)
if err != nil {
t.Fatalf("failed to test supply tracer: %v", err)
}
actual := out[expected.Number]
compareAsJSON(t, expected, actual)
}
func TestSupplyEip1559Burn(t *testing.T) {
func fillSupplyEip1559Burn(path string) error {
var (
config = *params.AllEthashProtocolChanges
@ -179,9 +209,8 @@ func TestSupplyEip1559Burn(t *testing.T) {
},
}
)
signer := types.LatestSigner(gspec.Config)
config.ChainID = big.NewInt(1)
signer := types.LatestSigner(&config)
eip1559BlockGenerationFunc := func(b *core.BlockGen) {
txdata := &types.DynamicFeeTx{
ChainID: gspec.Config.ChainID,
@ -197,15 +226,22 @@ func TestSupplyEip1559Burn(t *testing.T) {
b.AddTx(tx)
}
out, chain, err := testSupplyTracer(t, gspec, eip1559BlockGenerationFunc)
out, db, chain, err := testSupplyTracer(gspec, eip1559BlockGenerationFunc)
if err != nil {
t.Fatalf("failed to test supply tracer: %v", err)
return fmt.Errorf("failed to test supply tracer: %v", err)
}
var (
head = chain.CurrentBlock()
reward = new(big.Int).Mul(common.Big2, big.NewInt(params.Ether))
burn = new(big.Int).Mul(big.NewInt(21000), head.BaseFee)
expected = supplyInfo{
expected = []supplyInfo{{
Issuance: &supplyInfoIssuance{
GenesisAlloc: (*hexutil.Big)(eth1),
},
Number: 0,
Hash: common.HexToHash("0xc4265421181cafc43e4b97ae4f21530e37e00320f219a13311482c9c552bcdc7"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Issuance: &supplyInfoIssuance{
Reward: (*hexutil.Big)(reward),
},
@ -215,14 +251,18 @@ func TestSupplyEip1559Burn(t *testing.T) {
Number: 1,
Hash: head.Hash(),
ParentHash: head.ParentHash,
}
}}
)
actual := out[expected.Number]
compareAsJSON(t, expected, actual)
if err := compareAsJSON(expected, out); err != nil {
return err
}
if err := writeArtefact(filepath.Join(path, "eip1559_burn.json"), "eip1559_burn_grayGlacier", db, chain, expected, nil); err != nil {
return err
}
return nil
}
func TestSupplyWithdrawals(t *testing.T) {
func fillSupplyWithdrawals(path string) error {
var (
config = *params.MergedTestChainConfig
gspec = &core.Genesis{
@ -240,25 +280,33 @@ func TestSupplyWithdrawals(t *testing.T) {
})
}
out, chain, err := testSupplyTracer(t, gspec, withdrawalsBlockGenerationFunc)
out, db, chain, err := testSupplyTracer(gspec, withdrawalsBlockGenerationFunc)
if err != nil {
t.Fatalf("failed to test supply tracer: %v", err)
return fmt.Errorf("failed to test supply tracer: %v", err)
}
var (
head = chain.CurrentBlock()
expected = supplyInfo{
expected = []supplyInfo{{
Number: 0,
Hash: common.HexToHash("0xc02ee8ee5b54a40e43f0fa827d431e1bd4f217e941790dda10b2521d1925a20b"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Issuance: &supplyInfoIssuance{
Withdrawals: (*hexutil.Big)(big.NewInt(1337000000000)),
},
Number: 1,
Hash: head.Hash(),
ParentHash: head.ParentHash,
}
actual = out[expected.Number]
}}
)
compareAsJSON(t, expected, actual)
if err := compareAsJSON(expected, out); err != nil {
return err
}
if err := writeArtefact(filepath.Join(path, "withdrawals.json"), "withdrawals_cancun", db, chain, expected, nil); err != nil {
return err
}
return nil
}
// Tests fund retrieval after contract's selfdestruct.
@ -266,7 +314,7 @@ func TestSupplyWithdrawals(t *testing.T) {
// after the selfdestruct opcode executes from Contract A.
// Because Contract B is removed only at the end of the transaction
// the ether sent in between is burnt before Cancun hard fork.
func TestSupplySelfdestruct(t *testing.T) {
func fillSupplySelfdestruct(path string) error {
var (
config = *params.TestChainConfig
@ -295,34 +343,29 @@ func TestSupplySelfdestruct(t *testing.T) {
},
},
}
signer = types.LatestSigner(gspec.Config)
testBlockGenerationFunc = func(b *core.BlockGen) {
txdata := &types.LegacyTx{
Nonce: 0,
To: &aa,
Value: gwei5,
Gas: 150000,
GasPrice: gwei5,
Data: []byte{},
}
tx := types.NewTx(txdata)
tx, _ = types.SignTx(tx, signer, key1)
b.AddTx(tx)
}
)
gspec.Config.TerminalTotalDifficulty = big.NewInt(0)
signer := types.LatestSigner(gspec.Config)
testBlockGenerationFunc := func(b *core.BlockGen) {
b.SetPoS()
txdata := &types.LegacyTx{
Nonce: 0,
To: &aa,
Value: gwei5,
Gas: 150000,
GasPrice: gwei5,
Data: []byte{},
}
tx := types.NewTx(txdata)
tx, _ = types.SignTx(tx, signer, key1)
b.AddTx(tx)
}
// 1. Test pre Cancun
preCancunOutput, preCancunChain, err := testSupplyTracer(t, gspec, testBlockGenerationFunc)
preCancunOutput, preCancunDB, preCancunChain, err := testSupplyTracer(gspec, testBlockGenerationFunc)
if err != nil {
t.Fatalf("Pre-cancun failed to test supply tracer: %v", err)
return fmt.Errorf("failed to test supply tracer: %v", err)
}
// Check balance at state:
@ -331,39 +374,67 @@ func TestSupplySelfdestruct(t *testing.T) {
// 3. B has 0 ether
statedb, _ := preCancunChain.State()
if got, exp := statedb.GetBalance(dad), eth1; got.CmpBig(exp) != 0 {
t.Fatalf("Pre-cancun address \"%v\" balance, got %v exp %v\n", dad, got, exp)
return fmt.Errorf("Pre-cancun address \"%v\" balance, got %v exp %v\n", dad, got, exp)
}
if got, exp := statedb.GetBalance(aa), big.NewInt(0); got.CmpBig(exp) != 0 {
t.Fatalf("Pre-cancun address \"%v\" balance, got %v exp %v\n", aa, got, exp)
return fmt.Errorf("Pre-cancun address \"%v\" balance, got %v exp %v\n", aa, got, exp)
}
if got, exp := statedb.GetBalance(bb), big.NewInt(0); got.CmpBig(exp) != 0 {
t.Fatalf("Pre-cancun address \"%v\" balance, got %v exp %v\n", bb, got, exp)
return fmt.Errorf("Pre-cancun address \"%v\" balance, got %v exp %v\n", bb, got, exp)
}
head := preCancunChain.CurrentBlock()
// Check live trace output
expected := supplyInfo{
Burn: &supplyInfoBurn{
EIP1559: (*hexutil.Big)(big.NewInt(55289500000000)),
Misc: (*hexutil.Big)(big.NewInt(5000000000)),
},
Number: 1,
Hash: head.Hash(),
ParentHash: head.ParentHash,
var (
head = preCancunChain.CurrentBlock()
// Check live trace output
expected = []supplyInfo{{
Issuance: &supplyInfoIssuance{
GenesisAlloc: (*hexutil.Big)(new(big.Int).Mul(big.NewInt(2), big.NewInt(params.Ether))),
},
Number: 0,
Hash: common.HexToHash("0xdd9fbe877f0b43987d2f0cda0df176b7939be14f33eb5137f16e6eddf4562706"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Issuance: &supplyInfoIssuance{
Reward: (*hexutil.Big)(new(big.Int).Mul(big.NewInt(2), big.NewInt(params.Ether))),
},
Burn: &supplyInfoBurn{
EIP1559: (*hexutil.Big)(big.NewInt(55289500000000)),
Misc: (*hexutil.Big)(big.NewInt(5000000000)),
},
Number: 1,
Hash: head.Hash(),
ParentHash: head.ParentHash,
}}
post = &types.GenesisAlloc{
dad: {Balance: eth1},
aa: {Balance: big.NewInt(0), Code: gspec.Alloc[aa].Code},
bb: {Balance: big.NewInt(0)},
}
)
if err := compareAsJSON(expected, preCancunOutput); err != nil {
return err
}
actual := preCancunOutput[expected.Number]
compareAsJSON(t, expected, actual)
preCancunTest, err := btFromChain(preCancunDB, preCancunChain, post)
if err != nil {
return fmt.Errorf("failed to fill tests from chain: %v", err)
}
preCancunTest.Expected = expected
// 2. Test post Cancun
cancunTime := uint64(0)
gspec.Config = params.MergedTestChainConfig
gspec.Config.ShanghaiTime = &cancunTime
gspec.Config.CancunTime = &cancunTime
postCancunOutput, postCancunChain, err := testSupplyTracer(t, gspec, testBlockGenerationFunc)
gspec.Config.TerminalTotalDifficulty = big.NewInt(0)
signer = types.LatestSigner(gspec.Config)
posTestBlockGenerationFunc := func(b *core.BlockGen) {
b.SetPoS()
testBlockGenerationFunc(b)
}
postCancunOutput, postCancunDB, postCancunChain, err := testSupplyTracer(gspec, posTestBlockGenerationFunc)
if err != nil {
t.Fatalf("Post-cancun failed to test supply tracer: %v", err)
return fmt.Errorf("Post-cancun failed to test supply tracer: %v", err)
}
// Check balance at state:
@ -372,29 +443,50 @@ func TestSupplySelfdestruct(t *testing.T) {
// 3. B has 5 gwei
statedb, _ = postCancunChain.State()
if got, exp := statedb.GetBalance(dad), eth1; got.CmpBig(exp) != 0 {
t.Fatalf("Post-shanghai address \"%v\" balance, got %v exp %v\n", dad, got, exp)
return fmt.Errorf("Post-shanghai address \"%v\" balance, got %v exp %v\n", dad, got, exp)
}
if got, exp := statedb.GetBalance(aa), big.NewInt(0); got.CmpBig(exp) != 0 {
t.Fatalf("Post-shanghai address \"%v\" balance, got %v exp %v\n", aa, got, exp)
return fmt.Errorf("Post-shanghai address \"%v\" balance, got %v exp %v\n", aa, got, exp)
}
if got, exp := statedb.GetBalance(bb), gwei5; got.CmpBig(exp) != 0 {
t.Fatalf("Post-shanghai address \"%v\" balance, got %v exp %v\n", bb, got, exp)
return fmt.Errorf("Post-shanghai address \"%v\" balance, got %v exp %v\n", bb, got, exp)
}
// Check live trace output
head = postCancunChain.CurrentBlock()
expected = supplyInfo{
expected = []supplyInfo{{
Issuance: &supplyInfoIssuance{
GenesisAlloc: (*hexutil.Big)(new(big.Int).Mul(big.NewInt(2), big.NewInt(params.Ether))),
},
Number: 0,
Hash: common.HexToHash("0x9e597272c69b46903e5307d7f68a9026070d61e4e504fd2a96e41e4387466728"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Burn: &supplyInfoBurn{
EIP1559: (*hexutil.Big)(big.NewInt(55289500000000)),
},
Number: 1,
Hash: head.Hash(),
ParentHash: head.ParentHash,
}}
post = &types.GenesisAlloc{
dad: {Balance: eth1},
aa: {Balance: big.NewInt(0), Code: gspec.Alloc[aa].Code},
bb: {Balance: gwei5, Code: gspec.Alloc[bb].Code},
}
actual = postCancunOutput[expected.Number]
compareAsJSON(t, expected, actual)
if err := compareAsJSON(expected, postCancunOutput); err != nil {
return err
}
postCancunTest, err := btFromChain(postCancunDB, postCancunChain, post)
if err != nil {
return fmt.Errorf("failed to fill tests from chain: %v", err)
}
postCancunTest.Expected = expected
if err := writeBTs(filepath.Join(path, "selfdestruct.json"), map[string]*blockTest{"selfdestruct_grayGlacier": preCancunTest, "selfdestruct_cancun": postCancunTest}); err != nil {
return err
}
return nil
}
// Tests selfdestructing contract to send its balance to itself (burn).
@ -404,7 +496,7 @@ func TestSupplySelfdestruct(t *testing.T) {
// - Contract C selfdestructs and sends the eth1 to itself.
// - Contract D calls C and reverts (Burn amount of C
// has to be reverted as well).
func TestSupplySelfdestructItselfAndRevert(t *testing.T) {
func fillSupplySelfdestructItselfAndRevert(path string) error {
var (
config = *params.TestChainConfig
@ -479,13 +571,8 @@ func TestSupplySelfdestructItselfAndRevert(t *testing.T) {
}
)
gspec.Config.TerminalTotalDifficulty = big.NewInt(0)
signer := types.LatestSigner(gspec.Config)
testBlockGenerationFunc := func(b *core.BlockGen) {
b.SetPoS()
txdata := &types.LegacyTx{
Nonce: 0,
To: &aa,
@ -501,9 +588,9 @@ func TestSupplySelfdestructItselfAndRevert(t *testing.T) {
b.AddTx(tx)
}
output, chain, err := testSupplyTracer(t, gspec, testBlockGenerationFunc)
output, db, chain, err := testSupplyTracer(gspec, testBlockGenerationFunc)
if err != nil {
t.Fatalf("failed to test supply tracer: %v", err)
return fmt.Errorf("failed to test supply tracer: %v", err)
}
// Check balance at state:
@ -513,53 +600,73 @@ func TestSupplySelfdestructItselfAndRevert(t *testing.T) {
// 4. D has 1 ether, reverted
statedb, _ := chain.State()
if got, exp := statedb.GetBalance(aa), common.Big0; got.CmpBig(exp) != 0 {
t.Fatalf("address \"%v\" balance, got %v exp %v\n", aa, got, exp)
return fmt.Errorf("address \"%v\" balance, got %v exp %v\n", aa, got, exp)
}
if got, exp := statedb.GetBalance(bb), common.Big0; got.CmpBig(exp) != 0 {
t.Fatalf("address \"%v\" balance, got %v exp %v\n", bb, got, exp)
return fmt.Errorf("address \"%v\" balance, got %v exp %v\n", bb, got, exp)
}
if got, exp := statedb.GetBalance(cc), eth1; got.CmpBig(exp) != 0 {
t.Fatalf("address \"%v\" balance, got %v exp %v\n", bb, got, exp)
return fmt.Errorf("address \"%v\" balance, got %v exp %v\n", cc, got, exp)
}
if got, exp := statedb.GetBalance(dd), eth2; got.CmpBig(exp) != 0 {
t.Fatalf("address \"%v\" balance, got %v exp %v\n", bb, got, exp)
return fmt.Errorf("address \"%v\" balance, got %v exp %v\n", dd, got, exp)
}
// Check live trace output
block := chain.GetBlockByNumber(1)
expected := supplyInfo{
expected := []supplyInfo{{
Issuance: &supplyInfoIssuance{
GenesisAlloc: (*hexutil.Big)(new(big.Int).Mul(big.NewInt(9), big.NewInt(params.Ether))),
},
Number: 0,
Hash: common.HexToHash("0xaf41e72f748de317965454508c749f7e14dc4fe444cd07bca4c981c7e952364d"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Burn: &supplyInfoBurn{
EIP1559: (*hexutil.Big)(new(big.Int).Mul(block.BaseFee(), big.NewInt(int64(block.GasUsed())))),
Misc: (*hexutil.Big)(eth5), // 5ETH burned from contract B
},
Issuance: &supplyInfoIssuance{
Reward: (*hexutil.Big)(eth2),
},
Number: 1,
Hash: block.Hash(),
ParentHash: block.ParentHash(),
}}
if err := compareAsJSON(expected, output); err != nil {
return err
}
actual := output[expected.Number]
compareAsJSON(t, expected, actual)
if err := writeArtefact(filepath.Join(path, "selfdestruct_itself_and_revert.json"), "selfdestruct_itself_and_revert_grayGlacier", db, chain, expected, nil); err != nil {
return err
}
return nil
}
func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockGen)) ([]supplyInfo, *core.BlockChain, error) {
func testSupplyTracer(genesis *core.Genesis, gen func(*core.BlockGen)) ([]supplyInfo, ethdb.Database, *core.BlockChain, error) {
var (
engine = beacon.New(ethash.NewFaker())
)
traceOutputPath := filepath.ToSlash(t.TempDir())
tempDir, err := os.MkdirTemp("", "supply-filler-")
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to generate directory for tracer outputs: %v", err)
}
defer os.RemoveAll(tempDir) // Clean up
traceOutputPath := filepath.ToSlash(tempDir)
traceOutputFilename := path.Join(traceOutputPath, "supply.jsonl")
// Load supply tracer
tracer, err := tracers.LiveDirectory.New("supply", json.RawMessage(fmt.Sprintf(`{"path":"%s"}`, traceOutputPath)))
if err != nil {
return nil, nil, fmt.Errorf("failed to create call tracer: %v", err)
return nil, nil, nil, fmt.Errorf("failed to create tracer: %v", err)
}
chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), core.DefaultCacheConfigWithScheme(rawdb.PathScheme), genesis, nil, engine, vm.Config{Tracer: tracer}, nil)
db := rawdb.NewMemoryDatabase()
chain, err := core.NewBlockChain(db, core.DefaultCacheConfigWithScheme(rawdb.PathScheme), genesis, nil, engine, vm.Config{Tracer: tracer}, nil)
if err != nil {
return nil, nil, fmt.Errorf("failed to create tester chain: %v", err)
return nil, nil, nil, fmt.Errorf("failed to create tester chain: %v", err)
}
defer chain.Stop()
@ -569,13 +676,13 @@ func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockG
})
if n, err := chain.InsertChain(blocks); err != nil {
return nil, chain, fmt.Errorf("block %d: failed to insert into chain: %v", n, err)
return nil, nil, chain, fmt.Errorf("block %d: failed to insert into chain: %v", n, err)
}
// Check and compare the results
file, err := os.OpenFile(traceOutputFilename, os.O_RDONLY, 0666)
if err != nil {
return nil, chain, fmt.Errorf("failed to open output file: %v", err)
return nil, nil, chain, fmt.Errorf("failed to open output file: %v", err)
}
defer file.Close()
@ -587,28 +694,74 @@ func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockG
var info supplyInfo
if err := json.Unmarshal(blockBytes, &info); err != nil {
return nil, chain, fmt.Errorf("failed to unmarshal result: %v", err)
return nil, nil, chain, fmt.Errorf("failed to unmarshal result: %v", err)
}
output = append(output, info)
}
return output, chain, nil
return output, db, chain, nil
}
func compareAsJSON(t *testing.T, expected interface{}, actual interface{}) {
t.Helper()
func compareAsJSON(expected interface{}, actual interface{}) error {
want, err := json.Marshal(expected)
if err != nil {
t.Fatalf("failed to marshal expected value to JSON: %v", err)
return fmt.Errorf("failed to marshal expected value to JSON: %v", err)
}
have, err := json.Marshal(actual)
if err != nil {
t.Fatalf("failed to marshal actual value to JSON: %v", err)
return fmt.Errorf("failed to marshal actual value to JSON: %v", err)
}
if !bytes.Equal(want, have) {
t.Fatalf("incorrect supply info:\nwant %s\nhave %s", string(want), string(have))
return fmt.Errorf("incorrect supply info:\nwant %s\nhave %s", string(want), string(have))
}
return nil
}
func writeArtefact(path, name string, db ethdb.Database, chain *core.BlockChain, expected []supplyInfo, post *types.GenesisAlloc) error {
bt, err := btFromChain(db, chain, post)
if err != nil {
return fmt.Errorf("failed to fill tests from chain: %v", err)
}
bt.Expected = expected
return writeBTs(path, map[string]*blockTest{name: bt})
}
type blockTest struct {
bt *tests.BlockTest
Expected []supplyInfo `json:"expected"`
}
func writeBTs(path string, tests map[string]*blockTest) error {
enc, err := json.MarshalIndent(&tests, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal tests: %v", err)
}
if err := os.WriteFile(path, enc, 0644); err != nil {
return fmt.Errorf("failed to write test to file: %v", err)
}
slog.Info("Wrote artefact", "file", path)
return nil
}
func btFromChain(db ethdb.Database, chain *core.BlockChain, post *types.GenesisAlloc) (*blockTest, error) {
bt, err := tests.FromChain(db, chain, post)
if err != nil {
return nil, err
}
return &blockTest{bt: &bt}, nil
}
func (bt *blockTest) MarshalJSON() ([]byte, error) {
enc, err := json.Marshal(bt.bt)
if err != nil {
return nil, err
}
// Insert the expected supply info
result := make(map[string]any)
if err := json.Unmarshal(enc, &result); err != nil {
return nil, err
}
result["expected"] = bt.Expected
return json.Marshal(result)
}

View file

@ -505,6 +505,13 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi
return parentTotalDiff.Cmp(c.TerminalTotalDifficulty) < 0 && totalDiff.Cmp(c.TerminalTotalDifficulty) >= 0
}
// IsParis returns whether the given block is either equal to the Paris (merge)
// fork or greater.
// Note: Only usable for post-merge networks where MergeNetsplitBlock has been configured.
func (c *ChainConfig) IsParis(num *big.Int) bool {
return c.IsLondon(num) && isBlockForked(c.MergeNetsplitBlock, num)
}
// IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
@ -704,8 +711,8 @@ func (c *ChainConfig) ElasticityMultiplier() uint64 {
return DefaultElasticityMultiplier
}
// LatestFork returns the latest time-based fork that would be active for the given time.
func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
// LatestPostLondonFork returns the latest time-based fork that would be active for the given time.
func (c *ChainConfig) LatestPostLondonFork(time uint64) forks.Fork {
// Assume last non-time-based fork has passed.
london := c.LondonBlock
@ -721,6 +728,47 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
}
}
func (c *ChainConfig) LatestFork(num *big.Int, time uint64) forks.Fork {
switch {
case c.IsPrague(num, time):
return forks.Prague
case c.IsCancun(num, time):
return forks.Cancun
case c.IsShanghai(num, time):
return forks.Shanghai
case c.IsParis(num):
return forks.Paris
case c.IsGrayGlacier(num):
return forks.GrayGlacier
case c.IsArrowGlacier(num):
return forks.ArrowGlacier
case c.IsLondon(num):
return forks.London
case c.IsBerlin(num):
return forks.Berlin
case c.IsMuirGlacier(num):
return forks.MuirGlacier
case c.IsIstanbul(num):
return forks.Istanbul
case c.IsPetersburg(num):
return forks.Petersburg
case c.IsConstantinople(num):
return forks.Constantinople
case c.IsByzantium(num):
return forks.Byzantium
case c.IsEIP158(num):
return forks.SpuriousDragon
case c.IsEIP150(num):
return forks.TangerineWhistle
case c.IsDAOFork(num):
return forks.DAO
case c.IsHomestead(num):
return forks.Homestead
default:
return forks.Frontier
}
}
// isForkBlockIncompatible returns true if a fork scheduled at block s1 cannot be
// rescheduled to block s2 because head is already past the fork.
func isForkBlockIncompatible(s1, s2, head *big.Int) bool {

View file

@ -40,3 +40,48 @@ const (
Cancun
Prague
)
func (f Fork) String() string {
switch f {
case Prague:
return "Prague"
case Cancun:
return "Cancun"
case Shanghai:
return "Shanghai"
case Paris:
return "Paris"
case GrayGlacier:
return "GrayGlacier"
case ArrowGlacier:
return "ArrowGlacier"
case London:
return "London"
case Berlin:
return "Berlin"
case MuirGlacier:
return "MuirGlacier"
case Istanbul:
return "Istanbul"
case Petersburg:
return "Petersburg"
case Constantinople:
return "Constantinople"
case Byzantium:
return "Byzantium"
case SpuriousDragon:
return "SpuriousDragon"
case TangerineWhistle:
return "TangerineWhistle"
case DAO:
return "Dao"
case Homestead:
return "Homestead"
case FrontierThawing:
return "FrontierThawing"
case Frontier:
return "Frontier"
default:
panic("unknown fork")
}
}

View file

@ -38,6 +38,7 @@ import (
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
@ -56,6 +57,51 @@ func (t *BlockTest) UnmarshalJSON(in []byte) error {
return json.Unmarshal(in, &t.json)
}
// MarshalJSON implements json.Marshaler interface.
func (t *BlockTest) MarshalJSON() ([]byte, error) {
return json.Marshal(t.json)
}
// FromChain creates a BlockTest from the history of the given chain.
func FromChain(db ethdb.Database, chain *core.BlockChain, post *types.GenesisAlloc) (BlockTest, error) {
var (
bt = BlockTest{}
head = chain.CurrentHeader()
blocks = make([]btBlock, head.Number.Uint64())
)
for i := 1; i <= int(head.Number.Uint64()); i++ {
block := chain.GetBlockByNumber(uint64(i))
if block == nil {
return bt, fmt.Errorf("block %d not found", i)
}
btBlock, err := FromBlock(block)
if err != nil {
return bt, err
}
blocks[i-1] = btBlock
}
allocData := rawdb.ReadGenesisStateSpec(db, chain.Genesis().Hash())
if len(allocData) == 0 {
return bt, fmt.Errorf("alloc data missing")
}
var alloc types.GenesisAlloc
if err := alloc.UnmarshalJSON(allocData); err != nil {
return bt, fmt.Errorf("failed to read genesis alloc: %v", err)
}
if post == nil {
post = &types.GenesisAlloc{}
}
bt.json = btJSON{
Network: chain.Config().LatestFork(head.Number, head.Time).String(),
Blocks: blocks,
Genesis: FromHeader(chain.Genesis().Header()),
Pre: alloc,
Post: *post,
BestBlock: common.UnprefixedHash(head.Hash()),
}
return bt, nil
}
type btJSON struct {
Blocks []btBlock `json:"blocks"`
Genesis btHeader `json:"genesisBlockHeader"`
@ -73,6 +119,18 @@ type btBlock struct {
UncleHeaders []*btHeader
}
func FromBlock(block *types.Block) (btBlock, error) {
header := FromHeader(block.Header())
enc, err := rlp.EncodeToBytes(block)
if err != nil {
return btBlock{}, err
}
return btBlock{
BlockHeader: &header,
Rlp: "0x" + common.Bytes2Hex(enc),
}, nil
}
//go:generate go run github.com/fjl/gencodec -type btHeader -field-override btHeaderMarshaling -out gen_btheader.go
type btHeader struct {
@ -99,6 +157,32 @@ type btHeader struct {
ParentBeaconBlockRoot *common.Hash
}
func FromHeader(header *types.Header) btHeader {
return btHeader{
Bloom: header.Bloom,
Coinbase: header.Coinbase,
MixHash: header.MixDigest,
Nonce: header.Nonce,
Number: header.Number,
Hash: header.Hash(),
ParentHash: header.ParentHash,
ReceiptTrie: header.ReceiptHash,
StateRoot: header.Root,
TransactionsTrie: header.TxHash,
UncleHash: header.UncleHash,
ExtraData: header.Extra,
Difficulty: header.Difficulty,
GasLimit: header.GasLimit,
GasUsed: header.GasUsed,
Timestamp: header.Time,
BaseFeePerGas: header.BaseFee,
WithdrawalsRoot: header.WithdrawalsHash,
BlobGasUsed: header.BlobGasUsed,
ExcessBlobGas: header.ExcessBlobGas,
ParentBeaconBlockRoot: header.ParentBeaconRoot,
}
}
type btHeaderMarshaling struct {
ExtraData hexutil.Bytes
Number *math.HexOrDecimal256