Skip to content

Commit

Permalink
test: Speedup static_call test (AztecProtocol#6157)
Browse files Browse the repository at this point in the history
Fixing AztecProtocol#6153. 467 -> 99 seconds. The tests were resetting the setup for
every test and then performing operations that do not alter the state ->
setup once and reuse.
  • Loading branch information
LHerskind authored May 3, 2024
1 parent 3ec9303 commit abe8875
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions yarn-project/end-to-end/src/e2e_static_calls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@ describe('e2e_static_calls', () => {
let childContract: ChildContract;
let teardown: () => Promise<void>;

beforeEach(async () => {
beforeAll(async () => {
({ teardown, wallet } = await setup());
});

afterEach(() => teardown());

beforeEach(async () => {
parentContract = await ParentContract.deploy(wallet).send().deployed();
childContract = await ChildContract.deploy(wallet).send().deployed();

// We create a note in the set, such that later reads doesn't fail due to get_notes returning 0 notes
await childContract.methods.private_set_value(42n, wallet.getCompleteAddress().address).send().wait();
});

afterAll(() => teardown());

describe('parent calls child', () => {
it('performs legal private to private static calls', async () => {
// We create a note in the set, so...
await childContract.methods.private_set_value(42n, wallet.getCompleteAddress().address).send().wait();
// ...this call doesn't fail due to get_notes returning 0 notes
await parentContract.methods
.private_static_call(childContract.address, childContract.methods.private_get_value.selector, [
42n,
Expand All @@ -35,9 +32,6 @@ describe('e2e_static_calls', () => {
});

it('performs legal (nested) private to private static calls', async () => {
// We create a note in the set, so...
await childContract.methods.private_set_value(42n, wallet.getCompleteAddress().address).send().wait();
// ...this call doesn't fail due to get_notes returning 0 notes
await parentContract.methods
.private_nested_static_call(childContract.address, childContract.methods.private_get_value.selector, [
42n,
Expand Down

0 comments on commit abe8875

Please sign in to comment.