Skip to content
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

Swagger-API/Custom Smart Contract – Issues with return-data (tuples) of GET-(FF = /POST/query-)functions #1192

Open
Rabax55 opened this issue Feb 20, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Rabax55
Copy link

Rabax55 commented Feb 20, 2023

I'm filing this here, as it's somehow cross-package (Swagger-Api, evm-/ethconnect, firefly-signer). Please relocate as you see fit (probably firefly-signer)...

FireFly - Issue-/Bug-Report

** FireFly-version ***
(1) "1.1.2" w/ ethconnect
(2) "1.2.0" w/ evmconnect,

** Current behavior: **
The Swagger-Api fails to return tuples of state variables, requested by contract GETter-functions. The RLP-decoding of the data to return fails/is incomplete.

** Expected behavior: **
Return correctly decoded Tuple-data in FF-Swagger Json-Response

** Steps to reproduce: **

  1. For (1) -ethconnect: Create a new FF-stack with --blockchain-connector ethconnect
    (2) -evmconnect: Create a new FF-stack with --blockchain-connector evmconnect

  2. For both: deploy the attached SmaCo "DynStructArraysAndAbiTuples.sol" on FF,
    define contract interface/ABI, register API (via Sandbox...). The contracts Constructor
    will create some data for it's state-variables
    DynStructArraysAndAbiTuples.sol.txt
    ...

  3. As reference, deploy the said SmaCo with Remix Desktop-IDE (i used v.0.30.1), and connect it
    to the geth-node of the respective FF-stack:
    Remix-IDE-> "Environment",
    -> select 'External HTTP-Provider'-> with
    -> "External HTTP Provider Endpoint" =
    -> 'http://127.0.0.1:5100'

  4. Test the following SmaCo-functions (POST/query-endpoints in the FF-Swagger-Interface)

    • getDatingsLength
    • getAllDatings
    • getAllDatingEfforts
    • getDatingByAttempt
    • getAliceEffortByValue
  5. Do the same tests in the Remix-IDE, for comparison and reference.

  6. See the differences/errors, as documented as well in the attached pdf-document
    "FF-Tuples-AbiRlp-Decode-Tests.pdf"

FF-Tuples-AbiRlp-Decode-Tests.pdf

** Related code: **
The error-messages 'FF23023'(MsgReturnDataInvalid) from firefly-evmconnect,
'FF22046'(MsgABIArrayCountTooLarge) from firefly-signer

** Other information: **
Reference-tested as well with 'https://github.com/esaulpaugh/headlong-cli' + '~/headlong',
a library aiming to be just 'strict' in RLP-en-/decoding. See it's (correct) results in the
attached pdf-document.

@nguyer
Copy link
Contributor

nguyer commented Feb 20, 2023

Thanks for reporting this @Rabax55! I will attempt to reproduce it and figure out what's going on here when I get some cycles.

@nguyer nguyer added the bug Something isn't working label Feb 20, 2023
@nguyer nguyer self-assigned this Feb 20, 2023
@Rabax55
Copy link
Author

Rabax55 commented Jun 2, 2023

Hi @nguyer, is there any chance this getting corrected? There was a fix for a RLP-problem - #1323 - that looked similar. Could you please crosscheck, whether my problems are solved w/ this fix, and if not, add the correction for those? There is a complete test-case included here - pls use. These kind of bug(s) just invalidate a whole bunch of Solidity-standards to be used, see?

@nguyer
Copy link
Contributor

nguyer commented Jun 2, 2023

Hey @Rabax55 thanks for following up on this. Yes, there have been a number of RLP encoding/decoding fixes that have gone into the FireFly signer library lately. This issue sounds similar to some that were being worked on. If you have an environment that you can re-test this issue in, I think you should be able to use this evmconnect image in your docker-compose.override.yml file, which has the latest fixes in it: https://github.com/hyperledger/firefly-evmconnect/pkgs/container/firefly-evmconnect/98303084?tag=v1.2.12-20230602-55

@dwertent
Copy link
Contributor

@Rabax55 Just following up on this issue—can you confirm if it’s been resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants