Skip to content

Commit

Permalink
support for tanssi orchestrator, and distinguish between container an…
Browse files Browse the repository at this point in the history
…d orchestrator in configs
  • Loading branch information
girazoki committed Feb 1, 2024
1 parent 4a63bb4 commit b24a0bf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
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,12 @@
import { GenericExtrinsic } from '@polkadot/types'
import { HexString } from '@polkadot/util/types'
import { HexString, } from '@polkadot/util/types'
//import { u8aToHex } from '@polkadot/util'

import { Block } from '../../block.js'
import { BuildBlockParams } from '../../txpool.js'
import { InherentProvider } from '../index.js'
import { compactHex } from '../../../utils/index.js'

import { hexToBigInt } from '@polkadot/util'
// Support for Nimbus Author Inherent
export class SetNimbusAuthorInherent implements InherentProvider {
async createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]> {
Expand Down Expand Up @@ -44,7 +45,26 @@ export class SetNimbusAuthorInherent implements InherentProvider {
meta.registry.createType(`Vec<${accountType}>`, [alice]).toHex(),
)
}

if (meta.query.authorityAssignment && meta.query.session) {
const session = hexToBigInt(await newBlock.chain.head.get(compactHex(meta.query.session.currentIndex())), { isLe: true});
// 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 +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

0 comments on commit b24a0bf

Please sign in to comment.