Skip to content

Commit

Permalink
fix the kaustinene 6 startup and transition to the verkle vm
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Apr 25, 2024
1 parent c9e6577 commit f112869
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
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/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

0 comments on commit f112869

Please sign in to comment.