From 45fd280e4c1e4cd6161fe28c67960b53a1dfdfc5 Mon Sep 17 00:00:00 2001 From: Somnath Banerjee Date: Wed, 20 Nov 2024 13:27:40 +0400 Subject: [PATCH] Fix requests getPaylaod --- consensus/merge/merge.go | 2 +- turbo/builder/block_builder.go | 7 ++++++- turbo/execution/eth1/block_building.go | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/consensus/merge/merge.go b/consensus/merge/merge.go index bfc7a8bf6ca..8bb0c68f92f 100644 --- a/consensus/merge/merge.go +++ b/consensus/merge/merge.go @@ -306,7 +306,7 @@ func (s *Merge) Seal(chain consensus.ChainHeaderReader, blockWithReceipts *types header.Nonce = ProofOfStakeNonce select { - case results <- &types.BlockWithReceipts{Block: block.WithSeal(header), Receipts: receipts, Requests: requests }: + case results <- &types.BlockWithReceipts{Block: block.WithSeal(header), Receipts: receipts, Requests: requests}: default: log.Warn("Sealing result is not read", "sealhash", block.Hash()) } diff --git a/turbo/builder/block_builder.go b/turbo/builder/block_builder.go index 5274a28e74b..17928e8062b 100644 --- a/turbo/builder/block_builder.go +++ b/turbo/builder/block_builder.go @@ -1,6 +1,7 @@ package builder import ( + "fmt" "sync" "sync/atomic" "time" @@ -33,7 +34,11 @@ func NewBlockBuilder(build BlockBuilderFunc, param *core.BlockBuilderParameters) log.Warn("Failed to build a block", "err", err) } else { block := result.Block - log.Info("Built block", "hash", block.Hash(), "height", block.NumberU64(), "txs", len(block.Transactions()), "gas used %", 100*float64(block.GasUsed())/float64(block.GasLimit()), "time", time.Since(t)) + reqLenStr := "nil" + if len(result.Requests) == 3 { + reqLenStr = fmt.Sprint("Deposit Requests", len(result.Requests[0].RequestData), "Withdrawal Requests", len(result.Requests[1].RequestData), "Consolidation Requests", len(result.Requests[2].RequestData)) + } + log.Info("Built block", "hash", block.Hash(), "height", block.NumberU64(), "txs", len(block.Transactions()), "executionRequests", len(result.Requests), "Requests", reqLenStr, "gas used %", 100*float64(block.GasUsed())/float64(block.GasLimit()), "time", time.Since(t)) } builder.syncCond.L.Lock() diff --git a/turbo/execution/eth1/block_building.go b/turbo/execution/eth1/block_building.go index 1eb8d738e2d..45c401d80e9 100644 --- a/turbo/execution/eth1/block_building.go +++ b/turbo/execution/eth1/block_building.go @@ -204,10 +204,11 @@ func (e *EthereumExecutionModule) GetAssembledBlock(ctx context.Context, req *ex requests := make([][]byte, len(types.KnownRequestTypes)) if len(blockWithReceipts.Requests) == len(types.KnownRequestTypes) { for i, r := range blockWithReceipts.Requests { - copy(requests[i], r.RequestData) + requests[i] = make([]byte, 0) + requests[i] = append(requests[i], r.RequestData...) } } else { - e.logger.Error("Requests len SHOULD BE","equal to", len(types.KnownRequestTypes), "got", len(blockWithReceipts.Requests)) + e.logger.Error("Requests len SHOULD BE", "equal to", len(types.KnownRequestTypes), "got", len(blockWithReceipts.Requests)) for i := 0; i < len(types.KnownRequestTypes); i++ { requests[i] = make([]byte, 0) }