Skip to content

Commit 8b8fe15

Browse files
committed
fix: store merkle proof/root as constant, remove use of RPC in proof gen/verification test
1 parent c59cb41 commit 8b8fe15

File tree

7 files changed

+527
-1392
lines changed

7 files changed

+527
-1392
lines changed

package-lock.json

Lines changed: 399 additions & 1158 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/rln/src/contract/price_calculator.spec.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
11
import { expect, use } from "chai";
22
import chaiAsPromised from "chai-as-promised";
33
import sinon from "sinon";
4-
import { PublicClient } from "viem";
54

65
import { RLNBaseContract } from "./rln_base_contract.js";
76

87
use(chaiAsPromised);
98

109
function createMockRLNBaseContract(
1110
mockContract: any,
12-
<<<<<<< HEAD
1311
mockRpcClient: any
1412
): RLNBaseContract {
1513
const dummy = Object.create(RLNBaseContract.prototype);
1614
dummy.contract = mockContract;
1715
dummy.rpcClient = mockRpcClient;
18-
=======
19-
mockPublicClient: PublicClient
20-
): RLNBaseContract {
21-
const dummy = Object.create(RLNBaseContract.prototype);
22-
dummy.contract = mockContract;
23-
dummy.publicClient = mockPublicClient;
24-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
2516
return dummy as RLNBaseContract;
2617
}
2718

2819
describe("RLNBaseContract.getPriceForRateLimit (unit)", function () {
2920
let mockContract: any;
30-
<<<<<<< HEAD
3121
let mockRpcClient: any;
32-
=======
33-
let mockPublicClient: any;
34-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
3522
let priceCalculatorReadStub: sinon.SinonStub;
3623
let readContractStub: sinon.SinonStub;
3724

@@ -45,11 +32,7 @@ describe("RLNBaseContract.getPriceForRateLimit (unit)", function () {
4532
}
4633
};
4734

48-
<<<<<<< HEAD
4935
mockRpcClient = {
50-
=======
51-
mockPublicClient = {
52-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
5336
readContract: readContractStub
5437
};
5538
});
@@ -66,11 +49,7 @@ describe("RLNBaseContract.getPriceForRateLimit (unit)", function () {
6649
priceCalculatorReadStub.resolves(priceCalculatorAddress);
6750
readContractStub.resolves([fakeToken, fakePrice]);
6851

69-
<<<<<<< HEAD
7052
const rlnBase = createMockRLNBaseContract(mockContract, mockRpcClient);
71-
=======
72-
const rlnBase = createMockRLNBaseContract(mockContract, mockPublicClient);
73-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
7453
const result = await rlnBase.getPriceForRateLimit(20);
7554

7655
expect(result.token).to.equal(fakeToken);
@@ -92,11 +71,7 @@ describe("RLNBaseContract.getPriceForRateLimit (unit)", function () {
9271
priceCalculatorReadStub.resolves(priceCalculatorAddress);
9372
readContractStub.rejects(new Error("fail"));
9473

95-
<<<<<<< HEAD
9674
const rlnBase = createMockRLNBaseContract(mockContract, mockRpcClient);
97-
=======
98-
const rlnBase = createMockRLNBaseContract(mockContract, mockPublicClient);
99-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
10075
await expect(rlnBase.getPriceForRateLimit(20)).to.be.rejectedWith("fail");
10176

10277
expect(priceCalculatorReadStub.calledOnce).to.be.true;
@@ -109,11 +84,7 @@ describe("RLNBaseContract.getPriceForRateLimit (unit)", function () {
10984
priceCalculatorReadStub.resolves(priceCalculatorAddress);
11085
readContractStub.resolves([null, null]);
11186

112-
<<<<<<< HEAD
11387
const rlnBase = createMockRLNBaseContract(mockContract, mockRpcClient);
114-
=======
115-
const rlnBase = createMockRLNBaseContract(mockContract, mockPublicClient);
116-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
11788
const result = await rlnBase.getPriceForRateLimit(20);
11889

11990
expect(result.token).to.be.null;

packages/rln/src/contract/proof.integration.spec.ts

Lines changed: 0 additions & 187 deletions
This file was deleted.

packages/rln/src/contract/types.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
<<<<<<< HEAD
21
import { Address } from "viem";
32

43
import { RpcClient } from "../utils/index.js";
5-
=======
6-
import { Address, PublicClient, WalletClient } from "viem";
7-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
84

95
export type Member = {
106
idCommitment: string;
117
index: bigint;
128
};
139

1410
export interface RLNContractOptions {
15-
<<<<<<< HEAD
1611
rpcClient: RpcClient;
17-
=======
18-
publicClient: PublicClient;
19-
walletClient: WalletClient;
20-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
2112
address: Address;
2213
rateLimit?: number;
2314
}

packages/rln/src/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { createRLN } from "./create.js";
44
import { IdentityCredential } from "./identity.js";
55
import { Keystore } from "./keystore/index.js";
66
import { RLNInstance } from "./rln.js";
7-
<<<<<<< HEAD
87
import { createViemClientFromWindow } from "./utils/index.js";
9-
=======
10-
import { createViemClientsFromWindow } from "./utils/index.js";
11-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
128

139
export {
1410
RLNBaseContract,
@@ -17,11 +13,7 @@ export {
1713
RLNInstance,
1814
IdentityCredential,
1915
RLN_CONTRACT,
20-
<<<<<<< HEAD
2116
createViemClientFromWindow
22-
=======
23-
createViemClientsFromWindow as extractMetaMaskSigner
24-
>>>>>>> a88dd8cdbd (feat: migrate rln from ethers to viem)
2517
};
2618

2719
export {

0 commit comments

Comments
 (0)