diff --git a/configs/tanssi_orchestrator.yml b/configs/tanssi_orchestrator.yml new file mode 100644 index 00000000..fe898619 --- /dev/null +++ b/configs/tanssi_orchestrator.yml @@ -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: [] \ No newline at end of file diff --git a/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts b/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts index c8a4519c..5844c429 100644 --- a/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts +++ b/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts @@ -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 { @@ -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()] } } diff --git a/packages/core/src/utils/index.ts b/packages/core/src/utils/index.ts index 853b9635..9a4daf87 100644 --- a/packages/core/src/utils/index.ts +++ b/packages/core/src/utils/index.ts @@ -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 ]