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

improve resume #448

Merged
merged 1 commit into from
Oct 17, 2023
Merged
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
7 changes: 6 additions & 1 deletion packages/chopsticks/src/context.ts
Original file line number Diff line number Diff line change
@@ -2,8 +2,10 @@ import './utils/tunnel'
import { BlockEntity } from '@acala-network/chopsticks-core/db/entities'
import { Config } from './schema'
import { HexString } from '@polkadot/util/types'
import { defaultLogger, setup, timeTravel } from '@acala-network/chopsticks-core'
import { overrideStorage, overrideWasm } from './utils/override'
import { setup, timeTravel } from '@acala-network/chopsticks-core'

const logger = defaultLogger.child({ name: 'setup-context' })

export const setupContext = async (argv: Config, overrideParent = false) => {
const chain = await setup({
@@ -38,6 +40,9 @@ export const setupContext = async (argv: Config, overrideParent = false) => {
if (blockData) {
const block = await chain.loadBlockFromDB(blockData?.number)
block && (await chain.setHead(block))
logger.info(`Resume from block ${blockData.number}, hash: ${blockData.hash}`)
} else {
throw new Error(`Resume failed. Cannot find block ${argv.resume}`)
}
}
}