Deploy verifier with verifier key per network
This commit is contained in:
parent
903cdf3541
commit
5d2842c69b
|
@ -1,11 +1,9 @@
|
||||||
|
const { loadVerificationKey } = require ("../verifier/verifier.js")
|
||||||
|
|
||||||
module.exports = async ({ deployments, getNamedAccounts }) => {
|
module.exports = async ({ deployments, getNamedAccounts, network }) => {
|
||||||
const { deployer } = await getNamedAccounts()
|
const { deployer } = await getNamedAccounts()
|
||||||
|
const verificationKey = loadVerificationKey(network.name)
|
||||||
// TODO: Add logic to deploy specific version of verifier based on the network: network.tags....
|
await deployments.deploy("Groth16Verifier", { args: [verificationKey], from: deployer })
|
||||||
// The `contract: ...` part allows to fully specify the contract to be
|
|
||||||
// deployed even if they are with the same names.
|
|
||||||
await deployments.deploy("Verifier", { from: deployer, contract: "contracts/verifiers/testing/verifier.sol:Groth16Verifier" })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.tags = ["Verifier"]
|
module.exports.tags = ["Groth16Verifier"]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { expect } = require("chai")
|
const { expect } = require("chai")
|
||||||
const { ethers } = require("hardhat")
|
const { ethers, deployments } = require("hardhat")
|
||||||
const { hexlify, randomBytes } = ethers.utils
|
const { hexlify, randomBytes } = ethers.utils
|
||||||
const {
|
const {
|
||||||
snapshot,
|
snapshot,
|
||||||
|
@ -11,7 +11,7 @@ const {
|
||||||
advanceTimeToForNextBlock,
|
advanceTimeToForNextBlock,
|
||||||
} = require("./evm")
|
} = require("./evm")
|
||||||
const { periodic } = require("./time")
|
const { periodic } = require("./time")
|
||||||
const { loadProof, loadPublicInput, loadVerificationKey } = require("./proof")
|
const { loadProof, loadPublicInput } = require("../verifier/verifier")
|
||||||
const { SlotState } = require("./requests")
|
const { SlotState } = require("./requests")
|
||||||
const binomialTest = require("@stdlib/stats-binomial-test")
|
const binomialTest = require("@stdlib/stats-binomial-test")
|
||||||
const { exampleProof } = require("./examples")
|
const { exampleProof } = require("./examples")
|
||||||
|
@ -30,8 +30,8 @@ describe("Proofs", function () {
|
||||||
await snapshot()
|
await snapshot()
|
||||||
await ensureMinimumBlockHeight(256)
|
await ensureMinimumBlockHeight(256)
|
||||||
const Proofs = await ethers.getContractFactory("TestProofs")
|
const Proofs = await ethers.getContractFactory("TestProofs")
|
||||||
const Verifier = await ethers.getContractFactory("Groth16Verifier")
|
await deployments.fixture(["Groth16Verifier"])
|
||||||
const verifier = await Verifier.deploy(loadVerificationKey("local"))
|
const verifier = await deployments.get("Groth16Verifier")
|
||||||
proofs = await Proofs.deploy(
|
proofs = await Proofs.deploy(
|
||||||
{ period, timeout, downtime },
|
{ period, timeout, downtime },
|
||||||
verifier.address
|
verifier.address
|
||||||
|
@ -159,8 +159,8 @@ describe("Proofs", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("when proofs are required", function () {
|
describe("when proofs are required", function () {
|
||||||
const proof = loadProof("local")
|
const proof = loadProof("hardhat")
|
||||||
const pubSignals = loadPublicInput("local")
|
const pubSignals = loadPublicInput("hardhat")
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
await proofs.setSlotState(slotId, SlotState.Filled)
|
await proofs.setSlotState(slotId, SlotState.Filled)
|
||||||
|
|
Loading…
Reference in New Issue