Skip to content

Commit

Permalink
Merge branch 'master' into girazoki-update-holesky
Browse files Browse the repository at this point in the history
  • Loading branch information
girazoki authored Dec 19, 2024
2 parents bd78a11 + e2da250 commit 050ae8d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
5 changes: 5 additions & 0 deletions test/configs/zombie_tanssi_relay_eth_bridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
{
"name": "bob",
"validator": true
},
{
"name": "charlie",
"ws_port": "9948",
"validator": true
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions test/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,11 @@
"name": "Tanssi-relay",
"type": "polkadotJs",
"endpoints": ["ws://127.0.0.1:9947"]
},
{
"name": "Tanssi-charlie",
"type": "polkadotJs",
"endpoints": ["ws://127.0.0.1:9948"]
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describeSuite({
foundationMethods: "zombie",
testCases: function ({ it, context }) {
let relayApi: ApiPromise;
let relayCharlieApi: ApiPromise;
let ethereumNodeChildProcess;
let relayerChildProcess;
let alice;
Expand All @@ -44,17 +45,20 @@ describeSuite({
const relayNetwork = relayApi.consts.system.version.specName.toString();
expect(relayNetwork, "Relay API incorrect").to.contain("dancelight");

relayCharlieApi = context.polkadotJs("Tanssi-charlie");

// //BeaconRelay
const keyring = new Keyring({ type: "sr25519" });
alice = keyring.addFromUri("//Alice", { name: "Alice default" });
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);
operatorAccount = keyring.addFromUri("//Charlie", { name: "Charlie default" });
// We rotate the keys for charlie so that we have access to them from this test as well as the node
operatorNimbusKey = await relayCharlieApi.rpc.author.rotateKeys();
console.log(`operatorNimbusKey: ${operatorNimbusKey}`);
await relayApi.tx.session.setKeys(operatorNimbusKey, []).signAndSend(operatorAccount);

const fundingTxHash = await relayApi.tx.utility
.batch([
Expand Down Expand Up @@ -182,6 +186,9 @@ describeSuite({

const externalValidatorsBefore = await relayApi.query.externalValidators.externalValidators();

const sessionValidatorsBefore = await relayApi.query.session.validators();
expect(!sessionValidatorsBefore.includes(operatorNimbusKey));

const rawValidators = [
u8aToHex(operatorAccount.addressRaw),
"0x7894567890123456789012345678901234567890123456789012345678901234",
Expand Down Expand Up @@ -226,6 +233,24 @@ describeSuite({
},
});

it({
id: "T04",
title: "Operator produces blocks",
test: async function () {
for (let i = 0; i < 20; ++i) {
const latestBlockHash = await relayApi.rpc.chain.getBlockHash();
const author = (await relayApi.derive.chain.getHeader(latestBlockHash)).author;
if (author == operatorAccount.address) {
return;
}

await context.waitBlock(1, "Tanssi-relay");
}

expect.fail("operator didn't produce a block");
},
});

afterAll(async () => {
console.log("Cleaning up");
if (ethereumNodeChildProcess) {
Expand Down

0 comments on commit 050ae8d

Please sign in to comment.