Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

RevertReason changed to BytesValue #1746

Merged
merged 37 commits into from
Jul 30, 2019
Merged

RevertReason changed to BytesValue #1746

merged 37 commits into from
Jul 30, 2019

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Jul 24, 2019

The revert reason returned from the EVM has been changed to a bytes value to
better represent the specification (of it being an ABI encoded data block).

This has meant that the TransactionReceipt returned from
ethGetTransactionReceipt now provides a hex-encoded string (rather than UTF-8).

The revert reason returned from the EVM has been changed to a bytes value to
better represent the specificiation (of it being an ABI encoded data block).

This has meant that the TransactionReceipt returned from
ethGetTransactionReceipt now provides a hex-encoded string (rather than UTF-8).
@rain-on rain-on requested review from ajsutton and AbdelStark July 24, 2019 11:49
if (input.isEndOfCurrentList()) {
revertReason = Optional.empty();
} else {
if (!revertReasonAllowed) {
throw new RLPException("Unexpected value at end of TransactionReceipt");
}
final byte[] bytes = input.readBytesValue().getArrayUnsafe();
revertReason = Optional.of(new String(bytes, StandardCharsets.UTF_8));
revertReason = Optional.of(BytesValue.wrap(bytes));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to re-wrap the byte array here, just use the BytesValue returned from input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

.map(
revertReason ->
new String(revertReason.extractArray(), StandardCharsets.UTF_8))
.orElse(null)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still wrong, the revert reason isn't a string - we need to output the result as a hex array in the trace output.

@@ -36,7 +37,7 @@
private final int pc;
private final String[] stack;
private final Object storage;
private final String reason;
private final BytesValue reason;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a String here, but calculated from the BytesValue with BytesValue.toUnprefixedString. That would then match how the stack and return values are all formatted.

lucassaldanha and others added 24 commits July 26, 2019 16:59
…gaSysEng#1741)

* PIE-1792: Added chainId validation to PrivateTransactionValidator
…egaSysEng#1747)

To allow us to reset the timestamp in the blockchain for Retesteth support 
we need to pass a Clock to affected APIs and use that instead of the static method
System.currentTimeMillis().  The most consistent way to do this that will ensure
that the API does not sneak back in is to ban the method via ErrorProne.

TestClock.fixed() was altered to return the "now" time of the first time the fixed clock was requested, needed for many header validation tasks validating headers are not from the future.
…sEng#1758)

Matches behaviour expected of eth_coinbase call by ethstats.net reporter.
…ed docs (PegaSysEng#1736)

* Renames various eea methods to priv methods, with associated docs

* Restructures packages

* Adds priv commandline switch

* Refactors eea_getTransactionCount and eea_getPrivateTransaction to priv

* Changes package structure and fixes TODO

* Remove whitespace

* Update docs with new method names
…f Sync (PegaSysEng#1759)

-- Verify that while a new node is being added and is out of sync, it doesn't accept connections, it accepts connection once it is synced
…ng#1764)

* PAN-2723: Created Miner API transactions and conditions

* PAN-2723: Added static nodes options to permissioned node builder

* PAN-2723: Implemented permissioned node with static-nodes AT

* PAN-2723: Renaming test

* Refactoring test to use the waitForBlockHeight method
…illis()" (PegaSysEng#1768)

This reverts commit 814b36e
The needed chantes to get rid of Instant.now (which is also needed to get rid
of the wall clock dependency) are too deep and intrusive into IBFT to try and
speed patch them in that some APIs require re-work, so in the interst of test
stability this gets sheleved until it is all ready.
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

this.revertReason =
receipt
.getRevertReason()
.map(reason -> reason.isEmpty() ? "" : reason.toString())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should just be:

Suggested change
.map(reason -> reason.isEmpty() ? "" : reason.toString())
.map(BytesValue::toUnprefixedString)

as we want to output it as a hex value in the same way as StructLog does above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that means you get "revertReason": "0x" ... which ... seemed odd to me - but if thats the preferred solution ...

@rain-on rain-on merged commit b7550c4 into PegaSysEng:master Jul 30, 2019
@rain-on rain-on deleted the revert branch July 30, 2019 12:09
rain-on added a commit to rain-on/pantheon that referenced this pull request Jul 30, 2019
The revert reason returned from the EVM has been changed to a bytes value to
better represent the specification (of it being an ABI encoded data block).

This has meant that the TransactionReceipt returned from
ethGetTransactionReceipt now provides a hex-encoded string (rather than UTF-8).
rain-on added a commit that referenced this pull request Jul 30, 2019
The revert reason returned from the EVM has been changed to a bytes value to
better represent the specification (of it being an ABI encoded data block).

This has meant that the TransactionReceipt returned from
ethGetTransactionReceipt now provides a hex-encoded string (rather than UTF-8).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants