mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-10 03:21:03 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4a06e1ac5 |
+1
-3
@@ -8,6 +8,4 @@ node_modules
|
|||||||
# added to the .gitignore file.
|
# added to the .gitignore file.
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
profile.json.gz
|
profile.json.gz
|
||||||
resolc-compiler-tests
|
|
||||||
workdir
|
|
||||||
@@ -16,6 +16,7 @@ use revive_solc_json_interface::{
|
|||||||
SolcStandardJsonOutput,
|
SolcStandardJsonOutput,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::constants::SOLC_VERSION_SUPPORTING_VIA_YUL_IR;
|
||||||
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
||||||
|
|
||||||
use alloy::json_abi::JsonAbi;
|
use alloy::json_abi::JsonAbi;
|
||||||
@@ -256,23 +257,15 @@ impl SolidityCompiler for Resolc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn supports_mode(
|
fn supports_mode(
|
||||||
_compiler_version: &Version,
|
compiler_version: &Version,
|
||||||
_optimize_setting: ModeOptimizerSetting,
|
_optimize_setting: ModeOptimizerSetting,
|
||||||
pipeline: ModePipeline,
|
pipeline: ModePipeline,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// We only support the Y (IE compile via Yul IR) mode here, which also means that we can
|
// We only support the Y (IE compile via Yul IR) mode here, which also means that we can
|
||||||
// only use solc version 0.8.13 and above. We must always compile via Yul IR as resolc
|
// only use solc version 0.8.13 and above. We must always compile via Yul IR as resolc
|
||||||
// needs this to translate to LLVM IR and then RISCV.
|
// needs this to translate to LLVM IR and then RISCV.
|
||||||
|
|
||||||
// Note: the original implementation of this function looked like the following:
|
|
||||||
// ```
|
|
||||||
// pipeline == ModePipeline::ViaYulIR && compiler_version >= &SOLC_VERSION_SUPPORTING_VIA_YUL_IR
|
|
||||||
// ```
|
|
||||||
// However, that implementation is sadly incorrect since the version that's passed into this
|
|
||||||
// function is not the version of solc but the version of resolc. This is despite the fact
|
|
||||||
// that resolc depends on Solc for the initial Yul codegen. Therefore, we have skipped the
|
|
||||||
// version check until we do a better integrations between resolc and solc.
|
|
||||||
pipeline == ModePipeline::ViaYulIR
|
pipeline == ModePipeline::ViaYulIR
|
||||||
|
&& compiler_version >= &SOLC_VERSION_SUPPORTING_VIA_YUL_IR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -499,10 +499,6 @@ impl ResolverApi for GethNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Node for GethNode {
|
impl Node for GethNode {
|
||||||
fn name() -> &'static str {
|
|
||||||
"geth"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new(config: &Arguments) -> Self {
|
fn new(config: &Arguments) -> Self {
|
||||||
let geth_directory = config.directory().join(Self::BASE_DIRECTORY);
|
let geth_directory = config.directory().join(Self::BASE_DIRECTORY);
|
||||||
let id = NODE_COUNT.fetch_add(1, Ordering::SeqCst);
|
let id = NODE_COUNT.fetch_add(1, Ordering::SeqCst);
|
||||||
|
|||||||
@@ -105,11 +105,7 @@ impl KitchensinkNode {
|
|||||||
.arg("export-chain-spec")
|
.arg("export-chain-spec")
|
||||||
.arg("--chain")
|
.arg("--chain")
|
||||||
.arg("dev")
|
.arg("dev")
|
||||||
.output()
|
.output()?;
|
||||||
.context(format!(
|
|
||||||
"Failed to export chain spec with {}",
|
|
||||||
self.substrate_binary.display()
|
|
||||||
))?;
|
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
@@ -207,8 +203,6 @@ impl KitchensinkNode {
|
|||||||
.arg("Unsafe")
|
.arg("Unsafe")
|
||||||
.arg("--rpc-cors")
|
.arg("--rpc-cors")
|
||||||
.arg("all")
|
.arg("all")
|
||||||
.arg("--rpc-max-connections")
|
|
||||||
.arg(u32::MAX.to_string())
|
|
||||||
.env("RUST_LOG", Self::SUBSTRATE_LOG_ENV)
|
.env("RUST_LOG", Self::SUBSTRATE_LOG_ENV)
|
||||||
.stdout(kitchensink_stdout_logs_file.try_clone()?)
|
.stdout(kitchensink_stdout_logs_file.try_clone()?)
|
||||||
.stderr(kitchensink_stderr_logs_file.try_clone()?)
|
.stderr(kitchensink_stderr_logs_file.try_clone()?)
|
||||||
@@ -235,8 +229,6 @@ impl KitchensinkNode {
|
|||||||
.arg(proxy_rpc_port.to_string())
|
.arg(proxy_rpc_port.to_string())
|
||||||
.arg("--node-rpc-url")
|
.arg("--node-rpc-url")
|
||||||
.arg(format!("ws://127.0.0.1:{substrate_rpc_port}"))
|
.arg(format!("ws://127.0.0.1:{substrate_rpc_port}"))
|
||||||
.arg("--rpc-max-connections")
|
|
||||||
.arg(u32::MAX.to_string())
|
|
||||||
.env("RUST_LOG", Self::PROXY_LOG_ENV)
|
.env("RUST_LOG", Self::PROXY_LOG_ENV)
|
||||||
.stdout(eth_proxy_stdout_logs_file.try_clone()?)
|
.stdout(eth_proxy_stdout_logs_file.try_clone()?)
|
||||||
.stderr(eth_proxy_stderr_logs_file.try_clone()?)
|
.stderr(eth_proxy_stderr_logs_file.try_clone()?)
|
||||||
@@ -519,10 +511,6 @@ impl ResolverApi for KitchensinkNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Node for KitchensinkNode {
|
impl Node for KitchensinkNode {
|
||||||
fn name() -> &'static str {
|
|
||||||
"kitchensink"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new(config: &Arguments) -> Self {
|
fn new(config: &Arguments) -> Self {
|
||||||
let kitchensink_directory = config.directory().join(Self::BASE_DIRECTORY);
|
let kitchensink_directory = config.directory().join(Self::BASE_DIRECTORY);
|
||||||
let id = NODE_COUNT.fetch_add(1, Ordering::SeqCst);
|
let id = NODE_COUNT.fetch_add(1, Ordering::SeqCst);
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ pub const GENESIS_JSON: &str = include_str!("../../../genesis.json");
|
|||||||
|
|
||||||
/// An abstract interface for testing nodes.
|
/// An abstract interface for testing nodes.
|
||||||
pub trait Node: EthereumNode {
|
pub trait Node: EthereumNode {
|
||||||
/// The name of the node implementation.
|
|
||||||
fn name() -> &'static str;
|
|
||||||
|
|
||||||
/// Create a new uninitialized instance.
|
/// Create a new uninitialized instance.
|
||||||
fn new(config: &Arguments) -> Self;
|
fn new(config: &Arguments) -> Self;
|
||||||
|
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Revive Differential Tests - Quick Start Script
|
|
||||||
# This script clones the test repository, sets up the corpus file, and runs the tool
|
|
||||||
|
|
||||||
set -e # Exit on any error
|
|
||||||
|
|
||||||
# Colors for output
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
# Configuration
|
|
||||||
TEST_REPO_URL="https://github.com/paritytech/resolc-compiler-tests"
|
|
||||||
TEST_REPO_DIR="resolc-compiler-tests"
|
|
||||||
CORPUS_FILE="./corpus.json"
|
|
||||||
WORKDIR="workdir"
|
|
||||||
|
|
||||||
echo -e "${GREEN}=== Revive Differential Tests Quick Start ===${NC}"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Check if test repo already exists
|
|
||||||
if [ -d "$TEST_REPO_DIR" ]; then
|
|
||||||
echo -e "${YELLOW}Test repository already exists. Pulling latest changes...${NC}"
|
|
||||||
cd "$TEST_REPO_DIR"
|
|
||||||
git pull
|
|
||||||
cd ..
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}Cloning test repository...${NC}"
|
|
||||||
git clone "$TEST_REPO_URL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create corpus file with absolute path resolved at runtime
|
|
||||||
echo -e "${GREEN}Creating corpus file...${NC}"
|
|
||||||
ABSOLUTE_PATH=$(realpath "$TEST_REPO_DIR/fixtures/solidity/simple/yul_instructions/codesize.sol")
|
|
||||||
|
|
||||||
cat > "$CORPUS_FILE" << EOF
|
|
||||||
{
|
|
||||||
"name": "MatterLabs Solidity Simple, Complex, and Semantic Tests",
|
|
||||||
"path": "$ABSOLUTE_PATH"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo -e "${GREEN}Corpus file created: $CORPUS_FILE${NC}"
|
|
||||||
|
|
||||||
# Create workdir if it doesn't exist
|
|
||||||
mkdir -p "$WORKDIR"
|
|
||||||
|
|
||||||
echo -e "${GREEN}Starting differential tests...${NC}"
|
|
||||||
echo "This may take a while..."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Run the tool
|
|
||||||
RUST_LOG="error" cargo run --release -- \
|
|
||||||
--kitchensink "$(realpath ~/polkadot-sdk/target/debug/substrate-node)" \
|
|
||||||
--eth_proxy "$(realpath ~/polkadot-sdk/target/debug/eth-rpc)" \
|
|
||||||
--corpus "$CORPUS_FILE" \
|
|
||||||
--workdir "$WORKDIR" \
|
|
||||||
|
|
||||||
echo -e "${GREEN}=== Test run completed! ===${NC}"
|
|
||||||
Reference in New Issue
Block a user