miden_lib/errors/
note_script_errors.rs

1// This file is generated by build.rs, do not modify manually.
2// It is generated by extracting errors from the masm files in the `miden-lib/asm` directory.
3//
4// To add a new error, define a constant in masm of the pattern `const.ERR_<CATEGORY>_...`.
5// Try to fit the error into a pre-existing category if possible (e.g. Account, Prologue,
6// Non-Fungible-Asset, ...).
7//
8// The comment directly above the constant will be interpreted as the error message for that error.
9
10// Note Script errors are in range 0x2c000..0x30000.
11
12// NOTE SCRIPT ERRORS
13// ================================================================================================
14
15/// P2ID script expects exactly 2 note inputs
16pub const ERR_P2ID_WRONG_NUMBER_OF_INPUTS: u32 = 0x2c000;
17/// P2ID's target account address and transaction address do not match
18pub const ERR_P2ID_TARGET_ACCT_MISMATCH: u32 = 0x2c001;
19
20/// P2IDR scripts expect exactly 3 note inputs
21pub const ERR_P2IDR_WRONG_NUMBER_OF_INPUTS: u32 = 0x2c002;
22/// P2IDR's reclaimer is not the original sender
23pub const ERR_P2IDR_RECLAIM_ACCT_IS_NOT_SENDER: u32 = 0x2c003;
24/// P2IDR can not be reclaimed as the transaction's reference block is lower than the reclaim height
25pub const ERR_P2IDR_RECLAIM_HEIGHT_NOT_REACHED: u32 = 0x2c004;
26
27/// SWAP script expects exactly 10 note inputs
28pub const ERR_SWAP_WRONG_NUMBER_OF_INPUTS: u32 = 0x2c005;
29/// SWAP script requires exactly 1 note asset
30pub const ERR_SWAP_WRONG_NUMBER_OF_ASSETS: u32 = 0x2c006;
31
32pub const NOTE_SCRIPT_ERRORS: [(u32, &str); 7] = [
33    (ERR_P2ID_WRONG_NUMBER_OF_INPUTS, "P2ID script expects exactly 2 note inputs"),
34    (ERR_P2ID_TARGET_ACCT_MISMATCH, "P2ID's target account address and transaction address do not match"),
35
36    (ERR_P2IDR_WRONG_NUMBER_OF_INPUTS, "P2IDR scripts expect exactly 3 note inputs"),
37    (ERR_P2IDR_RECLAIM_ACCT_IS_NOT_SENDER, "P2IDR's reclaimer is not the original sender"),
38    (ERR_P2IDR_RECLAIM_HEIGHT_NOT_REACHED, "P2IDR can not be reclaimed as the transaction's reference block is lower than the reclaim height"),
39
40    (ERR_SWAP_WRONG_NUMBER_OF_INPUTS, "SWAP script expects exactly 10 note inputs"),
41    (ERR_SWAP_WRONG_NUMBER_OF_ASSETS, "SWAP script requires exactly 1 note asset"),
42];