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

dep: solang parser 0.2.2 #4328

Merged
merged 10 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ codegen-units = 1
# ethers-solc = { path = "../ethers-rs/ethers-solc" }

# [patch.crates-io]
# revm = { path = "../revm/crates/revm" }
# revm = { path = "../revm/crates/revm" }
4 changes: 2 additions & 2 deletions anvil/tests/it/ganache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::init_tracing;
use ethers::{
abi::Address,
contract::{Contract, ContractFactory},
contract::{Contract, ContractFactory, ContractInstance},
core::k256::SecretKey,
prelude::{abigen, Middleware, Signer, SignerMiddleware, TransactionRequest, Ws},
providers::{Http, Provider},
Expand Down Expand Up @@ -159,7 +159,7 @@ contract Contract {
Provider::<Http>::try_from("http://127.0.0.1:8545").unwrap(),
ganache_wallet2(),
);
let contract = Contract::new(contract.address(), abi.unwrap(), provider);
let contract = ContractInstance::new(contract.address(), abi.unwrap(), provider);
let resp = contract.method::<_, U256>("getSecret", ()).unwrap().legacy().call().await;
resp.unwrap_err();

Expand Down
8 changes: 4 additions & 4 deletions anvil/tests/it/revert.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anvil::{spawn, NodeConfig};
use ethers::{
contract::{Contract, ContractFactory},
contract::{ContractFactory, ContractInstance},
middleware::SignerMiddleware,
types::U256,
utils::WEI_IN_ETHER,
Expand Down Expand Up @@ -82,7 +82,7 @@ contract Contract {
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = Contract::new(
let contract = ContractInstance::new(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(handle.http_provider(), wallets[1].clone()),
Expand Down Expand Up @@ -139,7 +139,7 @@ async fn test_solc_revert_example() {
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = Contract::new(
let contract = ContractInstance::new(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(handle.http_provider(), wallets[1].clone()),
Expand Down Expand Up @@ -193,7 +193,7 @@ contract Contract {
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = Contract::new(
let contract = ContractInstance::new(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(handle.http_provider(), wallets[1].clone()),
Expand Down
8 changes: 4 additions & 4 deletions anvil/tests/it/traces.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::fork::fork_config;
use anvil::{spawn, NodeConfig};
use ethers::{
contract::Contract,
contract::ContractInstance,
prelude::{
Action, ContractFactory, GethTrace, GethTraceFrame, Middleware, Signer, SignerMiddleware,
TransactionRequest,
Expand Down Expand Up @@ -80,7 +80,7 @@ contract Contract {
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = Contract::new(
let contract = ContractInstance::new(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(handle.http_provider(), wallets[1].clone()),
Expand Down Expand Up @@ -127,7 +127,7 @@ contract Contract {
let factory = ContractFactory::new(abi.clone().unwrap(), bytecode.unwrap(), client);
let contract = factory.deploy(()).unwrap().send().await.unwrap();

let contract = Contract::new(
let contract = ContractInstance::new(
contract.address(),
abi.unwrap(),
SignerMiddleware::new(handle.http_provider(), wallets[1].clone()),
Expand All @@ -144,7 +144,7 @@ contract Contract {
GethTraceFrame::Default(traces) => {
assert!(!traces.failed);
}
GethTraceFrame::CallTracer(_) => {
_ => {
unreachable!()
}
},
Expand Down
2 changes: 1 addition & 1 deletion chisel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ reqwest = { version = "0.11", default-features = false, features = ["rustls"] }
# misc
clap = { version = "4.0", features = ["derive", "env", "wrap_help"] }
rustyline = "10.0.0"
solang-parser = "=0.2.1"
solang-parser = "=0.2.2"
yansi = "0.5.1"
strum = { version = "0.24.1", features = ["derive"] }
serde = "1.0.145"
Expand Down
2 changes: 1 addition & 1 deletion chisel/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ impl Type {
pt::Type::Uint(size) => Self::Builtin(ParamType::Uint(*size as usize)),
pt::Type::Bytes(size) => Self::Builtin(ParamType::FixedBytes(*size as usize)),
pt::Type::DynamicBytes => Self::Builtin(ParamType::Bytes),
pt::Type::Mapping(_, _, right) => Self::from_expression(right)?,
pt::Type::Mapping { value, .. } => Self::from_expression(value)?,
pt::Type::Function { params, returns, .. } => {
let params = map_parameters(params);
let returns = returns
Expand Down
4 changes: 2 additions & 2 deletions chisel/src/session_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ impl SessionSource {
/// source.
pub fn compiler_input(&self) -> CompilerInput {
let mut sources = Sources::new();
sources.insert(PathBuf::from("forge-std/Vm.sol"), Source { content: VM_SOURCE.to_owned() });
sources.insert(self.file_name.clone(), Source { content: self.to_repl_source() });
sources.insert(PathBuf::from("forge-std/Vm.sol"), Source::new(VM_SOURCE.to_owned()));
sources.insert(self.file_name.clone(), Source::new(self.to_repl_source()));
CompilerInput::with_sources(sources).pop().unwrap()
}

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ui = { path = "../ui" }

# eth
ethers = { git = "https://github.com/gakonst/ethers-rs", default-features = false, features = ["rustls"] }
solang-parser = "=0.2.1"
solang-parser = "=0.2.2"

# cli
clap = { version = "4.0", features = ["derive", "env", "unicode", "wrap_help"] }
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cmd/forge/script/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ pub fn filter_sources_and_artifacts(
}

if !is_standalone {
target_tree.get(&resolved).map(|source| (id, source.content.clone()))
target_tree.get(&resolved).map(|source| (id, source.content.as_str().to_string()))
} else {
Some((
id,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cmd/forge/verify/etherscan/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl EtherscanFlattenedSource {

let input = CompilerInput {
language: "Solidity".to_string(),
sources: BTreeMap::from([("contract.sol".into(), Source { content: content.into() })]),
sources: BTreeMap::from([("contract.sol".into(), Source::new(content))]),
settings: Default::default(),
};

Expand Down
6 changes: 4 additions & 2 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3846,7 +3846,8 @@ mod tests {
ModelCheckerTarget::Assert,
ModelCheckerTarget::OutOfBounds
]),
timeout: Some(10000)
timeout: Some(10000),
invariants: None,
})
);

Expand Down Expand Up @@ -3902,7 +3903,8 @@ mod tests {
ModelCheckerTarget::Assert,
ModelCheckerTarget::OutOfBounds
]),
timeout: Some(10000)
timeout: Some(10000),
invariants: None,
})
);

Expand Down
2 changes: 1 addition & 1 deletion doc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
futures-util = "0.3.4"

# misc
solang-parser = "=0.2.1"
solang-parser = "=0.2.2"
eyre = "0.6"
thiserror = "1.0.30"
rayon = "1.5.1"
Expand Down
14 changes: 12 additions & 2 deletions doc/src/writer/as_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@ impl AsString for Expression {
Type::DynamicBytes => "bytes".to_owned(),
Type::Int(n) => format!("int{n}"),
Type::Uint(n) => format!("uint{n}"),
Type::Mapping(_, from, to) => {
format!("mapping({} => {})", from.as_string(), to.as_string())
Type::Mapping { key, key_name, value, value_name, .. } => {
let mut key = key.as_string();
if let Some(name) = key_name {
key.push(' ');
key.push_str(&name.to_string());
}
let mut value = value.as_string();
if let Some(name) = value_name {
value.push(' ');
value.push_str(&name.to_string());
}
format!("mapping({key} => {value})")
}
Type::Function { params, attributes, returns } => {
let params = params.as_string();
Expand Down
2 changes: 1 addition & 1 deletion fmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ foundry-config = { path = "../config" }
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }

# parser
solang-parser = "=0.2.1"
solang-parser = "=0.2.2"

# misc
semver = "1.0.4"
Expand Down
4 changes: 4 additions & 0 deletions fmt/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ impl SurroundingChunk {
SurroundingChunk { before, next, content: format!("{content}") }
}

pub fn empty() -> Self {
Self { before: None, next: None, content: String::new() }
}

pub fn loc_before(&self) -> usize {
self.before.unwrap_or_default()
}
Expand Down
Loading