Skip to content

Commit

Permalink
refactor: add new errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran committed Jun 28, 2024
1 parent 06bb0ea commit 63682a7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion miden-tx/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ const ERR_ACCOUNT_ID_INSUFFICIENT_NUMBER_OF_ONES: u32 = 131132;
const ERR_ACCOUNT_MUST_BE_A_FAUCET_TO_CALL_PROCEDURE: u32 = 131073; // 131073 0x00020001
const ERR_ACCOUNT_NONCE_INCREASE_MUST_BE_U32_VALUE: u32 = 131131; // 131131 0x0002003B
const ERR_ACCOUNT_POW_IS_INSUFFICIENT: u32 = 131135; // 131135 0x0002003F
const ERR_ACCOUNT_READING_MAP_VALUE_FROM_NON_MAP_SLOT: u32 = 131145; // 131145 0x00020049
const ERR_ACCOUNT_SEED_DIGEST_MISMATCH: u32 = 131134; // 131134 0x0002003E
const ERR_ACCOUNT_SETTING_MAP_ITEM_ON_NON_MAP_SLOT: u32 = 131144; // 131144 0x00020048
const ERR_ACCOUNT_SETTING_NON_VALUE_ITEM_ON_VALUE_SLOT: u32 = 131143; // 131143 0x00020047

// --- NONCE ERROR --------------------------------------------------------------------------------
const ERR_NONCE_DID_NOT_INCREASE_AFTER_STATE_CHANGED: u32 = 131081; // 131081 0x00020009
Expand Down Expand Up @@ -226,6 +229,7 @@ const ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_ASSETS_FROM_INCORRECT_CONTEXT: u32 = 13111
const ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_INPUTS_FROM_INCORRECT_CONTEXT: u32 = 131113; // 131113 0x00020029
const ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_SENDER_FROM_INCORRECT_CONTEXT: u32 = 131111; // 131111 0x00020027
const ERR_NOTE_DATA_DOES_NOT_MATCH_COMMITMENT: u32 = 131136; // 131136 0x00020040
const ERR_NOTE_INVALID_INDEX: u32 = 131154; // 131154 0x00020052
const ERR_NOTE_INVALID_TYPE: u32 = 131140; // 131140 0x00020044
const ERR_NOTE_TAG_HIGH_BITS_MUST_BE_ZERO: u32 = 131142; // 131142 0x00020046
const ERR_NOTE_TYPE_TAG_PREFIX_IS_INVALID: u32 = 131141; // 131141 0x00020045
Expand Down Expand Up @@ -277,7 +281,7 @@ const ERR_SWAP_EXPECTS_EXACTLY_9_NOTE_INPUTS: u32 = 131079;
const ERR_SWAP_REQUIRES_EXACTLY_1_NOTE_ASSET: u32 = 131080; // 131080 0x00020008

#[rustfmt::skip]
pub const ERROR_MESSAGES: [(u32, &str); 71] = [
pub const ERROR_MESSAGES: [(u32, &str); 75] = [
(ERR_ACCOUNT_CODE_MUST_BE_UPDATABLE, stringify!(ERR_ACCOUNT_CODE_MUST_BE_UPDATABLE)),
(ERR_ACCOUNT_ID_INSUFFICIENT_NUMBER_OF_ONES,
stringify!(ERR_ACCOUNT_ID_INVALID_INSUFFICIENT_NUMBER_OF_ONES)),
Expand All @@ -286,7 +290,13 @@ pub const ERROR_MESSAGES: [(u32, &str); 71] = [
(ERR_ACCOUNT_NONCE_INCREASE_MUST_BE_U32_VALUE,
stringify!(ERR_ACCOUNT_NONCE_INCREASE_MUST_BE_U32_VALUE)),
(ERR_ACCOUNT_POW_IS_INSUFFICIENT, stringify!(ERR_ACCOUNT_POW_IS_INSUFFICIENT)),
(ERR_ACCOUNT_READING_MAP_VALUE_FROM_NON_MAP_SLOT,
stringify!(ERR_ACCOUNT_READING_MAP_VALUE_FROM_NON_MAP_SLOT)),
(ERR_ACCOUNT_SEED_DIGEST_MISMATCH, stringify!(ERR_ACCOUNT_SEED_DIGEST_MISMATCH)),
(ERR_ACCOUNT_SETTING_MAP_ITEM_ON_NON_MAP_SLOT,
stringify!(ERR_ACCOUNT_SETTING_MAP_ITEM_ON_NON_MAP_SLOT)),
(ERR_ACCOUNT_SETTING_NON_VALUE_ITEM_ON_VALUE_SLOT,
stringify!(ERR_ACCOUNT_SETTING_NON_VALUE_ITEM_ON_VALUE_SLOT)),

(ERR_NONCE_DID_NOT_INCREASE_AFTER_STATE_CHANGED,
stringify!(ERR_NONCE_DID_NOT_INCREASE_AFTER_STATE_CHANGED)),
Expand Down Expand Up @@ -356,6 +366,7 @@ pub const ERROR_MESSAGES: [(u32, &str); 71] = [
(ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_SENDER_FROM_INCORRECT_CONTEXT,
stringify!(ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_SENDER_FROM_INCORRECT_CONTEXT)),
(ERR_NOTE_DATA_DOES_NOT_MATCH_COMMITMENT, stringify!(ERR_NOTE_DATA_DOES_NOT_MATCH_COMMITMENT)),
(ERR_NOTE_INVALID_INDEX, stringify!(ERR_NOTE_INVALID_INDEX)),
(ERR_NOTE_INVALID_TYPE, stringify!(ERR_NOTE_INVALID_TYPE)),
(ERR_NOTE_TAG_HIGH_BITS_MUST_BE_ZERO, stringify!(ERR_NOTE_TAG_HIGH_BITS_MUST_BE_ZERO)),
(ERR_NOTE_TYPE_TAG_PREFIX_IS_INVALID, stringify!(ERR_NOTE_TYPE_TAG_PREFIX_IS_INVALID)),
Expand Down

0 comments on commit 63682a7

Please sign in to comment.