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

meta(chisel): tracking issue for chisel improvements #3743

Open
devtooligan opened this issue Nov 22, 2022 · 18 comments
Open

meta(chisel): tracking issue for chisel improvements #3743

devtooligan opened this issue Nov 22, 2022 · 18 comments
Labels
C-chisel Command: chisel T-meta Type: meta

Comments

@devtooligan
Copy link

devtooligan commented Nov 22, 2022

Component

Chisel

Describe the feature you would like

context: #3465 (comment)

@devtooligan devtooligan added the T-feature Type: feature label Nov 22, 2022
@devtooligan
Copy link
Author

need better ux for unknown commands, maybe a hint if the unkown command matches a !command

Screen Shot 2022-11-21 at 2 52 54 PM

@devtooligan
Copy link
Author

feature request:
convert unix epoch timestamp to readable date. maybe the other way around too
https://www.unixtimestamp.com/

@devtooligan
Copy link
Author

feature request:

  • more integration with cast.
  • call cast commands directly from chisel so u dont have to leave
  • use results of cast commands together with solidity commands (like set the value of some solidity var to the output of a cast cmd)

@devtooligan
Copy link
Author

nit:
after an error the first new -> prompt is red
Screen Shot 2022-11-21 at 3 07 50 PM

@devtooligan
Copy link
Author

feature request:
a listing of local variables and their values

!listvar

myadddy 0x18989013980190890818901
myNumber 0x11 (17)
myString "Yo homie"

@devtooligan
Copy link
Author

feature request:
convert from 64 bit numbers and back (also maybe 128 and?) replaces https://toolkit.abdk.consulting/math#convert-number

@devtooligan
Copy link
Author

feature request:
rightpad(0x123)
0x123000000000000....000 (32bytes)

@devtooligan
Copy link
Author

feature request:
i think the return value of anything you enter should be displayed after you type it.

so like:
uint y = 100 - 90

right now does nothing, i want it o display 10

values dont display if the expression is enclosed in (parens)
Screen Shot 2022-11-21 at 3 48 49 PM

@devtooligan
Copy link
Author

feature request:
ability to list files like doing ls from command line -- useful when trying to find ur imports

@devtooligan
Copy link
Author

i got imports to work. but the return value of a function called an instantiated contract does not display
Screen Shot 2022-11-21 at 3 24 17 PM

@devtooligan
Copy link
Author

feature request:
shortcuts, can we make it so you only have to enter the first two letters of the command?
!cl for !clear
!me for !memdump
etc...

maybe someday we can have some kind of global or user based aliases

@devtooligan devtooligan changed the title Chisel: Feature request meta thread Chisel: Feature request meta issue Nov 22, 2022
@mds1
Copy link
Collaborator

mds1 commented Nov 23, 2022

This is a great list, thanks @devtooligan!

One thing that might be helpful is refactoring this issue so the top comment is a checklist with all of these in a list, such as in #876 and #3412? This makes it easier to track each request individually, instead of the separate comments. (If you’re feeling really ambitious and want to create separate issues for each then link to them here, even better, but I know that’s tedious so nw)

@devtooligan
Copy link
Author

@mds1 sure. i should have some time to do this next week. for now it was just a quick dump to clean up the pr. cheers!

@mds1
Copy link
Collaborator

mds1 commented Nov 23, 2022

Awesome thanks! 🙌

@clabby
Copy link
Contributor

clabby commented Nov 25, 2022

Thanks for the feedback @devtooligan, great suggestions & super useful! Have just cleaned up the README for review, so posting the existing checklist here:

