Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0997c9a

Browse files
committedMar 13, 2025·
more changes for nitro
1 parent 9784143 commit 0997c9a

File tree

9 files changed

+37
-50
lines changed

9 files changed

+37
-50
lines changed
 

‎arbitrum/apibackend.go

+4
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ func (a *APIBackend) BlobBaseFee(ctx context.Context) *big.Int {
356356
return nil
357357
}
358358

359+
func (a *APIBackend) MaxBlobGasPerBlock(ctx context.Context) uint64 {
360+
return eip4844.MaxBlobGasPerBlock(a.ChainConfig(), a.CurrentHeader().Time)
361+
}
362+
359363
func (a *APIBackend) ChainDb() ethdb.Database {
360364
return a.dbForAPICalls
361365
}

‎eth/api_backend.go

+4
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ func (b *EthAPIBackend) BlobBaseFee(ctx context.Context) *big.Int {
383383
return nil
384384
}
385385

386+
func (b *EthAPIBackend) MaxBlobGasPerBlock(ctx context.Context) uint64 {
387+
return eip4844.MaxBlobGasPerBlock(b.ChainConfig(), b.CurrentHeader().Time)
388+
}
389+
386390
func (b *EthAPIBackend) ChainDb() ethdb.Database {
387391
return b.eth.ChainDb()
388392
}

‎ethclient/ethclient.go

+9
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,15 @@ func (ec *Client) BlobBaseFee(ctx context.Context) (*big.Int, error) {
607607
return (*big.Int)(&hex), nil
608608
}
609609

610+
// MaxBlobGasPerBlock retrieves the maximum gas limit per block for blob transactions.
611+
func (ec *Client) MaxBlobGasPerBlock(ctx context.Context) (uint64, error) {
612+
var res uint64
613+
if err := ec.c.CallContext(ctx, &res, "eth_maxBlobGasPerBlock"); err != nil {
614+
return 0, err
615+
}
616+
return res, nil
617+
}
618+
610619
type feeHistoryResultMarshaling struct {
611620
OldestBlock *hexutil.Big `json:"oldestBlock"`
612621
Reward [][]*hexutil.Big `json:"reward,omitempty"`

‎internal/ethapi/api.go

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ func (api *EthereumAPI) BlobBaseFee(ctx context.Context) *hexutil.Big {
145145
return (*hexutil.Big)(api.b.BlobBaseFee(ctx))
146146
}
147147

148+
// MaxBlobGasPerBlock returns the maximum blob gas per block at the current head.
149+
func (api *EthereumAPI) MaxBlobGasPerBlock(ctx context.Context) uint64 {
150+
return api.b.MaxBlobGasPerBlock(ctx)
151+
}
152+
148153
// Syncing returns false in case the node is currently not syncing with the network. It can be up-to-date or has not
149154
// yet received the latest block headers from its peers. In case it is synchronizing:
150155
// - startingBlock: block number this node started to synchronize from

‎internal/ethapi/api_test.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,16 @@ func (b testBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
480480
func (b testBackend) FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, []*big.Int, []float64, error) {
481481
return nil, nil, nil, nil, nil, nil, nil
482482
}
483-
func (b testBackend) BlobBaseFee(ctx context.Context) *big.Int { return new(big.Int) }
484-
func (b testBackend) ChainDb() ethdb.Database { return b.db }
485-
func (b testBackend) AccountManager() *accounts.Manager { return b.accman }
486-
func (b testBackend) ExtRPCEnabled() bool { return false }
487-
func (b testBackend) RPCGasCap() uint64 { return 10000000 }
488-
func (b testBackend) RPCEVMTimeout() time.Duration { return time.Second }
489-
func (b testBackend) RPCTxFeeCap() float64 { return 0 }
490-
func (b testBackend) UnprotectedAllowed() bool { return false }
491-
func (b testBackend) SetHead(number uint64) {}
483+
func (b testBackend) BlobBaseFee(ctx context.Context) *big.Int { return new(big.Int) }
484+
func (b testBackend) MaxBlobGasPerBlock(ctx context.Context) uint64 { return 0 }
485+
func (b testBackend) ChainDb() ethdb.Database { return b.db }
486+
func (b testBackend) AccountManager() *accounts.Manager { return b.accman }
487+
func (b testBackend) ExtRPCEnabled() bool { return false }
488+
func (b testBackend) RPCGasCap() uint64 { return 10000000 }
489+
func (b testBackend) RPCEVMTimeout() time.Duration { return time.Second }
490+
func (b testBackend) RPCTxFeeCap() float64 { return 0 }
491+
func (b testBackend) UnprotectedAllowed() bool { return false }
492+
func (b testBackend) SetHead(number uint64) {}
492493
func (b testBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
493494
if number == rpc.LatestBlockNumber {
494495
return b.chain.CurrentBlock(), nil

‎internal/ethapi/backend.go

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type Backend interface {
4949
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
5050
FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, []*big.Int, []float64, error)
5151
BlobBaseFee(ctx context.Context) *big.Int
52+
MaxBlobGasPerBlock(ctx context.Context) uint64
5253
ChainDb() ethdb.Database
5354
AccountManager() *accounts.Manager
5455
ExtRPCEnabled() bool

‎internal/ethapi/transaction_args_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ func (b *backendMock) setFork(fork string) error {
317317
func (b *backendMock) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
318318
return big.NewInt(42), nil
319319
}
320-
func (b *backendMock) BlobBaseFee(ctx context.Context) *big.Int { return big.NewInt(42) }
320+
func (b *backendMock) BlobBaseFee(ctx context.Context) *big.Int { return big.NewInt(42) }
321+
func (b *backendMock) MaxBlobGasPerBlock(ctx context.Context) uint64 { return 42 }
321322

322323
func (b *backendMock) CurrentHeader() *types.Header { return b.current }
323324
func (b *backendMock) ChainConfig() *params.ChainConfig { return b.config }

‎rpc/ipc_wasip1.go

-38
This file was deleted.

‎rpc/ipc_wasm.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
//go:build wasm
18-
// +build wasm
17+
//go:build wasm || wasip1
18+
// +build wasm wasip1
1919

2020
package rpc
2121

0 commit comments

Comments
 (0)
Please sign in to comment.