From 0047d51d6cc222a4ca4b64fbcb0a7d388770c16e Mon Sep 17 00:00:00 2001 From: clabby Date: Tue, 6 Dec 2022 12:41:04 -0500 Subject: [PATCH] Remove `forge-std` submodule in favor of testdata's `Cheats.sol` --- .gitmodules | 3 --- chisel/src/session_source.rs | 18 +++++++++--------- testdata/lib/forge-std | 1 - 3 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 .gitmodules delete mode 160000 testdata/lib/forge-std diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 9f4951517cf1..000000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "testdata/lib/forge-std"] - path = testdata/lib/forge-std - url = https://github.com/foundry-rs/forge-std diff --git a/chisel/src/session_source.rs b/chisel/src/session_source.rs index fc13fb905f8c..4f48a1b8086a 100644 --- a/chisel/src/session_source.rs +++ b/chisel/src/session_source.rs @@ -17,7 +17,7 @@ use solang_parser::pt; use std::{collections::HashMap, fs, path::PathBuf}; /// Solidity source for the `Vm` interface in [forge-std](https://github.com/foundry-rs/forge-std) -static VM_SOURCE: &str = include_str!("../../testdata/lib/forge-std/src/Vm.sol"); +static VM_SOURCE: &str = include_str!("../../testdata/cheats/Cheats.sol"); /// Intermediate output for the compiled [SessionSource] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -369,11 +369,11 @@ contract {} is Script {{ // SPDX-License-Identifier: UNLICENSED pragma solidity ^{major}.{minor}.{patch}; -import {{Vm}} from "forge-std/Vm.sol"; +import {{Cheats}} from "forge-std/Vm.sol"; {} contract {} {{ - Vm internal constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); + Cheats internal constant vm = Cheats(address(uint160(uint256(keccak256("hevm cheat code"))))); {} /// @notice REPL contract entry point @@ -401,9 +401,9 @@ contract {} {{ .into_iter() .filter_map(|sup| match sup { pt::SourceUnitPart::ImportDirective(i) => match i { - pt::Import::Plain(s, _) | - pt::Import::Rename(s, _, _) | - pt::Import::GlobalSymbol(s, _, _) => { + pt::Import::Plain(s, _) + | pt::Import::Rename(s, _, _) + | pt::Import::GlobalSymbol(s, _, _) => { let path = PathBuf::from(s.string); match fs::read_to_string(path) { @@ -532,13 +532,13 @@ pub fn parse_fragment( let mut base = SessionSource::new(solc, config); if base.clone().with_run_code(buffer).parse().is_ok() { - return Some(ParseTreeFragment::Function) + return Some(ParseTreeFragment::Function); } if base.clone().with_top_level_code(buffer).parse().is_ok() { - return Some(ParseTreeFragment::Contract) + return Some(ParseTreeFragment::Contract); } if base.with_global_code(buffer).parse().is_ok() { - return Some(ParseTreeFragment::Source) + return Some(ParseTreeFragment::Source); } None diff --git a/testdata/lib/forge-std b/testdata/lib/forge-std deleted file mode 160000 index 054a250aa5e3..000000000000 --- a/testdata/lib/forge-std +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 054a250aa5e3af9aea0bc8c12046a14720857b29