Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5f80cf4
migrate deploy config to hh3 and rocketh
mdtanrikulu Jun 5, 2025
ca3ce81
lint
mdtanrikulu Jun 5, 2025
6e269b0
migrate rest of the deploy scripts
mdtanrikulu Jun 6, 2025
f1ce1eb
fmt
mdtanrikulu Jun 6, 2025
633a928
feat: add foundry testing infrastructure
mdtanrikulu Jul 2, 2025
ad4a2bf
migrate: move ts test files into testLegacy folder
mdtanrikulu Jul 2, 2025
adfcc88
create BaseTest foundation and test utilities
mdtanrikulu Jul 2, 2025
dda7eb9
migrate core registry tests to foundry
mdtanrikulu Jul 2, 2025
f66d5a5
migrate ETH registrar tests to foundry
mdtanrikulu Jul 2, 2025
71298fe
migrate ReverseRegistrar tests to foundry
mdtanrikulu Jul 2, 2025
3efd9a1
migrate resolver tests
mdtanrikulu Jul 2, 2025
d2e7e05
create BaseWrapperTest test foundation, migrate basic wrapper tests
mdtanrikulu Jul 3, 2025
64fe4b5
migrate NameWrapper behavior tests
mdtanrikulu Jul 3, 2025
37135df
migrate NameWrapper functionality tests
mdtanrikulu Jul 4, 2025
94af610
migrate DNSSEC Oracle tests
mdtanrikulu Jul 4, 2025
ada94f0
migrate DNSRegistrar tests
mdtanrikulu Jul 4, 2025
095aa56
migrate CCIPRead tests and scripts
mdtanrikulu Jul 4, 2025
5bdc6ed
migrate UniversalResolver tests
mdtanrikulu Jul 4, 2025
9431125
update CI
mdtanrikulu Jul 4, 2025
faffffa
Merge branch 'staging' into 'feature/fet-1977-alternative-migrate-tes…
mdtanrikulu Jul 21, 2025
96d98bc
fmt
mdtanrikulu Jul 21, 2025
b5dfdf7
update/fix ccipRead tests using MockBatcher
mdtanrikulu Jul 21, 2025
85bf362
add tests for uncovered reverse registrar contracts
mdtanrikulu Jul 21, 2025
37756b1
add tests for uncovered reverse resolver contracts
mdtanrikulu Jul 21, 2025
712a54d
update foundry config
mdtanrikulu Jul 21, 2025
1d6067e
add tests for util contracts
mdtanrikulu Jul 21, 2025
56d0085
update RegisterAndWrapETH2LD
mdtanrikulu Jul 21, 2025
c707484
remove legacy test files
mdtanrikulu Jul 21, 2025
b293239
migrate build scripts fully and fix local deployment test
mdtanrikulu Jul 24, 2025
fd7d4cb
revert and keep fixtures under test folder for deploy scripts
mdtanrikulu Jul 24, 2025
9c5b01e
temp CI update lockfile
mdtanrikulu Jul 24, 2025
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
26 changes: 20 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Use Bun 1.2.3
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.3

- run: bun install --frozen-lockfile
- run: bun install

- name: Run wikiCheck
run: bun run wikiCheck
Expand All @@ -25,13 +27,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Use Bun 1.2.0
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.0

- run: bun install --frozen-lockfile
- run: bun install
Copy link
Contributor

Choose a reason for hiding this comment

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

frozen lockfiles ensure no random transititves get pulled and that the build is reproducible. I suggest to put it back and regenerate the lockfile and commit it to ensure it matches the same one in CI


- name: Run tests
run: bun run build
Expand All @@ -40,6 +44,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive # Required for forge-std submodule

- name: Use Bun 1.2.3
uses: oven-sh/setup-bun@v2
Expand All @@ -49,22 +55,30 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- run: bun install --frozen-lockfile
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Run tests
run: bun run test:parallel
- run: bun install

- name: Run Foundry tests
run: bun run test:fast

- name: Run gas report
run: bun run test:gas

deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive # Required for forge-std submodule

- name: Use Bun 1.2.3
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.3

