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

@ethersproject asm disassemble unknow opcodes #3

Open
wighawag opened this issue Sep 5, 2022 · 1 comment
Open

@ethersproject asm disassemble unknow opcodes #3

wighawag opened this issue Sep 5, 2022 · 1 comment
Assignees

Comments

@wighawag
Copy link

wighawag commented Sep 5, 2022

Ethers Version

5.7.0

Search Terms

asm

Describe the Problem

I am using asm disassemble on bytecode generated by solitidty 0.8.13 and got several unknown opcodes

Code Snippet

// SPDX-License-Identifier: AGPL-1.0
pragma solidity 0.8.13;

contract Test {
	constructor() {}

	function test() external {}
}


generated asm: using disassemble + formatBytecode
```asm
0000 : 0x80                                                               ; ethers-io/ethers.js#1 
0002 : 0x40                                                               ; ethers-io/ethers.js#1 
0004 : MSTORE
0005 : CALLVALUE
0006 : DUP1
0007 : ISZERO
0008 : 0x0f                                                               ; ethers-io/ethers.js#1 
000a : JUMPI
000b : 0x00                                                               ; ethers-io/ethers.js#1 
000d : DUP1
000e : REVERT
000f*: JUMPDEST
0010 : POP
0011 : 0x65                                                               ; ethers-io/ethers.js#1 
0013 : DUP1
0014 : 0x1d                                                               ; ethers-io/ethers.js#1 
0016 : 0x00                                                               ; ethers-io/ethers.js#1 
0018 : CODECOPY
0019 : 0x00                                                               ; ethers-io/ethers.js#1 
001b : RETURN
001c : INVALID
001d : 0x80                                                               ; ethers-io/ethers.js#1 
001f : 0x40                                                               ; ethers-io/ethers.js#1 
0021 : MSTORE
0022 : CALLVALUE
0023 : DUP1
0024 : ISZERO
0025 : 0x0f                                                               ; ethers-io/ethers.js#1 
0027 : JUMPI
0028 : 0x00                                                               ; ethers-io/ethers.js#1 
002a : DUP1
002b : REVERT
002c*: JUMPDEST
002d : POP
002e : 0x04                                                               ; ethers-io/ethers.js#1 
0030 : CALLDATASIZE
0031 : LT
0032 : 0x28                                                               ; ethers-io/ethers.js#1 
0034 : JUMPI
0035 : 0x00                                                               ; ethers-io/ethers.js#1 
0037 : CALLDATALOAD
0038 : 0xe0                                                               ; ethers-io/ethers.js#1 
003a : SHR
003b : DUP1
003c : 0xf8a8fd6d                                                         ; ethers-io/ethers.js#4 
0041 : EQ
0042 : 0x2d                                                               ; ethers-io/ethers.js#1 
0044 : JUMPI
0045*: JUMPDEST
0046 : 0x00                                                               ; ethers-io/ethers.js#1 
0048 : DUP1
0049 : REVERT
004a*: JUMPDEST
004b : STOP
004c : INVALID
004d : LOG2
004e : 0x6970667358                                                       ; ethers-io/ethers.js#5 
0054 : unknown (0x22)
0055 : SLT
0056 : SHA3
0057 : unknown (0xaf)
0058 : unknown (0xdd)
0059 : 0x49bbc60d2b1ec3cd669ec0f050abeb9f                                 ; ethers-io/ethers.js#16 
006a : EXP
006b : unknown (0xbc)
006c : PUSH22                                                             ; OOB!! 
006d : unknown (0xae)
006e : unknown (0xfb)
006f : unknown (0xbd)
0070 : 0x9c811407c2f464736f6c63                                           ; ethers-io/ethers.js#11 
007c : NUMBER
007d : STOP
007e : ADDMOD
007f : unknown (0x0d)
0080 : STOP
0081 : CALLER


### Contract ABI

_No response_

### Errors

_No response_

### Environment

node.js (v12 or newer)

### Environment (Other)

_No response_
@zemse
Copy link

zemse commented Oct 2, 2022

got several unknown opcodes

I think that's due to some metadata hash that is being appended at the end of the bytecode. Maybe it is always located after JUMPDEST STOP.

@ricmoo ricmoo transferred this issue from ethers-io/ethers.js Jan 18, 2023
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

No branches or pull requests

3 participants