Skip to content

Commit

Permalink
fix(evm): fixes axiom tests
Browse files Browse the repository at this point in the history
  • Loading branch information
allemanfredi committed Oct 18, 2023
1 parent 97902b4 commit 7406f7a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
3 changes: 3 additions & 0 deletions packages/evm/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
let jsonRpcUrl: string = process.env[`${chain.toUpperCase()}_JSON_RPC_URL`] as string
if (!jsonRpcUrl) {
switch (chain) {
case "mainnet":
jsonRpcUrl = "https://ethereum.publicnode.com"
break
case "avalanche":
jsonRpcUrl = "https://api.avax.network/ext/bc/C/rpc"
break
Expand Down
43 changes: 30 additions & 13 deletions packages/evm/test/adapters/axiom/00_Play.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/*
Note that these E2E tests simulate cross-chain interactions but,
for the sake of convenience, use only one network as both the origin and destination chain.
*/
// Note that these E2E tests simulate cross-chain interactions but,
// for the sake of convenience, use only one network as both the origin and destination chain.
import { expect } from "chai"
import { ethers, network } from "hardhat"
import { config, ethers, network } from "hardhat"

const DOMAIN_ID = network.config.chainId
const BYTES32_DOMAIN_ID = "0x0000000000000000000000000000000000000000000000000000000000007A69"
Expand Down Expand Up @@ -82,6 +79,27 @@ const setup = async () => {
}

describe("Axiom E2E test", function () {
this.beforeEach(async () => {
await network.provider.request({
method: "hardhat_reset",
params: [
{
forking: {
jsonRpcUrl: config?.networks?.mainnet?.url,
blockNumber: 10000000,
},
},
],
})
})

this.afterAll(async () => {
await network.provider.request({
method: "hardhat_reset",
params: [],
})
})

describe("Execution layer", function () {
it("Attest slots for the claimed block head with the block hash agreed on by N adapters", async function () {
const { amb, hashi, storageProof } = await setup()
Expand Down Expand Up @@ -203,7 +221,7 @@ describe("Axiom E2E test", function () {
})

it("Reverts if the proof for cryptopunk#420 owner address does not match with the block header", async function () {
const { amb, hashi, storageProof } = await setup()
const { amb, hashi/*, storageProof*/ } = await setup()

// deploy header storage
const HeaderStorage = await ethers.getContractFactory("HeaderStorage")
Expand All @@ -229,16 +247,15 @@ describe("Axiom E2E test", function () {
),
).to.equal(expectedHash)

// const incorrectProof = "0x000000000000000000000000000000000000000000d20a750285a779a8f382940000000000000000000000000000000000000000009040749a7b21fbbbc56ab1000000000000000000000000000000000000000000000cfa5466d74518ec8fc20000000000000000000000000000000000000000005df3478e70672aef4924ce000000000000000000000000000000000000000000231c15e9f1d049b4906f360000000000000000000000000000000000000000000028f4ec9495f4ac35ba99000000000000000000000000000000000000000000b4ea379117dbb72eb018e6000000000000000000000000000000000000000000d02a7285294fc5b3e33ce7000000000000000000000000000000000000000000002cd026928629d6bde1220000000000000000000000000000000000000000008c7d9b39cd4b8001427b92000000000000000000000000000000000000000000b71a51e053a0d595d1c0950000000000000000000000000000000000000000000018168d68ca1de197cf0700000000000000000000000000000000aa20f7bde5be60603f11a45fc4923aab000000000000000000000000000000007552be775403fc00c2e6b805e6297dbe0000000000000000000000000000000000000000000000000000000000989680000000000000000000000000b47e3cd837ddf8e4c57f05d70ab865de6e193bbb000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a068289d29f77618bbdcc6c71439a097a276013e033be69d8365ee3f31330cb720f5a67cf836f713e3cd4334b1cddf68091628f397af8834697d383c46ff30bd728a71b966ef58f2085906901b8721c12c6e4bdbfbd944fa61b5f32d6bb3034260f1c347c2c3f76bf78bc1ff9a0db6355644e79f3e61259b78020b867707f1c382496e73fef160560bc27269102bdccfad037b7d73a09041dd7f6b4fb7f3d4875097d4857f9b0dac1f369f688c2299204b75ad707bb2158e7fbd7b8f16e61b9bb10b72622525962ac6189f50c65efb70cdfa8586ece1972885cb62297ad077c45156c7ac61eaf715afcc00f5b294320d4dddf1545d66e2c565646d4bb45894ca50eec1d5a454b34c1a66997bfb222ea87d93f31ff0528662626a46e57e3c19513299b9b6c08ceeb6c74317c2aedf8767c98568c4affe24421a43c70be4423a22128cc3661a3063d8c787b88a83258633eb03a1a1672062cd8e1fa8dd3bb2eff9e1b17d7de9c9a9ccc741cb643c13af808e4ec81e97a33437c3a33cc663972e695289f54201c49bde0b9551fb27fb51d4e6d208b21f99827887fd8ca467c39d13716500b7e73a058379e09d8c79f0a2eda1e699c81042b8e2647f3fe0f0dba677f25a81b7c54b1efe184426530ad1f12ace22255859b8325f97922231b6c1de3fb0610102f9856a361b7fa1a39a96e0bfac9bcd6dcc3ec1ff8e80d9195590d305f147d3c67016e1a6f13a244a0e09082ceb4c54a09cf777197c82a0940dfea287f02d345930ce03b8a1ef30efc65ddf2eaede252f562443888f31747097a7b3956000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020bfc7599b7ad525a7a5c5673f24831cb57330c6368cfee195c2c8e6e2dcdff3328d97b69dd606bb9c58081b1e5b481a14c4a86e8a3b93e2197f2df3c2d6b45ca10c19fd6de9c6c266fe319d317d562028a9c0cc1497aeccc08e06cc261ea9c9f1314a2543e41ccdeb3cf95792cc31597ea54a947345d8d4c777da128946154d710070a5a3b1da94a326debdd3e42fc7f212abbe8d41e9f2255d9b65e671993ae2c745546d019c9d80f35ae33777ea4a0ff2792cf7ca2ad3ec78d408fc6034daa0dc791655fe9900cf082b028e33ab4368df91e47acfd9ba73eb0fb239453eca102c6a7f3a6bdd7696732e0b00eaf8300124236fc661af10d7c8ab44a1227b30e069f109e21b1359543f617314953f5bd0de5cf754ff94a03feb8b628a0d702840452c6cf70191c30a2461ca712b18d1022792aeba142427f2dade8265d50adbe0cfb24eb5762a677de8ed5acbe0654b01894df77a838d58df6ccc6aadea436dc2000649b14adec14afe9f132afc1ab6deb50980cd54915359c9a20fb59127f212700dc6fde636038c75a918aa2aa7082265ea6ccc1f2380c59a5d6b85794d4be136ecca620dee85a87e5dc94b07814d36fb3bc698e546ef8ef4304f4ac49e2ca106db6229d808b98feb76ca2bacb6d08bae4f0442c031e4838d68babf72cbeed07f5c9b3c318f27212e12519e7434fc4a36ec32415d39cd0545701df1643f2261cee180b590c88a67480df8d770fa50811bea8a4047e8e72c140354d5630f39002e5fae847e670e8a71e49fe41dc3a90d5e0e6519230f4f0cfc6289f7d94b3d923dd9e445b4e723d652cb0a28c4903356c960e5abd4f1dd5e53864053b6881bf00000000000000000000000000000000000000000000000000000000000000012e0a8d9f0ffbf6bd32ed84839f22fe86183955e330dc32c71a7bb91a8a4a1ea906db2b670bae0f9bbe78fe5831cb3d5b04d3772ce8bbebe3f2203afdf3226d4319c919e92c8f35440c255be3c1e0ec605a4a135602e9a9e28fa7b130b5a2d9cf126cee39684d877a577301b4523586d60643692cfce5a9b7739577dbb270292b237d2e53bb5a536cf096398a8bd37e9cdbab0bef75d41538a932b30763261e1917e1b18cad3ae3eb8d2b6c72b0a0ac6131985a9bca46c5cdc5a690aae80633871e8f1e8706a972a124da6864dec1780e2628af87e2e2e1a246b3a4aead2ed5420ad699156b44b28089c1e001f56025927f44811f16da5e1627ed76aeec0476c50ad52cc72bdc305d4f95136e84aeb351bde85c5bcd61376252a762b25922fa0d2a78e5a89489bd3ca3ab1044d586d2ce1ecb3e67fb34f6c0f17b7c04ec7b6ccd00cfab3aa4660176290472248fb2e65dffe64c78735c0450bfd751a5df4f6cc22d23ce481ea6694d4e838d9ee90896d5e8dd1d383ceff8f0b1663adc5423cb801fef7f6ce0ae102ffefa790f3205392215e69fb6da0b188db31b7184ac3231af0450ecdcba2d09b5a928f1fe9a0c5b86c93cab01a3ff6a9b6ced1a08d112cf0b241f916f1326df53e6f0a378779d1858acd187eb4313bb47beb55942f5af3d5f0edd784e862c678e020bd222dbea1d8915c3ed46bc73ab0ea69b3df2438c513710f81e94e27dd8c81fe3a2ec350ce18b48c72927f4703ce2ab4915c7feb4ac3508044a522b16938d9fa9bd90a5a0c03aca11e38465f0104c5960420f1dba9a542a3394443534a115c2c1523450a8b9c000bb400e978a5e0c94cf6a87c01b858408062321c2720ef601121f822072883452be1adfb58d50acb9a97bc75fd8564d0997fbf9ad6fd83bdadd4c03a381818736bc0bdadc0a4ab7265102328677abb41a6f8f471fb3072b1710c891959c09ef6304a491d724e66c57760f4a38593c2b"

const expectedAddress = await storageProof.callStatic.attestCryptoPunk420AddressWithHashi(
proof,
// TODO: Generate a wrong incorrectProof
/*const incorrectProof = "0x000000000000000000000000000000000000000000c20a750285a779a8f382940000000000000000000000000000000000000000009040749a7b21fbbbc56ab1000000000000000000000000000000000000000000000cfa5466d74518ec8fc20000000000000000000000000000000000000000005df3478e70672aef4924ce000000000000000000000000000000000000000000231c15e9f1d049b4906f360000000000000000000000000000000000000000000028f4ec9495f4ac35ba99000000000000000000000000000000000000000000b4ea379117dbb72eb018e6000000000000000000000000000000000000000000d02a7285294fc5b3e33ce700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008c7d9b39cd4b8001427b92000000000000000000000000000000000000000000b71a51e053a0d595d1c0950000000000000000000000000000000000000000000018168d68ca1de197cf0700000000000000000000000000000000aa20f7bde5be60603f11a45fc4923aab000000000000000000000000000000007552be775403fc00c2e6b805e6297dbe0000000000000000000000000000000000000000000000000000000000989680000000000000000000000000b47e3cd837ddf8e4c57f05d70ab865de6e193bbb000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53200000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a000000000000000000000000000000000f92f3ad435570e9f610d535ca71c2a400000000000000000000000000000000c5ef34aa438e925fe55dbb614b291b4b00000000000000000000000000000000000000000000000000000000c352b53400000000000000000000000000000000e8b987e036a93539fd6897f53488e56a068289d29f77618bbdcc6c71439a097a276013e033be69d8365ee3f31330cb720f5a67cf836f713e3cd4334b1cddf68091628f397af8834697d383c46ff30bd728a71b966ef58f2085906901b8721c12c6e4bdbfbd944fa61b5f32d6bb3034260f1c347c2c3f76bf78bc1ff9a0db6355644e79f3e61259b78020b867707f1c382496e73fef160560bc27269102bdccfad037b7d73a09041dd7f6b4fb7f3d4875097d4857f9b0dac1f369f688c2299204b75ad707bb2158e7fbd7b8f16e61b9bb10b72622525962ac6189f50c65efb70cdfa8586ece1972885cb62297ad077c45156c7ac61eaf715afcc00f5b294320d4dddf1545d66e2c565646d4bb45894ca50eec1d5a454b34c1a66997bfb222ea87d93f31ff0528662626a46e57e3c19513299b9b6c08ceeb6c74317c2aedf8767c98568c4affe24421a43c70be4423a22128cc3661a3063d8c787b88a83258633eb03a1a1672062cd8e1fa8dd3bb2eff9e1b17d7de9c9a9ccc741cb643c13af808e4ec81e97a33437c3a33cc663972e695289f54201c49bde0b9551fb27fb51d4e6d208b21f99827887fd8ca467c39d13716500b7e73a058379e09d8c79f0a2eda1e699c81042b8e2647f3fe0f0dba677f25a81b7c54b1efe184426530ad1f12ace22255859b8325f97922231b6c1de3fb0610102f9856a361b7fa1a39a96e0bfac9bcd6dcc3ec1ff8e80d9195590d305f147d3c67016e1a6f13a244a0e09082ceb4c54a09cf777197c82a0940dfea287f02d345930ce03b8a1ef30efc65ddf2eaede252f562443888f31747097a7b3956000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020bfc7599b7ad525a7a5c5673f24831cb57330c6368cfee195c2c8e6e2dcdff3328d97b69dd606bb9c58081b1e5b481a14c4a86e8a3b93e2197f2df3c2d6b45ca10c19fd6de9c6c266fe319d317d562028a9c0cc1497aeccc08e06cc261ea9c9f1314a2543e41ccdeb3cf95792cc31597ea54a947345d8d4c777da128946154d710070a5a3b1da94a326debdd3e42fc7f212abbe8d41e9f2255d9b65e671993ae2c745546d019c9d80f35ae33777ea4a0ff2792cf7ca2ad3ec78d408fc6034daa0dc791655fe9900cf082b028e33ab4368df91e47acfd9ba73eb0fb239453eca102c6a7f3a6bdd7696732e0b00eaf8300124236fc661af10d7c8ab44a1227b30e069f109e21b1359543f617314953f5bd0de5cf754ff94a03feb8b628a0d702840452c6cf70191c30a2461ca712b18d1022792aeba142427f2dade8265d50adbe0cfb24eb5762a677de8ed5acbe0654b01894df77a838d58df6ccc6aadea436dc2000649b14adec14afe9f132afc1ab6deb50980cd54915359c9a20fb59127f212700dc6fde636038c75a918aa2aa7082265ea6ccc1f2380c59a5d6b85794d4be136ecca620dee85a87e5dc94b07814d36fb3bc698e546ef8ef4304f4ac49e2ca106db6229d808b98feb76ca2bacb6d08bae4f0442c031e4838d68babf72cbeed07f5c9b3c318f27212e12519e7434fc4a36ec32415d39cd0545701df1643f2261cee180b590c88a67480df8d770fa50811bea8a4047e8e72c140354d5630f39002e5fae847e670e8a71e49fe41dc3a90d5e0e6519230f4f0cfc6289f7d94b3d923dd9e445b4e723d652cb0a28c4903356c960e5abd4f1dd5e53864053b6881bf00000000000000000000000000000000000000000000000000000000000000012e0a8d9f0ffbf6bd32ed84839f22fe86183955e330dc32c71a7bb91a8a4a1ea906db2b670bae0f9bbe78fe5831cb3d5b04d3772ce8bbebe3f2203afdf3226d4319c919e92c8f35440c255be3c1e0ec605a4a135602e9a9e28fa7b130b5a2d9cf126cee39684d877a577301b4523586d60643692cfce5a9b7739577dbb270292b237d2e53bb5a536cf096398a8bd37e9cdbab0bef75d41538a932b30763261e1917e1b18cad3ae3eb8d2b6c72b0a0ac6131985a9bca46c5cdc5a690aae80633871e8f1e8706a972a124da6864dec1780e2628af87e2e2e1a246b3a4aead2ed5420ad699156b44b28089c1e001f56025927f44811f16da5e1627ed76aeec0476c50ad52cc72bdc305d4f95136e84aeb351bde85c5bcd61376252a762b25922fa0d2a78e5a89489bd3ca3ab1044d586d2ce1ecb3e67fb34f6c0f17b7c04ec7b6ccd00cfab3aa4660176290472248fb2e65dffe64c78735c0450bfd751a5df4f6cc22d23ce481ea6694d4e838d9ee90896d5e8dd1d383ceff8f0b1663adc5423cb801fef7f6ce0ae102ffefa790f3205392215e69fb6da0b188db31b7184ac3231af0450ecdcba2d09b5a928f1fe9a0c5b86c93cab01a3ff6a9b6ced1a08d112cf0b241f916f1326df53e6f0a378779d1858acd187eb4313bb47beb55942f5af3d5f0edd784e862c678e020bd222dbea1d8915c3ed46bc73ab0ea69b3df2438c513710f81e94e27dd8c81fe3a2ec350ce18b48c72927f4703ce2ab4915c7feb4ac3508044a522b16938d9fa9bd90a5a0c03aca11e38465f0104c5960420f1dba9a542a3394443534a115c2c1523450a8b9c000bb400e978a5e0c94cf6a87c01b858408062321c2720ef601121f822072883452be1adfb58d50acb9a97bc75fd8564d0997fbf9ad6fd83bdadd4c03a381818736bc0bdadc0a4ab7265102328677abb41a6f8f471fb3072b1710c891959c09ef6304a491d724e66c57760f4a38593c2b"
await expect(storageProof.callStatic.attestCryptoPunk420AddressWithHashi(
incorrectProof,
DOMAIN_ID,
ID_ONE,
blockHashWitness.claimedBlockHash,
[ambAdapter.address, ambAdapter.address],
)
await expect(expectedAddress.toLowerCase()).to.revertedWith("Proof verification failed")
)).to.revertedWith("Proof verification failed")*/
})
})
})

0 comments on commit 7406f7a

Please sign in to comment.