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

Support for tanssi orchestrator and async backing pallets #665

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
File renamed without changes.
18 changes: 18 additions & 0 deletions configs/tanssi-orchestrator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
endpoint: wss://dancebox.tanssi-api.network
mock-signature-host: true
block: ${env.TANSSI_BLOCK_NUMBER}
db: ./tmp/db_mba.sqlite

import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: "100000000000000000000000"
Sudo:
Key: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"

Registrar:
registeredParaIds: []
pendingParaIds: []
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { GenericExtrinsic } from '@polkadot/types'
import { HexString } from '@polkadot/util/types'

import { Block } from '../../block.js'
import { BuildBlockParams } from '../../txpool.js'
import { GenericExtrinsic } from '@polkadot/types'
import { HexString } from '@polkadot/util/types'
import { InherentProvider } from '../index.js'
import { compactHex } from '../../../utils/index.js'

// Support for Nimbus Author Inherent
export class SetNimbusAuthorInherent implements InherentProvider {
async createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]> {
Expand Down Expand Up @@ -44,7 +42,34 @@ export class SetNimbusAuthorInherent implements InherentProvider {
meta.registry.createType(`Vec<${accountType}>`, [alice]).toHex(),
)
}
if (meta.query.authorityAssignment && meta.query.session) {
const session = await newBlock.chain.head.read('u32', meta.query.session.currentIndex)

if (session) {
// We need to set both the assignemnt for current and next sessions
layer.set(
compactHex(meta.query.authorityAssignment.collatorContainerChain(session)),
meta.registry
.createType(`DpCollatorAssignmentAssignedCollatorsPublic`, {
orchestratorChain: [alice],
})
.toHex(),
)
layer.set(
compactHex(meta.query.authorityAssignment.collatorContainerChain(session.toBigInt() + 1n)),
meta.registry
.createType(`DpCollatorAssignmentAssignedCollatorsPublic`, {
orchestratorChain: [alice],
})
.toHex(),
)
}

layer.set(
compactHex(meta.query.authorNoting.didSetContainerAuthorData()),
meta.registry.createType('bool', true).toHex(),
)
}
return [new GenericExtrinsic(meta.registry, meta.tx.authorInherent.kickOffAuthorshipValidation()).toHex()]
}
}
1 change: 1 addition & 0 deletions packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const stripChildPrefix = (key: HexString) => {
const POTENTIAL_SLOT_KEYS = [
'0x1cb6f36e027abb2091cfb5110ab5087f06155b3cd9a8c9e5e9a23fd5dc13a5ed', // babe.currentSlot
'0x57f8dc2f5ab09467896f47300f04243806155b3cd9a8c9e5e9a23fd5dc13a5ed', // aura.currentSlot
'0x8985dff79e6002d0deba9ddac46f32a5a70806914c906d747e668a21f9021729', // asynchronousBacking.slotInfo
'0xab2a8d5eca218f218c6fda6b1d22bb926bc171ab77f6a731a6e80c34ee1eda19', // authorInherent.highestSlotSeen
]

Expand Down
11 changes: 10 additions & 1 deletion packages/e2e/src/author-inherent-mock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe.runIf(process.env.CI || process.env.RUN_ALL)('Nimbus author inherent mo
await teardown()
})

it('Tanssi build blocks', async () => {
it('Tanssi container build blocks', async () => {
const { dev, teardown } = await setupContext({
endpoint: 'wss://fraa-dancebox-3001-rpc.a.dancebox.tanssi.network',
db: !process.env.RUN_TESTS_WITHOUT_DB ? 'e2e-tests-db.sqlite' : undefined,
Expand All @@ -20,6 +20,15 @@ describe.runIf(process.env.CI || process.env.RUN_ALL)('Nimbus author inherent mo
await teardown()
})

it('Tanssi orchestrator build blocks', async () => {
const { dev, teardown } = await setupContext({
endpoint: 'wss://dancebox.tanssi-api.network',
db: !process.env.RUN_TESTS_WITHOUT_DB ? 'e2e-tests-db.sqlite' : undefined,
})
await dev.newBlock({ count: 2 })
await teardown()
})

it('Moonbeam build blocks', async () => {
const { dev, teardown } = await setupContext({
endpoint: 'wss://wss.api.moonbeam.network',
Expand Down
Loading