- run: bun install --frozen-lockfile
- run: bun install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ node_modules
artifacts
cache
gasreport-*
generated
.env*
*.DS_Store
node_modules
build
forge-cache
out
deployments/**/.pendingSafeTransactions
test/foundry-*
deployments/**/.pendingSafeTransactions
deployments/localhost
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
24 changes: 23 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"solidity.remappings": [
"@ensdomains/buffer/=node_modules/@ensdomains/buffer/",
"@ensdomains/solsha1/=node_modules/@ensdomains/solsha1/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"@openzeppelin/contracts-v5/=node_modules/@openzeppelin/contracts-v5/",
"forge-std/=lib/forge-std/src/",
"test/=test/"
],
"solidity.packageDefaultDependenciesContractsDirectory": "contracts",
"solidity.packageDefaultDependenciesDirectory": "lib",
"search.exclude": {
"**/test/foundry-artifacts": true,
"**/test/foundry-cache": true,
"**/node_modules": true,
"**/cache": true,
"**/artifacts": true,
"**/build": true
},
"files.exclude": {
"**/test/foundry-artifacts": true,
"**/test/foundry-cache": true
}
}
Binary file added bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions contracts/reverseResolver/ChainReverseResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.17;

import {AbstractReverseResolver} from "./AbstractReverseResolver.sol";
import {Ownable} from "@openzeppelin/contracts-v5/access/Ownable.sol";
import {GatewayFetchTarget, IGatewayVerifier} from "@unruggable/gateways/contracts/GatewayFetchTarget.sol";
import {GatewayFetcher, GatewayRequest} from "@unruggable/gateways/contracts/GatewayFetcher.sol";
import {GatewayFetchTarget, IGatewayVerifier} from "../../node_modules/@unruggable/gateways/contracts/GatewayFetchTarget.sol";
import {GatewayFetcher, GatewayRequest} from "../../node_modules/@unruggable/gateways/contracts/GatewayFetcher.sol";
import {IStandaloneReverseRegistrar} from "../reverseRegistrar/IStandaloneReverseRegistrar.sol";
import {INameReverser} from "./INameReverser.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/TestStringUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ library TestStringUtils {
function escape(string memory s) external pure returns (string memory) {
return StringUtils.escape(s);
}

function strlen(string memory s) external pure returns (uint256) {
return StringUtils.strlen(s);
}
Expand Down
41 changes: 22 additions & 19 deletions deploy/dnsregistrar/00_deploy_offchain_dns_resolver.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import type { DeployFunction } from 'hardhat-deploy/types.js'
import { execute, artifacts } from '@rocketh'

const func: DeployFunction = async function (hre) {
const { viem } = hre
export default execute(
async ({ deploy, get, namedAccounts }) => {
const { deployer } = namedAccounts

const registry = await viem.getContract('ENSRegistry')
const dnssec = await viem.getContract('DNSSECImpl')
const registry = await get('ENSRegistry')
const dnssec = await get('DNSSECImpl')

await viem.deploy('OffchainDNSResolver', [
registry.address,
dnssec.address,
'https://dnssec-oracle.ens.domains/',
])

return true
}

func.id = 'OffchainDNSResolver v1.0.0'
func.tags = ['category:dnsregistrar', 'OffchainDNSResolver']
func.dependencies = ['ENSRegistry', 'DNSSECImpl']

export default func
await deploy('OffchainDNSResolver', {
account: deployer,
artifact: artifacts.OffchainDNSResolver,
args: [
registry.address,
dnssec.address,
'https://dnssec-oracle.ens.domains/',
],
})
},
{
id: 'OffchainDNSResolver v1.0.0',
tags: ['category:dnsregistrar', 'OffchainDNSResolver'],
dependencies: ['ENSRegistry', 'DNSSECImpl'],
},
)
126 changes: 73 additions & 53 deletions deploy/dnsregistrar/05_deploy_public_suffix_list.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,86 @@
import type { DeployFunction } from 'hardhat-deploy/types.js'
import { execute, artifacts } from '@rocketh'
import type { Hash } from 'viem'
import { dnsEncodeName } from '../../test/fixtures/dnsEncodeName.js'

