From dd6eb3447773a39ee50e56e51c1c57199171f228 Mon Sep 17 00:00:00 2001 From: Ales Tsurko Date: Mon, 17 Feb 2025 12:49:01 +0100 Subject: [PATCH 1/4] Fix max weight limit type --- src/evm/metagraph.precompile.test.js | 8 ++++---- src/util/precompile.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/evm/metagraph.precompile.test.js b/src/evm/metagraph.precompile.test.js index 2b77f1d..e37cad2 100644 --- a/src/evm/metagraph.precompile.test.js +++ b/src/evm/metagraph.precompile.test.js @@ -99,14 +99,14 @@ describe("Neuron metagraph data test", () => { const trust = await metagraphContract.getTrust(netuid, uid); expect(trust).to.not.be.undefined; - const consunsus = await metagraphContract.getConsensus(netuid, uid); - expect(consunsus).to.not.be.undefined; + const consensus = await metagraphContract.getConsensus(netuid, uid); + expect(consensus).to.not.be.undefined; const incentive = await metagraphContract.getIncentive(netuid, uid); expect(incentive).to.not.be.undefined; - const diviends = await metagraphContract.getDividends(netuid, uid); - expect(diviends).to.not.be.undefined; + const dividends = await metagraphContract.getDividends(netuid, uid); + expect(dividends).to.not.be.undefined; const emission = await metagraphContract.getEmission(netuid, uid); expect(emission).to.not.be.undefined; diff --git a/src/util/precompile.js b/src/util/precompile.js index 9564fc7..ae2a2f5 100644 --- a/src/util/precompile.js +++ b/src/util/precompile.js @@ -680,9 +680,9 @@ export const ISubnetABI = [ name: "getMaxWeightLimit", outputs: [ { - internalType: "uint64", + internalType: "uint16", name: "", - type: "uint64", + type: "uint16", }, ], stateMutability: "view", @@ -1126,9 +1126,9 @@ export const ISubnetABI = [ type: "uint16", }, { - internalType: "uint64", + internalType: "uint16", name: "maxWeightLimit", - type: "uint64", + type: "uint16", }, ], name: "setMaxWeightLimit", From 3ab9e5b84894d958a3031d114fa6538fb9781a76 Mon Sep 17 00:00:00 2001 From: Ales Tsurko Date: Mon, 17 Feb 2025 16:00:37 +0100 Subject: [PATCH 2/4] Update abi for subnet --- .../subnet.precompile.hyperparameter.test.js | 22 ++++------ src/util/precompile.js | 42 +++++++++---------- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/evm/subnet.precompile.hyperparameter.test.js b/src/evm/subnet.precompile.hyperparameter.test.js index 6ebeec1..4c6424f 100644 --- a/src/evm/subnet.precompile.hyperparameter.test.js +++ b/src/evm/subnet.precompile.hyperparameter.test.js @@ -90,23 +90,15 @@ describe("Subnet precompile test", () => { const contract = new ethers.Contract(ISUBNET_ADDRESS, ISubnetABI, signer); // Execute transaction - const name = ethers.toUtf8Bytes("name"); - const repo = ethers.toUtf8Bytes("repo"); - const contact = ethers.toUtf8Bytes("contact"); - const subnetUrl = ethers.toUtf8Bytes("subnetUrl"); - const discord = ethers.toUtf8Bytes("discord"); - const description = ethers.toUtf8Bytes("description"); - const additional = ethers.toUtf8Bytes("additional"); - const tx = await contract.registerNetwork( hotkey2.publicKey, - name, - repo, - contact, - subnetUrl, - discord, - description, - additional + "name", + "repo", + "contract", + "subnetUrl", + "discord", + "description", + "additional" ); await tx.wait(); diff --git a/src/util/precompile.js b/src/util/precompile.js index ae2a2f5..b4de033 100644 --- a/src/util/precompile.js +++ b/src/util/precompile.js @@ -604,9 +604,9 @@ export const ISubnetABI = [ name: "getImmunityPeriod", outputs: [ { - internalType: "uint64", + internalType: "uint16", name: "", - type: "uint64", + type: "uint16", }, ], stateMutability: "view", @@ -1017,9 +1017,9 @@ export const ISubnetABI = [ type: "uint16", }, { - internalType: "uint64", + internalType: "uint16", name: "immunityPeriod", - type: "uint64", + type: "uint16", }, ], name: "setImmunityPeriod", @@ -1335,48 +1335,48 @@ export const ISubnetABI = [ { internalType: "bytes32", name: "hotkey", - type: "bytes32", + type: "bytes32" }, { - internalType: "bytes", + internalType: "string", name: "subnetName", - type: "bytes", + type: "string" }, { - internalType: "bytes", + internalType: "string", name: "githubRepo", - type: "bytes", + type: "string" }, { - internalType: "bytes", + internalType: "string", name: "subnetContact", - type: "bytes", + type: "string" }, { - internalType: "bytes", + internalType: "string", name: "subnetUrl", - type: "bytes", + type: "string" }, { - internalType: "bytes", + internalType: "string", name: "discord", - type: "bytes", + type: "string" }, { - internalType: "bytes", + internalType: "string", name: "description", - type: "bytes", + type: "string" }, { - internalType: "bytes", + internalType: "string", name: "additional", - type: "bytes", - }, + type: "string" + } ], name: "registerNetwork", outputs: [], stateMutability: "payable", - type: "function", + type: "function" }, ]; From a65b8b70d42697fe2656f31e608cb13078703254 Mon Sep 17 00:00:00 2001 From: Ales Tsurko Date: Mon, 17 Feb 2025 18:35:40 +0100 Subject: [PATCH 3/4] Fix commit weights type --- src/evm/neuron.precompile.reveal-weights.test.js | 5 ++--- src/util/precompile.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/evm/neuron.precompile.reveal-weights.test.js b/src/evm/neuron.precompile.reveal-weights.test.js index 66ca8b0..94d7292 100644 --- a/src/evm/neuron.precompile.reveal-weights.test.js +++ b/src/evm/neuron.precompile.reveal-weights.test.js @@ -144,9 +144,8 @@ describe("EVM neuron weights test", () => { await usingEthApi(async (provider) => { const signer = new ethers.Wallet(fundedEthWallet.privateKey, provider); const contract = new ethers.Contract(INEURON_ADDRESS, INeuronABI, signer); - const commit_hash = getCommitHash(netuid); - const bigNumberValue = ethers.toBigInt(commit_hash); - const tx = await contract.commitWeights(netuid, bigNumberValue); + const commitHash = getCommitHash(netuid); + const tx = await contract.commitWeights(netuid, commitHash); await tx.wait(); }); diff --git a/src/util/precompile.js b/src/util/precompile.js index b4de033..315faa0 100644 --- a/src/util/precompile.js +++ b/src/util/precompile.js @@ -1389,9 +1389,9 @@ export const INeuronABI = [ type: "uint16", }, { - internalType: "uint256", + internalType: "bytes32", name: "commitHash", - type: "uint256", + type: "bytes32", }, ], name: "commitWeights", From 62bcde892c9b3c3a2b42c4975c3acded9cdc36fa Mon Sep 17 00:00:00 2001 From: Ales Tsurko Date: Tue, 18 Feb 2025 00:19:02 +0100 Subject: [PATCH 4/4] Fix typo --- src/evm/subnet.precompile.hyperparameter.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evm/subnet.precompile.hyperparameter.test.js b/src/evm/subnet.precompile.hyperparameter.test.js index 4c6424f..1a3755d 100644 --- a/src/evm/subnet.precompile.hyperparameter.test.js +++ b/src/evm/subnet.precompile.hyperparameter.test.js @@ -94,7 +94,7 @@ describe("Subnet precompile test", () => { hotkey2.publicKey, "name", "repo", - "contract", + "contact", "subnetUrl", "discord", "description",