Skip to content

Commit

Permalink
fix(rollup): sender use pending block base fee (#1556)
Browse files Browse the repository at this point in the history
Co-authored-by: yiweichi <[email protected]>
  • Loading branch information
yiweichi and yiweichi authored Oct 29, 2024
1 parent bc8f9db commit 2059b49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.4.70"
var tag = "v4.4.71"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
10 changes: 5 additions & 5 deletions rollup/internal/controller/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ func (s *Sender) getSenderMeta() *orm.SenderMeta {
}

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

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

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

0 comments on commit 2059b49

Please sign in to comment.