202ab70922
* fix: crash of highestVerifiedHeader * fix: panic of blobpool * fix: genesis set up * 1. modify NewDatabaseWithNodeDB to upstream 2. fix race use of hasher in statedb 3. fix use wrong value when updateTrie * fix dir legacypool * fix dir blobpool * fix dir vote * remove diffsync related code * fix core/state/snapshot * disable pipeCommit for now * fix applyTransaction for bloom setting * CI: fast finality in gasprice test * CI: diffFetcher was removed * CI: downloader, remove beaconsync test * CI: no beaconsync in downloader, remove a failed case TestCheckpointChallenge was removed in: https://github.com/ethereum/go-ethereum/pull/27147 since after merge, it is useless for ethereum, but might be useful for BSC. disable the case right now, as it is not a big issue. * CI: bsc protocol decHandlers * CI: receipt Bloom process * 1. skip CheckConfigForkOrder for non-parlia engine 2. all test cases in core work well now cd core && go test ./... -v * fix test cases in trie dir * CI: no beaconsync in downloader, remove a failed case(redo) * fix dir miner * fix dir cmd/geth * CI: filter test, BaseFee & Finality * fix dir graphql * remove diffStore * fix ethclient * fix TestRPCGetTransactionReceipt * fix dir internal * ut add dir ethstats and signer * disable pipeCommit thoroughly; fix concurrent map iteration and map write in statedb * CI: fix snap sync it could be changed by mistake * fix tests/Run to generate snapshot * prepare for merge * remove useless * use common hasher in getDeletedStateObject, no race here * an critical comment for state.Prepare * do not copy nil accessList * add omitempty tag for unused new fields of core.Genesis * remove totalFees * calculate fees before FinalizeAndAssemble * revert interface Finalize of consensus * do not double gas limit upon london block * use Leveldb as default * Revert "remove diffStore" This reverts commit df343b137412b0beb25298a6ba9c3c19e47f20b1. * Revert "remove diffsync related code" This reverts commit 8d84b81feae5d794cb5d7fcfdb7f5f7da751941b. * compile pass after revert * remove diffsync * fix dir eth/protocols/trust * fix TestFastNode * decHandlers for trust protocol * keep persist diff in test
137 lines
5.2 KiB
Go
137 lines
5.2 KiB
Go
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
package core
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
"github.com/ethereum/go-ethereum/common/math"
|
|
"github.com/ethereum/go-ethereum/params"
|
|
)
|
|
|
|
var _ = (*genesisSpecMarshaling)(nil)
|
|
|
|
// MarshalJSON marshals as JSON.
|
|
func (g Genesis) MarshalJSON() ([]byte, error) {
|
|
type Genesis struct {
|
|
Config *params.ChainConfig `json:"config"`
|
|
Nonce math.HexOrDecimal64 `json:"nonce"`
|
|
Timestamp math.HexOrDecimal64 `json:"timestamp"`
|
|
ExtraData hexutil.Bytes `json:"extraData"`
|
|
GasLimit math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"`
|
|
Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"`
|
|
Mixhash common.Hash `json:"mixHash"`
|
|
Coinbase common.Address `json:"coinbase"`
|
|
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"`
|
|
Number math.HexOrDecimal64 `json:"number"`
|
|
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
|
|
ParentHash common.Hash `json:"parentHash"`
|
|
BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"`
|
|
ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas,omitempty" toml:",omitempty"`
|
|
BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty" toml:",omitempty"`
|
|
}
|
|
var enc Genesis
|
|
enc.Config = g.Config
|
|
enc.Nonce = math.HexOrDecimal64(g.Nonce)
|
|
enc.Timestamp = math.HexOrDecimal64(g.Timestamp)
|
|
enc.ExtraData = g.ExtraData
|
|
enc.GasLimit = math.HexOrDecimal64(g.GasLimit)
|
|
enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty)
|
|
enc.Mixhash = g.Mixhash
|
|
enc.Coinbase = g.Coinbase
|
|
if g.Alloc != nil {
|
|
enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc))
|
|
for k, v := range g.Alloc {
|
|
enc.Alloc[common.UnprefixedAddress(k)] = v
|
|
}
|
|
}
|
|
enc.Number = math.HexOrDecimal64(g.Number)
|
|
enc.GasUsed = math.HexOrDecimal64(g.GasUsed)
|
|
enc.ParentHash = g.ParentHash
|
|
enc.BaseFee = (*math.HexOrDecimal256)(g.BaseFee)
|
|
enc.ExcessBlobGas = (*math.HexOrDecimal64)(g.ExcessBlobGas)
|
|
enc.BlobGasUsed = (*math.HexOrDecimal64)(g.BlobGasUsed)
|
|
return json.Marshal(&enc)
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
func (g *Genesis) UnmarshalJSON(input []byte) error {
|
|
type Genesis struct {
|
|
Config *params.ChainConfig `json:"config"`
|
|
Nonce *math.HexOrDecimal64 `json:"nonce"`
|
|
Timestamp *math.HexOrDecimal64 `json:"timestamp"`
|
|
ExtraData *hexutil.Bytes `json:"extraData"`
|
|
GasLimit *math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"`
|
|
Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"`
|
|
Mixhash *common.Hash `json:"mixHash"`
|
|
Coinbase *common.Address `json:"coinbase"`
|
|
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"`
|
|
Number *math.HexOrDecimal64 `json:"number"`
|
|
GasUsed *math.HexOrDecimal64 `json:"gasUsed"`
|
|
ParentHash *common.Hash `json:"parentHash"`
|
|
BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"`
|
|
ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas,omitempty" toml:",omitempty"`
|
|
BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty" toml:",omitempty"`
|
|
}
|
|
var dec Genesis
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
return err
|
|
}
|
|
if dec.Config != nil {
|
|
g.Config = dec.Config
|
|
}
|
|
if dec.Nonce != nil {
|
|
g.Nonce = uint64(*dec.Nonce)
|
|
}
|
|
if dec.Timestamp != nil {
|
|
g.Timestamp = uint64(*dec.Timestamp)
|
|
}
|
|
if dec.ExtraData != nil {
|
|
g.ExtraData = *dec.ExtraData
|
|
}
|
|
if dec.GasLimit == nil {
|
|
return errors.New("missing required field 'gasLimit' for Genesis")
|
|
}
|
|
g.GasLimit = uint64(*dec.GasLimit)
|
|
if dec.Difficulty == nil {
|
|
return errors.New("missing required field 'difficulty' for Genesis")
|
|
}
|
|
g.Difficulty = (*big.Int)(dec.Difficulty)
|
|
if dec.Mixhash != nil {
|
|
g.Mixhash = *dec.Mixhash
|
|
}
|
|
if dec.Coinbase != nil {
|
|
g.Coinbase = *dec.Coinbase
|
|
}
|
|
if dec.Alloc == nil {
|
|
return errors.New("missing required field 'alloc' for Genesis")
|
|
}
|
|
g.Alloc = make(GenesisAlloc, len(dec.Alloc))
|
|
for k, v := range dec.Alloc {
|
|
g.Alloc[common.Address(k)] = v
|
|
}
|
|
if dec.Number != nil {
|
|
g.Number = uint64(*dec.Number)
|
|
}
|
|
if dec.GasUsed != nil {
|
|
g.GasUsed = uint64(*dec.GasUsed)
|
|
}
|
|
if dec.ParentHash != nil {
|
|
g.ParentHash = *dec.ParentHash
|
|
}
|
|
if dec.BaseFee != nil {
|
|
g.BaseFee = (*big.Int)(dec.BaseFee)
|
|
}
|
|
if dec.ExcessBlobGas != nil {
|
|
g.ExcessBlobGas = (*uint64)(dec.ExcessBlobGas)
|
|
}
|
|
if dec.BlobGasUsed != nil {
|
|
g.BlobGasUsed = (*uint64)(dec.BlobGasUsed)
|
|
}
|
|
return nil
|
|
}
|