From 745d9d3fdb81b6b2a28a018a144e709e6da88d14 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 14 Mar 2024 23:30:22 +0800 Subject: [PATCH] [wip] cancun patches --- indexer/database/dump/indexer.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/indexer/database/dump/indexer.go b/indexer/database/dump/indexer.go index 7307989..7aeae6b 100644 --- a/indexer/database/dump/indexer.go +++ b/indexer/database/dump/indexer.go @@ -27,6 +27,7 @@ import ( "github.com/multiformats/go-multihash" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/misc/eip4844" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" @@ -68,8 +69,13 @@ func (sdi *StateDiffIndexer) PushBlock(block *types.Block, receipts types.Receip height := block.NumberU64() traceMsg := fmt.Sprintf("indexer stats for statediff at %d with hash %s:\r\n", height, blockHashStr) transactions := block.Transactions() + var blobGasPrice *big.Int + excessBlobGas := block.ExcessBlobGas() + if excessBlobGas != nil { + blobGasPrice = eip4844.CalcBlobFee(*excessBlobGas) + } // Derive any missing fields - if err := receipts.DeriveFields(sdi.chainConfig, blockHash, height, block.BaseFee(), transactions); err != nil { + if err := receipts.DeriveFields(sdi.chainConfig, blockHash, height, block.Time(), block.BaseFee(), blobGasPrice, transactions); err != nil { return nil, err } @@ -118,6 +124,7 @@ func (sdi *StateDiffIndexer) PushBlock(block *types.Block, receipts types.Receip err = sdi.processReceiptsAndTxs(blockTx, processArgs{ headerID: headerID, blockNumber: block.Number(), + blockTime: block.Time(), receipts: receipts, txs: transactions, rctNodes: rctNodes, @@ -213,6 +220,7 @@ func (sdi *StateDiffIndexer) processUncles(tx *BatchTx, headerID string, blockNu type processArgs struct { headerID string blockNumber *big.Int + blockTime uint64 receipts types.Receipts txs types.Transactions rctNodes []*ipld.EthReceipt @@ -223,7 +231,7 @@ type processArgs struct { // processReceiptsAndTxs publishes and indexes receipt and transaction IPLDs in Postgres func (sdi *StateDiffIndexer) processReceiptsAndTxs(tx *BatchTx, args processArgs) error { // Process receipts and txs - signer := types.MakeSigner(sdi.chainConfig, args.blockNumber) + signer := types.MakeSigner(sdi.chainConfig, args.blockNumber, args.blockTime) for i, receipt := range args.receipts { txNode := args.txNodes[i] tx.cacheIPLD(txNode)