Skip to content

Commit

Permalink
feat(chisel): Introduces a Solidity REPL (#3465)
Browse files Browse the repository at this point in the history
* Init chisel

* Playing w/ `TempProject` to start

* Temp changes to the readline, back to school work

* parse with solang_parser

* readme updates, feature bog 😓

* chisel session loading

* Start builtin command module

🧹

* Store raw source alongside parsed source units

* fix versioning in environment using semver

* Start REPL executor

* serde serialize and deserialize

* Clean; Scrap first runner impl

* Merge with `feat/repl`

* Hack together beginnings of runner

* caching progress

* optimistically use first pragma definition

* tests pass 🚧

* session cache io

* formatting ✨

* fixes

* cache tests and fixes

* merge upstream ⚠️

* add chisel to foundryup

* initial soli source generation port

* stashing refactor progress

* refactor nearly there

* ✨ fix styling

* Rip script runner into chisel

* Progress- still broken

* Progress

* Refactors; it's kinda alive 🚀

* 🧹

🧹

* start inspection formatter

* Fix caching

* Merge w/ upstream

* Foundry / EVM configuration; on-the-fly forking

* Port `soli`'s `SolidityHelper`

fmt

* Update README tasks

* Start tracing support; 🧹

* Fix dynamic bytes inspection formatting

* 🧹

* Clear session ID on `!clearcache` command

* Fix `int` inspection formatting

* Remove unnecessary fields from `ChiselResult`

* Inherit `Script.sol` from `testdata`

* 🧹, error handling, & readme

* solc version configuration, `memdump` / `stackdump` commands, and `rpc_endpoints` config support

* Bug fixes, cache tests, README updates

* Include `forge-std` contracts in binary

* Add criterion benchmarks

* Add binary subcommands

* Project remapping support

* Add `!export` command

* 🧹

* Checkout submodules in release workflow

* Update README

* Add @mds1's suggestions

* README tasks update

* Fetch interface of verified contracts on Etherscan

* Optional script inheritance; Clean up help menu; 🧹

* Command shortcuts; fork URL verification; 🧹

* expression evaluation WIP

* Updates

* Update README checklist

* Clean up script exporting

* Use `forge-fmt` to format source for both `!export` and `!source`

* Move to laptop

* Update checklist

* Function call expression eval updates; Still not a fan

* 🧹

* Big improvements in func expression eval

* More improvements; 🧹 tmrw

* Refactor intermediate output, expression eval stable

Update checklist

* Resolve conflicts w/ `master`

* Update preview gif

* Fix external contract expression evaluation; Make CI happy

* 🧹; fix parenthesis eval; add `!exec` command

* README

* Fix CI

* Bump `forge-std` to `v1.1.1`

* Bump chisel version; fix `foundryup` repo / commit fetch; use `vergen` crate for chisel bin version

* Print `stderr` in chisel's `!exec` command

* Clean up benches

* Finish README; chisel subcommand descriptions for manpage

* small 🧹

* Fix conflicts

* Start addressing Matt's nits

* Resolve conflicts

* Remove `forge-std` submodule in favor of testdata's `Cheats.sol`

* No need to check out submodules in workflows anymore

* Lint

* Fix clippy 0.1.67 errors

Co-authored-by: clabby <[email protected]>
  • Loading branch information
refcell and clabby authored Dec 8, 2022
1 parent 34d279a commit 43ca957
Show file tree
Hide file tree
Showing 29 changed files with 4,064 additions and 33 deletions.
155 changes: 139 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"forge",
"ui",
"utils",
"chisel",
]

[profile.dev]
Expand Down
2 changes: 1 addition & 1 deletion anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ impl PendingTransaction {
}

/// Represents all relevant information of an executed transaction
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct TransactionInfo {
pub transaction_hash: H256,
pub transaction_index: u32,
Expand Down
58 changes: 58 additions & 0 deletions chisel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[package]
name = "chisel"
version = "0.1.1"
edition = "2021"
authors = [
"clabby <https://github.com/clabby>",
"asnared <https://github.com/abigger87>"
]
description = "Solidity REPL"
repository = "https://github.com/foundry-rs/foundry/tree/main/chisel"
license = "MIT"
keywords = ["Rust", "Ethereum", "Foundry", "Chisel", "REPL", "Solidity", "Solang"]

[lib]
name = "chisel"
path = "src/lib.rs"
doctest = false

[[bin]]
name = "chisel"
path = "src/bin/chisel.rs"

[dependencies]
foundry-evm = { path = "../evm" }
forge = { path = "../forge" }
foundry-config = { path = "../config" }
foundry-cli = { path = "../cli" }
foundry-common = { path = "../common" }
forge-fmt = { path = "../fmt" }
tokio = { version = "1.21.2", features = ["full"] }
clap = { version = "4.0", features = ["derive", "env", "wrap_help"] }
rustyline = "10.0.0"
solang-parser = "0.1.18"
ethers = { git = "https://github.com/gakonst/ethers-rs" }
ethers-solc = { git = "https://github.com/gakonst/ethers-rs", features = ["project-util", "full"] }
yansi = "0.5.1"
strum = { version = "0.24.1", features = ["derive"] }
serde = "1.0.145"
serde_json = { version = "1.0.85", features = ["raw_value"] }
semver = "1.0.14"
bytes = "1.2.1"
revm = "2.1.0"
eyre = "0.6.8"
dirs = "4.0.0"
time = { version = "0.3.15", features = ["formatting"] }
reqwest = "0.11.12"

[dev-dependencies]
serial_test = "0.9.0"
criterion = "0.4.0"

[build-dependencies]
# used to generate constants
vergen = { version = "7.0", default-features = false, features = ["build", "rustc", "git"] }

[[bench]]
name = "session_source"
harness = false
Loading

0 comments on commit 43ca957

Please sign in to comment.