Skip to content

Commit

Permalink
fix: fix failing tests, also updated hardhat config
Browse files Browse the repository at this point in the history
  • Loading branch information
nutrina committed May 22, 2024
1 parent 4ca79ef commit 55bfd12
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 32 deletions.
35 changes: 23 additions & 12 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ let config: HardhatUserConfig = {
apiURL: "https://api.arbiscan.io/api",
browserURL: "https://arbiscan.io/"
}
},
{
network: "arbitrum-sepolia",
chainId: 421614,
urls: {
apiURL: "https://api-sepolia.arbiscan.io/api",
browserURL: "https://sepolia.arbiscan.io/"
}
}
]
},
Expand All @@ -85,10 +93,10 @@ let config: HardhatUserConfig = {
solidity: {
settings: {
optimizer: {
enabled: true,
runs: 200
enabled: false,
runs: 2
},
viaIR: true
viaIR: false
},

compilers: [
Expand Down Expand Up @@ -137,36 +145,39 @@ if (process.env.DEPLOYER_PRIVATE_KEY && process.env.DEPLOYER_ADDRESS) {
};
}
if (process.env.OP_SEPOLIA_PROVIDER_URL) {
console.log("process.env.OP_SEPOLIA_PROVIDER_URL: ", process.env.OP_SEPOLIA_PROVIDER_URL);
config.networks["optimism-sepolia"] = {
url: process.env.OP_SEPOLIA_PROVIDER_URL as string,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
chainId: 0xaa37dc,
from: process.env.DEPLOYER_ADDRESS as string,
from: process.env.DEPLOYER_ADDRESS as string
// gasPrice: 280000000,
// gasPrice: 9068663
};
}
if (process.env.ARBITRUM_PROVIDER_URL) {
console.log("process.env.ARBITRUM_PROVIDER_URL: ", process.env.ARBITRUM_PROVIDER_URL);
console.log("process.env.DEPLOYER_ADDRESS: ", process.env.DEPLOYER_ADDRESS);
config.networks["arbitrum"] = {
url: process.env.ARBITRUM_PROVIDER_URL as string,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
chainId: 42161,
from: process.env.DEPLOYER_ADDRESS as string,
from: process.env.DEPLOYER_ADDRESS as string
// gasPrice: 280000000,
// gasPrice: 9068663
};
}
if (process.env.ARBITRUM_SEPOLIA_PROVIDER_URL) {
console.log("process.env.ARBITRUM_PROVIDER_URL: ", process.env.ARBITRUM_SEPOLIA_PROVIDER_URL);
console.log("process.env.DEPLOYER_ADDRESS: ", process.env.DEPLOYER_ADDRESS);
config.networks["arbitrum"] = {
console.log(
"process.env.ARBITRUM_PROVIDER_URL: ",
process.env.ARBITRUM_SEPOLIA_PROVIDER_URL
);
console.log(
"process.env.DEPLOYER_ADDRESS: ",
process.env.DEPLOYER_ADDRESS
);
config.networks["arbitrum-sepolia"] = {
url: process.env.ARBITRUM_SEPOLIA_PROVIDER_URL as string,
accounts: [process.env.DEPLOYER_PRIVATE_KEY as string],
chainId: 421614,
from: process.env.DEPLOYER_ADDRESS as string,
from: process.env.DEPLOYER_ADDRESS as string
// gasPrice: 280000000,
// gasPrice: 9068663
};
Expand Down
14 changes: 2 additions & 12 deletions test/GitcoinAttester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "@ethereum-attestation-service/eas-sdk";

import { multiAttestationRequest } from "./helpers/mockAttestations";
import { EAS_CONTRACT_ADDRESS } from "./helpers/verifierTests";

describe("GitcoinAttester", function () {
let gitcoinAttester: any,
Expand All @@ -24,18 +25,7 @@ describe("GitcoinAttester", function () {
// We use loadFixture to run this setup once, snapshot that state,
// and reset Hardhat Network to that snapshot in every test.
async function deployGitcoinAttester() {
// Deployment and ABI: SchemaRegistry.json
// Sepolia

// v0.26

// EAS:
// Contract: 0xC2679fBD37d54388Ce493F1DB75320D236e1815e
// Deployment and ABI: EAS.json
// SchemaRegistry:
// Contract: 0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0
// Deployment and ABI: SchemaRegistry.json
EASContractAddress = "0xC2679fBD37d54388Ce493F1DB75320D236e1815e"; // Sepolia v0.26
EASContractAddress = EAS_CONTRACT_ADDRESS;

// Contracts are deployed using the first signer/account by default
const [
Expand Down
13 changes: 8 additions & 5 deletions test/GitcoinPassportDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";

const providers = [BigInt("111")];

const dayInSeconds = 3600 * 24;

const issuanceDates = [1694628559, 1695047108, 1693498086];
const expirationDates = [1702404559, 1702823108, 1701274086];
const hashes = [
Expand Down Expand Up @@ -274,9 +276,8 @@ describe("GitcoinPassportDecoder", function () {

const currentVersion = await gitcoinPassportDecoder.currentVersion();

const savedProviders = await gitcoinPassportDecoder.getProviders(
currentVersion
);
const savedProviders =
await gitcoinPassportDecoder.getProviders(currentVersion);

expect(savedProviders.length === providers.length);
expect(savedProviders).to.eql(providers);
Expand Down Expand Up @@ -381,7 +382,8 @@ describe("GitcoinPassportDecoder", function () {
data: [
{
recipient: recipientAccount.address,
expirationTime: 1708741995,
expirationTime:
Math.floor(new Date().getTime() / 1000) + 10 * dayInSeconds,
revocable: true,
refUID: ZERO_BYTES32,
data: easEncodePassport(),
Expand All @@ -401,7 +403,8 @@ describe("GitcoinPassportDecoder", function () {
data: [
{
recipient: recipientAccount.address,
expirationTime: 1708741995,
expirationTime:
Math.floor(new Date().getTime() / 1000) + 10 * dayInSeconds,
revocable: true,
refUID: ZERO_BYTES32,
data: easEncodeInvalidStamp(),
Expand Down
5 changes: 2 additions & 3 deletions test/GitcoinResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { encodedData, getScoreAttestation } from "./helpers/mockAttestations";
import { SCHEMA_REGISTRY_ABI } from "./abi/SCHEMA_REGISTRY_ABI";
import { AttestationStruct } from "../typechain-types/contracts/GitcoinResolver";
import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { EAS_SCHEMA_REGISTRY_ADDRESS } from "./helpers/verifierTests";

export const schemaRegistryContractAddress =
process.env.SEPOLIA_SCHEMA_REGISTRY_ADDRESS ||
"0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0";
export const schemaRegistryContractAddress = EAS_SCHEMA_REGISTRY_ADDRESS;

async function registerSchema(
owner: any,
Expand Down

0 comments on commit 55bfd12

Please sign in to comment.