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

test: add decoding test #12

Closed
wants to merge 1 commit into from
Closed

test: add decoding test #12

wants to merge 1 commit into from

Conversation

mattsse
Copy link
Contributor

@mattsse mattsse commented Jan 27, 2024

@DaniPopes we're unable to decode the revert reason for the output of this trace:

{
	"jsonrpc":"2.0",
	"method":"debug_traceTransaction",
	"params":["0x105707c8e3b3675a8424a7b0820b271cbe394eaf4d5065b03c273298e3a81314", {  "tracer": "callTracer" }],
	"id":1
}
            {
                "from": "0x8ba8ceecdcb00bee67a0e9acc0c23f4ef433857e",
                "gas": "0x6d706",
                "gasUsed": "0x463d2",
                "to": "0xf848e97469538830b0b147152524184a255b9106",
                "input": "0x022c0d9f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000544d473eab119205930000000000000000000000008ba8ceecdcb00bee67a0e9acc0c23f4ef433857e000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000ac953d1038efbf6000000000000000000000000000000000000000000000000052befe79d2ca1a7d3e000000000000000000000000000000000000000000000054bdde1a19a547ef49",
                "output": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e5400000000000000000000000000000000000000000000000000000080",
                "error": "Reverted",

erigon decodes the reason

           {
                "output": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e5400000000000000000000000000000000000000000000000000000080",
                "error": "execution reverted",
                "revertReason": "UniswapV2: INSUFFICIENT_INPUT_AMOUNT",

looks the like output has a few extra bytes, any ideas?

@mattsse
Copy link
Contributor Author

mattsse commented Feb 6, 2024

bump @DaniPopes any ideas?

@DaniPopes
Copy link
Member

DaniPopes commented Feb 6, 2024

Don't know, I'm not well versed in Solidity 0.5 invalid ABI encoding :)

08c379a0                                                         // keccak256("Error(string)")[..4]
0000000000000000000000000000000000000000000000000000000000000020 // offset = 32 (next word)
0000000000000000000000000000000000000000000000000000000000000024 // length = 36
556e697377617056323a20494e53554646494349454e545f494e5055545f414d // string[ 0..32]
4f554e54                                                         // string[32..36]
00000000000000000000000000000000000000000000000000000080         // ?

The error is this not the one you linked: https://github.com/Uniswap/v2-core/blob/ee547b17853e71ed4e0101ccfd52e70d5acded58/contracts/UniswapV2Pair.sol#L178

In this case it gets decoded correctly but fails validation because encode(decoded) != data due to the random 80 byte at the end of the string padding. You can pass false to abi decoding to skip this validation @mattsse: alloy-rs/core#511

@DaniPopes
Copy link
Member

Fixed in next release of alloy-core

@DaniPopes DaniPopes closed this Feb 15, 2024
@DaniPopes DaniPopes deleted the matt/add-decoding-test branch February 15, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants