Comments (8)
Example of how this can be acheived:
{
"jsonrpc": "2.0",
"id": 1,
"method": "debug_traceTransaction",
"params": ["0x5126bbcb9b77a26fecd2ece4b8c96e2794aaccd997fa6beffb06a0405dc270b2", {"enableReturnData": true}]
}
"jsonrpc": "2.0",
"id": 1,
"result": {
"gas": 21476,
"failed": true,
"returnValue": "08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003706f700000000000000000000000000000000000000000000000000000000000",
"structLogs": [...]
from firefly.
There does seem to be a well worked function for this in fact:
https://github.com/hyperledger/firefly-evmconnect/blob/35424990511fcc7677840ee8f335a4bd24684050/internal/ethereum/get_receipt.go#L145-L176
from firefly.
I do see the error going into receipt.extraInfo.errorMessage
for EVM:
from firefly.
Above was a simple revert
, but here I see with a structured error it can't be decoded - so the problem might be the ABI definition of the errors aren't being passed down to the code:
![image](https://private-user-images.githubusercontent.com/6660217/305578989-5f7b502a-dfb2-47ab-ae26-691d8e551432.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4ODk0ODgsIm5iZiI6MTcxODg4OTE4OCwicGF0aCI6Ii82NjYwMjE3LzMwNTU3ODk4OS01ZjdiNTAyYS1kZmIyLTQ3YWItYWUyNi02OTFkOGU1NTE0MzIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjBUMTMxMzA4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Mjc0ZjdmYThhYTE5NzcxYmFmYTVhNGM3OGE1ZGYxMmZhMzkzZDM1MjQyOWJiNzY4YmZmNTNhNTYwZjU4ZGI0ZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.7bm8MV5V8NHRM4qL1uVTXA4lL5HlAk_65IuOOXxEef0)
from firefly.
For ref, the simple contract I'm using is:
pragma solidity ^0.8.0;
contract reverter {
uint public storedData;
error Pop(string message, uint256 value);
constructor() {}
function pop1() pure public {
revert("pop");
}
function pop2() pure public {
revert Pop("bang", 12345);
}
}
from firefly.
Yes - that's the problem. We need to work on FFTM to pass through the error structure from the original TX down into the TransactionReceiptRequest
to be able to decode the errors.
I suggest at the same time, we promote errorMessage
to be a top-level field in the receipt response.
from firefly.
Ok - FFTM does not actually store the error ABI details, they are held in FireFly core and only passed on prepare.
They are a big glob of JSON that is associated with the interface, not the transaction, so storing them in FFTM is a big performance overhead.
So a more practical approach is to store the result byes from the receipt in FFTM (as for a non-archive node they won't be available indefinitely), and provide an API to decode them that is passed the error ABI.
FireFly core could call this API automatically.
from firefly.
I'm seeing a slightly different behavior with a require()
in my smart contract. Here is the test contract that I am using:
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.10;
// Declares a new contract
contract SimpleStorage {
// Storage. Persists in between transactions
uint256 _x;
// Allows the unsigned integer stored to be changed
function set(uint256 x) public {
_x = x;
emit Changed(msg.sender, _x);
}
// Allows the unsigned integer stored to be changed
function setIf(uint256 x, bool actuallyDoIt) public {
require(actuallyDoIt, "Not going to do it");
_x = x;
emit Changed(msg.sender, _x);
}
// Returns the currently stored unsigned integer
function get() public view returns (uint256 x) {
return (_x);
}
event Changed(address indexed from, uint256 x);
}
If I set actuallyDoIt
to false
here is what I see in my receipt in FireFly:
Notice how
"errorMessage": null
is not even in my receipt here
So this is a little different than what @peterbroadhurst was seeing with revert()
or a custom error. We want to make sure this case is covered by the fix for this as well.
from firefly.
Related Issues (20)
- FireFly 1.3 Performance Testing HOT 7
- Intermittent Unit Test - TestDownloadManagerStartupRecoveryCombinations
- Hardening for 1.3 Release HOT 8
- Error for "unable to resolve contract method" has a missing string
- Enhance documentation with signing knowledge
- Enhance multiparty documentation HOT 2
- FireFly does not attempt to re-connect to token connectors on Namespace startup retry
- FireFly requires a signing key for "query" operations
- Broadcast are stuck whilst running performance testing against 1.3.0-rc1 HOT 2
- Need to document the FF1.3 revert error handling, and make the default safer HOT 12
- GET API(s) response doesn't include a REST endpoint in urls
- Fix `latest` tag in Docker image workflows HOT 1
- Improve multi-party status information (if enabled) to aid registration automation HOT 3
- Build broken on main HOT 1
- Google search results for docs not going to /latest HOT 2
- Creating a new stack yields: `Error: no version for docker-compose has been detected`
- Start up retry does not clean up previous failed attempts HOT 3
- Swagger issue when working with identities HOT 2
- Enhance documentation for adding namespaces
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firefly.