Skip to content

defaultAbiDecoder doesn't work for encodePacked #1793

Answered by zemse
novaknole asked this question in Q&A
Discussion options

You must be logged in to vote

Heya! I don't think it is possible to properly decode all kinds of packed encodings as it is ambigious, take the following example:

function awesome(bytes32  nice, bytes memory good, bytes memory good2) public view returns(bytes memory){
        return abi.encodePacked(nice, good, good2);
}

nice = 0x1010101010101010101010101010101010101010101010101010101010101010
good = 0x00000000000000000000
good2 = 0x10000000000000000000

returnded value: 0x10101010101010101010101010101010101010101010101010101010101010100000000000000000000010000000000000000000

How since good and good2 are dynamic lengths, and their lengths are not encoded, there are multiple possible decodings that would encode to the…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ricmoo
Comment options

Answer selected by ricmoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants