wallet-core
wallet-core copied to clipboard
[Ethereum]: Add support for abi.encodePacked() | Resolves #3679
Description
This pull request adds support for abi.encodePacked()
as described in issue #3679. The implementation follows the non-standard packed mode encoding, which concatenates types shorter than 32 bytes directly without padding or sign extension, encodes dynamic types in-place without the length field, and encodes array elements padded but in-place.
How to test
Reviewers can test the changes by running the included test cases that cover various scenarios for abi.encodePacked()
encoding:
-
cargo test encode_packed_tokens
- Specific test cases:
-
encode_packed_address
-
encode_packed_bytes
-
encode_packed_string
-
encode_packed_int
-
encode_packed_bool
-
encode_packed_uint
-
encode_packed_fixed_bytes
-
encode_packed_mixed
-
encode_packed_array
-
Ensure that all tests pass and verify the encoded outputs match the expected values.
Types of changes
- New feature (non-breaking change which adds functionality)
Checklist
- [x] Create pull request as draft initially, unless it's complete.
- [x] Add tests to cover changes as needed.
- [ ] Update documentation as needed.
- [x] If there is a related Issue, mention it in the description.
If you're adding a new blockchain
- [ ] I have read the guidelines for adding a new blockchain.