Skip to content

Fix/object error code#236

Open
Unclebaffa wants to merge 2 commits into
Toolbox-Lab:mainfrom
Unclebaffa:fix/object-error-code
Open

Fix/object error code#236
Unclebaffa wants to merge 2 commits into
Toolbox-Lab:mainfrom
Unclebaffa:fix/object-error-code

Conversation

@Unclebaffa

Copy link
Copy Markdown

closes #216

I have resolved this task by pulling the full list of host object error codes from Stellar Soroban (the ScHostObjErrorCode enum) and integrating them into both the taxonomy database and the CLI decoding mappings.

  1. Object Error Taxonomy Code Listing
    The full set of host object errors is defined by the following variants and numeric codes:

Code 0 (UnknownError): General/unclassified host object failure.
Code 1 (UnknownReference): Handle references a non-existent or out-of-scope object.
Code 2 (UnexpectedType): Type mismatch (e.g. Map handle passed where Vector was expected).
Code 3 (ObjectCountExceedsU32Max): Max limit of host objects exceeded (u32::MAX).
Code 4 (ObjectNotExist): Requested object was missing or garbage collected.
Code 5 (VecIndexOutOfBound): Accessing an index greater than or equal to a vector/byte array length.
Code 6 (ContractHashWrongLength): Passing a hash or address of incorrect length (must be 32 bytes).

  1. Changes Implemented
    Taxonomy Database (

object.toml
):

Fixed code 0 to map to UnknownError (it was previously acting as a placeholder for IndexBounds).
Added complete entries for all 7 codes (0 through 6) with detailed descriptions, likelihood-rated common causes, and difficulty-rated suggested fixes.
Rust Mappings (

object.rs
):

Created the new mapping file with OBJECT_ERROR_DETAILS array and lookup function.
Added unit tests asserting correct lookup behavior for known and unknown object error codes.
Module Registration (

mod.rs
):

Registered the object mapping module alongside other error code mapping categories.
Decoder Support (

host_error.rs
):

Updated the object error match arm inside HostError::summary() to use the new crate::decode::mappings::object::lookup look-up mechanism.
Updated the unit test assertions to reflect the correct summaries for code 0 (UnknownError) and code 5 (VecIndexOutOfBound).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fill Out All Object Error Code Mappings

1 participant