@@ -43,13 +43,14 @@ import (
4343)
4444
4545var (
46- VALID = GenericStringResponse {"VALID" }
47- SUCCESS = GenericStringResponse {"SUCCESS" }
48- INVALID = ForkChoiceResponse {Status : "INVALID" , PayloadID : nil }
49- SYNCING = ForkChoiceResponse {Status : "INVALID" , PayloadID : nil }
50- UnknownHeader = rpc.CustomError {Code : - 32000 , Message : "unknown header" }
51- UnknownPayload = rpc.CustomError {Code : - 32001 , Message : "unknown payload" }
52- InvalidPayloadID = rpc.CustomError {Code : 1 , Message : "invalid payload id" }
46+ VALID = GenericStringResponse {"VALID" }
47+ SUCCESS = GenericStringResponse {"SUCCESS" }
48+ INVALID = ForkChoiceResponse {Status : "INVALID" , PayloadID : nil }
49+ SYNCING = ForkChoiceResponse {Status : "SYNCING" , PayloadID : nil }
50+ GenericServerError = rpc.CustomError {Code : - 32000 , ValidationError : "Server error" }
51+ UnknownPayload = rpc.CustomError {Code : - 32001 , ValidationError : "Unknown payload" }
52+ InvalidTB = rpc.CustomError {Code : - 32002 , ValidationError : "Invalid terminal block" }
53+ InvalidPayloadID = rpc.CustomError {Code : 1 , ValidationError : "invalid payload id" }
5354)
5455
5556// Register adds catalyst APIs to the full node.
@@ -232,7 +233,7 @@ func computePayloadId(headBlockHash common.Hash, params *PayloadAttributesV1) []
232233 hasher .Write (headBlockHash [:])
233234 binary .Write (hasher , binary .BigEndian , params .Timestamp )
234235 hasher .Write (params .Random [:])
235- hasher .Write (params .FeeRecipient [:])
236+ hasher .Write (params .SuggestedFeeRecipient [:])
236237 return hasher .Sum ([]byte {})[:8 ]
237238}
238239
@@ -308,7 +309,7 @@ func (api *ConsensusAPI) assembleBlock(parentHash common.Hash, params *PayloadAt
308309 log .Warn ("Producing block too far in the future" , "diff" , common .PrettyDuration (diff ))
309310 }
310311 pending := api .eth .TxPool ().Pending (true )
311- coinbase := params .FeeRecipient
312+ coinbase := params .SuggestedFeeRecipient
312313 num := parent .Number ()
313314 header := & types.Header {
314315 ParentHash : parent .Hash (),
@@ -419,10 +420,10 @@ func ExecutableDataToBlock(params ExecutableDataV1) (*types.Block, error) {
419420 header := & types.Header {
420421 ParentHash : params .ParentHash ,
421422 UncleHash : types .EmptyUncleHash ,
422- Coinbase : params .Coinbase ,
423+ Coinbase : params .FeeRecipient ,
423424 Root : params .StateRoot ,
424425 TxHash : types .DeriveSha (types .Transactions (txs ), trie .NewStackTrie (nil )),
425- ReceiptHash : params .ReceiptRoot ,
426+ ReceiptHash : params .ReceiptsRoot ,
426427 Bloom : types .BytesToBloom (params .LogsBloom ),
427428 Difficulty : common .Big0 ,
428429 Number : number ,
@@ -444,14 +445,14 @@ func BlockToExecutableData(block *types.Block, random common.Hash) *ExecutableDa
444445 return & ExecutableDataV1 {
445446 BlockHash : block .Hash (),
446447 ParentHash : block .ParentHash (),
447- Coinbase : block .Coinbase (),
448+ FeeRecipient : block .Coinbase (),
448449 StateRoot : block .Root (),
449450 Number : block .NumberU64 (),
450451 GasLimit : block .GasLimit (),
451452 GasUsed : block .GasUsed (),
452453 BaseFeePerGas : block .BaseFee (),
453454 Timestamp : block .Time (),
454- ReceiptRoot : block .ReceiptHash (),
455+ ReceiptsRoot : block .ReceiptHash (),
455456 LogsBloom : block .Bloom ().Bytes (),
456457 Transactions : encodeTransactions (block .Transactions ()),
457458 Random : random ,
@@ -475,11 +476,11 @@ func (api *ConsensusAPI) checkTerminalTotalDifficulty(head common.Hash) error {
475476 // make sure the parent has enough terminal total difficulty
476477 newHeadBlock := api .eth .BlockChain ().GetBlockByHash (head )
477478 if newHeadBlock == nil {
478- return & UnknownHeader
479+ return & GenericServerError
479480 }
480481 td := api .eth .BlockChain ().GetTd (newHeadBlock .Hash (), newHeadBlock .NumberU64 ())
481482 if td != nil && td .Cmp (api .eth .BlockChain ().Config ().TerminalTotalDifficulty ) < 0 {
482- return errors . New ( "total difficulty not reached yet" )
483+ return & InvalidTB
483484 }
484485 return nil
485486}
@@ -494,7 +495,7 @@ func (api *ConsensusAPI) setHead(newHead common.Hash) error {
494495 }
495496 newHeadHeader := api .les .BlockChain ().GetHeaderByHash (newHead )
496497 if newHeadHeader == nil {
497- return & UnknownHeader
498+ return & GenericServerError
498499 }
499500 if err := api .les .BlockChain ().SetChainHead (newHeadHeader ); err != nil {
500501 return err
@@ -508,15 +509,11 @@ func (api *ConsensusAPI) setHead(newHead common.Hash) error {
508509 }
509510 headBlock := api .eth .BlockChain ().CurrentBlock ()
510511 if headBlock .Hash () == newHead {
511- // Trigger the transition if it's the first `NewHead` event.
512- if merger := api .merger (); ! merger .PoSFinalized () {
513- merger .FinalizePoS ()
514- }
515512 return nil
516513 }
517514 newHeadBlock := api .eth .BlockChain ().GetBlockByHash (newHead )
518515 if newHeadBlock == nil {
519- return & UnknownHeader
516+ return & GenericServerError
520517 }
521518 if err := api .eth .BlockChain ().SetChainHead (newHeadBlock ); err != nil {
522519 return err
0 commit comments