diff --git a/packages/client/src/service/txpool.ts b/packages/client/src/service/txpool.ts index 58c86876ca9..a1f74c54e82 100644 --- a/packages/client/src/service/txpool.ts +++ b/packages/client/src/service/txpool.ts @@ -327,6 +327,16 @@ export class TxPool { ) } + // EIP-7825: Transaction Gas Limit Cap + if (tx.common.isActivatedEIP(7825)) { + const maxGasLimit = tx.common.param('maxTransactionGasLimit') + if (tx.gasLimit > maxGasLimit) { + throw EthereumJSErrorWithoutCode( + `Transaction gas limit ${tx.gasLimit} exceeds the maximum allowed by EIP-7825 (${maxGasLimit})`, + ) + } + } + // Copy VM in order to not overwrite the state root of the VMExecution module which may be concurrently running blocks const vmCopy = await this.service.execution.vm.shallowCopy() // Set state root to latest block so that account balance is correct when doing balance check diff --git a/packages/common/src/eips.ts b/packages/common/src/eips.ts index 58bd81db913..d6fb4180fdf 100644 --- a/packages/common/src/eips.ts +++ b/packages/common/src/eips.ts @@ -470,6 +470,15 @@ export const eipsDict: EIPsDict = { minimumHardfork: Hardfork.Chainstart, requiredEIPs: [2935], }, + /** + * Description : Transaction Gas Limit Cap + * URL : https://eips.ethereum.org/EIPS/eip-7825 + * Status : Draft + */ + 7825: { + minimumHardfork: Hardfork.Osaka, + requiredEIPs: [], + }, /** * Description : Ethereum state using a unified binary tree (experimental) * URL : hhttps://eips.ethereum.org/EIPS/eip-7864 diff --git a/packages/common/src/hardforks.ts b/packages/common/src/hardforks.ts index 6645984ddaf..f0d7bfa7390 100644 --- a/packages/common/src/hardforks.ts +++ b/packages/common/src/hardforks.ts @@ -166,7 +166,7 @@ export const hardforksDict: HardforksDict = { * Status : Final */ osaka: { - eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698], + eips: [663, 3540, 3670, 4200, 4750, 5450, 6206, 7069, 7480, 7620, 7692, 7698, 7825], }, /** * Description: Next feature hardfork after osaka, internally used for verkle testing/implementation (incomplete/experimental) diff --git a/packages/evm/src/evm.ts b/packages/evm/src/evm.ts index 5e157b96171..2d75b61a1fc 100644 --- a/packages/evm/src/evm.ts +++ b/packages/evm/src/evm.ts @@ -251,7 +251,7 @@ export class EVM implements EVMInterface { const supportedEIPs = [ 663, 1153, 1559, 2537, 2565, 2718, 2929, 2930, 2935, 3198, 3529, 3540, 3541, 3607, 3651, 3670, 3855, 3860, 4200, 4399, 4750, 4788, 4844, 4895, 5133, 5450, 5656, 6110, 6206, 6780, 6800, - 7002, 7069, 7251, 7480, 7516, 7620, 7685, 7691, 7692, 7698, 7702, 7709, + 7002, 7069, 7251, 7480, 7516, 7620, 7685, 7691, 7692, 7698, 7702, 7709, 7825, ] for (const eip of this.common.eips()) { diff --git a/packages/tx/src/params.ts b/packages/tx/src/params.ts index 8b97c8f7036..aba65e1e726 100644 --- a/packages/tx/src/params.ts +++ b/packages/tx/src/params.ts @@ -66,4 +66,10 @@ export const paramsTx: ParamsDict = { 7691: { maxBlobGasPerBlock: 1179648, // The max blob gas allowable per block }, + /** + * Transaction Gas Limit Cap + */ + 7825: { + maxTransactionGasLimit: 30000000, // Maximum gas limit for a single transaction (30M) + }, } diff --git a/packages/tx/src/util/internal.ts b/packages/tx/src/util/internal.ts index 29a52f6d5a9..c994abbd70d 100644 --- a/packages/tx/src/util/internal.ts +++ b/packages/tx/src/util/internal.ts @@ -163,6 +163,16 @@ export function sharedConstructor( // EIP-2681 limits nonce to 2^64-1 (cannot equal 2^64-1) valueBoundaryCheck({ nonce: tx.nonce }, 64, true) + // EIP-7825: Transaction Gas Limit Cap + if (tx.common.isActivatedEIP(7825)) { + const maxGasLimit = tx.common.param('maxTransactionGasLimit') + if (tx.gasLimit > maxGasLimit) { + throw EthereumJSErrorWithoutCode( + `Transaction gas limit ${tx.gasLimit} exceeds the maximum allowed by EIP-7825 (${maxGasLimit})`, + ) + } + } + const createContract = tx.to === undefined || tx.to === null const allowUnlimitedInitCodeSize = opts.allowUnlimitedInitCodeSize ?? false