hyperledger / firefly-ethconnect

Ethereum connectivity bridge for Web Services & async Messaging APIs - familiar to Enterprise Apps
Apache License 2.0
75 stars 33 forks source link

FireFly e2e test failing with FF10111: Error from ethconnect "No ABI found with ID" #159

Closed peterbroadhurst closed 3 years ago

peterbroadhurst commented 3 years ago
firefly_core_0_1  | Error: FF10111: Error from ethconnect: {"error":"No ABI found with ID "}
firefly_core_0_1  | Usage:
firefly_core_0_1  |   firefly [flags]
firefly_core_0_1  |   firefly [command]
firefly_core_0_1  | 
firefly_core_0_1  | Available Commands:
firefly_core_0_1  |   help        Help about any command
firefly_core_0_1  |   showconfig  List out the configuration options
firefly_core_0_1  | 
firefly_core_0_1  | Flags:
firefly_core_0_1  |   -f, --config string   config file
firefly_core_0_1  |   -h, --help            help for firefly
firefly_core_0_1  | 
firefly_core_0_1  | Use "firefly [command] --help" for more information about a command.
firefly_core_0_1  | 
firefly_core_0_1  | FF10111: Error from ethconnect: {"error":"No ABI found with ID "}
peterbroadhurst commented 3 years ago

Here is a failure where the logs have been captured as an artifact: https://github.com/hyperledger/firefly/pull/234/checks?check_run_id=3838443338

peterbroadhurst commented 3 years ago

~Am wondering if https://github.com/hyperledger/firefly/pull/208 being merged is related to this~

See below

peterbroadhurst commented 3 years ago

Key lines in the log look like:

ethconnect_0_1    | [2021-10-08T12:32:32.025Z]  INFO firefly -> 0x58890cc4cf8a3c1bf90bd11beeccc1b4c76cfed4
ethconnect_0_1    | [2021-10-08T12:32:32.025Z]  INFO ABI with ID  not found locally
ethconnect_0_1    | [2021-10-08T12:32:32.026Z] ERROR <-- POST /contracts/firefly/BatchPin [500]: No ABI found with ID 

Moving this one over to Ethconnect from the CLI

peterbroadhurst commented 3 years ago

Ok - tracked this down to the point that I believe the ID in this line, must have been empty at the point we did the register into the contract registry: https://github.com/hyperledger/firefly-ethconnect/blob/8545f1c09d5fc9829508dac9a08d8c57210079eb/internal/contractgateway/smartcontractgw.go#L189

peterbroadhurst commented 3 years ago

Looks like the code that ensures an ID is set on the header, might only exist in the Kafka codepath: https://github.com/hyperledger/firefly-ethconnect/blob/8545f1c09d5fc9829508dac9a08d8c57210079eb/internal/kafka/kafkabridge.go#L172-L174

But this seems very odd, as that's in the code that receives the message from the queue, not the REST API code that adds it.

peterbroadhurst commented 3 years ago

Looking back at the code all the way before https://github.com/hyperledger/firefly-ethconnect/pull/139 to work out how the ID was assigned when it was always assigned.

peterbroadhurst commented 3 years ago

Hmmn, looks like back then it was still only set on the webhooks path, not the resttoeth path. So the problem might always have been there for this path, but masked by the bug just fixed in https://github.com/hyperledger/firefly-ethconnect/pull/158

peterbroadhurst commented 3 years ago

The code change made in #160 had the intended effect. However, it means that when you get through to this line of code, the id is (as you would expect) a genuinely unique message ID - as it needs to be.

https://github.com/hyperledger/firefly-ethconnect/blob/cdaf563bcb998b1eb0de1c07a9da0b93254453d0/internal/contractgateway/smartcontractgw.go#L219

However, that code is passing requestID as the abiID into AddContract. That seems completely wrong. The ABI ID was unrelated to the unique request that was issued against the ABI.

peterbroadhurst commented 3 years ago

So I think this code (which was a very edge case invocation in prior uses of ethconnect before FireFly) has always depended on the behavior that was just fixed in #158, where the requestID happened to be propagated through to the ABI ID.

So I need to instead pass the ABI ID explicitly, in the deploy message.

peterbroadhurst commented 3 years ago

See additional detail on the fix here: https://github.com/hyperledger/firefly-ethconnect/pull/160#issuecomment-938735888