From dbe360b5a778640825e55921415a2df5933cd4c1 Mon Sep 17 00:00:00 2001 From: phoax Date: Thu, 1 Jun 2023 15:03:40 +0200 Subject: [PATCH 1/2] feat: remove check state root --- .../contracts/l1/LineaResolverStub.sol | 8 ++++---- packages/contracts/test/LineaResolverStub.ts | 20 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/contracts/contracts/l1/LineaResolverStub.sol b/packages/contracts/contracts/l1/LineaResolverStub.sol index 0e79dda0e..670cc6740 100644 --- a/packages/contracts/contracts/l1/LineaResolverStub.sol +++ b/packages/contracts/contracts/l1/LineaResolverStub.sol @@ -117,10 +117,10 @@ contract LineaResolverStub is IExtendedResolver, SupportsInterface { L2StateProof memory proof = abi.decode(response, (L2StateProof)); // step 1: check that the right state root was used to calculate the proof - require( - IRollup(rollup).stateRootHash() == proof.stateRoot, - "LineaResolverStub: invalid state root" - ); + // require( + // IRollup(rollup).stateRootHash() == proof.stateRoot, + // "LineaResolverStub: invalid state root" + // ); // step 2: check blockHash against encoded block array require( diff --git a/packages/contracts/test/LineaResolverStub.ts b/packages/contracts/test/LineaResolverStub.ts index a1a48ac19..fd3d71aa7 100644 --- a/packages/contracts/test/LineaResolverStub.ts +++ b/packages/contracts/test/LineaResolverStub.ts @@ -104,16 +104,16 @@ describe("LineaResolverStub", function () { ).to.revertedWith("LineaResolverStub: blockHash encodedBlockArray mismatch"); }); - it("Should revert if the given state root is invalid", async function () { - const { lineaResolverStub, hash } = await loadFixture(deployContractsFixture); - const extraData = `0x3b3b57de${hash.slice(2)}`; - await expect( - lineaResolverStub.resolveWithProof( - defaultAbiCoder.encode(["(bytes32,bytes,bytes,bytes32,bytes,bytes)"], [Object.values(MOCKED_PROOF_INVALID_STATE_ROOT)]), - extraData, - ), - ).to.revertedWith("LineaResolverStub: invalid state root"); - }); + // it("Should revert if the given state root is invalid", async function () { + // const { lineaResolverStub, hash } = await loadFixture(deployContractsFixture); + // const extraData = `0x3b3b57de${hash.slice(2)}`; + // await expect( + // lineaResolverStub.resolveWithProof( + // defaultAbiCoder.encode(["(bytes32,bytes,bytes,bytes32,bytes,bytes)"], [Object.values(MOCKED_PROOF_INVALID_STATE_ROOT)]), + // extraData, + // ), + // ).to.revertedWith("LineaResolverStub: invalid state root"); + // }); }); describe("resolve", async () => { From 694ea32edc032092f6ae72ab64f46a9fa267735d Mon Sep 17 00:00:00 2001 From: phoax Date: Mon, 5 Jun 2023 14:07:55 +0200 Subject: [PATCH 2/2] fix: change log --- README.md | 17 +++++++++++++++-- packages/contracts/.env.example | 2 +- packages/contracts/scripts/deployL1.ts | 13 +++++++++---- packages/contracts/scripts/deployL2.ts | 5 +++-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 269432f99..efa265491 100644 --- a/README.md +++ b/README.md @@ -130,10 +130,23 @@ yarn coverage ## How to deploy to public net (goerli for example) +Deploy L2 contracts first: + +```shell +npx hardhat run --network goerliLinea scripts/deployL2.ts +``` + +Get the `L2_RESOLVER_ADDRESS` resolver address, then deploy L1 contracts: + +``` +L2_RESOLVER_ADDRESS=$L2_RESOLVER_ADDRESS npx hardhat run --network goerli scripts/deployL1.ts +``` + ## Deployed contracts -- Linea Goerli resolver = 0x176569440293dF1fA85D0Eb342A92c6470D662f9 -- Gateway = https://ensgw1.dev.linea.build/ +- Goerli resolver stub = - +- Linea Goerli resolver = 0xCcA59f9eaa814Bedd0d3e7C41b7Bc624BB6fDd37 +- Gateway = https://ensgw1.dev.linea.build/{sender}/{data}.json - goerli test domain = linearesolver.eth ## Deploy gateway diff --git a/packages/contracts/.env.example b/packages/contracts/.env.example index b7d1388ef..b9895105b 100644 --- a/packages/contracts/.env.example +++ b/packages/contracts/.env.example @@ -11,6 +11,6 @@ L2_RESOLVER_NFT_SYMBOL=LTST L2_RESOLVER_NFT_BASE_URI=http://localhost:3000/metadata/ # Keys -PRIVATE_KEY=0x97d505ce954af0f961baf23911bf752fe5d09dc92620d0aa52a2d07038e16e2d +PRIVATE_KEY= ETHERSCAN_API_KEY=6WMKYHZ1B4R3AFBBWN7M7QPZGQQ5C53TWJ diff --git a/packages/contracts/scripts/deployL1.ts b/packages/contracts/scripts/deployL1.ts index e4ae1ee64..005032635 100644 --- a/packages/contracts/scripts/deployL1.ts +++ b/packages/contracts/scripts/deployL1.ts @@ -38,10 +38,15 @@ async function main() { if (chainId !== HARDHAT_NETWORK_CHAIN_ID) { // Only verify on "live" blockchain setTimeout(async () => { - await run("verify:verify", { - address: lineaResolverStub.address, - constructorArguments: [[gatewayUrl], L2_RESOLVER_ADDRESS, rollupAddr], - }); + console.log("Verify on Etherscan"); + try { + await run("verify:verify", { + address: lineaResolverStub.address, + constructorArguments: [[gatewayUrl], L2_RESOLVER_ADDRESS, rollupAddr], + }); + } catch (error) { + console.error(error.message); + } }, 20000); } } diff --git a/packages/contracts/scripts/deployL2.ts b/packages/contracts/scripts/deployL2.ts index ead73af58..fac21cabd 100644 --- a/packages/contracts/scripts/deployL2.ts +++ b/packages/contracts/scripts/deployL2.ts @@ -11,14 +11,15 @@ async function main() { const baseUri = process.env.L2_RESOLVER_NFT_BASE_URI; const lineaResolver = await upgrades.deployProxy(LineaResolver, [nftName, symbol, baseUri]); await lineaResolver.deployed(); - + console.log(`LineaResolver deployed to, L2_RESOLVER_ADDRESS: ${lineaResolver.address}`); // Test with subdomain with default "julink.lineatest.eth", assuming we still control lineatest.eth on L1 const name = process.env.L2_ENS_SUBDOMAIN_TEST ? process.env.L2_ENS_SUBDOMAIN_TEST : "julink.lineatest.eth"; const tx = await lineaResolver.mintSubdomain(name, owner.address, { value: ethers.utils.parseEther("0.001") }); await tx.wait(); - console.log(`LineaResolver deployed to, L2_RESOLVER_ADDRESS: ${lineaResolver.address}`); + console.log(`Subdomain minted: ${process.env.L2_ENS_SUBDOMAIN_TEST}`); if (chainId !== 31337) { + // Only verify on "live" blockchain setTimeout(async () => { console.error("Verify on Etherscan"); try {