open-standards/openpay/crates/op-crypto-extra/tests/cctp_burn_message.rs
Transaction Science 68b8a2dbee ingest wave F: 3 crates · op-crypto-extra + smart-byte-acdc + eoc-memory
OpenPay (1 crate, 3751 LOC, 83 tests)
  op-crypto-extra      Extended crypto rails. Stablecoin catalog (USDC, USDT,
                       PYUSD, DAI, RLUSD, EURC, FDUSD — 26 deployments). L2
                       catalog (12 chains incl. Optimism, Arbitrum, Base,
                       zkSync Era, Polygon zkEVM, Linea, Scroll, Starknet).
                       CCTP v2 BurnMessage encode/decode + domain ids +
                       attestation. ERC-4337 UserOperation v0.7 +
                       PackedUserOperation. EIP-7702 set-EOA-code with RLP
                       signing preimage. Uniswap Permit2 single + batch
                       transfer EIP-712 hashes. EIP-2612 ERC-20 permit.
                       BOLT-11 bech32 invoices + LNURL decode. Bitcoin
                       PSBT v2 (BIP-370). Atomic-swap HTLC. Solana SPL /
                       Aleo / Aztec confidential-transfer sketches.

Smart Byte (1 crate, 2304 LOC, 30 tests)
  smart-byte-acdc      Authentic Chained Data Containers (KERI ecosystem).
                       Acdc + AcdcBuilder (targeted + untargeted) with SAID
                       derivation. JSON Schema 2020-12 validator with
                       oneOf partial-disclosure. TEL (RIP/VRT/ISS/REV)
                       with hash-chained verification. IPEX (apply/offer/
                       agree/grant/admit/spurn) chained by SAID. Edge
                       records (I2I/NI2I/DI2I) + EdgeGraph BFS traversal
                       with cycle detection. Selective disclosure with
                       full/none/subset plans + compact packing.
                       CredentialRegistry trait + InMemoryRegistry over
                       TEL. Composes with smart-byte-core + smart-byte-keri-witness.

EOC (1 crate, 1764 LOC, 16 tests)
  eoc-memory           Long-term memory primitives. Memory trait + MemoryKind +
                       EpisodeId. Episodic event log with TimeIndex range
                       queries. RDF-style Triple store with S/P/O indices.
                       Bounded attention-budget Scratchpad with
                       salience-weighted eviction. Rolling SummaryBuffer +
                       FIFO SlidingWindow. Dream-cycle consolidate()
                       (episodic → semantic). Ebbinghaus forgetting curve
                       with reinforcement. Retriever blending cosine
                       similarity + recency + saturating frequency.
                       MemGpt three-tier shape (Main/Recall/Archival).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 17:28:24 -04:00

65 lines
1.9 KiB
Rust

//! Integration: CCTP v2 burn-message encode / decode.
use op_crypto_extra::cctp::{CctpAttestation, CctpBurnMessage, CctpDomain};
#[test]
fn burn_message_encode_size_is_228_plus_hook() {
let m = CctpBurnMessage::new([0x11; 32], [0x22; 32], 1, [0x33; 32]);
let bytes = m.encode();
assert_eq!(bytes.len(), 228);
let mut m2 = m.clone();
m2.hook_data = vec![0x44; 17];
let bytes2 = m2.encode();
assert_eq!(bytes2.len(), 228 + 17);
}
#[test]
fn domain_ids_match_circle_table() {
assert_eq!(CctpDomain::Ethereum.id(), 0);
assert_eq!(CctpDomain::Avalanche.id(), 1);
assert_eq!(CctpDomain::Optimism.id(), 2);
assert_eq!(CctpDomain::Arbitrum.id(), 3);
assert_eq!(CctpDomain::Solana.id(), 5);
assert_eq!(CctpDomain::Base.id(), 6);
assert_eq!(CctpDomain::Polygon.id(), 7);
assert_eq!(CctpDomain::from_id(42).id(), 42);
}
#[test]
fn encode_decode_round_trip_preserves_all_fields() {
let mut m = CctpBurnMessage::new(
[0xaa; 32],
[0xbb; 32],
500_000_000_000,
[0xcc; 32],
);
m.max_fee = 12_345;
m.expiration_block = 9_000_000;
m.hook_data = b"opaque hook bytes".to_vec();
let bytes = m.encode();
let decoded = CctpBurnMessage::decode(&bytes).unwrap();
assert_eq!(decoded, m);
}
#[test]
fn attestation_layout_check_signature_multiples_of_65() {
// Three-attestor: 195 bytes.
let att = CctpAttestation::new(vec![0xaa; 195], vec![1, 2, 3]);
att.check_layout().expect("3-attestor sig should pass");
// Bad: 130 bytes (= 2 * 65, OK).
let two = CctpAttestation::new(vec![0xaa; 130], vec![1, 2, 3]);
two.check_layout().expect("2-attestor sig should pass");
// 131 is not a multiple of 65.
let bad = CctpAttestation::new(vec![0xaa; 131], vec![1]);
assert!(bad.check_layout().is_err());
}
#[test]
fn cannot_decode_truncated() {
let res = CctpBurnMessage::decode(&[0u8; 100]);
assert!(res.is_err());
}