tests: migrated all goerli tests to sepolia; contracts and config

This commit is contained in:
Richard Moore 2024-04-17 01:08:25 -04:00
parent 8220090c20
commit 631aa1d91f
8 changed files with 52 additions and 36 deletions

@ -20,7 +20,7 @@ interface ProviderCreator {
create: (network: string) => null | AbstractProvider; create: (network: string) => null | AbstractProvider;
}; };
const ethNetworks = [ "default", "mainnet", "goerli" ]; const ethNetworks = [ "default", "mainnet", "sepolia" ];
//const maticNetworks = [ "matic", "maticmum" ]; //const maticNetworks = [ "matic", "maticmum" ];
const ProviderCreators: Array<ProviderCreator> = [ const ProviderCreators: Array<ProviderCreator> = [

@ -11,7 +11,9 @@ import type { ContractEventPayload, ContractEventName, Log } from "../index.js";
setupProviders(); setupProviders();
describe("Test Contract", function() { describe("Test Contract", function() {
const addr = "0x99417252Aad7B065940eBdF50d665Fb8879c5958"; const addr = "0x24264C81146c23bbF83Db1d3F87d2111C2935Ffa";
const networkName = "sepolia";
const abi = [ const abi = [
"error CustomError1(uint256 code, string message)", "error CustomError1(uint256 code, string message)",
@ -30,7 +32,7 @@ describe("Test Contract", function() {
it("tests contract calls", async function() { it("tests contract calls", async function() {
this.timeout(10000); this.timeout(10000);
const provider = getProvider("InfuraProvider", "goerli"); const provider = getProvider("InfuraProvider", networkName);
const contract = new Contract(addr, abi, provider); const contract = new Contract(addr, abi, provider);
assert.equal(await contract.testCallAdd(4, 5), BigInt(9), "testCallAdd(4, 5)"); assert.equal(await contract.testCallAdd(4, 5), BigInt(9), "testCallAdd(4, 5)");
@ -40,7 +42,7 @@ describe("Test Contract", function() {
it("tests events", async function() { it("tests events", async function() {
this.timeout(60000); this.timeout(60000);
const provider = getProvider("InfuraProvider", "goerli"); const provider = getProvider("InfuraProvider", networkName);
assert.ok(provider); assert.ok(provider);
const contract = new Contract(addr, abi, provider); const contract = new Contract(addr, abi, provider);
@ -49,7 +51,7 @@ describe("Test Contract", function() {
const contractSigner = <any>contract.connect(signer); const contractSigner = <any>contract.connect(signer);
const vUint256 = 42; const vUint256 = 42;
const vAddrName = "ethers.eth"; const vAddrName = "tests.eth";
const vAddr = "0x228568EA92aC5Bc281c1E30b1893735c60a139F1"; const vAddr = "0x228568EA92aC5Bc281c1E30b1893735c60a139F1";
const vString = "Hello"; const vString = "Hello";
const vBytes = "0x12345678"; const vBytes = "0x12345678";
@ -260,8 +262,10 @@ describe("Test Typed Contract Interaction", function() {
abi.push(`function testTyped(bytes memory) public pure returns (string memory)`); abi.push(`function testTyped(bytes memory) public pure returns (string memory)`);
abi.push(`function testTyped(string memory) public pure returns (string memory)`); abi.push(`function testTyped(string memory) public pure returns (string memory)`);
const addr = "0x838f41545DA5e18AA0e1ab391085d22E172B7B02"; const addr = "0xf20ba47c47a32fc2d9ad846ff06f2fa6e89eec74";
const provider = getProvider("InfuraProvider", "goerli"); const networkName = "sepolia";
const provider = getProvider("InfuraProvider", networkName);
const contract = new Contract(addr, abi, provider); const contract = new Contract(addr, abi, provider);
for (const { types, valueFunc } of tests) { for (const { types, valueFunc } of tests) {
@ -446,7 +450,8 @@ describe("Test Contract Fallback", function() {
}, },
]; ];
const provider = getProvider("InfuraProvider", "goerli"); const networkName = "sepolia";
const provider = getProvider("InfuraProvider", networkName);
const testGroups: Array<{ group: "sendNone" | "sendData" | "sendValue" | "sendDataAndValue", tx: any }> = [ const testGroups: Array<{ group: "sendNone" | "sendData" | "sendValue" | "sendDataAndValue", tx: any }> = [
{ {

@ -6,13 +6,13 @@ setupProviders();
describe("Resolve ENS avatar", function() { describe("Resolve ENS avatar", function() {
[ [
{ title: "data", name: "data-avatar.tests.ethers.eth", value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1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G9jdW1lbnRJRD0ieG1wLmRpZDo1RDg1MTI1QTI4QjAxMUVDODQ1MEM1NTZEOTU1MDk3OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkbM0uMAAAAGUExURQAA/wAAAHtivz4AAAAOSURBVHjaYmDABAABBgAAFAABaEkyYwAAAABJRU5ErkJggg==" },
{ title: "ipfs", name: "ipfs-avatar.tests.ethers.eth", value: "https:/\/gateway.ipfs.io/ipfs/QmQsQgpda6JAYkFoeVcj5iPbwV3xRcvaiXv3bhp1VuYUqw" }, { title: "ipfs", name: "ipfs-avatar.tests.eth", value: "https:/\/gateway.ipfs.io/ipfs/QmQsQgpda6JAYkFoeVcj5iPbwV3xRcvaiXv3bhp1VuYUqw" },
{ title: "url", name: "url-avatar.tests.ethers.eth", value: "https:/\/ethers.org/static/logo.png" }, { title: "url", name: "url-avatar.tests.eth", value: "https:/\/ethers.org/static/logo.png" },
].forEach((test) => { ].forEach((test) => {
it(`Resolves avatar for ${ test.title }`, async function() { it(`Resolves avatar for ${ test.title }`, async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect("sepolia");
const avatar = await provider.getAvatar(test.name); const avatar = await provider.getAvatar(test.name);
assert.equal(test.value, avatar, "avatar url"); assert.equal(test.value, avatar, "avatar url");
}); });

@ -23,13 +23,15 @@ describe("Test CCIP execution", function() {
assert.equal(result, keccak256(check), "response is equal"); assert.equal(result, keccak256(check), "response is equal");
} }
const address = "0x6C5ed35574a9b4d163f75bBf0595F7540D8FCc2d"; const address = "0xaeaa06a37e6421ac63120d6daddee0ffa04b43e8";
const networkName = "sepolia";
const calldata = "0x1234"; const calldata = "0x1234";
it("testGet passes under normal operation", async function() { it("testGet passes under normal operation", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testGet(bytes callData = "0x1234") // testGet(bytes callData = "0x1234")
const tx = { const tx = {
@ -44,7 +46,7 @@ describe("Test CCIP execution", function() {
it("testGet should fail with CCIP not explicitly enabled by overrides", async function() { it("testGet should fail with CCIP not explicitly enabled by overrides", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testGet(bytes callData = "0x1234") // testGet(bytes callData = "0x1234")
const tx = { const tx = {
@ -56,7 +58,11 @@ describe("Test CCIP execution", function() {
const result = await provider.call(tx); const result = await provider.call(tx);
console.log(result); console.log(result);
}, (error: unknown) => { }, (error: unknown) => {
const offchainErrorData = "0x556f18300000000000000000000000006c5ed35574a9b4d163f75bbf0595f7540d8fcc2d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; const offchainErrorData = concat([
"0x556f1830000000000000000000000000",
address,
"0x00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"
]);
return (isCallException(error) && error.data === offchainErrorData); return (isCallException(error) && error.data === offchainErrorData);
}); });
}); });
@ -64,7 +70,7 @@ describe("Test CCIP execution", function() {
it("testGet should fail with CCIP explicitly disabled on provider", async function() { it("testGet should fail with CCIP explicitly disabled on provider", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
provider.disableCcipRead = true; provider.disableCcipRead = true;
// testGetFail(bytes callData = "0x1234") // testGetFail(bytes callData = "0x1234")
@ -77,7 +83,12 @@ describe("Test CCIP execution", function() {
const result = await provider.call(tx); const result = await provider.call(tx);
console.log(result); console.log(result);
}, (error: unknown) => { }, (error: unknown) => {
const offchainErrorData = "0x556f18300000000000000000000000006c5ed35574a9b4d163f75bbf0595f7540d8fcc2d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; const offchainErrorData = concat([
"0x556f1830000000000000000000000000",
address,
"0x00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"
]);
return (isCallException(error) && error.data === offchainErrorData); return (isCallException(error) && error.data === offchainErrorData);
}); });
}); });
@ -85,7 +96,7 @@ describe("Test CCIP execution", function() {
it("testGetFail should fail if all URLs 5xx", async function() { it("testGetFail should fail if all URLs 5xx", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testGetFail(bytes callData = "0x1234") // testGetFail(bytes callData = "0x1234")
const tx = { const tx = {
@ -106,7 +117,7 @@ describe("Test CCIP execution", function() {
it("testGetSenderFail should fail if sender does not match", async function() { it("testGetSenderFail should fail if sender does not match", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testGetSenderFail(bytes callData = "0x1234") // testGetSenderFail(bytes callData = "0x1234")
const tx = { const tx = {
@ -131,7 +142,7 @@ describe("Test CCIP execution", function() {
it("testGetMissing should fail if early URL 4xx", async function() { it("testGetMissing should fail if early URL 4xx", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testGetMissing(bytes callData = "0x1234") // testGetMissing(bytes callData = "0x1234")
const tx = { const tx = {
@ -153,7 +164,7 @@ describe("Test CCIP execution", function() {
it("testGetFallback passes if any URL returns correctly", async function() { it("testGetFallback passes if any URL returns correctly", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testGetFallback(bytes callData = "0x1234") // testGetFallback(bytes callData = "0x1234")
const tx = { const tx = {
@ -168,7 +179,7 @@ describe("Test CCIP execution", function() {
it("testPost passes under normal operation", async function() { it("testPost passes under normal operation", async function() {
this.timeout(60000); this.timeout(60000);
const provider = connect("goerli"); const provider = connect(networkName);
// testPost(bytes callData = "0x1234") // testPost(bytes callData = "0x1234")
const tx = { const tx = {

@ -244,13 +244,13 @@ describe("Test Provider Transaction operations", function() {
describe("Test Networks", function() { describe("Test Networks", function() {
const networks = [ const networks = [
"mainnet", "goerli", "sepolia", "holesky", "mainnet", "sepolia", "holesky",
"arbitrum", "arbitrum-goerli", "arbitrum-sepolia", "arbitrum", "arbitrum-sepolia",
"base", "base-goerli", "base-sepolia", "base", "base-sepolia",
"bnb", "bnbt", "bnb", "bnbt",
"linea", "linea-goerli", "linea", "linea-sepolia",
"matic", "matic-mumbai", "matic", "matic-mumbai", "matic-amoy",
"optimism", "optimism-goerli", "optimism-sepolia", "optimism", "optimism-sepolia",
"xdai", "xdai",
]; ];

@ -42,9 +42,9 @@ describe("Tests Provider Call Exception", function() {
//{ code: 0x51, reason: "UNINITIALIZED_FUNCTION_CALL" }, //{ code: 0x51, reason: "UNINITIALIZED_FUNCTION_CALL" },
]; ];
const testAddr = "0xF20Ba47c47a32fc2d9ad846fF06f2fa6e89eeC74"; const testAddr = "0x86d19fF4b2EB0D451511B5B930b01DC71fD9a2Ee";
const networkName = "sepolia";
const networkName = "goerli";
for (const { code, reason } of panics) { for (const { code, reason } of panics) {
for (const method of [ "call", "estimateGas" ]) { for (const method of [ "call", "estimateGas" ]) {
for (const providerName of providerNames) { for (const providerName of providerNames) {
@ -166,7 +166,7 @@ describe("Tests Provider Call Exception", function() {
describe("Test Provider Blockchain Errors", function() { describe("Test Provider Blockchain Errors", function() {
const wallet = new Wallet(<string>(process.env.FAUCET_PRIVATEKEY)); const wallet = new Wallet(<string>(process.env.FAUCET_PRIVATEKEY));
const networkName = "goerli"; const networkName = "sepolia";
for (const providerName of providerNames) { for (const providerName of providerNames) {
const provider = getProvider(providerName, networkName); const provider = getProvider(providerName, networkName);

@ -17,7 +17,7 @@ describe("Sends Transactions", function() {
const wallet = new Wallet(<string>(process.env.FAUCET_PRIVATEKEY)); const wallet = new Wallet(<string>(process.env.FAUCET_PRIVATEKEY));
console.log("Faucet Address:", wallet.address); console.log("Faucet Address:", wallet.address);
const networkName = "goerli"; const networkName = "sepolia";
for (const providerName of providerNames) { for (const providerName of providerNames) {
const provider = getProvider(providerName, networkName); const provider = getProvider(providerName, networkName);
if (provider == null) { continue; } if (provider == null) { continue; }

@ -5,7 +5,7 @@ import { connect, setupProviders } from "./create-provider.js";
setupProviders(); setupProviders();
describe("Test EIP-2544 ENS wildcards", function() { describe("Test EIP-2544 ENS wildcards", function() {
const provider = connect("goerli"); const provider = connect("sepolia");
it("Resolves recursively", async function() { it("Resolves recursively", async function() {
this.timeout(10000); this.timeout(10000);
@ -13,13 +13,13 @@ describe("Test EIP-2544 ENS wildcards", function() {
const resolver = await provider.getResolver("ricmoose.hatch.eth"); const resolver = await provider.getResolver("ricmoose.hatch.eth");
assert.ok(resolver, "failed to get resolver"); assert.ok(resolver, "failed to get resolver");
assert.equal(resolver.address, "0x15abA1fa74Bfdecd63A71218DC632d4328Db8168", "address"); assert.equal(resolver.address, "0x657D81B1E647A56457ff035Af22898411673f7FD", "address");
assert.equal(await resolver.supportsWildcard(), true, "supportsWildcard()"); assert.equal(await resolver.supportsWildcard(), true, "supportsWildcard()");
// Test pass-through avatar // Test pass-through avatar
assert.equal(await resolver.getAvatar(), "https:/\/static.ricmoo.com/uploads/profile-06cb9c3031c9.jpg", "getAvatar()"); assert.equal(await resolver.getAvatar(), "https:/\/static.ricmoo.com/uploads/profile-06cb9c3031c9.jpg", "getAvatar()");
assert.equal(await resolver.getAddress(), "0x4B711A377B1b3534749FBe5e59Bcf7F94d92EA98", "getAddress()"); assert.equal(await resolver.getAddress(), "0xF0d6e3fC0f5A23aAAA4933700438b6313Dd331bD", "getAddress()");
}); });
}); });