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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Rust rest client return parsing error for some transactions when calling get_transaction_by_version. ie. version: 523388616, 523363977 #12702

Open
Alivers opened this issue Mar 27, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@Alivers
Copy link

Alivers commented Mar 27, 2024

馃悰 Bug

The client entry returns error without a valid reason. There are many transactions with this error.

To reproduce

rust sdk rev is branch = devnet.
Code snippet to reproduce

 let client = RestClient::new(Url::parse("https://api.mainnet.aptoslabs.com/v1").unwrap());
print!("{:?}", client.get_transaction_by_version(523363977).await);
return Ok(());

Stack trace/error message

Err(Unknown(error decoding response body: invalid value: map, expected map with a single key

Caused by:
    invalid value: map, expected map with a single key))  
@Alivers Alivers added the bug Something isn't working label Mar 27, 2024
@Alivers Alivers changed the title [Bug] Rest client return parsing error for some transactions when calling get_transaction_by_version. ie. version: 523388616 [Bug] Rust rest client return parsing error for some transactions when calling get_transaction_by_version. ie. version: 523388616 Mar 27, 2024
@Alivers Alivers changed the title [Bug] Rust rest client return parsing error for some transactions when calling get_transaction_by_version. ie. version: 523388616 [Bug] Rust rest client return parsing error for some transactions when calling get_transaction_by_version. ie. version: 523388616, 523363977 Mar 27, 2024
@Alivers
Copy link
Author

Alivers commented Mar 27, 2024

Seem these transaction are all MultiSig transactions. #12445
After changing the sdk rev to branch = main. The error also changed to the below:

Err(Unknown(error decoding response body: missing field `type`

Caused by:
    missing field `type`))      

@junkil-park Please have a look. Really appreciate it.

@junkil-park
Copy link
Contributor

junkil-park commented Mar 27, 2024

