Skip to content

Implement EIP-7825 for osaka (wip) #4073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/client/src/service/txpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@
)
}

// 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})`,
)
}

Check warning on line 337 in packages/client/src/service/txpool.ts

View check run for this annotation

Codecov / codecov/patch

packages/client/src/service/txpool.ts#L332-L337

Added lines #L332 - L337 were not covered by tests
}

// 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
Expand Down
9 changes: 9 additions & 0 deletions packages/common/src/eips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/hardforks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/src/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
6 changes: 6 additions & 0 deletions packages/tx/src/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
}
10 changes: 10 additions & 0 deletions packages/tx/src/util/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@
// 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})`,
)
}

Check warning on line 173 in packages/tx/src/util/internal.ts

View check run for this annotation

Codecov / codecov/patch

packages/tx/src/util/internal.ts#L168-L173

Added lines #L168 - L173 were not covered by tests
}

const createContract = tx.to === undefined || tx.to === null
const allowUnlimitedInitCodeSize = opts.allowUnlimitedInitCodeSize ?? false

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy