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

Ensuring HexAddress is Wrapped in String format and as HexAddress #278

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Philip-21
Copy link
Contributor

@Philip-21 Philip-21 commented Dec 19, 2023

This is pr fixes for #230

@nguyer @awrichar @peterbroadhurst
I have been able to implement the fix for issue #230 ensure the HexAddress are wrapped properly please, I would like reviews

Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
@nguyer
Copy link
Contributor

nguyer commented Dec 19, 2023

Hey @Philip-21. Sorry I probably should have steered you in the direction of the existing code in the firefly-signer library that we already have that does these sorts of things. Two places you might want to look are:

I'd rather that we use the existing library to handle parsing, validation, or conversion of these types, rather than creating another implementation in an additional repo. If there's functionality missing in firefly-signer that we need here, it would be great to add it to the shared library.

Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
@Philip-21
Copy link
Contributor Author

@nguyer I have been able to use the firefly-signer library to handle validation and parsing.
what do you think of the changes I made ?

@nguyer
Copy link
Contributor

nguyer commented Jan 5, 2024

@Philip-21 Looks like there are compilation errors now:

Error: ../internal/tokens/erc1155/erc1155_provider.go:93:41: cannot convert loc["address"] (map index expression of type string) to type types.HexAddress
# github.com/hyperledger/firefly-cli/internal/tokens/erc20erc721
Error: ../internal/tokens/erc20erc721/erc20_erc721_provider.go:92:40: cannot convert loc["address"] (map index expression of type string) to type types.HexAddress
Error: ../internal/tokens/erc20erc721/erc20_erc721_provider.go:103:58: invalid operation: factoryAddress != "" (mismatched types types.HexAddress and untyped string)
make: *** [Makefile:25: build] Error 2
Error: Process completed with exit code 2.

Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
@Philip-21
Copy link
Contributor Author

@nguyer please i would like you to review my code , i am still trying to figure out why the checks are failing i was able to tackle the compilation error , but i still have failing e2e tests

@Philip-21
Copy link
Contributor Author

@nguyer, these are error messages i got from the e2e tests

DEBUG evmconnect: FF21040: Invalid listener options: FF23036: Invalid event filter: {"address":"783688521890864681654499112172336319967459785509","event":{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"type_id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"TokenPoolCreation","type":"event"}}:

It seems the error is related to an invalid event filter in Ethereum. Specifically, it seems to be related to the event filter for "TokenPoolCreation" on a contract with address "783688521890864681654499112172336319967459785509".

Maybe, the address isn't defined well.

Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
@nguyer
Copy link
Contributor

nguyer commented Feb 6, 2024

783688521890864681654499112172336319967459785509 looks like something that was an address which may have been converted to a number. Based on what I see in the E2E test log:

initializing token providers
initializing tokens on member 0
Error: http://localhost:5110/api/v1/init [500] {"statusCode":500,"message":"Internal server error"}

I am guessing that the token connector config or environment variables aren't getting written correctly with these changes

Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
Signed-off-by: Philip-21 <philipuzomaobiora@gmail.com>
@Philip-21
Copy link
Contributor Author

Contributor

Yes these values don't have the proper Hexaddress format which are meant to be in 20 byte [] type, based on the firefly-signer library the address must be of 20 byte[] type.
the unit tests i wrote, gives different examples of how i defined the hexvalues in 20 byte []type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants