Skip to content

Commit

Permalink
feat: test solc v0.8.28 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 authored Oct 13, 2024
1 parent 9c94faa commit 27db474
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ on:
mode:
required: false
type: string
default: 'Y+M3B3 0.8.27'
description: 'Mode filter for the era-compiler-tester. For example: Y+M3B3 0.8.27'
default: 'Y+M3B3 0.8.28'
description: 'Mode filter for the era-compiler-tester. For example: Y+M3B3 0.8.28'
target:
required: false
type: string
Expand Down
28 changes: 22 additions & 6 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 compiler_tester/src/compiler_tester/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ mod tests {
verbosity: false,
quiet: false,
debug: false,
modes: vec!["Y+M3B3 0.8.27".to_owned()],
modes: vec!["Y+M3B3 0.8.28".to_owned()],
paths: vec!["tests/solidity/simple/default.sol".to_owned()],
groups: vec![],
benchmark: None,
Expand Down
22 changes: 17 additions & 5 deletions compiler_tester/src/test/case/input/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
use std::sync::Arc;
use std::sync::Mutex;

use web3::types::U256;

use crate::compilers::mode::Mode;
use crate::summary::Summary;
use crate::vm::eravm::system_context::SystemContext;
use crate::vm::eravm::EraVM;
use crate::vm::evm::EVM;
use crate::vm::revm::revm_type_conversions::web3_address_to_revm_address;
Expand Down Expand Up @@ -41,13 +40,26 @@ impl Balance {
pub fn run_eravm(
self,
summary: Arc<Mutex<Summary>>,
vm: &EraVM,
vm: &mut EraVM,
mode: Mode,
test_group: Option<String>,
name_prefix: String,
index: usize,
) {
let name = format!("{name_prefix}[#balance_check:{index}]");

let rich_addresses = SystemContext::get_rich_addresses();
if rich_addresses.contains(&self.address) {
vm.mint_ether(
self.address,
web3::types::U256::from_str_radix(
"10000000000000000000000000",
era_compiler_common::BASE_HEXADECIMAL,
)
.expect("Always valid"),
);
}

let found = vm.get_balance(self.address);
if found == self.balance {
Summary::passed_special(summary, mode, name, test_group);
Expand Down Expand Up @@ -98,7 +110,7 @@ impl Balance {
.balance(web3_address_to_revm_address(&self.address));
match found {
Ok(found) => {
let u256_found = U256::from(found.data.to_be_bytes());
let u256_found = web3::types::U256::from(found.data.to_be_bytes());
if u256_found == self.balance {
Summary::passed_special(summary, mode, name, test_group);
} else {
Expand All @@ -118,7 +130,7 @@ impl Balance {
mode,
name,
self.balance.into(),
U256::zero().into(),
web3::types::U256::zero().into(),
self.address.to_fixed_bytes().to_vec(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler_tester/src/test/case/input/deploy_eravm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl DeployEraVM {
) where
D: EraVMDeployer,
{
let name = format!("{}[#deployer:{}]", name_prefix, self.path);
let name = format!("{name_prefix}[#deployer:{}]", self.path);

vm.populate_storage(self.storage.inner);
let result = match deployer.deploy_eravm::<M>(
Expand Down
6 changes: 3 additions & 3 deletions compiler_tester/src/test/case/input/deploy_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ impl DeployEVM {
///
/// Runs the deploy transaction on native REVM.
///
pub fn run_revm<'a>(
pub fn run_revm(
self,
summary: Arc<Mutex<Summary>>,
vm: Revm<'a>,
vm: Revm,
mode: Mode,
test_group: Option<String>,
name_prefix: String,
evm_version: Option<EVMVersion>,
) -> Revm<'a> {
) -> Revm {
let name = format!("{}[#deployer:{}]", name_prefix, self.identifier);

let size = self.deploy_code.len();
Expand Down
10 changes: 4 additions & 6 deletions compiler_tester/src/test/case/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ use std::str::FromStr;
use std::sync::Arc;
use std::sync::Mutex;

use solidity_adapter::EVMVersion;

use crate::compilers::mode::Mode;
use crate::directories::matter_labs::test::metadata::case::input::Input as MatterLabsTestInput;
use crate::summary::Summary;
Expand Down Expand Up @@ -433,16 +431,16 @@ impl Input {
///
/// Runs the input on REVM.
///
pub fn run_revm<'a>(
pub fn run_revm(
self,
summary: Arc<Mutex<Summary>>,
mut vm: Revm<'a>,
mut vm: Revm,
mode: Mode,
test_group: Option<String>,
name_prefix: String,
index: usize,
evm_version: Option<EVMVersion>,
) -> Revm<'a> {
evm_version: Option<solidity_adapter::EVMVersion>,
) -> Revm {
match self {
Self::DeployEraVM { .. } => panic!("EraVM deploy transaction cannot be run on REVM"),
Self::DeployEVM(deploy) => {
Expand Down
3 changes: 2 additions & 1 deletion compiler_tester/src/test/case/input/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ impl Runtime {
name_prefix: String,
index: usize,
) {
let name = format!("{}[{}:{}]", name_prefix, self.name, index);
let name = format!("{name_prefix}[{}:{index}]", self.name);
vm.populate_storage(self.storage.inner);

let vm_function = match test_group.as_deref() {
Some(benchmark_analyzer::Benchmark::EVM_INTERPRETER_GROUP_NAME) => {
EraVM::execute_evm_interpreter::<M>
Expand Down
3 changes: 1 addition & 2 deletions compiler_tester/src/test/case/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pub mod input;

use solidity_adapter::test::params::evm_version;
use std::collections::BTreeMap;
use std::sync::Arc;
use std::sync::Mutex;
Expand Down Expand Up @@ -164,7 +163,7 @@ impl Case {
mode: &Mode,
test_name: String,
test_group: Option<String>,
evm_version: Option<evm_version::EVMVersion>,
evm_version: Option<solidity_adapter::EVMVersion>,
) {
let name = if let Some(case_name) = self.name {
format!("{test_name}::{case_name}")
Expand Down
6 changes: 6 additions & 0 deletions configs/solc-bin-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@
"destination": "./solc-bin/solc-${VERSION}"
},
"0.8.27": {
"is_enabled": false,
"protocol": "https",
"source": "https://github.com/matter-labs/era-solidity/releases/download/${VERSION}-1.0.1/solc-${PLATFORM}-${VERSION}-1.0.1",
"destination": "./solc-bin/solc-${VERSION}"
},
"0.8.28": {
"is_enabled": true,
"protocol": "https",
"source": "https://github.com/matter-labs/era-solidity/releases/download/${VERSION}-1.0.1/solc-${PLATFORM}-${VERSION}-1.0.1",
Expand Down
6 changes: 6 additions & 0 deletions configs/solc-bin-upstream.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@
"destination": "./solc-bin-upstream/solc-${VERSION}"
},
"0.8.27": {
"is_enabled": false,
"protocol": "compiler-bin-list",
"source": "https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/${PLATFORM}/list.json",
"destination": "./solc-bin-upstream/solc-${VERSION}"
},
"0.8.28": {
"is_enabled": true,
"protocol": "compiler-bin-list",
"source": "https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/${PLATFORM}/list.json",
Expand Down
Loading

0 comments on commit 27db474

Please sign in to comment.