|
| 1 | +//! Errors that may arise when interacting with the Core Bridge Program. |
| 2 | +
|
| 3 | +use anchor_lang::prelude::error_code; |
| 4 | + |
| 5 | +/// Errors relevant to Core Bridge's malfunction. |
| 6 | +/// |
| 7 | +/// * \>= 0x0 -- General program related. |
| 8 | +/// * \>= 0x10 -- General Core Bridge. |
| 9 | +/// * \>= 0x20 -- General Core Bridge Governance. |
| 10 | +/// * \>= 0x100 -- Legacy Post Message. |
| 11 | +/// * \>= 0x200 -- Legacy Post VAA. |
| 12 | +/// * \>= 0x300 -- Legacy Set Message Fee. |
| 13 | +/// * \>= 0x400 -- Legacy Transfer Fees. |
| 14 | +/// * \>= 0x500 -- Legacy Upgrade Contract. |
| 15 | +/// * \>= 0x600 -- Legacy Guardian Set Update. |
| 16 | +/// * \>= 0x700 -- Legacy Verify Signatures. |
| 17 | +/// * \>= 0x800 -- Legacy Post Message Unreliable. |
| 18 | +/// * \>= 0x1000 -- Core Bridge Anchor Instruction. |
| 19 | +/// * \>= 0x2000 -- Core Bridge SDK. |
| 20 | +/// |
| 21 | +/// NOTE: All of these error codes when triggered are offset by `ERROR_CODE_OFFSET` (6000). So for |
| 22 | +/// example, `U64Overflow` will return as 6006. |
| 23 | +#[error_code] |
| 24 | +pub enum CoreBridgeError { |
| 25 | + #[msg("InvalidInstructionArgument")] |
| 26 | + InvalidInstructionArgument = 0x2, |
| 27 | + |
| 28 | + #[msg("AccountNotZeroed")] |
| 29 | + AccountNotZeroed = 0x3, |
| 30 | + |
| 31 | + #[msg("InvalidDataConversion")] |
| 32 | + InvalidDataConversion = 0x4, |
| 33 | + |
| 34 | + #[msg("U64Overflow")] |
| 35 | + U64Overflow = 0x6, |
| 36 | + |
| 37 | + #[msg("InvalidComputeSize")] |
| 38 | + InvalidComputeSize = 0x8, |
| 39 | + |
| 40 | + #[msg("InvalidChain")] |
| 41 | + InvalidChain = 0x10, |
| 42 | + |
| 43 | + #[msg("InvalidGovernanceEmitter")] |
| 44 | + InvalidGovernanceEmitter = 0x20, |
| 45 | + |
| 46 | + #[msg("InvalidGovernanceAction")] |
| 47 | + InvalidGovernanceAction = 0x22, |
| 48 | + |
| 49 | + #[msg("LatestGuardianSetRequired")] |
| 50 | + LatestGuardianSetRequired = 0x24, |
| 51 | + |
| 52 | + #[msg("GovernanceForAnotherChain")] |
| 53 | + GovernanceForAnotherChain = 0x26, |
| 54 | + |
| 55 | + #[msg("InvalidGovernanceVaa")] |
| 56 | + InvalidGovernanceVaa = 0x28, |
| 57 | + |
| 58 | + #[msg("InsufficientFees")] |
| 59 | + InsufficientFees = 0x100, |
| 60 | + |
| 61 | + #[msg("EmitterMismatch")] |
| 62 | + EmitterMismatch = 0x102, |
| 63 | + |
| 64 | + #[msg("NotReadyForPublishing")] |
| 65 | + NotReadyForPublishing = 0x104, |
| 66 | + |
| 67 | + #[msg("InvalidPreparedMessage")] |
| 68 | + InvalidPreparedMessage = 0x106, |
| 69 | + |
| 70 | + #[msg("ExecutableEmitter")] |
| 71 | + ExecutableEmitter = 0x108, |
| 72 | + |
| 73 | + #[msg("LegacyEmitter")] |
| 74 | + LegacyEmitter = 0x10a, |
| 75 | + |
| 76 | + #[msg("InvalidSignatureSet")] |
| 77 | + InvalidSignatureSet = 0x200, |
| 78 | + |
| 79 | + #[msg("InvalidMessageHash")] |
| 80 | + InvalidMessageHash = 0x202, |
| 81 | + |
| 82 | + #[msg("NoQuorum")] |
| 83 | + NoQuorum, |
| 84 | + |
| 85 | + #[msg("MessageMismatch")] |
| 86 | + MessageMismatch = 0x204, |
| 87 | + |
| 88 | + #[msg("NotEnoughLamports")] |
| 89 | + NotEnoughLamports = 0x400, |
| 90 | + |
| 91 | + #[msg("InvalidFeeRecipient")] |
| 92 | + InvalidFeeRecipient = 0x402, |
| 93 | + |
| 94 | + #[msg("ImplementationMismatch")] |
| 95 | + ImplementationMismatch = 0x500, |
| 96 | + |
| 97 | + #[msg("InvalidGuardianSetIndex")] |
| 98 | + InvalidGuardianSetIndex = 0x600, |
| 99 | + |
| 100 | + #[msg("GuardianSetMismatch")] |
| 101 | + GuardianSetMismatch = 0x700, |
| 102 | + |
| 103 | + #[msg("InstructionAtWrongIndex")] |
| 104 | + InstructionAtWrongIndex = 0x702, |
| 105 | + |
| 106 | + #[msg("EmptySigVerifyInstruction")] |
| 107 | + EmptySigVerifyInstruction = 0x703, |
| 108 | + |
| 109 | + #[msg("InvalidSigVerifyInstruction")] |
| 110 | + InvalidSigVerifyInstruction = 0x704, |
| 111 | + |
| 112 | + #[msg("GuardianSetExpired")] |
| 113 | + GuardianSetExpired = 0x706, |
| 114 | + |
| 115 | + #[msg("InvalidGuardianKeyRecovery")] |
| 116 | + InvalidGuardianKeyRecovery = 0x708, |
| 117 | + |
| 118 | + #[msg("SignerIndicesMismatch")] |
| 119 | + SignerIndicesMismatch = 0x70a, |
| 120 | + |
| 121 | + #[msg("PayloadSizeMismatch")] |
| 122 | + PayloadSizeMismatch = 0x800, |
| 123 | + |
| 124 | + #[msg("ZeroGuardians")] |
| 125 | + ZeroGuardians = 0x1010, |
| 126 | + |
| 127 | + #[msg("GuardianZeroAddress")] |
| 128 | + GuardianZeroAddress = 0x1020, |
| 129 | + |
| 130 | + #[msg("DuplicateGuardianAddress")] |
| 131 | + DuplicateGuardianAddress = 0x1030, |
| 132 | + |
| 133 | + #[msg("MessageAlreadyPublished")] |
| 134 | + MessageAlreadyPublished = 0x1040, |
| 135 | + |
| 136 | + #[msg("VaaWritingDisallowed")] |
| 137 | + VaaWritingDisallowed = 0x1050, |
| 138 | + |
| 139 | + #[msg("VaaAlreadyVerified")] |
| 140 | + VaaAlreadyVerified = 0x1060, |
| 141 | + |
| 142 | + #[msg("InvalidGuardianIndex")] |
| 143 | + InvalidGuardianIndex = 0x1070, |
| 144 | + |
| 145 | + #[msg("InvalidSignature")] |
| 146 | + InvalidSignature = 0x1080, |
| 147 | + |
| 148 | + #[msg("UnverifiedVaa")] |
| 149 | + UnverifiedVaa = 0x10a0, |
| 150 | + |
| 151 | + #[msg("VaaStillProcessing")] |
| 152 | + VaaStillProcessing = 0x10a2, |
| 153 | + |
| 154 | + #[msg("InWritingStatus")] |
| 155 | + InWritingStatus = 0x10a4, |
| 156 | + |
| 157 | + #[msg("NotInWritingStatus")] |
| 158 | + NotInWritingStatus = 0x10a6, |
| 159 | + |
| 160 | + #[msg("InvalidMessageStatus")] |
| 161 | + InvalidMessageStatus = 0x10a8, |
| 162 | + |
| 163 | + #[msg("HashNotComputed")] |
| 164 | + HashNotComputed = 0x10aa, |
| 165 | + |
| 166 | + #[msg("InvalidVaaVersion")] |
| 167 | + InvalidVaaVersion = 0x10ac, |
| 168 | + |
| 169 | + #[msg("InvalidCreatedAccountSize")] |
| 170 | + InvalidCreatedAccountSize = 0x10ae, |
| 171 | + |
| 172 | + #[msg("DataOverflow")] |
| 173 | + DataOverflow = 0x10b0, |
| 174 | + |
| 175 | + #[msg("ExceedsMaxPayloadSize (30KB)")] |
| 176 | + ExceedsMaxPayloadSize = 0x10b2, |
| 177 | + |
| 178 | + #[msg("CannotParseVaa")] |
| 179 | + CannotParseVaa = 0x10b4, |
| 180 | + |
| 181 | + #[msg("EmitterAuthorityMismatch")] |
| 182 | + EmitterAuthorityMismatch = 0x10b6, |
| 183 | + |
| 184 | + #[msg("InvalidProgramEmitter")] |
| 185 | + InvalidProgramEmitter = 0x10b8, |
| 186 | + |
| 187 | + #[msg("WriteAuthorityMismatch")] |
| 188 | + WriteAuthorityMismatch = 0x10ba, |
| 189 | + |
| 190 | + #[msg("PostedVaaPayloadTooLarge")] |
| 191 | + PostedVaaPayloadTooLarge = 0x10bc, |
| 192 | + |
| 193 | + #[msg("ExecutableDisallowed")] |
| 194 | + ExecutableDisallowed = 0x10be, |
| 195 | +} |
0 commit comments