stellar / rs-soroban-env

Rust environment for Soroban contracts.
Apache License 2.0
61 stars 43 forks source link

A contract invocation that fails with a trap or error results in a successful operation / transaction result #522

Closed leighmcculloch closed 1 year ago

leighmcculloch commented 2 years ago

Something that @paulbellamy noticed while testing against stellar-core is that when a invocation fails with an error, the operation and transaction result are success.

This is unintuitive. It's very easy to write tools and applications that think everything worked as expected.

cc @graydon

anupsdf commented 1 year ago

Setting target milestone to Testnet Phase 1 after discussing with @graydon

graydon commented 1 year ago

@paulbellamy the error-propagation path in core has changed quite a bit since this was filed, and I'm not 100% sure if it's been fixed or not. Can you elaborate a bit here? Like, specifically, what you mean by "invocation fails". Do you mean when a contract successfully returns a value that happens to be a Rust Val::Error / XDR SCError? Or do you mean like if the host fails execution due to running out of gas or an illegal operation or something like that?

graydon commented 1 year ago

I've made some end-to-end tests that "returning Val::Error causes the transaction to fail" and it all looks like it works, so I think this was solved some time ago. Please reopen if you see anything fishy here in the future.