diff --git a/apps/commune-worker/src/db/index.ts b/apps/commune-worker/src/db/index.ts index 37dc2bd..9d8fdd9 100644 --- a/apps/commune-worker/src/db/index.ts +++ b/apps/commune-worker/src/db/index.ts @@ -12,7 +12,7 @@ import { export type NewVote = typeof daoVoteSchema.$inferInsert; export type Module = typeof moduleData.$inferInsert; -export type Subnet = typeof subnetDataSchema.$inferInsert; +export type Subnet = typeof subnetDataSchema.$inferInsert export type NewNotification = typeof governanceNotificationSchema.$inferInsert; @@ -40,8 +40,7 @@ export async function upsertSubnetData(subnets: Subnet[]) { proposalExpiration: s.proposalExpiration, voteMode: s.voteMode, proposalRewardTreasuryAllocation: s.proposalRewardTreasuryAllocation, - maxProposalRewardTreasuryAllocation: - s.maxProposalRewardTreasuryAllocation, + maxProposalRewardTreasuryAllocation: s.maxProposalRewardTreasuryAllocation, proposalRewardInterval: s.proposalRewardInterval, minBurn: s.minBurn, maxBurn: s.maxBurn, @@ -51,8 +50,8 @@ export async function upsertSubnetData(subnets: Subnet[]) { maxRegistrationsPerInterval: s.maxRegistrationsPerInterval, minValidatorStake: s.minValidatorStake, maxAllowedValidators: s.maxAllowedValidators, - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment atBlock: s.atBlock, + })), ) .onConflictDoUpdate({ diff --git a/apps/commune-worker/src/db/type-transformations.ts b/apps/commune-worker/src/db/type-transformations.ts index 1cee239..8a43875 100644 --- a/apps/commune-worker/src/db/type-transformations.ts +++ b/apps/commune-worker/src/db/type-transformations.ts @@ -1,7 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -import type { NetworkSubnetConfig, SubspaceModule } from "@commune-ts/types"; +import type { SubspaceModule, NetworkSubnetConfig } from "@commune-ts/types"; import type { Module, Subnet } from "./index.js"; @@ -28,10 +25,8 @@ export function SubspaceModuleToDatabase( }; } -export function SubnetToDatabase( - subnet: NetworkSubnetConfig, - atBlock: number, -): Subnet { + +export function SubnetToDatabase(subnet: NetworkSubnetConfig, atBlock: number): Subnet { return { netuid: subnet.netuid, name: subnet.subnetNames, @@ -44,31 +39,25 @@ export function SubnetToDatabase( founderShare: subnet.founderShare, incentiveRatio: subnet.incentiveRatio, trustRatio: subnet.trustRatio, - maxWeightAge: String(subnet.maxWeightAge), + maxWeightAge: subnet.maxWeightAge, bondsMa: subnet.bondsMovingAverage ?? null, maximumSetWeightCallsPerEpoch: subnet.maximumSetWeightCallsPerEpoch ?? null, - minValidatorStake: BigInt(subnet.minValidatorStake), + minValidatorStake: subnet.minValidatorStake ?? null, maxAllowedValidators: subnet.maxAllowedValidators ?? null, subnetMetadata: subnet.subnetMetadata, - minBurn: BigInt(subnet.moduleBurnConfig.minBurn), - maxBurn: BigInt(subnet.moduleBurnConfig.maxBurn), - adjustmentAlpha: String(subnet.moduleBurnConfig.adjustmentAlpha), - targetRegistrationsInterval: - subnet.moduleBurnConfig.targetRegistrationsInterval, - maxRegistrationsPerInterval: - subnet.moduleBurnConfig.maxRegistrationsPerInterval, - proposalCost: BigInt(subnet.subnetGovernanceConfig.proposalCost), + minBurn: subnet.moduleBurnConfig.minBurn, + maxBurn: subnet.moduleBurnConfig.maxBurn, + adjustmentAlpha: subnet.moduleBurnConfig.adjustmentAlpha, + targetRegistrationsInterval: subnet.moduleBurnConfig.targetRegistrationsInterval, + maxRegistrationsPerInterval: subnet.moduleBurnConfig.maxRegistrationsPerInterval, + proposalCost: subnet.subnetGovernanceConfig.proposalCost, proposalExpiration: subnet.subnetGovernanceConfig.proposalExpiration, - maxProposalRewardTreasuryAllocation: BigInt( - subnet.subnetGovernanceConfig.maxProposalRewardTreasuryAllocation, - ), - proposalRewardTreasuryAllocation: - subnet.subnetGovernanceConfig.proposalRewardTreasuryAllocation, - proposalRewardInterval: - subnet.subnetGovernanceConfig.proposalRewardInterval, - targetRegistrationsPerInterval: - subnet.moduleBurnConfig.targetRegistrationsPerInterval, + maxProposalRewardTreasuryAllocation: subnet.subnetGovernanceConfig.maxProposalRewardTreasuryAllocation, + proposalRewardTreasuryAllocation: subnet.subnetGovernanceConfig.proposalRewardTreasuryAllocation, + proposalRewardInterval: subnet.subnetGovernanceConfig.proposalRewardInterval, + targetRegistrationsPerInterval: subnet.moduleBurnConfig.targetRegistrationsPerInterval, + subnetEmission: subnet.subnetEmission, atBlock: atBlock, voteMode: subnet.subnetGovernanceConfig.voteMode, }; -} +} \ No newline at end of file diff --git a/apps/commune-worker/src/workers/subnet-fetcher.ts b/apps/commune-worker/src/workers/subnet-fetcher.ts index 8fd44aa..d1fdd32 100644 --- a/apps/commune-worker/src/workers/subnet-fetcher.ts +++ b/apps/commune-worker/src/workers/subnet-fetcher.ts @@ -27,7 +27,7 @@ export async function subnetFetcherWorker(props: WorkerProps) { SubnetToDatabase(subnet, props.lastBlock.blockNumber), ); log( - `Block ${props.lastBlock.blockNumber}: upserting ${subnetData.length} subnets`, + `Block ${props.lastBlock.blockNumber}: upserting ${subnetData.length} modules`, ); await upsertSubnetData(subnetData); diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 3b61c92..d006ea4 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -3,12 +3,12 @@ import { bigint, index, integer, - numeric, pgEnum, pgTableCreator, pgView, real, serial, + numeric, text, timestamp, unique, @@ -103,10 +103,7 @@ export const subnetDataSchema = createTable( minAllowedWeights: integer("min_allowed_weights").notNull(), maxAllowedWeights: integer("max_allowed_weights").notNull(), maxAllowedUids: integer("max_allowed_uids").notNull(), - maxWeightAge: numeric("max_weight_age", { - precision: 20, - scale: 0, - }).notNull(), + maxWeightAge: numeric("max_weight_age", { precision: 20, scale: 0 }).notNull(), trustRatio: integer("trust_ratio").notNull(), founderShare: integer("founder_share").notNull(), incentiveRatio: integer("incentive_ratio").notNull(), @@ -132,10 +129,7 @@ export const subnetDataSchema = createTable( // BurnConfiguration fields minBurn: bigint("min_burn", { mode: "bigint" }).notNull(), maxBurn: bigint("max_burn", { mode: "bigint" }).notNull(), - adjustmentAlpha: numeric("adjustment_alpha", { - precision: 20, - scale: 0, - }).notNull(), + adjustmentAlpha: numeric("adjustment_alpha", { precision: 20, scale: 0 }).notNull(), targetRegistrationsInterval: integer( "target_registrations_interval", ).notNull(), @@ -148,7 +142,6 @@ export const subnetDataSchema = createTable( // Additional fields minValidatorStake: bigint("min_validator_stake", { mode: "bigint" }), maxAllowedValidators: integer("max_allowed_validators"), - // subnetEmission: bigint("subnet_emission", { mode: "bigint" }), createdAt: timestamp("created_at").defaultNow().notNull(), deletedAt: timestamp("deleted_at").default(sql`null`), }, diff --git a/packages/ui/src/components/button.tsx b/packages/ui/src/components/button.tsx index 181cf29..44d1712 100644 --- a/packages/ui/src/components/button.tsx +++ b/packages/ui/src/components/button.tsx @@ -12,7 +12,7 @@ const buttonVariants = cva( variant: { base: "border", default: - "border border-white/20 bg-[#898989]/5 bg-background text-white hover:border-green-500 hover:bg-background-green hover:text-green-500 active:bg-green-500/40", + "hover:bg-background-green border border-white/20 bg-[#898989]/5 bg-background text-white hover:border-green-500 hover:text-green-500 active:bg-green-500/40", destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", ghost: "hover:bg-accent hover:text-accent-foreground", diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx index ebaa591..9982a84 100644 --- a/packages/ui/src/components/select.tsx +++ b/packages/ui/src/components/select.tsx @@ -24,7 +24,7 @@ const SelectTrigger = React.forwardRef< span]:line-clamp-1", + "hover:bg-background-green flex h-9 w-full items-center justify-between whitespace-nowrap border border-input border-white/20 bg-background px-3 py-2 text-sm shadow-sm ring-offset-background transition duration-200 placeholder:text-muted-foreground hover:border-green-500 hover:text-green-500 focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className, )} {...props}