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: 8 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,16 @@ jobs:
- name: Test mappings
run: npm test

- name: Render canonical deployment manifest
- name: Render canonical Testnet deployment manifest
run: npm run render:deployment

- name: Build canonical deployment subgraph
- name: Build canonical Testnet deployment subgraph
run: npm run build

- name: Render canonical Mainnet deployment manifest
run: npm run render:mainnet

- name: Build canonical Mainnet deployment subgraph
run: npm run build

publish-docker:
Expand Down
35 changes: 35 additions & 0 deletions contracts/deployments/dos-mainnet-7979.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"environment": "dos-mainnet",
"chainId": 7979,
"deploymentBlock": 117,
"finalDeploymentBlock": 162,
"deployedAt": "2026-08-12T19:44:44Z",
"deployer": "0x99999e454138f6be73E2bE82c890bc5765749999",
"owner": "0x310Bc061214ee89aF5CfB28a6ebF96c5436fa3CD",
"beneficiary": "0x310Bc061214ee89aF5CfB28a6ebF96c5436fa3CD",
"smokeName": "bens-smoke.dos",
"smokeResolvedAddress": "0x99999e454138f6be73E2bE82c890bc5765749999",
"transactions": {
"first": "0xb2fc1d57f72439403e095a8ec1d319342069cf400d77c89b5a043d43eb301ffc",
"last": "0xd1860882db7b632405c6189b4dbad6804f37fc6b957e0558e13d37738170ccbb",
"count": 46
},
"contracts": {
"wrappedDOS": "0x1111111111111111111111111111111111111111",
"contractNamerImplementation": "0xc647ccf449dec38bb8b7272e60fc14b3548c9547",
"contractNamer": "0x069056B2Ae8fD8c071Efb827c5AF73a0996840E1",
"verifiableFactory": "0x030eec847cf5D9d1c4A0b4e0459d130D0B35577C",
"labelStore": "0xB86bb608E6Afd7a8Eb209510c01BB859A7c315f1",
"rootRegistry": "0x38FC582690c3F28099087A88520056afAb08ce5F",
"dosRegistry": "0xb17Fec6fe18aC0b7F3dd934495E84eC06Cf88564",
"reverseRegistry": "0x8A2730c903d93b2116Fab3d9110C7D585F7B5a91",
"priceOracle": "0x4fcD4427859fc657a5Ef3c181202728cc16c85cf",
"dosRegistrar": "0x1F31e05948769174dA256D0484b8f26cfD3d8c97",
"permissionedResolverImplementation": "0x72aB4bE8B13CF39F68c73bA1B409A1fdFc0448AD",
"userRegistryImplementation": "0xfa579733d7C5A21B5D3C4399D3d6Ef89fc3A3720",
"gatewayProvider": "0x8291F1C6aEf2acBC58F3fe11C9e4EC0d3D4aE904",
"universalResolver": "0xCB20A0C349f079b8bD403ea8F668FE3DA49E981f",
"reverseRegistrar": "0x5A34c9fB9806239Ed61f1570c51edb198333fbeA",
"smokeResolver": "0xDDeE50c9721807B8B7e8640D9E2bd0AEBB6AA4d4"
}
}
1 change: 1 addition & 0 deletions subgraph/dos-names/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"render": "node scripts/render-manifest.mjs",
"render:test": "node scripts/render-manifest.mjs tests/fixtures/dos-testnet-3939.json subgraph.template.yaml subgraph.yaml",
"render:deployment": "node scripts/render-manifest.mjs ../../contracts/deployments/dos-testnet-3939.json subgraph.template.yaml subgraph.yaml",
"render:mainnet": "node scripts/render-manifest.mjs ../../contracts/deployments/dos-mainnet-7979.json subgraph.template.yaml subgraph.yaml",
"test": "graph test",
"test:render": "node --test tests/render-manifest.test.mjs"
},
Expand Down
17 changes: 14 additions & 3 deletions subgraph/dos-names/scripts/render-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import fs from "node:fs";
import path from "node:path";
import { pathToFileURL } from "node:url";

const EXPECTED_CHAIN_ID = 3939;
const EXPECTED_CHAIN_IDS = new Set([3939, 7979]);
const NETWORKS = new Map([
[3939, "dos-testnet"],
[7979, "dos-mainnet"],
]);
Comment on lines +5 to +9

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Maintaining both EXPECTED_CHAIN_IDS and NETWORKS is redundant and can lead to out-of-sync configurations when adding new networks. We can simplify this by using only the NETWORKS map and checking its keys.

const NETWORKS = new Map([
  [3939, "dos-testnet"],
  [7979, "dos-mainnet"],
]);

const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
const ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/;

Expand All @@ -16,8 +20,8 @@ const CONTRACT_PLACEHOLDERS = [
];

