Skip to content

Commit

Permalink
[test] Update capacity test (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytham authored Apr 9, 2024
2 parents 107c94a + 805d2d6 commit a1fb2e2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 25 deletions.
29 changes: 29 additions & 0 deletions client/test/integration/capacityDataQuery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,33 @@ describe("On-chain Data Query scenarios", () => {
const receipt = await axiom.sendQuery();
expect(receipt.status).toBe('success');
}, 180000);

test("256-capacity query", async () => {
const { circuit, compiledCircuit, inputs } = await generateCircuit("capacityDataQuery/size256Header");

const axiom = new Axiom({
circuit: circuit,
compiledCircuit: compiledCircuit,
chainId: "11155111", // Sepolia
provider: process.env.PROVIDER_URI_SEPOLIA as string,
privateKey: process.env.PRIVATE_KEY_SEPOLIA as string,
callback: {
target: "0x4A4e2D8f3fBb3525aD61db7Fc843c9bf097c362e",
},
options: {
overrides: {
validateBuild: false,
},
},
capacity: {
maxOutputs: 256,
maxSubqueries: 256,
},
});
await axiom.init();
await axiom.prove(inputs);
const receipt = await axiom.sendQuery();
// Transaction will be sent successfully but fulfill tx may not succeed
expect(receipt.status).toBe('success');
}, 180000);
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ export interface CircuitInputs {}

export const defaultInputs = {};

export const config = {
capacity: {
maxOutputs: 256,
maxSubqueries: 256,
},
};

export const circuit = async (inputs: CircuitInputs) => {
const blockNumber = 5000000;
for (let i = 0; i < 129; i++) {
for (let i = 0; i < 256; i++) {
const header = await getHeader(blockNumber + i).receiptsRoot();
addToCallback(header);
}
Expand Down
24 changes: 0 additions & 24 deletions client/test/integration/computeQuery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,4 @@ describe("Build ComputeQuery with DataQuery", () => {
expect(args.args[0]).toBe(chainIdOverride);
expect(args.address).toBe(addressOverride);
}, 90000);

test("simple computeQuery with non-default capacity", async () => {
const { circuit, compiledCircuit, inputs } = await generateCircuit("computeQuery/simpleWithCapacity");

const axiom = new Axiom({
circuit: circuit,
compiledCircuit: compiledCircuit,
chainId: "11155111", // Sepolia
provider: process.env.PROVIDER_URI_SEPOLIA as string,
privateKey: process.env.PRIVATE_KEY_SEPOLIA as string,
callback: {
target: "0x4A4e2D8f3fBb3525aD61db7Fc843c9bf097c362e",
},
capacity: {
maxOutputs: 256,
maxSubqueries: 256,
},
});
await axiom.init();
await axiom.prove(inputs);
const receipt = await axiom.sendQuery();
// Transaction will be sent successfully but fulfill tx may not succeed
expect(receipt.status).toBe('success');
}, 90000);
});

0 comments on commit a1fb2e2

Please sign in to comment.