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

common: add osaka hardfork and shift verkle to osaka #3371

Merged
merged 2 commits into from
Apr 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion packages/client/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ async function startExecutionFrom(client: EthereumClient) {
})

if (
client.config.execCommon.hardforkGteHardfork(startExecutionHardfork, Hardfork.Prague) &&
client.config.execCommon.hardforkGteHardfork(startExecutionHardfork, Hardfork.Osaka) &&
client.config.statelessVerkle
) {
// for stateless verkle sync execution witnesses are available and hence we can blindly set the vmHead
Expand Down
24 changes: 12 additions & 12 deletions packages/client/src/execution/vmexecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class VMExecution extends Execution {
this.config.execCommon.setHardforkBy({ blockNumber: number, td, timestamp })
this.hardfork = this.config.execCommon.hardfork()

if (this.config.execCommon.gteHardfork(Hardfork.Prague)) {
if (this.config.execCommon.gteHardfork(Hardfork.Osaka)) {
if (!this.config.statelessVerkle) {
throw Error(`Currently stateful verkle execution not supported`)
}
Expand Down Expand Up @@ -324,7 +324,7 @@ export class VMExecution extends Execution {
td,
timestamp,
})
if (this.config.execCommon.gteHardfork(Hardfork.Prague)) {
if (this.config.execCommon.gteHardfork(Hardfork.Osaka)) {
// verkleVM should already exist but we can still do an allocation just to be safe
await this.setupVerkleVM()
this.vm = this.verkleVM!
Expand Down Expand Up @@ -394,8 +394,8 @@ export class VMExecution extends Execution {

let vm = this.vm
if (
!this.config.execCommon.gteHardfork(Hardfork.Prague) &&
this.config.execCommon.hardforkGteHardfork(hardfork, Hardfork.Prague)
!this.config.execCommon.gteHardfork(Hardfork.Osaka) &&
this.config.execCommon.hardforkGteHardfork(hardfork, Hardfork.Osaka)
) {
// see if this is a transition block
const parentBlock =
Expand All @@ -407,7 +407,7 @@ export class VMExecution extends Execution {
timestamp: parentBlock.header.timestamp,
})

if (!this.config.execCommon.hardforkGteHardfork(parentHf, Hardfork.Prague)) {
if (!this.config.execCommon.hardforkGteHardfork(parentHf, Hardfork.Osaka)) {
await this.transitionToVerkle(parentBlock.header.stateRoot, false)
}
if (this.verkleVM === undefined) {
Expand Down Expand Up @@ -553,8 +553,8 @@ export class VMExecution extends Execution {
timestamp: vmHeadBlock.header.timestamp,
})
if (
!this.config.execCommon.gteHardfork(Hardfork.Prague) &&
this.config.execCommon.hardforkGteHardfork(hardfork, Hardfork.Prague)
!this.config.execCommon.gteHardfork(Hardfork.Osaka) &&
this.config.execCommon.hardforkGteHardfork(hardfork, Hardfork.Osaka)
) {
// verkle transition should have happened by now
if (this.verkleVM === undefined) {
Expand Down Expand Up @@ -681,7 +681,7 @@ export class VMExecution extends Execution {
timestamp,
})
if (hardfork !== this.hardfork) {
const wasPrePrague = !this.config.execCommon.gteHardfork(Hardfork.Prague)
const wasPrePrague = !this.config.execCommon.gteHardfork(Hardfork.Osaka)
const hash = short(block.hash())
this.config.superMsg(
`Execution hardfork switch on block number=${number} hash=${hash} old=${this.hardfork} new=${hardfork}`
Expand All @@ -691,16 +691,16 @@ export class VMExecution extends Execution {
td,
timestamp,
})
const isPostPrague = this.config.execCommon.gteHardfork(Hardfork.Prague)
if (wasPrePrague && isPostPrague) {
const isPostOsaka = this.config.execCommon.gteHardfork(Hardfork.Osaka)
if (wasPrePrague && isPostOsaka) {
await this.transitionToVerkle(parentState!)
clearCache = false
}
}
if (
(!this.config.execCommon.gteHardfork(Hardfork.Prague) &&
(!this.config.execCommon.gteHardfork(Hardfork.Osaka) &&
this.vm.stateManager instanceof StatelessVerkleStateManager) ||
(this.config.execCommon.gteHardfork(Hardfork.Prague) &&
(this.config.execCommon.gteHardfork(Hardfork.Osaka) &&
this.vm.stateManager instanceof DefaultStateManager)
) {
throw Error(
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/service/fullethereumservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class FullEthereumService extends Service {
// it will open execution when done (or if doesn't need to snap sync)
if (this.snapsync !== undefined) {
// set up execution vm to avoid undefined error in syncWithPeer when vm is being passed to accountfetcher
if (this.execution.config.execCommon.gteHardfork(Hardfork.Prague)) {
if (this.execution.config.execCommon.gteHardfork(Hardfork.Osaka)) {
if (!this.execution.config.statelessVerkle) {
throw Error(`Currently stateful verkle execution not supported`)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/rpc/engine/preimages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe(`valid verkle network setup`, async () => {
// unschedule verkle
const unschedulePragueJson = {
...genesisJSON,
config: { ...genesisJSON.config, pragueTime: undefined },
config: { ...genesisJSON.config, osakaTime: undefined },
}
const { server, chain, common, execution } = await setupChain(
unschedulePragueJson,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/rpc/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export async function setupChain(genesisFile: any, chainName = 'dev', clientOpts
// currently we don't have a way to create verkle genesis root so we will
// use genesisStateRoot for blockchain init as well as to start of the stateless
// client. else the stateroot could have been generated out of box
const genesisMeta = common.gteHardfork(Hardfork.Prague) ? { genesisStateRoot } : { genesisState }
const genesisMeta = common.gteHardfork(Hardfork.Osaka) ? { genesisStateRoot } : { genesisState }
const blockchain = await Blockchain.create({
common,
validateBlocks: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/testdata/geth-genesis/kaustinen2.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"londonBlock": 0,
"mergeNetsplitBlock": 0,
"shanghaiTime": 0,
"pragueTime": 0,
"osakaTime": 0,
"terminalTotalDifficulty": 0,
"terminalTotalDifficultyPassed": true,
"proofInBlocks": true
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/testdata/geth-genesis/kaustinen6.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"terminalTotalDifficulty": 0,
"terminalTotalDifficultyPassed": true,
"shanghaiTime": 0,
"pragueTime": 0,
"osakaTime": 0,
"proofInBlocks": true
},
"alloc": {
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export const chains: ChainsDict = {
name: 'kaustinen6',
chainId: 69420,
networkId: 69420,
defaultHardfork: 'prague',
defaultHardfork: 'osaka',
consensus: {
type: 'pos',
algorithm: 'casper',
Expand Down Expand Up @@ -644,7 +644,7 @@ export const chains: ChainsDict = {
timestamp: '0',
},
{
name: 'prague',
name: 'osaka',
block: null,
timestamp: '1712848500',
},
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export enum Hardfork {
Shanghai = 'shanghai',
Cancun = 'cancun',
Prague = 'prague',
Osaka = 'osaka',
}

export enum ConsensusType {
Expand Down
10 changes: 9 additions & 1 deletion packages/common/src/hardforks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,17 @@ export const hardforks: HardforksDict = {
prague: {
name: 'prague',
comment:
'Next feature hardfork after cancun, internally used for verkle testing/implementation (incomplete/experimental)',
'Next feature hardfork after cancun, internally used for pectra testing/implementation (incomplete/experimental)',
url: 'https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/prague.md',
status: Status.Draft,
eips: [2537, 2935, 3074],
},
osaka: {
name: 'osaka',
comment:
'Next feature hardfork after prague, internally used for verkle testing/implementation (incomplete/experimental)',
url: 'https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/osaka.md',
status: Status.Draft,
eips: [6800, 2935],
},
}
1 change: 1 addition & 0 deletions packages/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function parseGethParams(json: any, mergeForkIdPostMerge: boolean = true) {
[Hardfork.Shanghai]: { name: 'shanghaiTime', postMerge: true, isTimestamp: true },
[Hardfork.Cancun]: { name: 'cancunTime', postMerge: true, isTimestamp: true },
[Hardfork.Prague]: { name: 'pragueTime', postMerge: true, isTimestamp: true },
[Hardfork.Osaka]: { name: 'osakaTime', postMerge: true, isTimestamp: true },
}

// forkMapRev is the map from config field name to Hardfork
Expand Down
1 change: 1 addition & 0 deletions packages/evm/src/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class EVM implements EVMInterface {
Hardfork.Shanghai,
Hardfork.Cancun,
Hardfork.Prague,
Hardfork.Osaka,
]
protected _tx?: {
gasPrice: bigint
Expand Down
Loading