Skip to content

Commit

Permalink
reset notFirstBlock if randomness pallet exists (AcalaNetwork#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci authored and ns212 committed Apr 3, 2023
1 parent d9887b1 commit 1d371f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/chopsticks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "rm -rf lib && tsc -p ./tsconfig.json",
"test": "vitest run",
"test:watch": "vitest",
"script:start": "cd ../..; ts-node packages/chopsticks/src/cli.ts",
"script:start": "cd ../..; ts-node --transpile-only packages/chopsticks/src/cli.ts",
"script:run": "LOG_LEVEL=trace ts-node-dev --transpile-only --inspect --notify=false src/cli.ts -- dev --config=../../configs/dev.yml",
"dev:karura": "ts-node-dev --transpile-only --inspect --notify=false src/cli.ts -- dev --config=../../configs/karura.yml",
"dev:acala": "ts-node-dev --transpile-only --inspect --notify=false src/cli.ts -- dev --config=../../configs/acala.yml",
Expand Down
6 changes: 5 additions & 1 deletion packages/chopsticks/src/blockchain/block-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ export const newHeader = async (head: Block) => {
],
},
...consensus.rest,
head.pushStorageLayer().set(compactHex(meta.query.randomness.notFirstBlock()), StorageValueKind.Deleted),
]

if (meta.query.randomness) {
// reset notFirstBlock so randomness will skip validation
head.pushStorageLayer().set(compactHex(meta.query.randomness.notFirstBlock()), StorageValueKind.Deleted)
}
}

const header = meta.registry.createType<Header>('Header', {
Expand Down

0 comments on commit 1d371f7

Please sign in to comment.