mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
all: fix tests
This commit is contained in:
parent
43dd6b968c
commit
1d8d879764
10 changed files with 81 additions and 63 deletions
|
|
@ -261,7 +261,10 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash,
|
||||||
ParentBeaconRoot: beaconRoot,
|
ParentBeaconRoot: beaconRoot,
|
||||||
InclusionListSummaryRoot: inclusionRoot,
|
InclusionListSummaryRoot: inclusionRoot,
|
||||||
}
|
}
|
||||||
block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */).WithWithdrawals(params.Withdrawals).WithInclusionList(params.InclusionListSummary.Summary)
|
block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */).WithWithdrawals(params.Withdrawals)
|
||||||
|
if inclusionRoot != nil {
|
||||||
|
block = block.WithInclusionList(params.InclusionListSummary.Summary)
|
||||||
|
}
|
||||||
if block.Hash() != params.BlockHash {
|
if block.Hash() != params.BlockHash {
|
||||||
return nil, fmt.Errorf("blockhash mismatch, want %x, got %x", params.BlockHash, block.Hash())
|
return nil, fmt.Errorf("blockhash mismatch, want %x, got %x", params.BlockHash, block.Hash())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
|
||||||
header.Root = state.IntermediateRoot(true)
|
header.Root = state.IntermediateRoot(true)
|
||||||
|
|
||||||
// Assemble and return the final block.
|
// Assemble and return the final block.
|
||||||
return types.NewBlockWithWithdrawals(header, body.Transactions, body.Uncles, receipts, body.Withdrawals, trie.NewStackTrie(nil)), nil
|
return types.NewBlockWithWithdrawals(header, body.Transactions, body.Uncles, receipts, body.Withdrawals, trie.NewStackTrie(nil)).WithInclusionList(body.InclusionListSummary), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seal generates a new sealing request for the given input block and pushes
|
// Seal generates a new sealing request for the given input block and pushes
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,12 @@ type BlockGen struct {
|
||||||
header *types.Header
|
header *types.Header
|
||||||
statedb *state.StateDB
|
statedb *state.StateDB
|
||||||
|
|
||||||
gasPool *GasPool
|
gasPool *GasPool
|
||||||
txs []*types.Transaction
|
txs []*types.Transaction
|
||||||
receipts []*types.Receipt
|
receipts []*types.Receipt
|
||||||
uncles []*types.Header
|
uncles []*types.Header
|
||||||
withdrawals []*types.Withdrawal
|
withdrawals []*types.Withdrawal
|
||||||
|
inclusionListSummary []*types.InclusionListEntry
|
||||||
|
|
||||||
engine consensus.Engine
|
engine consensus.Engine
|
||||||
}
|
}
|
||||||
|
|
@ -345,7 +346,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
gen(i, b)
|
gen(i, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
body := types.Body{Transactions: b.txs, Uncles: b.uncles, Withdrawals: b.withdrawals}
|
body := types.Body{Transactions: b.txs, Uncles: b.uncles, Withdrawals: b.withdrawals, InclusionListSummary: b.inclusionListSummary}
|
||||||
block, err := b.engine.FinalizeAndAssemble(cm, b.header, statedb, &body, b.receipts)
|
block, err := b.engine.FinalizeAndAssemble(cm, b.header, statedb, &body, b.receipts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ func (b *Block) DecodeRLP(s *rlp.Stream) error {
|
||||||
if err := s.Decode(&eb); err != nil {
|
if err := s.Decode(&eb); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
b.header, b.uncles, b.transactions, b.withdrawals = eb.Header, eb.Uncles, eb.Txs, eb.Withdrawals
|
b.header, b.uncles, b.transactions, b.withdrawals, b.inclusionListSummary = eb.Header, eb.Uncles, eb.Txs, eb.Withdrawals, eb.InclusionListSummary
|
||||||
b.size.Store(rlp.ListSize(size))
|
b.size.Store(rlp.ListSize(size))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -328,10 +328,11 @@ func (b *Block) DecodeRLP(s *rlp.Stream) error {
|
||||||
// EncodeRLP serializes a block as RLP.
|
// EncodeRLP serializes a block as RLP.
|
||||||
func (b *Block) EncodeRLP(w io.Writer) error {
|
func (b *Block) EncodeRLP(w io.Writer) error {
|
||||||
return rlp.Encode(w, &extblock{
|
return rlp.Encode(w, &extblock{
|
||||||
Header: b.header,
|
Header: b.header,
|
||||||
Txs: b.transactions,
|
Txs: b.transactions,
|
||||||
Uncles: b.uncles,
|
Uncles: b.uncles,
|
||||||
Withdrawals: b.withdrawals,
|
Withdrawals: b.withdrawals,
|
||||||
|
InclusionListSummary: b.inclusionListSummary,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -495,6 +496,7 @@ func (b *Block) WithInclusionList(summary []*InclusionListEntry) *Block {
|
||||||
header: b.header,
|
header: b.header,
|
||||||
transactions: b.transactions,
|
transactions: b.transactions,
|
||||||
uncles: b.uncles,
|
uncles: b.uncles,
|
||||||
|
withdrawals: b.withdrawals,
|
||||||
}
|
}
|
||||||
if summary != nil {
|
if summary != nil {
|
||||||
block.inclusionListSummary = make([]*InclusionListEntry, len(summary))
|
block.inclusionListSummary = make([]*InclusionListEntry, len(summary))
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,8 @@ type ConsensusAPI struct {
|
||||||
forkchoiceLock sync.Mutex // Lock for the forkChoiceUpdated method
|
forkchoiceLock sync.Mutex // Lock for the forkChoiceUpdated method
|
||||||
newPayloadLock sync.Mutex // Lock for the NewPayload method
|
newPayloadLock sync.Mutex // Lock for the NewPayload method
|
||||||
|
|
||||||
coolMapThatIsNotAMemLeak map[common.Hash][]*types.Transaction
|
coolMapThatIsNotAMemLeak map[common.Hash][]*types.Transaction
|
||||||
|
coolMapThatIsNotAMemLeak2 map[common.Hash]*types.InclusionListSummary
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConsensusAPI creates a new consensus api for the given backend.
|
// NewConsensusAPI creates a new consensus api for the given backend.
|
||||||
|
|
@ -154,12 +155,13 @@ func newConsensusAPIWithoutHeartbeat(eth *eth.Ethereum) *ConsensusAPI {
|
||||||
log.Warn("Engine API started but chain not configured for merge yet")
|
log.Warn("Engine API started but chain not configured for merge yet")
|
||||||
}
|
}
|
||||||
api := &ConsensusAPI{
|
api := &ConsensusAPI{
|
||||||
eth: eth,
|
eth: eth,
|
||||||
remoteBlocks: newHeaderQueue(),
|
remoteBlocks: newHeaderQueue(),
|
||||||
localBlocks: newPayloadQueue(),
|
localBlocks: newPayloadQueue(),
|
||||||
invalidBlocksHits: make(map[common.Hash]int),
|
invalidBlocksHits: make(map[common.Hash]int),
|
||||||
invalidTipsets: make(map[common.Hash]*types.Header),
|
invalidTipsets: make(map[common.Hash]*types.Header),
|
||||||
coolMapThatIsNotAMemLeak: make(map[common.Hash][]*types.Transaction),
|
coolMapThatIsNotAMemLeak: make(map[common.Hash][]*types.Transaction),
|
||||||
|
coolMapThatIsNotAMemLeak2: make(map[common.Hash]*types.InclusionListSummary),
|
||||||
}
|
}
|
||||||
eth.Downloader().SetBadBlockCallback(api.setInvalidAncestor)
|
eth.Downloader().SetBadBlockCallback(api.setInvalidAncestor)
|
||||||
return api
|
return api
|
||||||
|
|
@ -346,6 +348,7 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
|
||||||
api.eth.BlockChain().SetFinalized(finalBlock.Header())
|
api.eth.BlockChain().SetFinalized(finalBlock.Header())
|
||||||
// Clear the inclusionList for that block
|
// Clear the inclusionList for that block
|
||||||
delete(api.coolMapThatIsNotAMemLeak, update.FinalizedBlockHash)
|
delete(api.coolMapThatIsNotAMemLeak, update.FinalizedBlockHash)
|
||||||
|
delete(api.coolMapThatIsNotAMemLeak2, update.FinalizedBlockHash)
|
||||||
}
|
}
|
||||||
// Check if the safe block hash is in our canonical tree, if not something is wrong
|
// Check if the safe block hash is in our canonical tree, if not something is wrong
|
||||||
if update.SafeBlockHash != (common.Hash{}) {
|
if update.SafeBlockHash != (common.Hash{}) {
|
||||||
|
|
@ -366,14 +369,15 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
|
||||||
// will replace it arbitrarily many times in between.
|
// will replace it arbitrarily many times in between.
|
||||||
if payloadAttributes != nil {
|
if payloadAttributes != nil {
|
||||||
args := &miner.BuildPayloadArgs{
|
args := &miner.BuildPayloadArgs{
|
||||||
Parent: update.HeadBlockHash,
|
Parent: update.HeadBlockHash,
|
||||||
Timestamp: payloadAttributes.Timestamp,
|
Timestamp: payloadAttributes.Timestamp,
|
||||||
FeeRecipient: payloadAttributes.SuggestedFeeRecipient,
|
FeeRecipient: payloadAttributes.SuggestedFeeRecipient,
|
||||||
Random: payloadAttributes.Random,
|
Random: payloadAttributes.Random,
|
||||||
Withdrawals: payloadAttributes.Withdrawals,
|
Withdrawals: payloadAttributes.Withdrawals,
|
||||||
BeaconRoot: payloadAttributes.BeaconRoot,
|
BeaconRoot: payloadAttributes.BeaconRoot,
|
||||||
Version: payloadVersion,
|
Version: payloadVersion,
|
||||||
InclusionList: api.coolMapThatIsNotAMemLeak[update.HeadBlockHash],
|
InclusionList: api.coolMapThatIsNotAMemLeak[update.HeadBlockHash],
|
||||||
|
InclusionListSummary: api.coolMapThatIsNotAMemLeak2[update.HeadBlockHash],
|
||||||
}
|
}
|
||||||
id := args.Id()
|
id := args.Id()
|
||||||
// If we already are busy generating this work, then we do not need
|
// If we already are busy generating this work, then we do not need
|
||||||
|
|
@ -904,8 +908,8 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBodyV1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *ConsensusAPI) NewInclusionListV1(addresses []common.Address, transactions [][]byte, parentBlockHash common.Hash) (*engine.InclusionListStatusV1, error) {
|
func (api *ConsensusAPI) NewInclusionListV1(inclusionListSummary *types.InclusionListSummary, transactions [][]byte, parentBlockHash common.Hash) (*engine.InclusionListStatusV1, error) {
|
||||||
if len(addresses) != len(transactions) {
|
if len(inclusionListSummary.Summary) != len(transactions) {
|
||||||
return inclusionListError("number of transactions do not match addresses"), nil
|
return inclusionListError("number of transactions do not match addresses"), nil
|
||||||
}
|
}
|
||||||
txs, err := engine.DecodeTransactions(transactions)
|
txs, err := engine.DecodeTransactions(transactions)
|
||||||
|
|
@ -919,8 +923,8 @@ func (api *ConsensusAPI) NewInclusionListV1(addresses []common.Address, transact
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return inclusionListError(fmt.Sprintf("Invalid signer at index %v, error: %v", index, err)), nil
|
return inclusionListError(fmt.Sprintf("Invalid signer at index %v, error: %v", index, err)), nil
|
||||||
}
|
}
|
||||||
if addresses[index] != sender {
|
if inclusionListSummary.Summary[index].Address != sender {
|
||||||
return inclusionListError(fmt.Sprintf("Invalid sender at index %v, got %v want %v", index, sender, addresses[index])), nil
|
return inclusionListError(fmt.Sprintf("Invalid sender at index %v, got %v want %v", index, sender, inclusionListSummary.Summary[index].Address)), nil
|
||||||
}
|
}
|
||||||
maxGas += tx.Gas()
|
maxGas += tx.Gas()
|
||||||
}
|
}
|
||||||
|
|
@ -935,6 +939,7 @@ func (api *ConsensusAPI) NewInclusionListV1(addresses []common.Address, transact
|
||||||
return inclusionListError(err.Error()), nil
|
return inclusionListError(err.Error()), nil
|
||||||
}
|
}
|
||||||
api.coolMapThatIsNotAMemLeak[parentBlockHash] = txs
|
api.coolMapThatIsNotAMemLeak[parentBlockHash] = txs
|
||||||
|
api.coolMapThatIsNotAMemLeak2[parentBlockHash] = inclusionListSummary
|
||||||
return &engine.InclusionListStatusV1{Status: engine.VALID}, nil
|
return &engine.InclusionListStatusV1{Status: engine.VALID}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
t.Fatal("timed out without including all withdrawals/txs")
|
t.Fatalf("timed out without including all withdrawals/txs, want %v got %v", len(withdrawals), len(includedWithdrawals))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,7 @@ func testGetBlockBodies(t *testing.T, protocol uint) {
|
||||||
block := backend.chain.GetBlockByNumber(uint64(num))
|
block := backend.chain.GetBlockByNumber(uint64(num))
|
||||||
hashes = append(hashes, block.Hash())
|
hashes = append(hashes, block.Hash())
|
||||||
if len(bodies) < tt.expected {
|
if len(bodies) < tt.expected {
|
||||||
bodies = append(bodies, &BlockBody{Transactions: block.Transactions(), Uncles: block.Uncles(), Withdrawals: block.Withdrawals()})
|
bodies = append(bodies, &BlockBody{Transactions: block.Transactions(), Uncles: block.Uncles(), Withdrawals: block.Withdrawals(), InclusionListSummary: block.InclusionListSummary()})
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -410,7 +410,7 @@ func testGetBlockBodies(t *testing.T, protocol uint) {
|
||||||
hashes = append(hashes, hash)
|
hashes = append(hashes, hash)
|
||||||
if tt.available[j] && len(bodies) < tt.expected {
|
if tt.available[j] && len(bodies) < tt.expected {
|
||||||
block := backend.chain.GetBlockByHash(hash)
|
block := backend.chain.GetBlockByHash(hash)
|
||||||
bodies = append(bodies, &BlockBody{Transactions: block.Transactions(), Uncles: block.Uncles(), Withdrawals: block.Withdrawals()})
|
bodies = append(bodies, &BlockBody{Transactions: block.Transactions(), Uncles: block.Uncles(), Withdrawals: block.Withdrawals(), InclusionListSummary: block.InclusionListSummary()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,15 @@ import (
|
||||||
// Check engine-api specification for more details.
|
// Check engine-api specification for more details.
|
||||||
// https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#payloadattributesv3
|
// https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#payloadattributesv3
|
||||||
type BuildPayloadArgs struct {
|
type BuildPayloadArgs struct {
|
||||||
Parent common.Hash // The parent block to build payload on top
|
Parent common.Hash // The parent block to build payload on top
|
||||||
Timestamp uint64 // The provided timestamp of generated payload
|
Timestamp uint64 // The provided timestamp of generated payload
|
||||||
FeeRecipient common.Address // The provided recipient address for collecting transaction fee
|
FeeRecipient common.Address // The provided recipient address for collecting transaction fee
|
||||||
Random common.Hash // The provided randomness value
|
Random common.Hash // The provided randomness value
|
||||||
Withdrawals types.Withdrawals // The provided withdrawals
|
Withdrawals types.Withdrawals // The provided withdrawals
|
||||||
BeaconRoot *common.Hash // The provided beaconRoot (Cancun)
|
BeaconRoot *common.Hash // The provided beaconRoot (Cancun)
|
||||||
Version engine.PayloadVersion // Versioning byte for payload id calculation.
|
Version engine.PayloadVersion // Versioning byte for payload id calculation.
|
||||||
InclusionList []*types.Transaction // Mandatory Inclusion List
|
InclusionList []*types.Transaction // Mandatory Inclusion List
|
||||||
|
InclusionListSummary *types.InclusionListSummary // Inclusion List Summary
|
||||||
}
|
}
|
||||||
|
|
||||||
// Id computes an 8-byte identifier by hashing the components of the payload arguments.
|
// Id computes an 8-byte identifier by hashing the components of the payload arguments.
|
||||||
|
|
@ -182,15 +183,16 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) {
|
||||||
// enough to run. The empty payload can at least make sure there is something
|
// enough to run. The empty payload can at least make sure there is something
|
||||||
// to deliver for not missing slot.
|
// to deliver for not missing slot.
|
||||||
emptyParams := &generateParams{
|
emptyParams := &generateParams{
|
||||||
timestamp: args.Timestamp,
|
timestamp: args.Timestamp,
|
||||||
forceTime: true,
|
forceTime: true,
|
||||||
parentHash: args.Parent,
|
parentHash: args.Parent,
|
||||||
coinbase: args.FeeRecipient,
|
coinbase: args.FeeRecipient,
|
||||||
random: args.Random,
|
random: args.Random,
|
||||||
withdrawals: args.Withdrawals,
|
withdrawals: args.Withdrawals,
|
||||||
beaconRoot: args.BeaconRoot,
|
beaconRoot: args.BeaconRoot,
|
||||||
noTxs: true,
|
noTxs: true,
|
||||||
inclusionList: args.InclusionList,
|
inclusionList: args.InclusionList,
|
||||||
|
inclusionListSummary: args.InclusionListSummary,
|
||||||
}
|
}
|
||||||
empty := miner.generateWork(emptyParams)
|
empty := miner.generateWork(emptyParams)
|
||||||
if empty.err != nil {
|
if empty.err != nil {
|
||||||
|
|
|
||||||
|
|
@ -77,15 +77,16 @@ type newPayloadResult struct {
|
||||||
|
|
||||||
// generateParams wraps various of settings for generating sealing task.
|
// generateParams wraps various of settings for generating sealing task.
|
||||||
type generateParams struct {
|
type generateParams struct {
|
||||||
timestamp uint64 // The timestamp for sealing task
|
timestamp uint64 // The timestamp for sealing task
|
||||||
forceTime bool // Flag whether the given timestamp is immutable or not
|
forceTime bool // Flag whether the given timestamp is immutable or not
|
||||||
parentHash common.Hash // Parent block hash, empty means the latest chain head
|
parentHash common.Hash // Parent block hash, empty means the latest chain head
|
||||||
coinbase common.Address // The fee recipient address for including transaction
|
coinbase common.Address // The fee recipient address for including transaction
|
||||||
random common.Hash // The randomness generated by beacon chain, empty before the merge
|
random common.Hash // The randomness generated by beacon chain, empty before the merge
|
||||||
withdrawals types.Withdrawals // List of withdrawals to include in block (shanghai field)
|
withdrawals types.Withdrawals // List of withdrawals to include in block (shanghai field)
|
||||||
beaconRoot *common.Hash // The beacon root (cancun field).
|
beaconRoot *common.Hash // The beacon root (cancun field).
|
||||||
noTxs bool // Flag whether an empty block without any transaction is expected
|
noTxs bool // Flag whether an empty block without any transaction is expected
|
||||||
inclusionList []*types.Transaction // Mandatory transactions to include
|
inclusionListSummary *types.InclusionListSummary // Inclusion List summary
|
||||||
|
inclusionList []*types.Transaction // Mandatory transactions to include
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateWork generates a sealing block based on the given parameters.
|
// generateWork generates a sealing block based on the given parameters.
|
||||||
|
|
@ -119,7 +120,11 @@ func (miner *Miner) generateWork(params *generateParams) *newPayloadResult {
|
||||||
log.Warn("Block building is interrupted", "allowance", common.PrettyDuration(miner.config.Recommit))
|
log.Warn("Block building is interrupted", "allowance", common.PrettyDuration(miner.config.Recommit))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body := types.Body{Transactions: work.txs, Withdrawals: params.withdrawals}
|
var summary []*types.InclusionListEntry
|
||||||
|
if params.inclusionListSummary != nil {
|
||||||
|
summary = params.inclusionListSummary.Summary
|
||||||
|
}
|
||||||
|
body := types.Body{Transactions: work.txs, Withdrawals: params.withdrawals, InclusionListSummary: summary}
|
||||||
block, err := miner.engine.FinalizeAndAssemble(miner.chain, work.header, work.state, &body, work.receipts)
|
block, err := miner.engine.FinalizeAndAssemble(miner.chain, work.header, work.state, &body, work.receipts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &newPayloadResult{err: err}
|
return &newPayloadResult{err: err}
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ func TestNotify(t *testing.T) {
|
||||||
}
|
}
|
||||||
notifier.Notify(id, msg)
|
notifier.Notify(id, msg)
|
||||||
have := strings.TrimSpace(out.String())
|
have := strings.TrimSpace(out.String())
|
||||||
want := `{"jsonrpc":"2.0","method":"_subscription","params":{"subscription":"test","result":{"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000001","sha3Uncles":"0x0000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","receiptsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":null,"number":"0x64","gasLimit":"0x0","gasUsed":"0x0","timestamp":"0x0","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","baseFeePerGas":null,"withdrawalsRoot":null,"blobGasUsed":null,"excessBlobGas":null,"parentBeaconBlockRoot":null,"hash":"0xe5fb877dde471b45b9742bb4bb4b3d74a761e2fb7cb849a3d2b687eed90fb604"}}}`
|
want := `{"jsonrpc":"2.0","method":"_subscription","params":{"subscription":"test","result":{"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000001","sha3Uncles":"0x0000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","receiptsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":null,"number":"0x64","gasLimit":"0x0","gasUsed":"0x0","timestamp":"0x0","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","baseFeePerGas":null,"withdrawalsRoot":null,"blobGasUsed":null,"excessBlobGas":null,"parentBeaconBlockRoot":null,"inclusionListSummaryRoot":null,"hash":"0xe5fb877dde471b45b9742bb4bb4b3d74a761e2fb7cb849a3d2b687eed90fb604"}}}`
|
||||||
if have != want {
|
if have != want {
|
||||||
t.Errorf("have:\n%v\nwant:\n%v\n", have, want)
|
t.Errorf("have:\n%v\nwant:\n%v\n", have, want)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue