Skip to content

Commit

Permalink
rebase on master
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Lubinets committed Oct 24, 2018
1 parent 9a424d5 commit cbe117b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 61 deletions.
56 changes: 0 additions & 56 deletions jsontests/tests/constantinople.rs

This file was deleted.

52 changes: 47 additions & 5 deletions jsontests/tests/eiptests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,69 @@
#[macro_use]
extern crate jsontests_derive;
extern crate jsontests;
extern crate sputnikvm;
extern crate bigint;

#[cfg(feature = "bench")]
extern crate test;

/// Shifting opcodes tests
use sputnikvm::{EmbeddedAccountPatch, Patch, EMBEDDED_PRECOMPILEDS, Precompiled};
use bigint::{Address, Gas};

// Shifting opcodes tests
#[derive(JsonTests)]
#[directory = "jsontests/res/files/SputnikVM/vmEIP215"]
#[directory = "jsontests/res/files/eth/VMTests/vmEIP215"]
#[test_with = "jsontests::util::run_test"]
#[cfg_attr(feature = "bench", bench_with = "jsontests::util::run_bench")]
struct EIP215;

/// EXTCODEHASH tests
// EXTCODEHASH tests
#[derive(JsonTests)]
#[directory = "jsontests/res/files/SputnikVM/vmEIP215"]
#[directory = "jsontests/res/files/eth/VMTests/vmEIP1052"]
#[test_with = "jsontests::util::run_test"]
#[cfg_attr(feature = "bench", bench_with = "jsontests::util::run_bench")]
struct EIP1052;

/// CREATE2 tests
// CREATE2 tests
#[derive(JsonTests)]
#[directory = "jsontests/res/files/eth/VMTests/vmEIP1014"]
#[test_with = "jsontests::util::run_test"]
#[cfg_attr(feature = "bench", bench_with = "jsontests::util::run_bench")]
struct EIP1014;

// Gas metering changes tests
#[derive(JsonTests)]
#[directory = "jsontests/res/files/eth/VMTests/vmEIP1283"]
#[test_with = "jsontests::util::run_test"]
#[patch = "EIP1283Patch"]
#[cfg_attr(feature = "bench", bench_with = "jsontests::util::run_bench")]
struct EIP1283;

struct EIP1283Patch;
impl Patch for EIP1283Patch {
type Account = EmbeddedAccountPatch;

fn code_deposit_limit() -> Option<usize> { None }
fn callstack_limit() -> usize { 2 }
fn gas_extcode() -> Gas { Gas::from(20usize) }
fn gas_balance() -> Gas { Gas::from(20usize) }
fn gas_sload() -> Gas { Gas::from(50usize) }
fn gas_suicide() -> Gas { Gas::from(0usize) }
fn gas_suicide_new_account() -> Gas { Gas::from(0usize) }
fn gas_call() -> Gas { Gas::from(40usize) }
fn gas_expbyte() -> Gas { Gas::from(10usize) }
fn gas_transaction_create() -> Gas { Gas::from(0usize) }
fn force_code_deposit() -> bool { true }
fn has_delegate_call() -> bool { true }
fn has_static_call() -> bool { true }
fn has_revert() -> bool { true }
fn has_return_data() -> bool { true }
fn has_bitwise_shift() -> bool { true }
fn has_extcodehash() -> bool { true }
fn has_reduced_sstore_gas_metering() -> bool { true }
fn err_on_call_with_more_gas() -> bool { true }
fn call_create_l64_after_gas() -> bool { false }
fn memory_limit() -> usize { usize::max_value() }
fn precompileds() -> &'static [(Address, Option<&'static [u8]>, &'static Precompiled)] {
&EMBEDDED_PRECOMPILEDS }
}

0 comments on commit cbe117b

Please sign in to comment.