Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into dp/chore/extract-state-followup
Browse files Browse the repository at this point in the history
* master:
  Docker images renaming (#10863)
  Move the substate module into ethcore/executive (#10867)
  Run cargo fix on a few of the worst offenders (#10854)
  removed redundant fork choice abstraction (#10849)
  Extract state-db from ethcore (#10858)
  • Loading branch information
dvdplm committed Jul 11, 2019
2 parents f0cdaac + d850eb0 commit 9cb241d
Show file tree
Hide file tree
Showing 78 changed files with 551 additions and 514 deletions.
18 changes: 9 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ variables:
sccache --start-server
- sccache -s
after_script:
# sccache debug info
# sccache debug info
- if test -e sccache_debug.log;
then
echo "_____All crate-types:_____";
Expand Down Expand Up @@ -147,7 +147,7 @@ test-linux-nightly:

build-android:
<<: *build-on-linux
image: parity/rust-parity-ethereum-android-build:stretch
image: parity/parity-ci-android:stretch
variables:
CARGO_TARGET: armv7-linux-androideabi

Expand All @@ -158,21 +158,21 @@ build-linux:
build-linux-i386:
<<: *build-on-linux
only: *releaseable_branches
image: parity/rust-parity-ethereum-build:i386
image: parity/parity-ci-i386:latest
variables:
CARGO_TARGET: i686-unknown-linux-gnu

build-linux-arm64:
<<: *build-on-linux
only: *releaseable_branches
image: parity/rust-parity-ethereum-build:arm64
image: parity/parity-ci-arm64:latest
variables:
CARGO_TARGET: aarch64-unknown-linux-gnu

build-linux-armhf:
<<: *build-on-linux
only: *releaseable_branches
image: parity/rust-parity-ethereum-build:armhf
image: parity/parity-ci-armhf:latest
variables:
CARGO_TARGET: armv7-unknown-linux-gnueabihf

Expand Down Expand Up @@ -310,14 +310,14 @@ publish-awss3-release:
- linux-docker

publish-docs:
stage: publish
image: parity/rust-parity-ethereum-docs:xenial
stage: publish
image: parity/parity-ci-docs:latest
only:
- tags
except:
- nightly
cache: {}
dependencies: []
cache: {}
dependencies: []
script:
- scripts/gitlab/publish-docs.sh
tags:
Expand Down
27 changes: 24 additions & 3 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ serde = "1.0"
serde_derive = "1.0"
account-state = { path = "account-state" }
stats = { path = "../util/stats" }
state-db = { path = "state-db" }
tempdir = { version = "0.3", optional = true }
time-utils = { path = "../util/time-utils" }
trace = { path = "trace" }
Expand Down
2 changes: 0 additions & 2 deletions ethcore/account-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ common-types = { path = "../types"}
derive_more = "0.15.0"
ethereum-types = "0.6.0"
ethtrie = { package = "patricia-trie-ethereum", path = "../../util/patricia-trie-ethereum" }
evm = { path = "../evm" }
trie-vm-factories = { path = "../trie-vm-factories" }
hash-db = "0.12.4"
journaldb = { path = "../../util/journaldb" }
Expand All @@ -28,7 +27,6 @@ rlp = "0.4.0"
serde = { version = "1.0", features = ["derive"] }
trace = { path = "../trace" }
trie-db = "0.12.4"
vm = { path = "../vm" }

[dev-dependencies]
account-db = { path = "../account-db" }
Expand Down
2 changes: 0 additions & 2 deletions ethcore/account-state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@

pub mod account;
pub mod backend;
pub mod substate;
pub mod state;
pub mod error;

pub use {
account::Account,
backend::Backend,
error::Error,
substate::Substate,
state::{State, CleanupMode},
};
2 changes: 1 addition & 1 deletion ethcore/account-state/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ enum RequireCache {
}

/// Mode of dealing with null accounts.
#[derive(PartialEq)]
#[derive(Debug, PartialEq)]
pub enum CleanupMode<'a> {
/// Create accounts which would be null.
ForceCreate,
Expand Down
22 changes: 11 additions & 11 deletions ethcore/db/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ pub trait Key<T> {
/// Should be used to write value into database.
pub trait Writable {
/// Writes the value into the database.
fn write<T, R>(&mut self, col: Option<u32>, key: &Key<T, Target = R>, value: &T) where T: rlp::Encodable, R: AsRef<[u8]>;
fn write<T, R>(&mut self, col: Option<u32>, key: &dyn Key<T, Target = R>, value: &T) where T: rlp::Encodable, R: AsRef<[u8]>;

/// Deletes key from the databse.
fn delete<T, R>(&mut self, col: Option<u32>, key: &Key<T, Target = R>) where T: rlp::Encodable, R: AsRef<[u8]>;
fn delete<T, R>(&mut self, col: Option<u32>, key: &dyn Key<T, Target = R>) where T: rlp::Encodable, R: AsRef<[u8]>;

/// Writes the value into the database and updates the cache.
fn write_with_cache<K, T, R>(&mut self, col: Option<u32>, cache: &mut Cache<K, T>, key: K, value: T, policy: CacheUpdatePolicy) where
fn write_with_cache<K, T, R>(&mut self, col: Option<u32>, cache: &mut dyn Cache<K, T>, key: K, value: T, policy: CacheUpdatePolicy) where
K: Key<T, Target = R> + Hash + Eq,
T: rlp::Encodable,
R: AsRef<[u8]> {
Expand All @@ -113,7 +113,7 @@ pub trait Writable {
}

/// Writes the values into the database and updates the cache.
fn extend_with_cache<K, T, R>(&mut self, col: Option<u32>, cache: &mut Cache<K, T>, values: HashMap<K, T>, policy: CacheUpdatePolicy) where
fn extend_with_cache<K, T, R>(&mut self, col: Option<u32>, cache: &mut dyn Cache<K, T>, values: HashMap<K, T>, policy: CacheUpdatePolicy) where
K: Key<T, Target = R> + Hash + Eq,
T: rlp::Encodable,
R: AsRef<[u8]> {
Expand All @@ -134,7 +134,7 @@ pub trait Writable {
}

/// Writes and removes the values into the database and updates the cache.
fn extend_with_option_cache<K, T, R>(&mut self, col: Option<u32>, cache: &mut Cache<K, Option<T>>, values: HashMap<K, Option<T>>, policy: CacheUpdatePolicy) where
fn extend_with_option_cache<K, T, R>(&mut self, col: Option<u32>, cache: &mut dyn Cache<K, Option<T>>, values: HashMap<K, Option<T>>, policy: CacheUpdatePolicy) where
K: Key<T, Target = R> + Hash + Eq,
T: rlp::Encodable,
R: AsRef<[u8]> {
Expand Down Expand Up @@ -165,7 +165,7 @@ pub trait Writable {
/// Should be used to read values from database.
pub trait Readable {
/// Returns value for given key.
fn read<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> Option<T> where
fn read<T, R>(&self, col: Option<u32>, key: &dyn Key<T, Target = R>) -> Option<T> where
T: rlp::Decodable,
R: AsRef<[u8]>;

Expand All @@ -189,7 +189,7 @@ pub trait Readable {
}

/// Returns true if given value exists.
fn exists<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> bool where R: AsRef<[u8]>;
fn exists<T, R>(&self, col: Option<u32>, key: &dyn Key<T, Target = R>) -> bool where R: AsRef<[u8]>;

/// Returns true if given value exists either in cache or in database.
fn exists_with_cache<K, T, R, C>(&self, col: Option<u32>, cache: &RwLock<C>, key: &K) -> bool where
Expand All @@ -208,25 +208,25 @@ pub trait Readable {
}

impl Writable for DBTransaction {
fn write<T, R>(&mut self, col: Option<u32>, key: &Key<T, Target = R>, value: &T) where T: rlp::Encodable, R: AsRef<[u8]> {
fn write<T, R>(&mut self, col: Option<u32>, key: &dyn Key<T, Target = R>, value: &T) where T: rlp::Encodable, R: AsRef<[u8]> {
self.put(col, key.key().as_ref(), &rlp::encode(value));
}

fn delete<T, R>(&mut self, col: Option<u32>, key: &Key<T, Target = R>) where T: rlp::Encodable, R: AsRef<[u8]> {
fn delete<T, R>(&mut self, col: Option<u32>, key: &dyn Key<T, Target = R>) where T: rlp::Encodable, R: AsRef<[u8]> {
self.delete(col, key.key().as_ref());
}
}

impl<KVDB: KeyValueDB + ?Sized> Readable for KVDB {
fn read<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> Option<T>
fn read<T, R>(&self, col: Option<u32>, key: &dyn Key<T, Target = R>) -> Option<T>
where T: rlp::Decodable, R: AsRef<[u8]> {
self.get(col, key.key().as_ref())
.expect(&format!("db get failed, key: {:?}", key.key().as_ref()))
.map(|v| rlp::decode(&v).expect("decode db value failed") )

}

fn exists<T, R>(&self, col: Option<u32>, key: &Key<T, Target = R>) -> bool where R: AsRef<[u8]> {
fn exists<T, R>(&self, col: Option<u32>, key: &dyn Key<T, Target = R>) -> bool where R: AsRef<[u8]> {
let result = self.get(col, key.key().as_ref());

match result {
Expand Down
2 changes: 1 addition & 1 deletion ethcore/evm/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct Factory {
impl Factory {
/// Create fresh instance of VM
/// Might choose implementation depending on supplied gas.
pub fn create(&self, params: ActionParams, schedule: &Schedule, depth: usize) -> Box<Exec> {
pub fn create(&self, params: ActionParams, schedule: &Schedule, depth: usize) -> Box<dyn Exec> {
match self.evm {
VMType::Interpreter => if Self::can_fit_in_usize(&params.gas) {
Box::new(super::interpreter::Interpreter::<usize>::new(params, self.evm_cache.clone(), schedule, depth))
Expand Down
6 changes: 3 additions & 3 deletions ethcore/evm/src/interpreter/gasometer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ impl<Gas: evm::CostType> Gasometer<Gas> {
/// it will be the amount of gas that the current context provides to the child context.
pub fn requirements(
&mut self,
ext: &vm::Ext,
ext: &dyn vm::Ext,
instruction: Instruction,
info: &InstructionInfo,
stack: &Stack<U256>,
stack: &dyn Stack<U256>,
current_mem_size: usize,
) -> vm::Result<InstructionRequirements<Gas>> {
let schedule = ext.schedule();
Expand Down Expand Up @@ -402,7 +402,7 @@ fn calculate_eip1283_sstore_gas<Gas: evm::CostType>(schedule: &Schedule, origina
)
}

pub fn handle_eip1283_sstore_clears_refund(ext: &mut vm::Ext, original: &U256, current: &U256, new: &U256) {
pub fn handle_eip1283_sstore_clears_refund(ext: &mut dyn vm::Ext, original: &U256, current: &U256, new: &U256) {
let sstore_clears_schedule = ext.schedule().sstore_refund_gas;

if current == new {
Expand Down
6 changes: 3 additions & 3 deletions ethcore/evm/src/interpreter/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ mod tests {
#[test]
fn test_memory_read_and_write() {
// given
let mem: &mut Memory = &mut vec![];
let mem: &mut dyn Memory = &mut vec![];
mem.resize(0x80 + 32);

// when
Expand All @@ -149,7 +149,7 @@ mod tests {
#[test]
fn test_memory_read_and_write_byte() {
// given
let mem: &mut Memory = &mut vec![];
let mem: &mut dyn Memory = &mut vec![];
mem.resize(32);

// when
Expand All @@ -163,7 +163,7 @@ mod tests {

#[test]
fn test_memory_read_slice_and_write_slice() {
let mem: &mut Memory = &mut vec![];
let mem: &mut dyn Memory = &mut vec![];
mem.resize(32);

{
Expand Down
Loading

0 comments on commit 9cb241d

Please sign in to comment.