Skip to content

Commit

Permalink
fix: weight aggreagator not pushing subnet data + use netuid 2 on mod…
Browse files Browse the repository at this point in the history
…ule fetcher
  • Loading branch information
steinerkelvin committed Oct 14, 2024
1 parent b6ccf0d commit 09e4fd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apps/commune-worker/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export interface WorkerProps {

// -- Constants -- //

export const CONSENSUS_NETUID = 0;
export const SUBNETS_NETUID = 0
export const CONSENSUS_NETUID = 2;

export const BLOCK_TIME = 8000;
export const DAO_EXPIRATION_TIME = 75600; // 7 days in blocks

Expand Down
9 changes: 5 additions & 4 deletions apps/commune-worker/src/workers/weight-aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import {
normalizeWeightsToPercent,
} from "../weights";

const SUBNETS_NETUID = 0;
const MODULES_NETUID = 2;
import { SUBNETS_NETUID, CONSENSUS_NETUID } from "../common";

type AggregatorKind = "module" | "subnet";

Expand Down Expand Up @@ -219,7 +218,7 @@ async function postModuleAggregation(
await doVote(
api,
keypair,
MODULES_NETUID,
CONSENSUS_NETUID,
normalizedWeights,
);
}
Expand All @@ -237,7 +236,7 @@ async function postSubnetAggregation(
subnetWeightMap,
);

const subnetWeights: SubnetWeight[] = Array.from(
const dbSubnetWeights: SubnetWeight[] = Array.from(
stakeWeights,
)
.map(([netuid, stakeWeight]): SubnetWeight | null => {
Expand All @@ -255,6 +254,8 @@ async function postSubnetAggregation(
})
.filter((subnet) => subnet !== null);

await insertSubnetWeight(dbSubnetWeights);

await doVote(
api,
keypair,
Expand Down

0 comments on commit 09e4fd5

Please sign in to comment.