Skip to content

Commit

Permalink
update migration notes
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Oct 3, 2024
1 parent 768b5ec commit 68758d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
16 changes: 11 additions & 5 deletions docs/docs/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Aztec is in full-speed development. Literally every version breaks compatibility

## TBD

### Changes to public calling convention

Contracts that include public functions (that is, marked with `#[public]`), are required to have a function `public_dispatch(selector: Field)` which acts as an entry point. This will be soon the only public function registered/deployed in contracts. The calling convention is updated so that external calls are made to this function.

If you are writing your contracts using Aztec-nr, there is nothing you need to change. The `public_dispatch` function is automatically generated by the `#[aztec]` macro.

### [Aztec.nr] Renamed `unsafe_rand` to `random`

Since this is an `unconstrained` function, callers are already supposed to include an `unsafe` block, so this function has been renamed for reduced verbosity.
Expand Down Expand Up @@ -64,8 +70,8 @@ contract XYZ {

- numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note_with_keys(&mut context, owner_ovpk_m, owner_ivpk_m, owner));
+ numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note(&mut context, owner_ovpk_m, owner_ivpk_m, owner));

}
```

## 0.56.0

Expand Down Expand Up @@ -208,6 +214,7 @@ export LOG_LEVEL="debug"
- assert(verification == true);
- true
+ std::ecdsa_secp256k1::verify_signature(public_key.x, public_key.y, signature, hashed_message)
```

## 0.49.0

Expand Down Expand Up @@ -406,17 +413,16 @@ struct WithdrawalProcessed {

### [Aztec.nr] rename `encode_and_encrypt_with_keys` to `encode_and_encrypt_note_with_keys`

````diff
```diff
contract XYZ {
- use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_with_keys;
+ use dep::aztec::encrypted_logs::encrypted_note_emission::encode_and_encrypt_note_with_keys;
....

- numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_with_keys(&mut context, owner_ovpk_m, owner_ivpk_m));
+ numbers.at(owner).initialize(&mut new_number).emit(encode_and_encrypt_note_with_keys(&mut context, owner_ovpk_m, owner_ivpk_m));

}

```

### [Aztec.nr] changes to `NoteInterface`

Expand Down Expand Up @@ -469,7 +475,7 @@ These changes were done because having the note hash exposed allowed us to not h
+ (note_hash_for_nullify, nullifier)
+ }
+ }
````
```

### [Aztec.nr] `note_getter` returns `BoundedVec`

Expand Down
4 changes: 4 additions & 0 deletions noir-projects/aztec-nr/aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ impl PrivateContext {
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
// We don't validate or compute it in the circuit because a) it's harder to do with slices, and
// b) this is only temporary.
let args_hash = enqueue_public_function_call_internal(
contract_address,
function_selector,
Expand Down Expand Up @@ -522,6 +524,8 @@ impl PrivateContext {
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
// We don't validate or compute it in the circuit because a) it's harder to do with slices, and
// b) this is only temporary.
let args_hash = set_public_teardown_function_call_internal(
contract_address,
function_selector,
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/simulator/src/client/client_execution_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ export class ClientExecutionContext extends ViewDataOracle {
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
// We don't validate or compute it in the circuit because a) it's harder to do with slices, and
// b) this is only temporary.
const newArgsHash = this.packedValuesCache.pack([
functionSelector.toField(),
...this.packedValuesCache.unpack(argsHash),
Expand Down Expand Up @@ -579,6 +581,8 @@ export class ClientExecutionContext extends ViewDataOracle {
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
// We don't validate or compute it in the circuit because a) it's harder to do with slices, and
// b) this is only temporary.
const newArgsHash = this.packedValuesCache.pack([
functionSelector.toField(),
...this.packedValuesCache.unpack(argsHash),
Expand Down

0 comments on commit 68758d8

Please sign in to comment.