Skip to content
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
2 changes: 1 addition & 1 deletion evm-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"test": "mocha --timeout 999999 --file src/setup.ts --require ts-node/register test/*test.ts"
"test": "mocha --timeout 999999 --retries 3 --file src/setup.ts --require ts-node/register test/*test.ts"
},
"keywords": [],
"author": "",
Expand Down
30 changes: 24 additions & 6 deletions evm-tests/src/subtensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,21 @@ export async function forceSetBalanceToSs58Address(api: TypedApi<typeof devnet>,
const internalCall = api.tx.Balances.force_set_balance({ who: MultiAddress.Id(ss58Address), new_free: balance })
const tx = api.tx.Sudo.sudo({ call: internalCall.decodedCall })

await waitForTransactionCompletion(api, tx, alice)
.then(() => { })
.catch((error) => { console.log(`transaction error ${error}`) });
let failed = true;
let retries = 0;

// set max retries times
while (failed && retries < 5) {
failed = false
await waitForTransactionCompletion(api, tx, alice)
.then(() => { })
.catch((error) => {
failed = true
console.log(`transaction error ${error}`)
});
await new Promise((resolve) => setTimeout(resolve, 1000));
retries += 1
}

const balanceOnChain = (await api.query.System.Account.getValue(ss58Address)).data.free
// check the balance except for sudo account becasue of tx fee
Expand Down Expand Up @@ -155,6 +167,7 @@ export async function disableWhiteListCheck(api: TypedApi<typeof devnet>, disabl
}

export async function burnedRegister(api: TypedApi<typeof devnet>, netuid: number, ss58Address: string, keypair: KeyPair) {
await new Promise((resolve) => setTimeout(resolve, 1000));
const uids = await api.query.SubtensorModule.SubnetworkN.getValue(netuid)
const signer = getSignerFromKeypair(keypair)
const tx = api.tx.SubtensorModule.burned_register({ hotkey: ss58Address, netuid: netuid })
Expand Down Expand Up @@ -347,8 +360,8 @@ export async function rootRegister(api: TypedApi<typeof devnet>, ss58Address: st
export async function setSubtokenEnable(api: TypedApi<typeof devnet>, netuid: number, subtokenEnable: boolean) {
const signer = getAliceSigner()
let internalTx = api.tx.AdminUtils.sudo_set_subtoken_enabled({
netuid: netuid,
subtoken_enabled: subtokenEnable
netuid: netuid,
subtoken_enabled: subtokenEnable
})
let tx = api.tx.Sudo.sudo({ call: internalTx.decodedCall })

Expand All @@ -371,11 +384,16 @@ export async function startCall(api: TypedApi<typeof devnet>, netuid: number, ke

const signer = getSignerFromKeypair(keypair)
let tx = api.tx.SubtensorModule.start_call({
netuid: netuid,
netuid: netuid,
})

await waitForTransactionCompletion(api, tx, signer)
.then(() => { })
.catch((error) => { console.log(`transaction error ${error}`) });

await new Promise((resolve) => setTimeout(resolve, 1000));
const callStarted = await api.query.SubtensorModule.FirstEmissionBlockNumber
.getValue(netuid);
assert.notEqual(callStarted, undefined);

}
Loading