Skip to content
Open
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
3 changes: 0 additions & 3 deletions .claude/skills/bump-aztec-version/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ When everything is green: commit, open a PR to `main`, let CI pass, merge. Then
message-signing/fallback keys, escrow addresses stopped matching. If `get_escrow`/derivation tests
fail, diff the key-derivation constants/`PublicKeys` at the target ref and re-sync. Regenerate the
hardcoded `get_test_vector` hashes.
- The escrow test crate's `utils.nr` duplicates the crate-private TXE oracle `aztec_txe_getPrivateEvents`.
Its return type must match the target's `aztec/src/test/helpers/txe_oracles.nr` exactly (v6:
`BoundedVec<BoundedVec<Field, 10>, 5>`; v5 returned a raw tuple).
- NFT/MultiToken partial notes import aztec-nr domain separators; v6 moved
`DOM_SEP__PARTIAL_NOTE_COMMITMENT` and `DOM_SEP__NOTE_COMPLETION_LOG_TAG` to `aztec::note::partial_note`.
- **Removed CLI commands.** v6 dropped `aztec inspect-contract` (among others); check `scripts/` and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ unconstrained fn share_escrow_success() {
let logic = logic_utils::deploy_logic(&mut env, escrow_class_id);
let escrow = escrow_utils::deploy_escrow_with_secret(&mut env, 1, logic);

// The emitted `EscrowDetailsLogContent` is checked in src/ts/test/escrow.test.ts: aztec-nr exposes no TXE
// reader for private events (aztec-labs-eng/aztec-node#363).
env.call_private(sender, TestLogic::at(logic).share_escrow(recipient, escrow, secret_key));

logic_utils::assert_escrow_details_private_event(logic, recipient, escrow, secret_key);
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
use crate::TestLogic;
use aztec::{
event::{event_interface::EventInterface, EventSelector},
protocol::{
address::AztecAddress,
point::EmbeddedCurvePoint,
public_keys::{IvpkM, PublicKeys},
traits::Serialize,
},
protocol::{address::AztecAddress, point::EmbeddedCurvePoint, public_keys::{IvpkM, PublicKeys}},
test::helpers::test_environment::TestEnvironment,
};
use escrow_contract::types::escrow_details_event::EscrowDetailsLogContent;

// aztec-nr's `txe_oracles::get_private_events` is crate-private, so this duplicates its oracle. The oracle's return
// type (#L187-L192) and these module-private constants (#L42-L43) must match the `aztec` tag in this crate's Nargo.toml:
// https://github.com/aztec-labs-eng/aztec-nr/blob/v6.0.0-rc.1/aztec/src/test/helpers/txe_oracles.nr
global MAX_PRIVATE_EVENTS_PER_TXE_QUERY: u32 = 5;
global MAX_EVENT_SERIALIZATION_LENGTH: u32 = 10;

#[oracle(aztec_txe_getPrivateEvents)]
unconstrained fn get_private_events_oracle(
selector: EventSelector,
contract_address: AztecAddress,
scope: AztecAddress,
) -> BoundedVec<BoundedVec<Field, MAX_EVENT_SERIALIZATION_LENGTH>, MAX_PRIVATE_EVENTS_PER_TXE_QUERY> {}

pub unconstrained fn deploy_logic(
env: &mut TestEnvironment,
Expand Down Expand Up @@ -114,38 +94,3 @@ pub unconstrained fn get_test_vector() -> (PublicKeys, Field, PublicKeys, Field)

(public_keys_1, secret_key_1, public_keys_2, secret_key_2)
}

/// Private events emitted in the last mined transaction, visible to `scope` (the recipient), from `contract_address`.
pub unconstrained fn get_private_events_from_last_tx(
selector: EventSelector,
contract_address: AztecAddress,
scope: AztecAddress,
) -> BoundedVec<BoundedVec<Field, MAX_EVENT_SERIALIZATION_LENGTH>, MAX_PRIVATE_EVENTS_PER_TXE_QUERY> {
std::static_assert(
<EscrowDetailsLogContent as Serialize>::N <= MAX_EVENT_SERIALIZATION_LENGTH,
"EscrowDetailsLogContent::N exceeds MAX_EVENT_SERIALIZATION_LENGTH - sync with aztec-nr txe_oracles and TXE",
);

get_private_events_oracle(selector, contract_address, scope)
}

/// Asserts the last transaction emitted exactly one `EscrowDetailsLogContent` private event to `recipient` from `logic`.
pub unconstrained fn assert_escrow_details_private_event(
logic: AztecAddress,
recipient: AztecAddress,
expected_escrow: AztecAddress,
expected_secret_key: Field,
) {
let selector = EscrowDetailsLogContent::get_event_type_id();
let events = get_private_events_from_last_tx(selector, logic, recipient);
assert_eq(events.len(), 1);

let payload = events.get(0);
let expected =
EscrowDetailsLogContent { escrow: expected_escrow, secret_key: expected_secret_key };
let serialized = expected.serialize();
assert_eq(payload.len(), serialized.len());
for i in 0..serialized.len() {
assert_eq(payload.get(i), serialized[i]);
}
}
Loading