-
Notifications
You must be signed in to change notification settings - Fork 85
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
Transaction ID mismatch between SDK and flow model #420
Comments
yeah this is very old issue ( related to cadence json in args )there was a fix in flow-go-sdk to match fcl-js behaviour. ( while encoding arguments, extra new line or not issue ) related: onflow/flow-cli#679 |
I think this is a little different. The SDK uses grpc under the covers (I think), so in my reproduction, the SDK and my script received identical responses from the API. The only difference was the logic that converts from protobuf to a go struct. |
@peterargue Lines 372 to 376 in 26fbdab
Here is go json encoder part: Basically go is adding extra \n when encoding Cadence.Value, fcl-js is not. There was some issue long ago, when some server side signing tx ID was not matching, so flow-go-sdk added this hack. (#292) Now removing this hacks for sure breaks someones workflow, so canonical encoding is waited (I suppose). ( in the mean time it can be fixed on cli side, but just passing txid (like: onflow/flow-cli#679 ) ) |
Yea, that's it. I tried my script with that code disabled and get the same tx ID. here's the args as hex
I'm guessing the the user that submitted the problem tx was just using an older version of the sdk that didn't include this change. I think the problem is just that the SDK is using this hack for both new and already submitted tx. This makes sense for tx it submits, but for any received via the API, the hack should be skipped. |
@peterargue for existing old Tx you are right, the problem is there's no good way of knowing in that SDK implementation where the payload came from unless breaking a lot of stuff. I believe the new CCF format will address this better and hopefully greatly reduce any kind of similar issues. If you see any action we can take let me know. |
Related to: #377 |
Problem
Someone on discord reported an issue where the flow-cli shows a different transaction ID from the one requested. e.g.
Note that the requested TX was
38559cfac11eba732f3de2420eac511393e223bc92b0c52f75b6604098e4181a
, and the ID included in the response was06e254293add97d9a9519eac42a30c8450ff7f51556392901462f5476ca06a18
. Also note that the ID in the events correctly match the request.Looking at the flow-cli code, the ID field is populated using the
tx.ID()
method on the transaction returned using the SDK.The
ID()
generates a hash of the datastructure, so this most likely means that the serialized representation of the transaction produced by the sdk is different from the flow model used to produce the original.Steps to Reproduce
I created this repo script: https://gist.github.com/peterargue/da744c9e7c4bddbfee4d89240a3f4244
It requests the same transaction from an AN using the sdk and grpc directly. Calling
ID()
on the sdk version produces06e254293add97d9a9519eac42a30c8450ff7f51556392901462f5476ca06a18
, but using the flow model, it returns38559cfac11eba732f3de2420eac511393e223bc92b0c52f75b6604098e4181a
.The text was updated successfully, but these errors were encountered: