Skip to content

Commit 2059b49

Browse files
authored
fix(rollup): sender use pending block base fee (#1556)
Co-authored-by: yiweichi <[email protected]>
1 parent bc8f9db commit 2059b49

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime/debug"
66
)
77

8-
var tag = "v4.4.70"
8+
var tag = "v4.4.71"
99

1010
var commit = func() string {
1111
if info, ok := debug.ReadBuildInfo(); ok {

rollup/internal/controller/sender/sender.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ func (s *Sender) getSenderMeta() *orm.SenderMeta {
626626
}
627627

628628
func (s *Sender) getBlockNumberAndBaseFeeAndBlobFee(ctx context.Context) (uint64, uint64, uint64, error) {
629-
header, err := s.client.HeaderByNumber(ctx, nil)
629+
header, err := s.client.HeaderByNumber(ctx, big.NewInt(rpc.PendingBlockNumber.Int64()))
630630
if err != nil {
631631
return 0, 0, 0, fmt.Errorf("failed to get header by number, err: %w", err)
632632
}
@@ -637,11 +637,11 @@ func (s *Sender) getBlockNumberAndBaseFeeAndBlobFee(ctx context.Context) (uint64
637637
}
638638

639639
var blobBaseFee uint64
640-
if header.ExcessBlobGas != nil && header.BlobGasUsed != nil {
641-
parentExcessBlobGas := eip4844.CalcExcessBlobGas(*header.ExcessBlobGas, *header.BlobGasUsed)
642-
blobBaseFee = eip4844.CalcBlobFee(parentExcessBlobGas).Uint64()
640+
if excess := header.ExcessBlobGas; excess != nil {
641+
blobBaseFee = eip4844.CalcBlobFee(*excess).Uint64()
643642
}
644-
return header.Number.Uint64(), baseFee, blobBaseFee, nil
643+
// header.Number.Uint64() returns the pendingBlockNumber, so we minus 1 to get the latestBlockNumber.
644+
return header.Number.Uint64() - 1, baseFee, blobBaseFee, nil
645645
}
646646

647647
func makeSidecar(blob *kzg4844.Blob) (*gethTypes.BlobTxSidecar, error) {

0 commit comments

Comments
 (0)