Skip to content

Commit ec9bb13

Browse files
committed
update docs for code change
1 parent 26c9ba0 commit ec9bb13

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

contract-tests/src/subtensor.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { tao } from './balance-math'
88

99
// create a new subnet and return netuid
1010
export async function addNewSubnetwork(api: TypedApi<typeof devnet>, hotkey: KeyPair, coldkey: KeyPair) {
11-
12-
1311
const alice = getAliceSigner()
1412
const totalNetworks = await api.query.SubtensorModule.TotalNetworks.getValue()
1513

@@ -27,9 +25,8 @@ export async function addNewSubnetwork(api: TypedApi<typeof devnet>, hotkey: Key
2725
const newTotalNetworks = await api.query.SubtensorModule.TotalNetworks.getValue()
2826
// could create multiple subnetworks during retry, just return the first created one
2927
assert.ok(newTotalNetworks > totalNetworks)
30-
28+
// reset network last lock to 0 for tests
3129
await resetNetworkLastLock(api)
32-
3330
return totalNetworks
3431
}
3532

@@ -404,6 +401,8 @@ export async function sendWasmContractExtrinsic(api: TypedApi<typeof devnet>, co
404401
await waitForTransactionWithRetry(api, tx, signer)
405402
}
406403

404+
// Reset network last lock to 0 for tests, then the cose for network registration will be the default minimum
405+
// We can make the const cost for each network registration for tests. avoid the cost spike
407406
export async function resetNetworkLastLock(api: TypedApi<typeof devnet>) {
408407
const alice = getAliceSigner()
409408
const key = await api.query.SubtensorModule.NetworkLastLockCost.getKey()
@@ -412,7 +411,7 @@ export async function resetNetworkLastLock(api: TypedApi<typeof devnet>) {
412411
const codec = await getTypedCodecs(devnet)
413412
const valueCodec = codec.query.SubtensorModule.NetworkLastLockCost.value
414413

415-
// Encode the value 1 TAO as SCALE-encoded bytes
414+
// Encode the value 0 as SCALE-encoded bytes
416415
const encodedValue = valueCodec.enc(BigInt(0))
417416

418417
const changes: [Binary, Binary][] = [[Binary.fromHex(key.toString()), Binary.fromBytes(encodedValue)]];

0 commit comments

Comments
 (0)