-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Aptos]: Fix an issue in deserializing the EntryFunction object #4011
[Aptos]: Fix an issue in deserializing the EntryFunction object #4011
Conversation
Hi @satoshiotomakan , I have come across a bug in the code. Whenever you have some time, could you please review it? |
Hi @10gic, thank you for the fix! Could you please add a test with the following steps:
|
Hi @satoshiotomakan, there is no function to deserialize an EntryFunction from a byte array or hex, and the bug exists in the process of deserializing an EntryFunction from JSON.
I added a test case to check the equality of Hex1 and Hex2. If the bug is not fixed, Hex1 will not equal Hex2. |
Hey @10gic please take a look at this issue: aptos-labs/aptos-core#6235 - I do think that the code is needed. |
Hi @Milerius, you posted an example in that issue:
I checked the source code of function The type of argument
The tricky part is that both
can represent the argument of following two functions:
We must know the extract function argument type while do bcs encoding. I think in the implement code of
RPC My fix appears to be correct.
However, deserializing EntryFunction from JSON in the wallet core (or any other offline tool) remains ambiguous, as we need the function argument type for clarity. |
As I said, deserializing EntryFunction from JSON is ambiguous. So following line would lead to bugs.
I believe that issue #3899 is also caused by this bug. Possible solution: pass types of arguments into wallet core, use these types of information to reconstruct EntryFunction. |
* Fix an issue in deserializing the EntryFunction object * Add more test cases --------- Co-authored-by: satoshiotomakan <127754187+satoshiotomakan@users.noreply.github.com>
Description
There is a bug in the function serialize_argument, which leads to the deserialization process generating an incorrect EntryFunction object.
How to test
Run Rust, C++, Kotlin, Swift tests
Types of changes
Checklist
If you're adding a new blockchain