@Alivers , could you confirm if this functionality in question was operational fine prior my PR (#12445)?

I am asking this because the multisig payload (de)serialization in JSON has been already broken, so my PR fixes it. The fix isn't rolled out to the devnet and the mainnet yet.

@junkil-park
Copy link
Contributor

@Alivers , can you use the BCS version: get_transaction_by_version_bcs instead of get_transaction_by_version? BCS is more robust to this kind of change in general.

@Alivers
Copy link
Author

Alivers commented Mar 28, 2024

@Alivers , could you confirm if this functionality in question was operational fine prior my PR (#12445)?

I am asking this because the multisig payload (de)serialization in JSON has been already broken, so my PR fixes it. The fix isn't rolled out to the devnet and the mainnet yet.

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

@Alivers
Copy link
Author

Alivers commented Mar 28, 2024

@Alivers , can you use the BCS version: get_transaction_by_version_bcs instead of get_transaction_by_version? BCS is more robust to this kind of change in general.

This function works. But I need to change the Transaction Type Reference all my codebase, or is there any convenient way to convert TransactionData to Transaction?

@junkil-park
Copy link
Contributor

junkil-park commented Mar 28, 2024

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

My question was that: did get_transaction_by_version for multisig transactions work previously? Has it only recently stopped functioning?

@junkil-park
Copy link
Contributor

This function works. But I need to change the Transaction Type Reference all my codebase, or is there any convenient way to convert TransactionData to Transaction?

Unfortunately, the conversion function doesn't seem to exist. However, the information contained in the two struct should largely overlap.

@Alivers
Copy link
Author

Alivers commented Mar 28, 2024

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

My question is: Did get_transaction_by_version for multisig transactions work previously? Has it only recently stopped functioning?

Did work for a long time. I just recently noticed that.

@Alivers
Copy link
Author

Alivers commented Mar 28, 2024

This function works. But I need to change the Transaction Type Reference all my codebase, or is there any convenient way to convert TransactionData to Transaction?

Unfortunately, the conversion function doesn't seem to exist. However, the information contained in the two struct should largely overlap.

Ok, but it is too difficult for me to change the type and match multi-layer invariants(Transaction, Event, WriteSet). Could you please fix this issue? 馃檹馃徎

@junkil-park
Copy link
Contributor

junkil-park commented Mar 28, 2024

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

My question is: Did get_transaction_by_version for multisig transactions work previously? Has it only recently stopped functioning?

Did work for a long time. I just recently noticed that.

I think that this has not been functioning on the mainnet. I tested it with branch = mainnet, and found that it also produced an error:

Err(Unknown(error decoding response body: invalid value: map, expected map with a single key

Caused by:
    invalid value: map, expected map with a single key))

Probably, you haven't encountered this Multisig payload cases. The transactions 523388616 and 523363977 you mention are from very recent days, only a few days ago.

@junkil-park
Copy link
Contributor

This function works. But I need to change the Transaction Type Reference all my codebase, or is there any convenient way to convert TransactionData to Transaction?

Unfortunately, the conversion function doesn't seem to exist. However, the information contained in the two struct should largely overlap.

Ok, but it is too difficult for me to change the type and match multi-layer invariants(Transaction, Event, WriteSet). Could you please fix this issue? 馃檹馃徎

I believe that this PR (#12445) is the fix to the issue you describe. The fix has already landed on the main branch, which needs to roll out to devnet -> testnet -> mainnet. This process will probably take 1.5 months from now.

I would highly recommend you to try the BCS version, and let me know if you have any question on that.

@Alivers
Copy link
Author

Alivers commented Mar 28, 2024

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

My question is: Did get_transaction_by_version for multisig transactions work previously? Has it only recently stopped functioning?

Did work for a long time. I just recently noticed that.

I think that this has not been functioning on the mainnet. I tested it with branch = mainnet, and found that it also produced an error:


Err(Unknown(error decoding response body: invalid value: map, expected map with a single key



Caused by:

    invalid value: map, expected map with a single key))

Probably, you haven't encountered this Multisig payload cases. The transactions 523388616 and 523363977 you mention are from very recent days, only a few days ago.

The mainnet branch produced the invalid value map error. But the main branch(which contains the changes of #12445) prodeces the type field missing error. Two different branches.
Not sure if it was caused by the multisig tx parsing.

@junkil-park
Copy link
Contributor

junkil-park commented Mar 28, 2024

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

My question is: Did get_transaction_by_version for multisig transactions work previously? Has it only recently stopped functioning?

Did work for a long time. I just recently noticed that.

I think that this has not been functioning on the mainnet. I tested it with branch = mainnet, and found that it also produced an error:


Err(Unknown(error decoding response body: invalid value: map, expected map with a single key



Caused by:

    invalid value: map, expected map with a single key))

Probably, you haven't encountered this Multisig payload cases. The transactions 523388616 and 523363977 you mention are from very recent days, only a few days ago.

The mainnet branch produced the invalid value map error. But the main branch(which contains the changes of #12445) prodeces the type field missing error. Two different branches. Not sure if it was caused by the multisig tx parsing.

It's not just a parsing (deserialization) issue but also a serialization issue. More specifically, the error is caused by the misalignment of serialization and deserialization of MultisigTransactionPayload in JSON, which has exists for a while (#8304).

My fix #12445 makes them aligned. It's expected that even though you use aptos-sdk from branch = main now, you still encounter the error, because currently, the mainnet fullnode incorrectly serializes those payloads (or in a misaligned way). So, the issue will be resolved once the fix rolls out to the mainnet fullnode.

@Alivers
Copy link
Author

Alivers commented Mar 29, 2024

I鈥檝e tried the fix in PR #12445, using the main branch, but I鈥檓 still encountering issues. The error description is mentioned in my first comment. Could you please take a look and provide some guidance or assistance?

My question is: Did get_transaction_by_version for multisig transactions work previously? Has it only recently stopped functioning?

Did work for a long time. I just recently noticed that.

I think that this has not been functioning on the mainnet. I tested it with branch = mainnet, and found that it also produced an error:

Err(Unknown(error decoding response body: invalid value: map, expected map with a single key

Caused by:

invalid value: map, expected map with a single key))

Probably, you haven't encountered this Multisig payload cases. The transactions 523388616 and 523363977 you mention are from very recent days, only a few days ago.

The mainnet branch produced the invalid value map error. But the main branch(which contains the changes of #12445) prodeces the type field missing error. Two different branches. Not sure if it was caused by the multisig tx parsing.

It's not just a parsing (deserialization) issue but also a serialization issue. More specifically, the error is caused by the misalignment of serialization and deserialization of MultisigTransactionPayload in JSON, which has exists for a while (#8304).

My fix #12445 makes them aligned. It's expected that even though you use aptos-sdk from branch = main now, you still encounter the error, because currently, the mainnet fullnode incorrectly serializes those payloads (or in a misaligned way). So, the issue will be resolved once the fix rolls out to the mainnet fullnode.

Got it! Thank you.

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
Status: 馃帀 New
Development

No branches or pull requests

2 participants