Fix/object error code#236
Open
Unclebaffa wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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).
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).