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
10 changes: 6 additions & 4 deletions src/chains/testnetAsimov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import {GenLayerChain} from "@/types";
import {STAKING_ABI} from "@/abi/staking";

// chains/localnet.ts
const TESTNET_JSON_RPC_URL = "https://genlayer-testnet.rpc.caldera.xyz/http";
const TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev";
const TESTNET_WS_URL = "wss://zksync-os-testnet-alpha.zksync.dev/ws";
Comment on lines 5 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n src/chains/testnetAsimov.ts | head -20

Repository: genlayerlabs/genlayer-js

Length of output: 884


🏁 Script executed:

# Check if there are other chain files to compare patterns
fd -t f "chains/.*\.ts$" src/

Repository: genlayerlabs/genlayer-js

Length of output: 50


🏁 Script executed:

# Search for similar RPC URL patterns in the codebase
rg "zksync-os-testnet" -A 2 -B 2

Repository: genlayerlabs/genlayer-js

Length of output: 1008


Remove stale comment on line 5.

Line 5 contains // chains/localnet.ts, which is a leftover comment that doesn't apply to this file. The mismatched hostnames between the HTTP endpoint (zksync-os-testnet-genlayer) and WebSocket endpoint (zksync-os-testnet-alpha) are intentional per the test suite in tests/smoke.test.ts.

🔧 Fix the stale comment
-// chains/localnet.ts
+// Testnet Asimov RPC endpoints
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// chains/localnet.ts
const TESTNET_JSON_RPC_URL = "https://genlayer-testnet.rpc.caldera.xyz/http";
const TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev";
const TESTNET_WS_URL = "wss://zksync-os-testnet-alpha.zksync.dev/ws";
// Testnet Asimov RPC endpoints
const TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev";
const TESTNET_WS_URL = "wss://zksync-os-testnet-alpha.zksync.dev/ws";
🤖 Prompt for AI Agents
In `@src/chains/testnetAsimov.ts` around lines 5 - 7, Remove the stale comment "//
chains/localnet.ts" at the top of the file so it no longer mislabels the file;
leave the constants TESTNET_JSON_RPC_URL and TESTNET_WS_URL intact (do not
change their values) ensuring only relevant comments remain above those
constants.


const STAKING_CONTRACT = {
address: "0x03f410748EBdb4026a6b8299E9B6603A273709D1" as Address,
address: "0x63Fa5E0bb10fb6fA98F44726C5518223F767687A" as Address,
abi: STAKING_ABI,
};
const EXPLORER_URL = "https://explorer-asimov.genlayer.com/";
const CONSENSUS_MAIN_CONTRACT = {
address: "0x67fd4aC71530FB220E0B7F90668BAF977B88fF07" as Address,
address: "0x6CAFF6769d70824745AD895663409DC70aB5B28E" as Address,
abi: [
{
inputs: [],
Expand Down Expand Up @@ -1401,7 +1402,7 @@ const CONSENSUS_MAIN_CONTRACT = {
};

const CONSENSUS_DATA_CONTRACT = {
address: "0xB6E1316E57d47d82FDcEa5002028a554754EF243" as Address,
address: "0x0D9d1d74d72Fa5eB94bcf746C8FCcb312a722c9B" as Address,
abi: [
{
inputs: [],
Expand Down Expand Up @@ -3989,6 +3990,7 @@ export const testnetAsimov: GenLayerChain = defineChain({
rpcUrls: {
default: {
http: [TESTNET_JSON_RPC_URL],
webSocket: [TESTNET_WS_URL],
},
},
nativeCurrency: {
Expand Down
59 changes: 59 additions & 0 deletions tests/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// tests/smoke.test.ts
// Basic smoke tests to verify testnet chain configuration and connectivity
import {describe, it, expect} from "vitest";
import {testnetAsimov} from "@/chains/testnetAsimov";
import {createPublicClient, http} from "viem";

describe("Testnet Asimov Chain Config", () => {
it("should have valid RPC URL", () => {
const rpcUrl = testnetAsimov.rpcUrls.default.http[0];
expect(rpcUrl).toBe("https://zksync-os-testnet-genlayer.zksync.dev");
});

it("should have valid WebSocket URL", () => {
const wsUrl = testnetAsimov.rpcUrls.default.webSocket?.[0];
expect(wsUrl).toBe("wss://zksync-os-testnet-alpha.zksync.dev/ws");
});

it("should have consensus main contract address", () => {
expect(testnetAsimov.consensusMainContract?.address).toBe(
"0x6CAFF6769d70824745AD895663409DC70aB5B28E",
);
});

it("should have consensus data contract address", () => {
expect(testnetAsimov.consensusDataContract?.address).toBe(
"0x0D9d1d74d72Fa5eB94bcf746C8FCcb312a722c9B",
);
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

it("should have staking contract address", () => {
expect(testnetAsimov.stakingContract?.address).toBe(
"0x63Fa5E0bb10fb6fA98F44726C5518223F767687A",
);
});

it("should have correct chain ID", () => {
expect(testnetAsimov.id).toBe(0x107d);
});
});

describe("Testnet Asimov RPC Connectivity", () => {
it("should connect and fetch chain ID", async () => {
const client = createPublicClient({
chain: testnetAsimov,
transport: http(testnetAsimov.rpcUrls.default.http[0]),
});
const chainId = await client.getChainId();
expect(chainId).toBe(testnetAsimov.id);
}, 15000);

it("should fetch latest block number", async () => {
const client = createPublicClient({
chain: testnetAsimov,
transport: http(testnetAsimov.rpcUrls.default.http[0]),
});
const blockNumber = await client.getBlockNumber();
expect(blockNumber).toBeGreaterThan(0n);
}, 15000);
});