mirror of
https://github.com/privacy-scaling-explorations/zk-kit.git
synced 2026-04-22 03:00:15 -04:00
refactor(lazytower.sol): rename the task from deploy-ht-test to deploy-lazytower-test
This commit is contained in:
@@ -65,19 +65,19 @@ yarn add @zk-kit/lazytower.sol
|
||||
|
||||
pragma solidity ^0.8.4;
|
||||
|
||||
import "../LazyTower.sol";
|
||||
import "../LazyTowerHashChain.sol";
|
||||
|
||||
contract LazyTowerTest {
|
||||
using LazyTower for LazyTowerData;
|
||||
contract LazyTowerHashChainTest {
|
||||
using LazyTowerHashChain for LazyTowerHashChainData;
|
||||
|
||||
// LazyTower may emit multiple events in a singal add() call
|
||||
event Add(uint8 indexed level, uint64 indexed lvFullIndex, uint256 value);
|
||||
event Add(uint256 item);
|
||||
|
||||
// map for multiple test cases
|
||||
mapping(bytes32 => LazyTowerData) public towers;
|
||||
mapping(bytes32 => LazyTowerHashChainData) public towers;
|
||||
|
||||
function add(bytes32 _towerId, uint256 _item) external {
|
||||
towers[_towerId].add(_item);
|
||||
emit Add(_item);
|
||||
}
|
||||
|
||||
function getDataForProving(bytes32 _towerId)
|
||||
@@ -101,7 +101,7 @@ contract LazyTowerTest {
|
||||
import { Contract } from "ethers"
|
||||
import { task, types } from "hardhat/config"
|
||||
|
||||
task("deploy:ht-test", "Deploy a LazyTowerTest contract")
|
||||
task("deploy:lazytower-test", "Deploy a LazyTowerHashChainTest contract")
|
||||
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
|
||||
.setAction(async ({ logs }, { ethers }): Promise<Contract> => {
|
||||
const PoseidonT3Factory = await ethers.getContractFactory("PoseidonT3")
|
||||
@@ -111,7 +111,7 @@ task("deploy:ht-test", "Deploy a LazyTowerTest contract")
|
||||
console.info(`PoseidonT3 library has been deployed to: ${PoseidonT3.address}`)
|
||||
}
|
||||
|
||||
const LazyTowerLibFactory = await ethers.getContractFactory("LazyTower", {
|
||||
const LazyTowerLibFactory = await ethers.getContractFactory("LazyTowerHashChain", {
|
||||
libraries: {
|
||||
PoseidonT3: PoseidonT3.address
|
||||
}
|
||||
@@ -121,12 +121,12 @@ task("deploy:ht-test", "Deploy a LazyTowerTest contract")
|
||||
await lazyTowerLib.deployed()
|
||||
|
||||
if (logs) {
|
||||
console.info(`LazyTower library has been deployed to: ${lazyTowerLib.address}`)
|
||||
console.info(`LazyTowerHashChain library has been deployed to: ${lazyTowerLib.address}`)
|
||||
}
|
||||
|
||||
const ContractFactory = await ethers.getContractFactory("LazyTowerTest", {
|
||||
const ContractFactory = await ethers.getContractFactory("LazyTowerHashChainTest", {
|
||||
libraries: {
|
||||
LazyTower: lazyTowerLib.address
|
||||
LazyTowerHashChain: lazyTowerLib.address
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import "../LazyTowerHashChain.sol";
|
||||
contract LazyTowerHashChainTest {
|
||||
using LazyTowerHashChain for LazyTowerHashChainData;
|
||||
|
||||
// LazyTower may emit multiple events in a singal add() call
|
||||
event Add(uint256 item);
|
||||
|
||||
// map for multiple test cases
|
||||
|
||||
@@ -3,7 +3,7 @@ import { config as dotenvConfig } from "dotenv"
|
||||
import { HardhatUserConfig } from "hardhat/config"
|
||||
import { resolve } from "path"
|
||||
import { config } from "./package.json"
|
||||
import "./tasks/deploy-ht-test"
|
||||
import "./tasks/deploy-lazytower-test"
|
||||
|
||||
dotenvConfig({ path: resolve(__dirname, "./.env") })
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Contract } from "ethers"
|
||||
import { task, types } from "hardhat/config"
|
||||
|
||||
task("deploy:ht-test", "Deploy a LazyTowerTest contract")
|
||||
task("deploy:lazytower-test", "Deploy a LazyTowerHashChainTest contract")
|
||||
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
|
||||
.setAction(async ({ logs }, { ethers }): Promise<Contract> => {
|
||||
const PoseidonT3Factory = await ethers.getContractFactory("PoseidonT3")
|
||||
@@ -9,7 +9,7 @@ describe("LazyTowerHashChainTest", () => {
|
||||
let contract: Contract
|
||||
|
||||
before(async () => {
|
||||
contract = await run("deploy:ht-test", { logs: false })
|
||||
contract = await run("deploy:lazytower-test", { logs: false })
|
||||
})
|
||||
|
||||
it("Should produce correct levelLengths, digests and digest of digests", async () => {
|
||||
|
||||
Reference in New Issue
Block a user