Skip to content

Commit

Permalink
test operators appears in pallet session
Browse files Browse the repository at this point in the history
  • Loading branch information
nanocryk committed Dec 4, 2024
1 parent dca3c6e commit e8e6009
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ describeSuite({
let beefyClientDetails;
let gatewayProxyAddress;
let gatewayDetails;

let ethereumWallet;

let operatorAccount;
let operatorNimbusKey;

beforeAll(async () => {
relayApi = context.polkadotJs("Tanssi-relay");
const relayNetwork = relayApi.consts.system.version.specName.toString();
Expand All @@ -46,6 +50,12 @@ describeSuite({
const beaconRelay = keyring.addFromUri("//BeaconRelay", { name: "Beacon relay default" });
const executionRelay = keyring.addFromUri("//ExecutionRelay", { name: "Execution relay default" });

// Operator keys
operatorAccount = keyring.addFromUri("//" + "Bob", { name: "COLLATOR" + " ACCOUNT" });
operatorNimbusKey = keyring.addFromUri("//" + "COLLATOR_NIMBUS", { name: "COLLATOR" + " NIMBUS" });

await relayApi.tx.session.setKeys(u8aToHex(operatorNimbusKey), []).signAndSend(operatorAccount);

const fundingTxHash = await relayApi.tx.utility
.batch([
relayApi.tx.balances.transferAllowDeath(beaconRelay.address, 1_000_000_000_000),
Expand Down Expand Up @@ -173,7 +183,7 @@ describeSuite({
const externalValidatorsBefore = await relayApi.query.externalValidators.externalValidators();

const rawValidators = [
"0x1234567890123456789012345678901234567890123456789012345678901234",
u8aToHex(operatorAccount.addressRaw),
"0x7894567890123456789012345678901234567890123456789012345678901234",
"0x4564567890123456789012345678901234567890123456789012345678901234",
];
Expand All @@ -196,6 +206,9 @@ describeSuite({
});

expect(externalValidatorsHex).to.deep.eq(rawValidators);

const sessionValidators = await relayApi.query.session.validators();
expect(sessionValidators.includes(operatorNimbusKey));
},
});

Expand Down

0 comments on commit e8e6009

Please sign in to comment.