export function validateDeployment(deployment) {
if (deployment?.chainId !== EXPECTED_CHAIN_ID) {
throw new Error(`chainId must be ${EXPECTED_CHAIN_ID}`);
if (!EXPECTED_CHAIN_IDS.has(deployment?.chainId)) {
throw new Error("chainId must be one of 3939, 7979");
}
Comment on lines +23 to 25

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of checking EXPECTED_CHAIN_IDS, we can check NETWORKS.has(...). Additionally, we can dynamically construct the error message using the keys of NETWORKS to prevent the error message from becoming out of sync when new networks are added.

Suggested change
if (!EXPECTED_CHAIN_IDS.has(deployment?.chainId)) {
throw new Error("chainId must be one of 3939, 7979");
}
if (!NETWORKS.has(deployment?.chainId)) {
throw new Error("chainId must be one of " + Array.from(NETWORKS.keys()).join(", "));
}


if (
Expand Down Expand Up @@ -61,6 +65,13 @@ export function renderManifest(template, deployment) {
validateDeployment(deployment);

let rendered = template;
if (!rendered.includes("__NETWORK__")) {
throw new Error("template is missing __NETWORK__");
}
rendered = rendered.replaceAll(
"__NETWORK__",
NETWORKS.get(deployment.chainId),
);
for (const [contractName, placeholder] of CONTRACT_PLACEHOLDERS) {
if (!rendered.includes(placeholder)) {
throw new Error(`template is missing ${placeholder}`);
Expand Down
10 changes: 5 additions & 5 deletions subgraph/dos-names/subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dataSources:
# Emits: NameRegistered, ResolverUpdated, ExpiryUpdated, SubregistryUpdated, ERC1155 transfers
- kind: ethereum/contract
name: DOSTLDRegistry
network: dos-testnet
network: __NETWORK__
source:
abi: PermissionedRegistry
address: "__DOS_REGISTRY_ADDRESS__"
Expand Down Expand Up @@ -49,7 +49,7 @@ dataSources:
# Emits: NameRegistered (with cost info), NameRenewed
- kind: ethereum/contract
name: DOSRegistrar
network: dos-testnet
network: __NETWORK__
source:
abi: DOSRegistrar
address: "__DOS_REGISTRAR_ADDRESS__"
Expand All @@ -76,7 +76,7 @@ dataSources:
# Emits: AddrChanged, AddressChanged, TextChanged, ContenthashChanged, etc.
- kind: ethereum/contract
name: Resolver
network: dos-testnet
network: __NETWORK__
source:
abi: PermissionedResolver
address: "__PERMISSIONED_RESOLVER_IMPLEMENTATION_ADDRESS__"
Expand Down Expand Up @@ -116,7 +116,7 @@ dataSources:
templates:
- kind: ethereum/contract
name: UserRegistryTemplate
network: dos-testnet
network: __NETWORK__
source:
abi: PermissionedRegistry
mapping:
Expand Down Expand Up @@ -155,7 +155,7 @@ templates:

- kind: ethereum/contract
name: ResolverTemplate
network: dos-testnet
network: __NETWORK__
source:
abi: PermissionedResolver
mapping:
Expand Down
24 changes: 20 additions & 4 deletions subgraph/dos-names/tests/render-manifest.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const VALID_DEPLOYMENT = {
};

const TEMPLATE = `
network: __NETWORK__
registry: __DOS_REGISTRY_ADDRESS__
registrar: __DOS_REGISTRAR_ADDRESS__
resolver: __PERMISSIONED_RESOLVER_IMPLEMENTATION_ADDRESS__
Expand All @@ -31,13 +32,24 @@ test("renders every contract address and deployment block", () => {
assert.match(rendered, /0x2222222222222222222222222222222222222222/);
assert.match(rendered, /0x3333333333333333333333333333333333333333/);
assert.match(rendered, /startBlock: 68/);
assert.match(rendered, /network: dos-testnet/);
assert.doesNotMatch(rendered, /__[A-Z0-9_]+__/);
});

test("rejects a deployment for another chain", () => {
test("accepts the canonical DOS Mainnet deployment", () => {
const deployment = {
...VALID_DEPLOYMENT,
chainId: 7979,
};

assert.doesNotThrow(() => validateDeployment(deployment));
assert.match(renderManifest(TEMPLATE, deployment), /network: dos-mainnet/);
});

test("rejects a deployment for an unsupported chain", () => {
assert.throws(
() => validateDeployment({ ...VALID_DEPLOYMENT, chainId: 7979 }),
/chainId must be 3939/,
() => validateDeployment({ ...VALID_DEPLOYMENT, chainId: 1 }),
/chainId must be one of 3939, 7979/,
);
});

Expand Down Expand Up @@ -102,7 +114,11 @@ test("rejects a zero contract address", () => {

test("rejects a template missing a required placeholder", () => {
assert.throws(
() => renderManifest("startBlock: __START_BLOCK__", VALID_DEPLOYMENT),
() =>
renderManifest(
"network: __NETWORK__\nstartBlock: __START_BLOCK__",
VALID_DEPLOYMENT,
),
/template is missing __DOS_REGISTRY_ADDRESS__/,
);
});
Loading