diff --git a/bun.lockb b/bun.lockb index 7b54f838..cc8b81b2 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/crosschain-reverse-resolver/contracts/L1ReverseResolver.sol b/crosschain-reverse-resolver/contracts/L1ReverseResolver.sol index b013046f..4d353002 100644 --- a/crosschain-reverse-resolver/contracts/L1ReverseResolver.sol +++ b/crosschain-reverse-resolver/contracts/L1ReverseResolver.sol @@ -9,10 +9,9 @@ contract L1ReverseResolver is EVMFetchTarget { using EVMFetcher for EVMFetcher.EVMFetchRequest; IEVMVerifier immutable verifier; address immutable target; - uint256 constant COIN_TYPE_ETH = 60; uint256 constant RECORD_VERSIONS_SLOT = 1; - uint256 constant VERSINABLE_NAME_SLOT = 9; - uint256 constant VERSINABLE_TEXTS_SLOT = 11; + uint256 constant VERSINABLE_TEXTS_SLOT = 3; + uint256 constant VERSINABLE_NAME_SLOT = 4; constructor(IEVMVerifier _verifier, address _target) { verifier = _verifier; diff --git a/crosschain-reverse-resolver/contracts/deps.sol b/crosschain-reverse-resolver/contracts/deps.sol index e749d348..cd51ba58 100644 --- a/crosschain-reverse-resolver/contracts/deps.sol +++ b/crosschain-reverse-resolver/contracts/deps.sol @@ -1,19 +1,14 @@ import {L1Verifier} from '@ensdomains/l1-verifier/contracts/L1Verifier.sol'; import '@ensdomains/ens-contracts/contracts/resolvers/OwnedResolver.sol'; +import '@ensdomains/ens-contracts/contracts/reverseRegistrar/L2ReverseRegistrar.sol'; // Storage slot -// ┌─────────────────────┬──────────────────────────────┬──────────────┬ -// │ contract │ state_variable │ storage_slot │ -// ├─────────────────────┼──────────────────────────────┼──────────────┼ -// | OwnedResolver │ _owner │ 0 │ -// │ OwnedResolver │ recordVersions │ 1 │ -// │ OwnedResolver │ versionable_abis │ 2 │ -// │ OwnedResolver │ versionable_addresses │ 3 │ -// │ OwnedResolver │ versionable_hashes │ 4 │ -// │ OwnedResolver │ versionable_zonehashes │ 5 │ -// │ OwnedResolver │ versionable_records │ 6 │ -// │ OwnedResolver │ versionable_nameEntriesCount │ 7 │ -// │ OwnedResolver │ versionable_interfaces │ 8 │ -// │ OwnedResolver │ versionable_names │ 9 │ -// │ OwnedResolver │ versionable_pubkeys │ 10 │ -// │ OwnedResolver │ versionable_texts │ 11 │ +// ┌───────────────────────┬──────────────────────────────┬──────────────┬ +// │ contract │ state_variable │ storage_slot │ +// ├───────────────────────┼──────────────────────────────┼──────────────│ +// │ L2ReverseRegistrar │ _owner │ 0 │ +// │ L2ReverseRegistrar │ recordVersions │ 1 │ +// │ L2ReverseRegistrar │ lastUpdated │ 2 │ +// │ L2ReverseRegistrar │ versionable_texts │ 3 │ +// │ L2ReverseRegistrar │ versionable_names │ 4 │ +// │ L2ReverseResolverBase │ recordVersions │ 0 │ diff --git a/crosschain-reverse-resolver/deploy_l1/10_l1resolver.ts b/crosschain-reverse-resolver/deploy_l1/10_l1resolver.ts index 767bcf81..7be5a9da 100644 --- a/crosschain-reverse-resolver/deploy_l1/10_l1resolver.ts +++ b/crosschain-reverse-resolver/deploy_l1/10_l1resolver.ts @@ -9,12 +9,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployer} = await getNamedAccounts(); const OP_VERIFIER_ADDRESS = process.env.OP_VERIFIER_ADDRESS - const OwnedResolver = await hre.companionNetworks['l2'].deployments.get('OwnedResolver'); + const L2ReverseRegistrar = await hre.companionNetworks['l2'].deployments.get('L2ReverseRegistrar'); if(!OP_VERIFIER_ADDRESS) throw ('Set $OP_VERIFIER_ADDRESS') - console.log({OP_VERIFIER_ADDRESS, OWNED_RESOLVER_ADDRESS:OwnedResolver.address}) + console.log({OP_VERIFIER_ADDRESS, L2_RESOLVER_ADDRESS:L2ReverseRegistrar.address}) await deploy('L1ReverseResolver', { from: deployer, - args: [OP_VERIFIER_ADDRESS, OwnedResolver.address], + args: [OP_VERIFIER_ADDRESS, L2ReverseRegistrar.address], log: true, }); }; diff --git a/crosschain-reverse-resolver/deploy_l2/01_l2resolver .ts b/crosschain-reverse-resolver/deploy_l2/01_l2resolver .ts index 6c685678..58ed7641 100644 --- a/crosschain-reverse-resolver/deploy_l2/01_l2resolver .ts +++ b/crosschain-reverse-resolver/deploy_l2/01_l2resolver .ts @@ -7,11 +7,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const {deployer} = await getNamedAccounts(); console.log({deployer}) - await deploy('OwnedResolver', { + await deploy('L2ReverseRegistrar', { from: deployer, args: [], log: true, }); }; export default func; -func.tags = ['OwnedResolver']; +func.tags = ['L2ReverseRegistrar']; diff --git a/crosschain-reverse-resolver/package.json b/crosschain-reverse-resolver/package.json index b29324d6..f53e8efc 100644 --- a/crosschain-reverse-resolver/package.json +++ b/crosschain-reverse-resolver/package.json @@ -40,7 +40,7 @@ "typescript": "^5.2.2" }, "dependencies": { - "@ensdomains/ens-contracts": "^0.0.22", + "@ensdomains/ens-contracts": "ensdomains/ens-contracts#l2-reverse-registrar", "@ensdomains/evm-verifier": "^0.1.0", "@eth-optimism/contracts": "^0.6.0" } diff --git a/crosschain-reverse-resolver/test/testReverseResolver.ts b/crosschain-reverse-resolver/test/testReverseResolver.ts index affb2c0a..882fa4cc 100644 --- a/crosschain-reverse-resolver/test/testReverseResolver.ts +++ b/crosschain-reverse-resolver/test/testReverseResolver.ts @@ -14,7 +14,7 @@ import { FetchRequest } from 'ethers'; import { ethers } from 'hardhat'; import { EthereumProvider } from 'hardhat/types'; import request from 'supertest'; -const node = '0x80ee077a908dffcf32972ba13c2df16b42688e1de21bcf17d3469a8507895eae' +const NAMESPACE = 2147483658 // OP type ethersObj = typeof ethersT & Omit & { @@ -72,37 +72,38 @@ describe('Crosschain Reverse Resolver', () => { signer ); verifier = await l1VerifierFactory.deploy(['test:']); - const testL2Factory = await ethers.getContractFactory( - 'OwnedResolver', + 'L2ReverseRegistrar', signer ); - l2contract = await testL2Factory.deploy(); - + l2contract = await testL2Factory.deploy(ethers.namehash(`${NAMESPACE}.reverse`)); const testL1Factory = await ethers.getContractFactory( 'L1ReverseResolver', signer ); target = await testL1Factory.deploy(await verifier.getAddress(), await l2contract.getAddress()); - // Mine an empty block so we have something to prove against await provider.send('evm_mine', []); }); it("should test name", async() => { const name = 'vitalik.eth' - await l2contract.clearRecords(node) - await l2contract.setName(node, name) + const node = await l2contract.node( + await signer.getAddress(), + ) + await l2contract.setName(name) await provider.send("evm_mine", []); const result2 = await target.name(node, { enableCcipRead: true }) expect(result2).to.equal(name); }) it("should test text record", async() => { + const node = await l2contract.node( + await signer.getAddress(), + ) const key = 'name' const value = 'nick.eth' - await l2contract.clearRecords(node) - await l2contract.setText(node, key, value) + await l2contract.setText(key, value) await provider.send("evm_mine", []); const result = await l2contract.text(node, key) expect(result).to.equal(value);