Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
phoax committed Jun 5, 2023
2 parents 6007015 + 0e6f5ee commit dc9fd36
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions packages/contracts/contracts/l1/LineaResolverStub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion packages/contracts/scripts/deployL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ async function main() {
// Only verify on "live" blockchain
setTimeout(async () => {
console.log("Verify on Etherscan");

try {
await run("verify:verify", {
address: lineaResolverStub.address,
Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/scripts/deployL2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.log("Verify on Etherscan");
try {
Expand Down
20 changes: 10 additions & 10 deletions packages/contracts/test/LineaResolverStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit dc9fd36

Please sign in to comment.