Skip to content

chain: typed chain-error with an rpc case carrying revert bytes #209

Description

@mfw78

Problem. Revert payloads travel as JSON-quoted hex strings that guests must trim and decode by hand, and RPC codes are smushed into a domain-relative s32.

Change. Add record rpc-error { code: s32, message: string, data: option<list<u8>> } and variant chain-error { fault(fault), rpc(rpc-error) } to chain.wit. The host hex-decodes error.data once. Add From<ProviderError> for ChainError. decode_revert takes &[u8], and decode_revert_hex's quote-stripping is removed. Update the twap poll path and the chainlink helper to match.

Files. chain.wit, host/impls/chain.rs, host/error.rs, provider_pool.rs, nexum-sdk chain plus macro, shepherd-sdk cow/composable, twap-monitor.

Risk / size. M.

Depends on. Sub-issue A, in parallel with sub-issue B.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/chainalloy provider, chain host backend, RPC middlewarecomponent/sdknexum-sdk / shepherd-sdk, proc macros, cargo-nexumcomponent/wit-abiWIT packages, worlds, wit-bindgen, host/guest contract

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions