Skip to content
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

EIP 4444 explorations #3196

Draft
wants to merge 6 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 39 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -51,9 +51,9 @@
"vitest": "0.32.2"
},
"peerDependencies": {
"@vitest/browser": "0.32.2",
"playwright": "^1.35.1",
"webdriverio": "^8.10.7",
"@vitest/browser": "0.32.2"
"webdriverio": "^8.10.7"
},
"peerDependenciesMeta": {
"playwright": {
Expand Down
13 changes: 12 additions & 1 deletion packages/client/bin/cli.ts
Expand Up @@ -402,6 +402,11 @@ const args: ClientOpts = yargs(hideBin(process.argv))
'Skip executing blocks in new payload calls in engine, alias for --engineNewpayloadMaxExecute=0 and overrides any engineNewpayloadMaxExecute if also provided',
boolean: true,
})
.option('fourFours', {
describe: 'Activate EIP-4444 to prune ancient chain history',
boolean: true,
default: false,
})
.completion()
// strict() ensures that yargs throws when an invalid arg is provided
.strict()
Expand Down Expand Up @@ -790,7 +795,11 @@ async function run() {
}

let customGenesisState: GenesisState | undefined
let common = new Common({ chain, hardfork: Hardfork.Chainstart })
let common = new Common({
chain,
hardfork: Hardfork.Chainstart,
eips: args.fourFours === true ? [4444] : undefined,
})

if (args.dev === true || typeof args.dev === 'string') {
args.discDns = false
Expand All @@ -814,6 +823,7 @@ async function run() {
common = new Common({
chain: customChainParams.name,
customChains: [customChainParams],
eips: args.fourFours === true ? [4444] : undefined,
})
} catch (err: any) {
console.error(`invalid chain parameters: ${err.message}`)
Expand All @@ -826,6 +836,7 @@ async function run() {
common = Common.fromGethGenesis(genesisFile, {
chain: chainName,
mergeForkIdPostMerge: args.mergeForkIdPostMerge,
eips: args.fourFours === true ? [4444] : undefined,
})
customGenesisState = parseGethGenesisState(genesisFile)
}
Expand Down
1 change: 1 addition & 0 deletions packages/client/package.json
Expand Up @@ -86,6 +86,7 @@
"level": "^8.0.0",
"memory-level": "^1.0.0",
"multiaddr": "^10.0.1",
"portalnetwork": "../../ultralight",
"qheap": "^1.4.0",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5",
Expand Down
9 changes: 8 additions & 1 deletion packages/client/src/client.ts
@@ -1,3 +1,5 @@
import { type HistoryNetwork, NetworkId, PortalNetwork } from 'portalnetwork'

import { version as packageVersion } from '../package.json'

import { Chain } from './blockchain'
Expand Down Expand Up @@ -70,7 +72,7 @@ export class EthereumClient {
public config: Config
public chain: Chain
public services: (FullEthereumService | LightEthereumService)[] = []

public history: HistoryNetwork | undefined
public opened: boolean
public started: boolean

Expand Down Expand Up @@ -124,6 +126,11 @@ export class EthereumClient {
if (this.opened) {
return false
}
if (this.config.chainCommon.isActivatedEIP(4444)) {
// Instantiate portal network if EIP-4444 is activated
const portal = await PortalNetwork.create({ supportedNetworks: [NetworkId.HistoryNetwork] })
this.history = portal.network()['0x500b']
}
const name = this.config.chainCommon.chainName()
const chainId = this.config.chainCommon.chainId()
this.config.logger.info(
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/types.ts
Expand Up @@ -167,4 +167,5 @@ export interface ClientOpts {
statelessVerkle?: boolean
engineNewpayloadMaxExecute?: number
skipEngineExec?: boolean
fourFours?: boolean
}
14 changes: 14 additions & 0 deletions packages/common/src/eips.ts
Expand Up @@ -364,6 +364,20 @@ export const EIPs: EIPsDict = {
},
},
},
4444: {
comment: 'Bound Historical Data in Execution Clients',
url: 'https://eips.ethereum.org/EIPS/eip-4444',
status: Status.Draft,
minimumHardfork: Hardfork.Shanghai,
requiredEIPs: [],
gasPrices: {},
history: {
historyPruneEpochs: {
v: 82125,
d: 'A year in beacon chain epochs',
},
},
},
4788: {
comment: 'Beacon block root in the EVM',
url: 'https://eips.ethereum.org/EIPS/eip-4788',
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/types.ts
Expand Up @@ -152,6 +152,9 @@ export type EIPOrHFConfig = {
vm?: {
[key: string]: ParamDict
}
history?: {
[key: string]: ParamDict
}
}

export type EIPConfig = {
Expand Down