Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ACVM and recompile with latest Noir #1239

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@aztec/circuits.js": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/types": "workspace:^",
"acvm_js": "github:noir-lang/acvm-simulator-wasm#c56eec56f67f90fef90126c5575b85190bdcd1e1",
"acvm_js": "github:noir-lang/acvm-simulator-wasm#b9d9ca9dfc5140839f23998d9466307215607c42",
"levelup": "^5.1.1",
"memdown": "^6.1.1",
"tslib": "^2.4.0"
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/noir-contracts/src/artifacts/child_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions yarn-project/noir-contracts/src/artifacts/lending_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions yarn-project/noir-contracts/src/artifacts/parent_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions yarn-project/noir-contracts/src/artifacts/test_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions yarn-project/noir-contracts/src/artifacts/zk_token_contract.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ contract EasyZkToken {
// Helper function to get the balance of a user ("unconstrained" is a Noir alternative of Solidity's "view" function).
unconstrained fn getBalance(
owner: Field,
) -> pub Field {
) -> Field {
let storage = Storage::init();
let balances = storage.balances;

// Return the sum of all notes in the set.
balance_utils::get_balance(balances.at(owner).storage_slot)
}

unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] {
let note_header = NoteHeader { contract_address, nonce, storage_slot };
compute_note_hash_and_nullifier(ValueNoteInterface, note_header, preimage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ contract EcdsaAccount {
context.finish()
}

unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; ECDSA_PUBLIC_KEY_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; ECDSA_PUBLIC_KEY_NOTE_LEN]) -> [Field; 4] {
assert(storage_slot == 1);
let note_header = NoteHeader { contract_address, nonce, storage_slot };
compute_note_hash_and_nullifier(EcdsaPublicKeyNoteInterface, note_header, preimage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ contract Lending {
inputs: PublicContextInputs,
owner: Field,
amount: Field
) -> Field {
) -> pub Field {
// @todo @LHerskind Transfer tokens into this contract. We can't do it now because too few writes.

call_public_function(inputs.call_context.storage_contract_address, 3009041984, [owner, amount])[0]
Expand All @@ -121,7 +121,7 @@ contract Lending {
inputs: PublicContextInputs,
owner: Field,
amount: Field
) -> Field {
) -> pub Field {
let _void = call_public_function_no_args(inputs.call_context.storage_contract_address, 1259373467)[0];

let storage = Storage::init();
Expand Down Expand Up @@ -159,7 +159,7 @@ contract Lending {
open fn withdraw_public(
inputs: PublicContextInputs,
amount: Field
) -> Field {
) -> pub Field {
// @todo @LHerskind Transfer tokens into this contract. We can't do it now because too few writes.

call_public_function(inputs.call_context.storage_contract_address, 1065861440, [inputs.call_context.msg_sender, amount])[0]
Expand All @@ -170,7 +170,7 @@ contract Lending {
owner: Field,
// recipient: Field,
amount: Field
) -> Field {
) -> pub Field {
// Access control.
let _void = call_public_function_no_args(inputs.call_context.storage_contract_address, 1259373467)[0];

Expand Down Expand Up @@ -217,15 +217,15 @@ contract Lending {
open fn borrow_public(
inputs: PublicContextInputs,
amount: Field
) -> Field {
) -> pub Field {
call_public_function(inputs.call_context.storage_contract_address, 1462609836, [inputs.call_context.msg_sender, amount])[0]
}

open internal fn _borrow(
inputs: PublicContextInputs,
owner: Field,
amount: Field
) -> Field {
) -> pub Field {
// Access control.
let _void = call_public_function_no_args(inputs.call_context.storage_contract_address, 1259373467)[0];

Expand Down Expand Up @@ -283,7 +283,7 @@ contract Lending {
inputs: PublicContextInputs,
owner: Field,
amount: Field
) -> Field {
) -> pub Field {
// @todo @LHerskind Transfer tokens from msg.sender to this contract.
call_public_function(inputs.call_context.storage_contract_address, 3985016136, [owner, amount])[0]
}
Expand All @@ -292,7 +292,7 @@ contract Lending {
inputs: PublicContextInputs,
owner: Field,
amount: Field
) -> Field {
) -> pub Field {
let _void = call_public_function_no_args(inputs.call_context.storage_contract_address, 1259373467)[0];

let storage = Storage::init();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::std::hash::sha256;

// Computes a content hash of a deposit/mint message.
fn get_mint_content_hash(amount: Field, owner_address: Field, canceller: Field) -> pub Field {
fn get_mint_content_hash(amount: Field, owner_address: Field, canceller: Field) -> Field {
let mut hash_bytes: [u8; 100] = [0; 100];
let amount_bytes = amount.to_be_bytes(32);
let recipient_bytes = owner_address.to_be_bytes(32);
Expand Down Expand Up @@ -38,7 +38,7 @@ fn get_mint_content_hash(amount: Field, owner_address: Field, canceller: Field)
}

// Computes a content hash of a withdraw message.
fn get_withdraw_content_hash(amount: Field, recipient: Field, callerOnL1: Field) -> pub Field {
fn get_withdraw_content_hash(amount: Field, recipient: Field, callerOnL1: Field) -> Field {
// Compute the content hash
// Compute sha256(selector || amount || recipient)
// then convert to a single field element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ contract NonNativeToken {
msg_key: Field,
secret: Field,
canceller: Field,
) -> Field {
) -> pub Field {
let storage = Storage::init();
let public_balances = storage.public_balances;

Expand Down Expand Up @@ -317,7 +317,7 @@ contract NonNativeToken {

unconstrained fn getBalance(
owner: Field,
) -> pub Field {
) -> Field {
let storage = Storage::init();
let owner_balance = storage.balances.at(owner);

Expand All @@ -327,7 +327,7 @@ contract NonNativeToken {
// stev function needs to be defined by every contract producing logs. Having it in all the contracts gives us the ability to
// compute the note hash and nullifier differently for different kind of notes.
// Note: "stev" is just a placeholder name before we come up with a better one.
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] {
let note_header = NoteHeader { contract_address, nonce, storage_slot };
compute_note_hash_and_nullifier(ValueNoteInterface, note_header, preimage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ contract PendingCommitments {
// stev function needs to be defined by every contract producing logs. Having it in all the contracts gives us the ability to
// compute the note hash and nullifier differently for different kind of notes.
// Note: "stev" is just a placeholder name before we come up with a better one.
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] {
let note_header = NoteHeader { contract_address, nonce, storage_slot };
compute_note_hash_and_nullifier(ValueNoteInterface, note_header, preimage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract PokeableToken {
// Helper function to get the balance of a user ("unconstrained" is a Noir alternative of Solidity's "view" function).
unconstrained fn getBalance(
sender: Field,
) -> pub Field {
) -> Field {
let storage = Storage::init();

// Get the set of notes owned by the user.
Expand All @@ -129,7 +129,7 @@ contract PokeableToken {
// stev function needs to be defined by every contract producing logs. Having it in all the contracts gives us the ability to
// compute the note hash and nullifier differently for different kind of notes.
// Note: "stev" is just a placeholder name before we come up with a better one.
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] {
let note_header = NoteHeader { contract_address, nonce, storage_slot };
if (storage_slot == 1) | (storage_slot == 2) {
compute_note_hash_and_nullifier(AddressNoteInterface, note_header, preimage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ contract SchnorrMultiKeyAccount {
context.finish()
}

unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; PUBLIC_KEY_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; PUBLIC_KEY_NOTE_LEN]) -> [Field; 4] {
assert(storage_slot == 1);
let note_header = NoteHeader { contract_address, nonce, storage_slot };
compute_note_hash_and_nullifier(PublicKeyNoteInterface, note_header, preimage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract Test {
_inputs: PublicContextInputs,
amount: Field,
secretHash: Field,
) -> Field {
) -> pub Field {

// Create a commitment to the amount
let note = DummyNote::new(amount, secretHash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ contract ZkToken {
// Helper function to get the balance of a user ("unconstrained" is a Noir alternative of Solidity's "view" function).
unconstrained fn getBalance(
owner: Field,
) -> pub Field {
) -> Field {
let storage = Storage::init();

// Get the set of notes owned by the user.
Expand All @@ -169,7 +169,7 @@ contract ZkToken {
// stev function needs to be defined by every contract producing logs. Having it in all the contracts gives us the ability to
// compute the note hash and nullifier differently for different kind of notes.
// Note: "stev" is just a placeholder name before we come up with a better one.
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> pub [Field; 4] {
unconstrained fn stev(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] {
let note_header = NoteHeader { contract_address, nonce, storage_slot };
if (storage_slot == 2) {
compute_note_hash_and_nullifier(ClaimNoteInterface, note_header, preimage)
Expand Down
10 changes: 5 additions & 5 deletions yarn-project/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ __metadata:
"@rushstack/eslint-patch": ^1.1.4
"@types/jest": ^29.5.0
"@types/node": ^18.7.23
acvm_js: "github:noir-lang/acvm-simulator-wasm#c56eec56f67f90fef90126c5575b85190bdcd1e1"
acvm_js: "github:noir-lang/acvm-simulator-wasm#b9d9ca9dfc5140839f23998d9466307215607c42"
jest: ^29.5.0
jest-mock-extended: ^3.0.4
levelup: ^5.1.1
Expand Down Expand Up @@ -3763,10 +3763,10 @@ __metadata:
languageName: node
linkType: hard

"acvm_js@github:noir-lang/acvm-simulator-wasm#c56eec56f67f90fef90126c5575b85190bdcd1e1":
version: 0.0.0-3cc4575
resolution: "acvm_js@https://github.com/noir-lang/acvm-simulator-wasm.git#commit=c56eec56f67f90fef90126c5575b85190bdcd1e1"
checksum: 479e08c328314514d243d4c58ca1aa5284c9098158bfea589d5e27ae3cb6acd38291825bf79b0c0cc4cb3e32d155ac1cc662ff4c2987ceb9a979ddd589310b4e
"acvm_js@github:noir-lang/acvm-simulator-wasm#b9d9ca9dfc5140839f23998d9466307215607c42":
version: 0.0.0-d576736
resolution: "acvm_js@https://github.com/noir-lang/acvm-simulator-wasm.git#commit=b9d9ca9dfc5140839f23998d9466307215607c42"
checksum: ea88c231451e7aeab2ecf4219c062d1193860c5bd782ea1b0d8f778990798a27ab983ae5036e2cb99248cb75d22d961d1dd4b9c1c8c0ce0215e955f00e07944f
languageName: node
linkType: hard

Expand Down