Skip to content

fix: cross_contract_safety hardcodes error symbol and drops context #28

Description

@Icahbod

safe_invoke_contract in apexchainx_calculator/src/cross_contract_safety.rs collapses both recoverable and fatal downstream errors into a single hardcoded error_symbol = Symbol::new(env, "CROSS_CONTRACT_FAILURE"). The actual error value returned by the target contract is dropped on the floor, so backends cannot tell which downstream contract failed or under which error code. Preserve the raw error context by attaching the original error Val to SafeCallResult (which will require annotating the struct with #[contracttype] per #16 of the planned follow-ups), or by deriving an explanatory symbol from the contract address plus function name. Add tests proving that two distinct downstream error paths produce two distinguishable error_symbol values rather than the same string.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignbugSomething isn't workingenhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions