Skip to content

Commit b46c72b

Browse files
authored
Merge pull request #1307 from Ndifreke000/issue-975-myfans-lib-error-codes
fix(myfans-lib): add #[repr(u32)] to stabilize error discriminants (f…
2 parents 6e59df6 + cad82fe commit b46c72b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • contract/contracts/myfans-lib/src

contract/contracts/myfans-lib/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub enum ContentType {
2525
/// Shared error enum across all MyFans contracts.
2626
/// Codes preserved exactly for test snapshot compatibility.
2727
#[contracterror]
28+
#[repr(u32)]
2829
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
2930
pub enum MyfansError {
3031
/// Common init/admin errors
@@ -52,6 +53,10 @@ pub enum MyfansError {
5253
MinBalanceViolation = 106,
5354
}
5455

56+
// Ensure numeric discriminants are represented as `u32` in the compiled ABI.
57+
// This keeps the contracterror discriminants stable across builds and targets.
58+
59+
5560
/// Stable numeric error codes for every MyFans contract, grouped by contract.
5661
/// Clients can import these instead of hard-coding magic numbers.
5762
///

0 commit comments

Comments
 (0)