Skip to content

fix(cketh): use try_send instead of send for calls to the EVM RPC canister#8821

Open
gregorydemay wants to merge 4 commits intomasterfrom
gdemay/DEFI-2566-cketh-try-send
Open

fix(cketh): use try_send instead of send for calls to the EVM RPC canister#8821
gregorydemay wants to merge 4 commits intomasterfrom
gdemay/DEFI-2566-cketh-try-send

Conversation

@gregorydemay
Copy link
Contributor

To call the EVM RPC canister, the ckETH/ckERC20 minter uses the EvmRpcClient::send method, which panics in case the call to the EVM RPC canister could not be made, e.g. the EVM RPC canister is stopped due to an upgrade. This PR fixes this by using instead the try_send method and dealing with the client error IcError as follows:

  • Introduce ConsistentError enum to distinguish between IC client errors (IcError) and EVM RPC canister errors (RpcError).
  • Replace all send() calls to the EVM RPC canister with try_send() to gracefully handle inter-canister call failures (e.g., when the EVM RPC canister is stopped) instead of panicking
  • Implement ToReducedWithStrategy for Result<EvmMultiRpcResult, IcError> so try_send() results can be reduced with the same strategy API. In particular the trait implementation is no longer with using the send methos.
  • Add integration test verifying the minter does not panic when the EVM RPC canister is stopped

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant