diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b51d128d6..9240fcc07 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,72 +10,26 @@ on: env: CARGO_TERM_COLOR: always jobs: - start-runner: - name: Start self-hosted EC2 runner - runs-on: ubuntu-latest - outputs: - label: ${{ steps.start-ec2-runner.outputs.label }} - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - name: Start EC2 runner - id: start-ec2-runner - uses: fuzzland/ec2-github-runner@v2 - with: - mode: start - pre-runner-script: | - source "/root/.cargo/env" - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - ec2-image-id: ami-0b5bc504b604fe97d - ec2-instance-type: c5d.12xlarge - subnet-id: subnet-0bdfed1a35eccc1fe - security-group-id: sg-088af6a76c47f0e45 - aws-resource-tags: | - [ - {"Key": "Name", "Value": "ec2-github-runner"}, - {"Key": "GitHubRepository", "Value": "${{ github.repository }}"} - ] build: - needs: start-runner - runs-on: ${{ needs.start-runner.outputs.label }} + runs-on: [self-hosted, integration-xl] steps: - uses: actions/checkout@v3 with: submodules: recursive ref: ${{ github.event.pull_request.head.sha || github.sha }} - - name: Setup Home - run: export HOME="/root" - name: Download and Extract Cache run: curl -L https://github.com/fuzzland/ityfuzz-test-cache/releases/latest/download/cache.tar.gz -o cache.tar.gz && tar -xzf cache.tar.gz - name: Build - run: export PATH="/root/.cargo/bin:$PATH" && echo $PATH && ls "/root/.cargo/bin" && cargo build --verbose + run: cargo build --verbose - name: Run tests - run: export PATH="/root/.cargo/bin:$PATH" && cargo test --verbose - - name: Run integration tests - run: export PATH="/root/.cargo/bin:$PATH" && NO_TELEMETRY=1 python3 integration_test.py - stop-runner: - name: Stop self-hosted EC2 runner - needs: - - start-runner - - build - runs-on: ubuntu-latest - if: ${{ always() }} - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - name: Stop EC2 runner - uses: fuzzland/ec2-github-runner@v2 - with: - mode: stop - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - label: ${{ needs.start-runner.outputs.label }} - ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} + run: cargo test --verbose + - name: Run integration tests (Offchain) + run: NO_TELEMETRY=1 python3 integration_test.py offchain + - name: Run integration tests (Onchain) + run: NO_TELEMETRY=1 python3 integration_test.py onchain + - name: Report onchain tests + env: + BOT_GH_TOKEN: ${{ secrets.BOT_GH_TOKEN }} + PR_NUMBER: ${{ github.event.number }} + run: echo "PR=$PR_NUMBER" && python3 ci.py + diff --git a/cli/src/evm.rs b/cli/src/evm.rs index c2d191a16..3c6270cc4 100644 --- a/cli/src/evm.rs +++ b/cli/src/evm.rs @@ -266,8 +266,7 @@ enum EVMTargetType { Config } -pub fn evm_main(args: EvmArgs) { - ityfuzz::telemetry::report_campaign(args.onchain, args.target.clone()); +pub fn evm_main(args: EvmArgs) { let mut target_type: EVMTargetType = match args.target_type { Some(v) => match v.as_str() { "glob" => EVMTargetType::Glob, diff --git a/cli/src/main.rs b/cli/src/main.rs index a026ead55..00c1f5e9c 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -41,14 +41,6 @@ pub fn init_sentry() { release: sentry::release_name!(), ..Default::default() })); - if let Ok(value) = env::var("NO_TELEMETRY") { - if value == "1" { - println!("Telemetry is disabled."); - unsafe { - ityfuzz::telemetry::TELEMETRY_ENABLED = false; - } - } - } } #[derive(Parser)] diff --git a/src/fuzzer.rs b/src/fuzzer.rs index 135b5347f..559b5b4f4 100644 --- a/src/fuzzer.rs +++ b/src/fuzzer.rs @@ -45,7 +45,6 @@ use crate::evm::vm::EVMState; use crate::input::ConciseSerde; use crate::oracle::BugMetadata; use crate::scheduler::{HasReportCorpus, HasVote}; -use crate::telemetry::report_vulnerability; const STATS_TIMEOUT_DEFAULT: Duration = Duration::from_millis(100); pub static mut RUN_FOREVER: bool = false; @@ -516,9 +515,6 @@ where } // find the solution ExecuteInputResult::Solution => { - report_vulnerability( - unsafe {serde_json::to_string(&ORACLE_OUTPUT).expect("")}, - ); println!("\n\n\nšŸ˜ŠšŸ˜Š Found violations! \n\n"); let cur_report = format!( diff --git a/src/lib.rs b/src/lib.rs index bbe9189c8..fcfe31767 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,6 @@ pub mod oracle; pub mod scheduler; pub mod state; pub mod state_input; -pub mod telemetry; pub mod tracer; pub mod mutation_utils; diff --git a/src/telemetry.rs b/src/telemetry.rs deleted file mode 100644 index ed66a28f6..000000000 --- a/src/telemetry.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Providing telemetry for the fuzzing campaign - -pub use reqwest; -use std::env; -use std::fmt::format; -use serde_json::json; - -pub static mut TELEMETRY_ENABLED: bool = true; - - -const TELEMETRY_HOST: &str = "https://telemetry.fuzz.land/api/v1/"; - -/// sends a ping to the telemetry server when campaign starts -/// only send (is_onchain, first 10 bytes of contract_address / name) -pub fn report_campaign(is_onchain: bool, contracts: String) { - - if unsafe {TELEMETRY_ENABLED} { - let json = json!({ - "is_onchain": is_onchain, - "contracts": contracts - }); - let client = reqwest::blocking::Client::new(); - client.post(TELEMETRY_HOST.to_owned() + "telemetry").json(&json).send().unwrap(); - } -} - -/// sends a ping to the telemetry server when vulnerability is found -pub fn report_vulnerability(vuln: String) { - if unsafe {TELEMETRY_ENABLED} { - reqwest::blocking::get(TELEMETRY_HOST.to_owned() + format!("vuln/{}",vuln.len()).as_str()) - .unwrap(); - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_report_campaign() { - report_campaign(true, "0x1234567890".to_string()); - } - - #[test] - fn test_report_vulnerability() { - report_vulnerability("reentrancy".to_string()); - } -}