Checklist

  • REPL functionality
    • Create temporary REPL contract (in memory, or temp file?).
      • Implement forge-std/Test.sol so that cheatcodes, etc. can be used.
    • Utilize foundry's evm module for REPL env.
      • Implement network forking.
    • Expression evaluation / inspection (i.e. the input 0x01 << 0x08 should inspect a uint of value 256)
      • Support for primitive type expressions (i.e. primitive types, arithmetic ops, bitwise ops, boolean ops, global vars (msg, tx, block, & abi))
      • Support for function call expressions (both local and external to the REPL contract)
      • Support for array indexing (external + local)
      • Support for mapping indexing (external + local)
      • Clean up refactor
    • Input history.
    • Use forge fmt module to format source code when printing via the !source command or exporting to a Script file (?)
  • Cache REPL History
    • Allow a user to save/load sessions from their Chisel history.
      • Fix session loading bug wrt non-serializable IntermediateOutput component.
  • Custom commands / cmd flags / etc.
    • Inspect variable
      • Inspect raw stack
    • Inspect memory vars
      • Inspect raw memory
    • Inspect storage vars
      • Inspect raw storage slots / storage layout
    • Inspection verbosity configuration
    • Undo
    • Inspect bytecode / mnenomic of local or remote contracts.
      • Possibly use the forge debugger for this?
    • Fetch contract interface from Etherscan ABI
    • Import remote sources from GitHub
    • Enable / disable call trace printing
      • Rip trace printing code from another module of foundry.
    • On-the-fly network forking
    • Export to file
      • Export session to script contract if within project.
  • Syntax highlighting
  • Binary subcommands
  • Tests.
    • Cache
  • Benchmarks.
    • Session Source
      • Building
      • Executor
      • Inspection
      • Cloning
  • Optimizations (after MVP).
    • Speed up REPL execution time.
      • Use flamegraph to determine plan of attack.
      • Rework SessionSource clone, does not need to be a full deep copy.
      • Cache the backend within the executor so that it is not regenerated on each run. This causes lag with forks especially. We should keep the option to refresh each time to keep live state, but disable this by default.
  • Finish README.
    • Examples
    • Migration from existing REPLs
  • First review.
    • Support ENV var interpolation in fork urls
    • Allow named sessions
    • Rename !flush to !save
    • Check fork URL validity
    • Add builtin command shorthands
    • ...

@joshieDo
Copy link
Collaborator

feature request: execute a script and start the shell at the end of it 👉 👈
chisel script/script.sol

@transmissions11
Copy link
Contributor

transmissions11 commented Dec 27, 2022

Crossposting some of my chisel feature request #3965 here:

feat(chisel): display raw stack values when logging variable

Describe the feature you would like

Currently with <32 byte types, their higher order bits aren't shown anywhere except the stackdump. Often when I'm fooling around with assembly I want to see the full in-stack representation of these types (higher order bits and all), so would be great if there was an additional field in the variable output like Raw: 0x1000000000000000000000000000000000000000000000000000000000000002 so we could easily observe these things. Another option would be a !raw [var]-esque command.

Here are some repro cases of higher order bits not being shown.

λ chisel
Welcome to Chisel! Type `!help` to show available commands.

➜ uint16 num = 2;
➜ assembly { num := 0x1000000000000000000000000000000000000000000000000000000000000002 }
➜ num
Type: uint
├ Hex: 0x2
└ Decimal: 2!sd
[0]: 0x1000000000000000000000000000000000000000000000000000000000000002
[1]: 0x33
[2]: 0xc0406226address addy = address(0xBEEF);
➜ assembly { addy := 0x100000000000000000000000000000000000000000000000000000000000beef }
➜ addy
Type: address
└ Data: 0x000000000000000000000000000000000000beef!sd
[0]: 0x100000000000000000000000000000000000000000000000000000000000beef
[1]: 0x33
[2]: 0xc0406226

Additional context

No response

@ItosTerence
Copy link

Feature Request: Gas Reporting Per Line

After you run a command, it'd be great to see the gas cost of what you just ran.

@zerosnacks zerosnacks added T-meta Type: meta and removed T-feature Type: feature labels Jun 27, 2024
@zerosnacks zerosnacks changed the title Chisel: Feature request meta issue meta(chisel): tracking issue for chisel improvements Jun 27, 2024
@zerosnacks zerosnacks modified the milestone: v1.0.0 Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-chisel Command: chisel T-meta Type: meta
Projects
None yet
Development

No branches or pull requests

8 participants