Skip to content

Commit 299fef5

Browse files
committed
make changes backward compatible with tests
1 parent e4cf623 commit 299fef5

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

rollup/internal/controller/sender/sender.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -841,17 +841,20 @@ func (s *Sender) getBlockNumberAndTimestampAndBaseFeeAndBlobFee(ctx context.Cont
841841
baseFee = header.BaseFee.Uint64()
842842
}
843843

844-
// Leave it up to the L1 node to compute the correct blob base fee.
845-
// Previously we would compute it locally using `CalcBlobFee`, but
846-
// that approach requires syncing any future L1 configuration changes.
847-
// Note: The fetched blob base fee might not correspond to the block
848-
// that we fetched in the previous step, but this is acceptable.
849-
var blobBaseFeeHex hexutil.Big
850-
if err := s.rpcClient.CallContext(ctx, &blobBaseFeeHex, "eth_blobBaseFee"); err != nil {
851-
return 0, 0, 0, 0, fmt.Errorf("failed to call eth_blobBaseFee, err: %w", err)
852-
}
853-
// A correct L1 node could not return a value that overflows uint64
854-
blobBaseFee := blobBaseFeeHex.ToInt().Uint64()
844+
var blobBaseFee uint64
845+
if excess := header.ExcessBlobGas; excess != nil {
846+
// Leave it up to the L1 node to compute the correct blob base fee.
847+
// Previously we would compute it locally using `CalcBlobFee`, but
848+
// that approach requires syncing any future L1 configuration changes.
849+
// Note: The fetched blob base fee might not correspond to the block
850+
// that we fetched in the previous step, but this is acceptable.
851+
var blobBaseFeeHex hexutil.Big
852+
if err := s.rpcClient.CallContext(ctx, &blobBaseFeeHex, "eth_blobBaseFee"); err != nil {
853+
return 0, 0, 0, 0, fmt.Errorf("failed to call eth_blobBaseFee, err: %w", err)
854+
}
855+
// A correct L1 node could not return a value that overflows uint64
856+
blobBaseFee = blobBaseFeeHex.ToInt().Uint64()
857+
}
855858

856859
// header.Number.Uint64() returns the pendingBlockNumber, so we minus 1 to get the latestBlockNumber.
857860
return header.Number.Uint64() - 1, header.Time, baseFee, blobBaseFee, nil

rollup/internal/controller/watcher/l1_watcher.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,20 @@ func (w *L1WatcherClient) FetchBlockHeader(blockHeight uint64) error {
8282
baseFee = block.BaseFee.Uint64()
8383
}
8484

85-
// Leave it up to the L1 node to compute the correct blob base fee.
86-
// Previously we would compute it locally using `CalcBlobFee`, but
87-
// that approach requires syncing any future L1 configuration changes.
88-
// Note: The fetched blob base fee might not correspond to the block
89-
// that we fetched in the previous step, but this is acceptable.
90-
var blobBaseFeeHex hexutil.Big
91-
if err := w.rpcClient.CallContext(w.ctx, &blobBaseFeeHex, "eth_blobBaseFee"); err != nil {
92-
return fmt.Errorf("failed to call eth_blobBaseFee, err: %w", err)
85+
var blobBaseFee uint64
86+
if excess := block.ExcessBlobGas; excess != nil {
87+
// Leave it up to the L1 node to compute the correct blob base fee.
88+
// Previously we would compute it locally using `CalcBlobFee`, but
89+
// that approach requires syncing any future L1 configuration changes.
90+
// Note: The fetched blob base fee might not correspond to the block
91+
// that we fetched in the previous step, but this is acceptable.
92+
var blobBaseFeeHex hexutil.Big
93+
if err := w.rpcClient.CallContext(w.ctx, &blobBaseFeeHex, "eth_blobBaseFee"); err != nil {
94+
return fmt.Errorf("failed to call eth_blobBaseFee, err: %w", err)
95+
}
96+
// A correct L1 node could not return a value that overflows uint64
97+
blobBaseFee = blobBaseFeeHex.ToInt().Uint64()
9398
}
94-
// A correct L1 node could not return a value that overflows uint64
95-
blobBaseFee := blobBaseFeeHex.ToInt().Uint64()
9699

97100
l1Block := orm.L1Block{
98101
Number: blockHeight,

0 commit comments

Comments
 (0)