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

feat: destructure input args even when selector is unknown #160

Closed
2 tasks done
fomotrader opened this issue Oct 28, 2023 · 6 comments · Fixed by #188
Closed
2 tasks done

feat: destructure input args even when selector is unknown #160

fomotrader opened this issue Oct 28, 2023 · 6 comments · Fixed by #188
Assignees
Labels
A-core Area: core C-decode Command: decode D-average Difficulty: average P-normal Priority: normal T-feature Type: feature

Comments

@fomotrader
Copy link

Version

heimdall 0.6.3

Please check the following

  • This is not a duplicate question
  • I have checked the wiki beforehand

Operating System

macOS (Apple Silicon)

Ask your question here

Suppose I have this transaction and we don't have the function selector in samczsun's selector library. Can I still use the decode command to at least decode all its input args? Should be possible to do this with heimdall imo, I can then use etherscan to reverse engineer what inputs are what exactly.

Sometimes the name is'nt as important as what's going in to a function. What do you think Jon?

At the moment I get the output below which could be a lot better if all the input args were destructed for me. I think I could then generate an ABI from this and destructure these function calls no?

⚡23% ➜  heimdall decode0x01015a19cc6287eb099da29efa33cd8a7b2b8a6d515731b03000b1dc821d82b9 -vvv
warn: couldn't find any matches for the given function signature.
trace:
  [262] heimdall::decode(0x01015a19cc6287eb099da29efa33cd8a7b2b8a6d515731b03000b1dc821d82b9)
    │
    ├─ selector: 0x70fef1da
    ├─ calldata: 484 bytes
    │
    ├─ input 0:  000000000000000000000000de47a2460e4b6c36b26919ef9255b4f3f86de0a0
    │        1:  000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
    │        2:  0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
    │        3:  0000000000000000000000000a8e3f1dcf7b28896f5b4fd44430c9b66731647c
    │        4:  0000000000000000000000000000000000000000000000000000000000000000
    │        5:  0000000000000000000000000000000000000000000000000000000000000000
    │        6:  0000000000000000000000005200a0e9b161bc59feecb165fe2592bef3e1847a
    │        7:  0000000000000000000000000000000000000000000000000000000000000100
    │        8:  0000000000000000000000000000000000000000000000000000000000000006
    │        9:  0000000000000000000000000000000000000000000000000000000000000032
    │        10: 0000000000000000000000000000000000000000000000000000000000000001
    │        11: 0000000000000000000000000000000000000000000000000000000000000023
    │        12: 0000000000000000000000000000000000000000000000000000000000000000
    │        13: 00000000000000000000000000000000000000000000000000000000653c852f
    │        14: 0000000000000000000000000000000000000000000000000000000000000000
    └─ ← ()
@Jon-Becker
Copy link
Owner

Hey! Sorry for the slow response, been a pretty busy week.

I can defitnely make the decode module guess parameters.

In the past, I decided against this for the sake of "correctness", but it makes sense imo that a forensic/heuristic toolkit should be able to do this kind of guesswork.

I'll get a PR for you this weekend!

@Jon-Becker Jon-Becker self-assigned this Nov 3, 2023
@fomotrader
Copy link
Author

@Jon-Becker thank you and no apologies needed it's open source and I'm thankful this project even exists. Thanks

@Jon-Becker
Copy link
Owner

Release will be either tonight or tomorrow night. I'll ping you here and on twitter when it's out!

@Jon-Becker
Copy link
Owner

Wasn't able to squeeze into this release, but this is on top of my prio list for heimdall now.

@Jon-Becker Jon-Becker added A-core Area: core C-decode Command: decode D-average Difficulty: average P-normal Priority: normal T-feature Type: feature and removed A: Common labels Nov 12, 2023
@Jon-Becker Jon-Becker linked a pull request Nov 19, 2023 that will close this issue
@Jon-Becker Jon-Becker changed the title [Question]: Destructure input args even when selector is unknown feat: destructure input args even when selector is unknown Nov 20, 2023
@Jon-Becker
Copy link
Owner

@fomotrader made pretty big progress on this front:

image

I expect the PR will be merged tomorrow.

@fomotrader
Copy link
Author

@Jon-Becker thank you very much, this is amazing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: core C-decode Command: decode D-average Difficulty: average P-normal Priority: normal T-feature Type: feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants