shazow / whatsabi

Extract the ABI (and resolve proxies, and get other metadata) from Ethereum bytecode, even without source code.
https://shazow.github.io/whatsabi/
MIT License
1.04k stars 71 forks source link

buffer does not contain relative step #42

Closed mkchungs closed 1 year ago

mkchungs commented 1 year ago

I'm getting this error:buffer does not contain relative step when trying to get selectors for Ethereum contract at 0x37c6e59e1ae39d81828db1a8e8233d6b2afcb9a8

Minimal code to reproduce the problem:

const whatsabi = require("@shazow/whatsabi")
let bytecode = '0x5b602960346000f073032be5d2772329c11a72dadb32ce03806bb26f0a3160005760006000600060003031335af15060006000f36000600060206000600073032be5d2772329c11a72dadb32ce03806bb26f0a5a6069600052f15033ff'
let selectors = whatsabi.selectorsFromBytecode(bytecode)

Errors:

> let selectors = whatsabi.selectorsFromBytecode(bytecode)
Uncaught Error: buffer does not contain relative step
    at BytecodeIter.asPos (/root/go/src/github.com/colorfulnotion/evm-etl/node_modules/@shazow/whatsabi/lib/disasm.js:67:23)
    at BytecodeIter.at (/root/go/src/github.com/colorfulnotion/evm-etl/node_modules/@shazow/whatsabi/lib/disasm.js:76:26)
    at disasm (/root/go/src/github.com/colorfulnotion/evm-etl/node_modules/@shazow/whatsabi/lib/disasm.js:213:44)
    at abiFromBytecode (/root/go/src/github.com/colorfulnotion/evm-etl/node_modules/@shazow/whatsabi/lib/disasm.js:136:15)
    at Object.selectorsFromBytecode (/root/go/src/github.com/colorfulnotion/evm-etl/node_modules/@shazow/whatsabi/lib/selectors.js:22:46)
> 

Any helps?

shazow commented 1 year ago

Hiya, which version of whatsabi are you using?

mkchungs commented 1 year ago

currently using @shazow/whatsabi@0.5.0

shazow commented 1 year ago

Cool thanks, I'll look into this soon, thanks for reporting. :)

shazow commented 1 year ago

Should be fixed in main. Will do a v0.6.1 release shortly!

shazow commented 1 year ago

v0.6.1 should be published, let me know if you're still having problems!