Skip to content

Commit

Permalink
Fix validation data mock (#531)
Browse files Browse the repository at this point in the history
* fix mock validation data for new upgrade

* bump
  • Loading branch information
ermalkaleci committed Nov 9, 2023
1 parent 9e45639 commit f115c3b
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion executor/Cargo.lock

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

2 changes: 1 addition & 1 deletion executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chopsticks-executor"
version = "0.9.1"
version = "0.9.2-1"
description = "Chopsticks executor"
repository = "https://github.com/AcalaNetwork/chopsticks"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks",
"version": "0.9.1",
"version": "0.9.2-1",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"bin": "./chopsticks.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-core",
"version": "0.9.1",
"version": "0.9.2-1",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down
18 changes: 15 additions & 3 deletions packages/core/src/blockchain/inherent/parachain/validation-data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbridgedHrmpChannel, HrmpChannelId } from '@polkadot/types/interfaces'
import { AbridgedHrmpChannel, HrmpChannelId, Slot } from '@polkadot/types/interfaces'
import { GenericExtrinsic } from '@polkadot/types'
import { HexString } from '@polkadot/util/types'
import { hexToU8a, u8aConcat } from '@polkadot/util'
import { hexToU8a, u8aConcat, u8aToHex } from '@polkadot/util'
import _ from 'lodash'

import { Block } from '../../block.js'
Expand All @@ -13,6 +13,7 @@ import {
hrmpChannels,
hrmpEgressChannelIndex,
hrmpIngressChannelIndex,
paraHead,
upgradeGoAheadSignal,
} from '../../../utils/proof.js'
import { blake2AsHex, blake2AsU8a } from '@polkadot/util-crypto'
Expand Down Expand Up @@ -101,11 +102,22 @@ export class SetValidationData implements CreateInherents {
)

for (const key of Object.values(WELL_KNOWN_KEYS)) {
newEntries.push([key, decoded[key]])
if (key === WELL_KNOWN_KEYS.CURRENT_SLOT) {
// increment current slot
const currentSlot = meta.registry.createType<Slot>('Slot', hexToU8a(decoded[key])).toNumber()
const newSlot = meta.registry.createType<Slot>('Slot', currentSlot + 2)
newEntries.push([key, u8aToHex(newSlot.toU8a())])
} else {
newEntries.push([key, decoded[key]])
}
}
newEntries.push([hrmpIngressChannelIndexKey, decoded[hrmpIngressChannelIndexKey]])
newEntries.push([hrmpEgressChannelIndexKey, decoded[hrmpEgressChannelIndexKey]])

// inject paraHead
const headData = meta.registry.createType('HeadData', (await parent.header).toHex())
newEntries.push([paraHead(paraId), u8aToHex(headData.toU8a())])

// inject downward messages
let dmqMqcHeadHash = decoded[dmqMqcHeadKey]
if (dmqMqcHeadHash) {
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/utils/proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ export const hrmpChannels = (channelId: HrmpChannelId) => {
const prefix = '0x6a0da05ca59913bc38a8630590f2627cb6604cff828a6e3f579ca6c59ace013d'
return hash(prefix, channelId.toU8a())
}

export const paraHead = (paraId: u32) => {
const prefix = '0xcd710b30bd2eab0352ddcc26417aa1941b3c252fcb29d88eff4f3de5de4476c3'
return hash(prefix, paraId.toU8a())
}
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-db",
"version": "0.9.1",
"version": "0.9.2-1",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e/src/__snapshots__/author.test.ts.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/e2e/src/__snapshots__/chain.test.ts.snap

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/e2e/src/__snapshots__/dry-run-extrinsic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`dry-run-extrinsic > dry run extrinsic 2`] = `
],
[
"0x26aa394eea5630e07c48ae0c9558cef7a86da5a932684f199539836fcb8c886f",
"0x6a140000",
"0x68150000",
],
[
"0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9280b197190fc1a763257f65171ea366e88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee",
Expand Down Expand Up @@ -89,7 +89,7 @@ exports[`dry-run-extrinsic > dry run extrinsic with fake signature 2`] = `
],
[
"0x26aa394eea5630e07c48ae0c9558cef7a86da5a932684f199539836fcb8c886f",
"0x48140000",
"0x46150000",
],
[
"0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9280b197190fc1a763257f65171ea366e88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/src/build-block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe.runIf(process.env.CI).each([

{ chain: 'Kusama', endpoint: 'wss://kusama-rpc.polkadot.io', storage: KUSAMA_STORAGE },
{ chain: 'Statemine', endpoint: 'wss://statemine-rpc.polkadot.io' },
{ chain: 'Karura', endpoint: 'wss://karura-rpc-1.aca-api.network' },
{ chain: 'Karura', endpoint: 'wss://karura-rpc-3.aca-api.network' },

{ chain: 'Westend', endpoint: 'wss://westend-rpc.polkadot.io' },
{ chain: 'Westmint', endpoint: 'wss://westmint-rpc.polkadot.io' },
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-testing",
"version": "0.9.1",
"version": "0.9.2-1",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down

0 comments on commit f115c3b

Please sign in to comment.