Best effort to decode nester error strings from reverts#184
Conversation
1de5d77 to
1e98a85
Compare
There was a problem hiding this comment.
first pass - @davecrighton can you sign off the commits for DCO please
peterbroadhurst
left a comment
There was a problem hiding this comment.
To aid a review @davecrighton - please could you provide in the subject:
- A Solidity example of the coding pattern that results in the problem
- A link to somewhere that helps us understand how standard this is
- e.g. is it a link to the Solidity docs, or OpenZeppelin, or some forums on coding suggestions
- An description of what the algorithm is we're applying
- I understand from your comment this only works for
Error(string)"default" revert errors, but what are we inferring about thestringplaced in there and why
- I understand from your comment this only works for
peterbroadhurst
left a comment
There was a problem hiding this comment.
Second request from me:
Can we make this a pkg utility function (honestly I think firefly-signer would be the ideal place, but we've started putting package utilities in firefly-evmconnect too a little recently).
This code feels important to standardize as DecodeRevertErrorBytes() and return a well structured struct return that is documented, that has a String() function.
|
A note on how standard this approach is: We encountered this pattern in a complex enterprise solidity application where the contract author was making a significant number of calls to other contracts within a single contract execution and was using this as a way to provide context for the operation that was actually failing. Having said that there are examples in the wild such as: https://github.com/InjectiveLabs/solidity-contracts/blob/master/src/BankERC20.sol |
f54eb15 to
d3d3e2d
Compare
The standardization is now in this ff-signer PR hyperledger/firefly-signer#98 I have left this call site calling the |
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
d3d3e2d to
bdee294
Compare
|
Note that for the moment I need a ff-signer psuedo version to build, once the ff-signer PR is merged I will drop these changes from the PR |
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io> Made-with: Cursor
bdee294 to
255f37f
Compare
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
ac30c1f to
6deb6e0
Compare
Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
… PR 98 is merged Signed-off-by: Dave Crighton <dave.crighton@kaleido.io>
Part of the changes for hyperledger/firefly#1717
The issue being addressed is that when solidity such as the following is used:
Where:
The resulting error message is not useful and appears garbled, for example:
This PR moves evmconnect to use the new common revert processing defined in hyperledger/firefly-signer#98 which will attempt to decode nested errors to produce a more meaningful revert message such as:
This PR also introduces tests for using the new ff-signer functionality in-context.