const func: DeployFunction = async function (hre) {
const { viem } = hre
export default execute(
async ({ deploy, execute, namedAccounts }) => {
const { deployer, owner } = namedAccounts

const { deployer, owner } = await viem.getNamedClients()
const psl = await deploy('SimplePublicSuffixList', {
account: deployer,
artifact: artifacts.SimplePublicSuffixList,
args: [],
})

await viem.deploy('SimplePublicSuffixList', [])
if (!psl.newlyDeployed) {
return
}

const psl = await viem.getContract('SimplePublicSuffixList')
const listOwner = await psl.read.owner()
console.log('SimplePublicSuffixList deployed successfully')

if (
owner !== undefined &&
owner.address !== deployer.address &&
listOwner !== owner.address
) {
console.log('Transferring ownership to owner account')
const hash = await psl.write.transferOwnership([owner.address])
console.log(`Transfer ownership (tx: ${hash})...`)
await viem.waitForTransactionSuccess(hash)
}
// Transfer ownership to owner if different from deployer
if (owner !== deployer) {
await execute(psl, {
functionName: 'transferOwnership',
args: [owner],
account: deployer,
})
console.log('Transferred ownership to owner account')
}

const suffixList = await (
await fetch('https://publicsuffix.org/list/public_suffix_list.dat', {
headers: {
Connection: 'close',
},
})
).text()
let suffixes = suffixList
.split('\n')
.filter((suffix) => !suffix.startsWith('//') && suffix.trim() != '')
// Right now we're only going to support top-level, non-idna suffixes
suffixes = suffixes.filter((suffix) => suffix.match(/^[a-z0-9]+$/))
// Fetch and set public suffix list
const suffixList = await (
await fetch('https://publicsuffix.org/list/public_suffix_list.dat', {
headers: {
Connection: 'close',
},
})
).text()

const transactionHashes: Hash[] = []
console.log('Starting suffix transactions')
let suffixes = suffixList
.split('\n')
.filter((suffix) => !suffix.startsWith('//') && suffix.trim() != '')
// Right now we're only going to support top-level, non-idna suffixes
suffixes = suffixes.filter((suffix) => suffix.match(/^[a-z0-9]+$/))

for (let i = 0; i < suffixes.length; i += 100) {
const batch = suffixes
.slice(i, i + 100)
.map((suffix) => dnsEncodeName(suffix))
const hash = await psl.write.addPublicSuffixes([batch], {
account: owner.account,
})
console.log(`Setting suffixes (tx: ${hash})...`)
transactionHashes.push(hash)
}
console.log(
`Waiting on ${transactionHashes.length} suffix-setting transactions to complete...`,
)
await Promise.all(
transactionHashes.map((hash) => viem.waitForTransactionSuccess(hash)),
)
console.log(`Starting suffix transactions for ${suffixes.length} suffixes`)
const totalBatches = Math.ceil(suffixes.length / 100)
let successfulBatches = 0
let failedBatches = 0

// Send transactions sequentially to avoid nonce conflicts
for (let i = 0; i < suffixes.length; i += 100) {
const batch = suffixes
.slice(i, i + 100)
.map((suffix) => dnsEncodeName(suffix))

return true
}
const batchIndex = Math.floor(i / 100) + 1
console.log(
`Sending suffixes batch ${batchIndex}/${totalBatches} (${batch.length} suffixes)`,
)

func.id = 'SimplePublicSuffixList v1.0.0'
func.tags = ['category:dnsregistrar', 'SimplePublicSuffixList']
func.dependencies = []
try {
await execute(psl, {
functionName: 'addPublicSuffixes',
args: [batch],
account: owner,
})
successfulBatches++
console.log(`Batch ${batchIndex} completed successfully`)
} catch (error) {
failedBatches++
console.error(`Batch ${batchIndex} failed:`, error.message || error)
// Continue with next batch
}
}

export default func
console.log(
`Public suffix list configuration completed: ${successfulBatches} successful, ${failedBatches} failed`,
)
},
{
id: 'SimplePublicSuffixList v1.0.0',
tags: ['category:dnsregistrar', 'SimplePublicSuffixList'],
dependencies: [],
},
)
Loading
Loading