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

Better parsing of information of get_call_trace() #2438

Open
amanusk opened this issue Sep 3, 2024 · 0 comments
Open

Better parsing of information of get_call_trace() #2438

amanusk opened this issue Sep 3, 2024 · 0 comments
Labels
feature New feature request/description snforge

Comments

@amanusk
Copy link
Contributor

amanusk commented Sep 3, 2024

Which component is your feature related to?

Forge

Feature Request

Currently, the output of get_call_trace() is something like the following:

Entry point type: External
Selector: 655947323460646800722791151288222075903983590237721746322261907338444055163
Calldata: []
Storage address: 469394814521890341860918960550914
Caller address: 0
Call type: Call
Nested Calls: [
    (
        Entry point type: Constructor
        Selector: 1159040026212278395030414237414753050475174923702621880048416706425641521556
        Calldata: [1000000000, 0, 1]
        Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: []
    ),
    (
        Entry point type: Constructor
        Selector: 1159040026212278395030414237414753050475174923702621880048416706425641521556
        Calldata: []
        Storage address: 266602857962780500560575367605163353787844403251461374617586343325758272539
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: []
    ),
    (
        Entry point type: External
        Selector: 1516754014369808875012295842270199525215452866521012470027807093200784961331
        Calldata: [1]
        Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: [1000000000, 0]
    ),
    (
        Entry point type: External
        Selector: 949021990203918389843157787496164629863144228991510976554585288817234167820
        Calldata: [266602857962780500560575367605163353787844403251461374617586343325758272539, 200, 0]
        Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: [1]
    ),
    (
        Entry point type: External
        Selector: 863164345921111744606866654754108663958095967665259696902984674202985078753
        Calldata: [1, 266602857962780500560575367605163353787844403251461374617586343325758272539]
        Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: [200, 0]
    ),
    (
        Entry point type: External
        Selector: 1516754014369808875012295842270199525215452866521012470027807093200784961331
        Calldata: [1]
        Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: [1000000000, 0]
    ),
    (
        Entry point type: External
        Selector: 1146600213091971980026421286902096186391639375067540226477872965793053492560
        Calldata: [2640695653809124472829969446340594280031864228451411863974916565453572282122, 1, 2, 100, 0]
        Storage address: 266602857962780500560575367605163353787844403251461374617586343325758272539
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: [
            (
                Entry point type: External
                Selector: 1555377517929037318987687899825758707538299441176447799544473656894800517992
                Calldata: [1, 266602857962780500560575367605163353787844403251461374617586343325758272539, 100, 0]
                Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
                Caller address: 266602857962780500560575367605163353787844403251461374617586343325758272539
                Call type: Call
                Nested Calls: []
                Call Result: Success: [1]
            ),
            (
                Entry point type: External
                Selector: 232670485425082704932579856502088130646006032362877466777181098476241604910
                Calldata: [2, 100, 0]
                Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
                Caller address: 266602857962780500560575367605163353787844403251461374617586343325758272539
                Call type: Call
                Nested Calls: []
                Call Result: Success: [1]
            )
        ]
        Call Result: Success: []
    ),
    (
        Entry point type: External
        Selector: 1516754014369808875012295842270199525215452866521012470027807093200784961331
        Calldata: [2]
        Storage address: 2640695653809124472829969446340594280031864228451411863974916565453572282122
        Caller address: 469394814521890341860918960550914
        Call type: Call
        Nested Calls: []
        Call Result: Success: [100, 0]
    )
]

This has a lot of valuable information but is not very readable.
Since we have insights into which contracts and functions are called, we can augment the calltrace with more data.
Some points that would help the parsed call trace be more informative:

  • Include call contract name
  • Decode selector into its relevant string
  • Caller addresses and and contract addresses in Hex (or configurable)
  • Deserialized call results to their Cairo types
  • Gas usage of each entry point

A good reference is how this is displayed on Walnut

@github-actions github-actions bot added the new label Sep 3, 2024
@cptartur cptartur added feature New feature request/description and removed new labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request/description snforge
Projects
Status: Triage
Development

No branches or pull requests

3 participants