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

Transaction ID Mismatch: Encoding Issue #377

Open
h0rs3fa11 opened this issue Apr 11, 2023 · 2 comments
Open

Transaction ID Mismatch: Encoding Issue #377

h0rs3fa11 opened this issue Apr 11, 2023 · 2 comments
Labels
Bug Something isn't working

Comments

@h0rs3fa11
Copy link

h0rs3fa11 commented Apr 11, 2023

Instructions

Problem

I encountered an issue with transaction encoding, where the transaction ID returned by calling the ID() function does not match the transaction ID found on the blockchain. After further review, I think this is caused by payloadCanonicalForm(), which was added as a temporary solution for issue #286 since version 0.26.4.
https://github.com/onflow/flow-go-sdk/blob/master/transaction.go#L373

Steps to Reproduce

I used several transactions to test this

txID := flow.HexToID(TXID_FROM_BLOCKCHAIN_EXPLORER)
tx, _ := flowClient.GetTransaction(ctx, txID)
fmt.Printf("\nTx ID: %s, \nTx ID from SDK: %s\n", txID.Hex(), tx.ID().Hex())

the results are as follows:

Tx ID: 2e16e084fa64aaa5a7d886ba4c5f1646daa297b9b4e4efa6a006b606573671d3, 
Tx ID from SDK: c42aad97d7d6815c7a11d84f413a4846286bd051d657bef299ad730b20f964a5, 

Tx ID: 35d8dce0c5fd0357af05aa98ff133386c39ecf277c2c745d89125eebf88e33bb, 
Tx ID from SDK: be2147e6dd88e0ebaf289c9bd9e020d02d940d49f99ee399601de3045f8dd096, 

Tx ID: 4aabde51d996ef6f1d3ddb5a68e87fa016b122502d4cd1a7a67a196c4c360ee6, 
Tx ID from SDK: 97563ff30e917834737655c38b1a9d3e3ba8c06c3f297070c0c92110be956bfd, 

Tx ID: 159a6e313ada5feb109033e4d744c746e7f9af4c4ad482bce176f0a6d55913df, 
Tx ID from SDK: 80eca1c33e7df980326cffb6fa81d92a7968f2f49b35b24f5db2b98b850cd5c3, 

Tx ID: 5c31bde864d4bab7861129e9167dc87ddecc11411b4ebd4525a8b288a0cc44b9, 
Tx ID from SDK: eca84a892715ac3b403ed67c0b176f8aba2ffb37d9c732dbbf11dd01fe59cc02, 

Tx ID: 5e5ce254cfae3a85e5bf060b54c5c165c4d0a0a53fb38a73987c79af6d7d20a1, 
Tx ID from SDK: 5ae2c3906ae12a584ec86c1897f0ae0c906fef906d12ba40197750b0607e3010, 

Tx ID: 6a257b002f39742217358220fd2227954d7c5826329940ed8fa37d5fc97ae15e, 
Tx ID from SDK: 7ff38861d0c32f3450e2d5d6fb2ad0b5572ad372e236ce922e5f0a7a7f2ed6ea, 

Tx ID: 7ebc61d0e3b4f67af4127351c45756ec4c2d17e05bc5bfe4550ccf3dd960a406, 
Tx ID from SDK: 59c6ac6850f80d4e551c93d9492081988ef6c5ba0520f6ea66f7ca3dccd94193, 

Tx ID: 818432ec83530c143765ad402f50d6940d5182d4a7f82863528669e5b7cabec2, 
Tx ID from SDK: 9ad6bfd7f4ffbf3048bafd687aa2b80440f091381293d57d27590ee25093fc22, 

Tx ID: 81b2897ace93b4b26a70e22920d60f052870fda747abc311345cfd09d94a1e8d, 
Tx ID from SDK: d8b3d90e04c4b1f0c3299179e5a7367698e838da977c60a370e87d9b829ff09c, 
@bluesign
Copy link
Contributor

ref: onflow/flow-go#4030

@sideninja
Copy link
Contributor

sideninja commented Apr 11, 2023

@h0rs3fa11 thank you for reporting. The problem is we didn't define a canonical format, and thus, JS SDK builds a different ID which the PR mentioned fixed, since JSON marshaller in GO adds an extra new line. Not sure what a good workaround would be, but for sure final solution is for the format to be defined, which is the work that's already in progress I believe. Will gather more context and provide another comment.

@sideninja sideninja moved this to 🔖 Ready for Pickup in 🌊 Flow 4D Apr 11, 2023
@sideninja sideninja self-assigned this Apr 11, 2023
@sideninja sideninja removed their assignment Apr 26, 2023
@sideninja sideninja added the Bug Something isn't working label Apr 26, 2023
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