-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.1] Update cleos to return an error code on failed trx processing #199
Conversation
…similar to before --return-failure-trace was added.
…ome tests are expecting to find errors in the trace.
programs/cleos/main.cpp
Outdated
int r = 0; | ||
if (result.is_object() && result.get_object().contains("processed")) { | ||
const auto& processed = result["processed"]; | ||
if( processed.get_object().contains( "except" ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to check if processed
is an object before get_object()
ing it? You do the is_object()
check for result
& except
. And a failure here with processed
not being an object would be outside of the try block internal to this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be better. I copy/pasted from print_result
which does not have that. I'll add the check.
@@ -205,7 +205,8 @@ def checkDelayedOutput(popen, cmd, ignoreError=False): | |||
Utils.checkOutputFileWrite(start, cmd, output, error) | |||
if popen.returncode != 0 and not ignoreError: | |||
Utils.Print("ERROR: %s" % error) | |||
raise subprocess.CalledProcessError(returncode=popen.returncode, cmd=cmd, output=error) | |||
# for now just include both stderr and stdout in output, python 3.5+ supports both a stdout and stderr attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the Python 3.5+ comment here getting at -- even Ubuntu 18 is using 3.6 so if there is a 3.5+ feature we should be able to use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stderr
was being placed in output
. Python 3.5+ has both an output
and a stderr
. The better fix is to put stdout
into output
and stderr
into stderr
. However, output
is used in 20+ places in many tests. I didn't want to make that big of a change in release/3.1
. In main
I plan to sperate out the stdout
and stderr
and update the 20+ usages of the CalledProcessError
.
programs/cleos/main.cpp
Outdated
if( except.is_object() ) { | ||
try { | ||
auto soft_except = except.as<std::optional<fc::exception>>(); | ||
if( soft_except ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we've established that except
is an object. Do we really need to treat except
as an optional
type still?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Removed optional
.
Leap 3.1 returns transaction failure traces by default.
EOSIO/eos 2.0
would instead throw an exception.The 3.1 release notes included the following:
This PR addresses the cleos non-zero return values for failed transaction execution. With this PR, cleos will parse the returned transaction traces and return a non-zero return value for transactions that failed to speculatively execute.
Before:
After:
Resolves #139