-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
135 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
noir-projects/noir-contracts/contracts/avm_initializer_test_contract/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "avm_initializer_test_contract" | ||
authors = [""] | ||
compiler_version = ">=0.25.0" | ||
type = "contract" | ||
|
||
[dependencies] | ||
aztec = { path = "../../../aztec-nr/aztec" } |
22 changes: 22 additions & 0 deletions
22
noir-projects/noir-contracts/contracts/avm_initializer_test_contract/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
contract AvmInitializerTest { | ||
// Libs | ||
use dep::aztec::state_vars::PublicImmutable; | ||
use dep::aztec::protocol_types::address::AztecAddress; | ||
|
||
struct Storage { | ||
immutable: PublicImmutable<Field>, | ||
} | ||
|
||
/************************************************************************ | ||
* Storage | ||
************************************************************************/ | ||
#[aztec(public-vm)] | ||
#[aztec(initializer)] | ||
fn constructor() { | ||
storage.immutable.initialize(42); | ||
} | ||
|
||
unconstrained fn view_storage_immutable() -> pub Field { | ||
storage.immutable.read() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { type Wallet } from '@aztec/aztec.js'; | ||
import { AvmInitializerTestContract } from '@aztec/noir-contracts.js'; | ||
|
||
import { jest } from '@jest/globals'; | ||
|
||
import { setup } from './fixtures/utils.js'; | ||
|
||
const TIMEOUT = 100_000; | ||
|
||
describe('e2e_avm_initializer', () => { | ||
jest.setTimeout(TIMEOUT); | ||
|
||
let wallet: Wallet; | ||
let avmContact: AvmInitializerTestContract; | ||
let teardown: () => Promise<void>; | ||
|
||
beforeAll(async () => { | ||
({ teardown, wallet } = await setup()); | ||
}, 100_000); | ||
|
||
afterAll(() => teardown()); | ||
|
||
beforeEach(async () => { | ||
avmContact = await AvmInitializerTestContract.deploy(wallet).send().deployed(); | ||
}, 50_000); | ||
|
||
describe('Storage', () => { | ||
it('Read immutable (initialized) storage (Field)', async () => { | ||
expect(await avmContact.methods.view_storage_immutable().view()).toEqual(42n); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters