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

Add Callisto Mainnet and Testnet #9283

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f3a5ae1
Add Galilei -Callisto testnet-
yograterol Feb 28, 2018
5075d9f
Add CLO reward
yograterol Mar 4, 2018
10afe62
CLO Testnet 3.0 genesis file
yograterol Mar 11, 2018
304e16a
Modify bootnode for testnet 3.0
yograterol Mar 30, 2018
2be8896
Fix testnet 3.0 genesis file
yograterol Mar 30, 2018
e8a98da
CLO Mainnet
yograterol Apr 15, 2018
b587bc1
Mainnet release v1.0
yograterol Apr 15, 2018
437ab58
Add CLO bootnodes
Apr 15, 2018
bc17a00
Switch bootnodes to the new one
Apr 16, 2018
f0674b3
Update bootnodes from Chainkorea
Jul 3, 2018
3652a74
Modify genesis params
yograterol Aug 5, 2018
c5c0ef4
Change ident to tabs
yograterol Aug 5, 2018
a5ddc70
Default value for CLO ethashs params
yograterol Aug 5, 2018
3f2fd61
Fix loop start value (#9285)
Jongsic Aug 6, 2018
e8b13cb
Implement KIP4: create2 for wasm (#9277)
sorpaas Aug 6, 2018
1e44a62
Update wasm-tests hash (#9295)
sorpaas Aug 7, 2018
0d8001a
Improve return data truncate logic (#9254)
sorpaas Aug 7, 2018
1f18dbb
Remove all dapp permissions related settings (#9120)
sorpaas Aug 7, 2018
712101b
ethcore: add transition flag for transaction permission contract (#9275)
andresilva Aug 7, 2018
78a38e9
ethcore sync decodes rlp less often (#9264)
debris Aug 8, 2018
e2095d4
Move ethereum-specific H256FastMap type to own crate (#9307)
dvdplm Aug 9, 2018
8814195
Fix codecov.io badge in README (#9327)
kavu Aug 9, 2018
62fdfb9
Allow tx pool to be Send (#9315)
arkpar Aug 9, 2018
b28e742
Update tobalaba.json (#9313)
maciejhirsz Aug 9, 2018
e590874
Update `log` -> 0.4, `env_logger` -> 0.5. (#9294)
c0gent Aug 9, 2018
65a1d88
Docker alpine: use multi-stage concept (#9269)
fanatid Aug 10, 2018
30e4007
Prevent blockchain & miner racing when accessing pending block. (#9310)
tomusdrw Aug 10, 2018
1564fae
Allow setting the panic hook with parity-clib (#9292)
tomaka Aug 10, 2018
6e2821b
ethcore/sync `Make view macro only visible to test` (#9316)
niklasad1 Aug 10, 2018
4eab867
ethcore: fix pow difficulty validation (#9328)
andresilva Aug 10, 2018
a6df452
Implement EIP234 block_hash for eth_getLogs (#9256)
sorpaas Aug 13, 2018
98dbd1f
Fix load share (#9321)
ordian Aug 13, 2018
9c595af
Allow single opcode stepping for EVM (#9051)
sorpaas Aug 13, 2018
ff716e7
Remove pass-by-reference return data value from executive (#9211)
sorpaas Aug 13, 2018
fcb6cc1
Light client logs should include 'from_block' when querying logs (#9331)
cheme Aug 14, 2018
7262601
Expose UnorderedIterator. (#9347)
tomusdrw Aug 14, 2018
fe5301c
More details in logs returned by light client (#9324)
tomusdrw Aug 14, 2018
1ac4676
Remove prepare_trace_output and make sure prepare_trace_call and trac…
sorpaas Aug 14, 2018
29125e8
Lower the max size of transaction packet to prevent going oversize. (…
tomusdrw Aug 14, 2018
c21c19b
Fix no line breaks in logs (#9355)
ascjones Aug 14, 2018
7c32aea
Callisto Patch for Parity PR
Aug 15, 2018
d5271a4
Add Galilei -Callisto testnet-
yograterol Feb 28, 2018
bc699a4
Add CLO reward
yograterol Mar 4, 2018
97bca67
CLO Testnet 3.0 genesis file
yograterol Mar 11, 2018
dd748e1
Modify bootnode for testnet 3.0
yograterol Mar 30, 2018
03476cf
Fix testnet 3.0 genesis file
yograterol Mar 30, 2018
b8ab9ee
CLO Mainnet
yograterol Apr 15, 2018
038bff7
Mainnet release v1.0
yograterol Apr 15, 2018
0992b6d
Add CLO bootnodes
Apr 15, 2018
35ec813
Switch bootnodes to the new one
Apr 16, 2018
80b95bd
Update bootnodes from Chainkorea
Jul 3, 2018
fc25fe4
Modify genesis params
yograterol Aug 5, 2018
a39603f
Change ident to tabs
yograterol Aug 5, 2018
178e76e
Default value for CLO ethashs params
yograterol Aug 5, 2018
5e347b3
Merge branch 'master' of github.com:EthereumCommonwealth/rust-callisto
yograterol Aug 15, 2018
56bd939
Merge pull request #6 from chainkorea/master
yograterol Aug 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 119 additions & 49 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
blooms-db = { path = "util/blooms-db" }
log = "0.3"
env_logger = "0.4"
log = "0.4"
env_logger = "0.5"
rustc-hex = "1.0"
docopt = "0.8"
clap = "2"
Expand Down Expand Up @@ -136,6 +136,7 @@ members = [
"util/triehash-ethereum",
"util/keccak-hasher",
"util/patricia-trie-ethereum",
"util/fastmap",
]

[patch.crates-io]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### [» Download the latest release «](https://github.com/paritytech/parity-ethereum/releases/latest)

[![build status](https://gitlab.parity.io/parity/parity/badges/master/build.svg)](https://gitlab.parity.io/parity/parity/commits/master)
[![codecov](https://codecov.io/gh/paritytech/parity/branch/master/graph/badge.svg)](https://codecov.io/gh/paritytech/parity)
[![codecov](https://codecov.io/gh/paritytech/parity-ethereum/branch/master/graph/badge.svg)](https://codecov.io/gh/paritytech/parity-ethereum)
[![Snap Status](https://build.snapcraft.io/badge/paritytech/parity.svg)](https://build.snapcraft.io/user/paritytech/parity)
[![GPLv3](https://img.shields.io/badge/license-GPL%20v3-green.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)

Expand Down
52 changes: 33 additions & 19 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
FROM alpine:edge
FROM alpine:edge AS builder

# show backtraces
ENV RUST_BACKTRACE 1

RUN apk add --no-cache \
build-base \
cargo \
cmake \
eudev-dev \
linux-headers \
perl \
rust

WORKDIR /build
WORKDIR /parity
COPY . /parity
RUN cargo build --release --target x86_64-alpine-linux-musl --verbose
RUN strip target/x86_64-alpine-linux-musl/release/parity

# install tools and dependencies
RUN apk add --no-cache gcc musl-dev pkgconfig g++ make curl \
eudev-dev rust cargo git file binutils \
libusb-dev linux-headers perl cmake

FROM alpine:edge

# show backtraces
ENV RUST_BACKTRACE 1

# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
RUN apk add --no-cache \
libstdc++ \
eudev-libs \
libgcc

# build parity
ADD . /build/parity
RUN cd parity && \
cargo build --release --verbose && \
ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity
RUN addgroup -g 1000 parity \
&& adduser -u 1000 -G parity -s /bin/sh -D parity

RUN file /build/parity/target/release/parity
USER parity

EXPOSE 8080 8545 8180
ENTRYPOINT ["/build/parity/target/release/parity"]

WORKDIR /home/parity

RUN mkdir -p /home/parity/.local/share/io.parity.ethereum/
COPY --chown=parity:parity --from=builder /parity/target/x86_64-alpine-linux-musl/release/parity ./

ENTRYPOINT ["./parity"]
11 changes: 6 additions & 5 deletions ethash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ authors = ["Parity Technologies <admin@parity.io>"]
[lib]

[dependencies]
log = "0.3"
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
primal = "0.2.3"
parking_lot = "0.6"
crunchy = "0.1.0"
memmap = "0.6"
either = "1.0.0"
ethereum-types = "0.3"
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
log = "0.4"
memmap = "0.6"
parking_lot = "0.6"
primal = "0.2.3"

[dev-dependencies]
tempdir = "0.3"
Expand Down
66 changes: 64 additions & 2 deletions ethash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

#![cfg_attr(feature = "benches", feature(test))]

extern crate primal;
extern crate parking_lot;
extern crate either;
extern crate ethereum_types;
extern crate memmap;
extern crate parking_lot;
extern crate primal;

#[macro_use]
extern crate crunchy;
Expand All @@ -38,6 +39,7 @@ mod shared;
pub use cache::{NodeCacheBuilder, OptimizeFor};
pub use compute::{ProofOfWork, quick_get_difficulty, slow_hash_block_number};
use compute::Light;
use ethereum_types::{U256, U512};
use keccak::H256;
use parking_lot::Mutex;
pub use seed_compute::SeedHashCompute;
Expand Down Expand Up @@ -136,6 +138,29 @@ impl EthashManager {
}
}

/// Convert an Ethash boundary to its original difficulty. Basically just `f(x) = 2^256 / x`.
pub fn boundary_to_difficulty(boundary: &ethereum_types::H256) -> U256 {
difficulty_to_boundary_aux(&**boundary)
}

/// Convert an Ethash difficulty to the target boundary. Basically just `f(x) = 2^256 / x`.
pub fn difficulty_to_boundary(difficulty: &U256) -> ethereum_types::H256 {
difficulty_to_boundary_aux(difficulty).into()
}

fn difficulty_to_boundary_aux<T: Into<U512>>(difficulty: T) -> ethereum_types::U256 {
let difficulty = difficulty.into();

assert!(!difficulty.is_zero());

if difficulty == U512::one() {
U256::max_value()
} else {
// difficulty > 1, so result should never overflow 256 bits
U256::from((U512::one() << 256) / difficulty)
}
}

#[test]
fn test_lru() {
use tempdir::TempDir;
Expand All @@ -155,6 +180,43 @@ fn test_lru() {
assert_eq!(ethash.cache.lock().prev_epoch.unwrap(), 0);
}

#[test]
fn test_difficulty_to_boundary() {
use ethereum_types::H256;
use std::str::FromStr;

assert_eq!(difficulty_to_boundary(&U256::from(1)), H256::from(U256::max_value()));
assert_eq!(difficulty_to_boundary(&U256::from(2)), H256::from_str("8000000000000000000000000000000000000000000000000000000000000000").unwrap());
assert_eq!(difficulty_to_boundary(&U256::from(4)), H256::from_str("4000000000000000000000000000000000000000000000000000000000000000").unwrap());
assert_eq!(difficulty_to_boundary(&U256::from(32)), H256::from_str("0800000000000000000000000000000000000000000000000000000000000000").unwrap());
}

#[test]
fn test_difficulty_to_boundary_regression() {
use ethereum_types::H256;

// the last bit was originally being truncated when performing the conversion
// https://github.com/paritytech/parity-ethereum/issues/8397
for difficulty in 1..9 {
assert_eq!(U256::from(difficulty), boundary_to_difficulty(&difficulty_to_boundary(&difficulty.into())));
assert_eq!(H256::from(difficulty), difficulty_to_boundary(&boundary_to_difficulty(&difficulty.into())));
assert_eq!(U256::from(difficulty), boundary_to_difficulty(&boundary_to_difficulty(&difficulty.into()).into()));
assert_eq!(H256::from(difficulty), difficulty_to_boundary(&difficulty_to_boundary(&difficulty.into()).into()));
}
}

#[test]
#[should_panic]
fn test_difficulty_to_boundary_panics_on_zero() {
difficulty_to_boundary(&U256::from(0));
}

#[test]
#[should_panic]
fn test_boundary_to_difficulty_panics_on_zero() {
boundary_to_difficulty(&ethereum_types::H256::from(0));
}

#[cfg(feature = "benches")]
mod benchmarks {
extern crate test;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ evm = { path = "evm" }
heapsize = "0.4"
itertools = "0.5"
lazy_static = "1.0"
log = "0.3"
log = "0.4"
lru-cache = "0.1"
num = { version = "0.1", default-features = false, features = ["bigint"] }
num_cpus = "1.2"
Expand Down
3 changes: 2 additions & 1 deletion ethcore/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
bit-set = "0.4"
parity-bytes = { git = "https://github.com/paritytech/parity-common" }
ethereum-types = "0.3"
heapsize = "0.4"
lazy_static = "1.0"
log = "0.3"
log = "0.4"
vm = { path = "../vm" }
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
parking_lot = "0.6"
Expand Down
8 changes: 7 additions & 1 deletion ethcore/evm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Finalize for Result<GasLeft> {
fn finalize<E: Ext>(self, ext: E) -> Result<FinalizationResult> {
match self {
Ok(GasLeft::Known(gas_left)) => Ok(FinalizationResult { gas_left: gas_left, apply_state: true, return_data: ReturnData::empty() }),
Ok(GasLeft::NeedsReturn {gas_left, data, apply_state}) => ext.ret(&gas_left, &data, apply_state).map(|gas_left| FinalizationResult {
Ok(GasLeft::NeedsReturn { gas_left, data, apply_state }) => ext.ret(&gas_left, &data, apply_state).map(|gas_left| FinalizationResult {
gas_left: gas_left,
apply_state: apply_state,
return_data: data,
Expand All @@ -55,6 +55,12 @@ impl Finalize for Result<GasLeft> {
}
}

impl Finalize for Error {
fn finalize<E: Ext>(self, _ext: E) -> Result<FinalizationResult> {
Err(self)
}
}

/// Cost calculation type. For low-gas usage we calculate costs using usize instead of U256
pub trait CostType: Sized + From<usize> + Copy
+ ops::Mul<Output=Self> + ops::Div<Output=Self> + ops::Add<Output=Self> +ops::Sub<Output=Self>
Expand Down
20 changes: 14 additions & 6 deletions ethcore/evm/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
//! Evm factory.
//!
use std::sync::Arc;
use vm::Vm;
use vm::{Vm, Schedule};
use ethereum_types::U256;
use super::vm::ActionParams;
use super::interpreter::SharedCache;
use super::vmtype::VMType;

Expand All @@ -32,12 +33,12 @@ pub struct Factory {
impl Factory {
/// Create fresh instance of VM
/// Might choose implementation depending on supplied gas.
pub fn create(&self, gas: &U256) -> Box<Vm> {
pub fn create(&self, params: ActionParams, schedule: &Schedule, depth: usize) -> Box<Vm> {
match self.evm {
VMType::Interpreter => if Self::can_fit_in_usize(gas) {
Box::new(super::interpreter::Interpreter::<usize>::new(self.evm_cache.clone()))
VMType::Interpreter => if Self::can_fit_in_usize(&params.gas) {
Box::new(super::interpreter::Interpreter::<usize>::new(params, self.evm_cache.clone(), schedule, depth))
} else {
Box::new(super::interpreter::Interpreter::<U256>::new(self.evm_cache.clone()))
Box::new(super::interpreter::Interpreter::<U256>::new(params, self.evm_cache.clone(), schedule, depth))
}
}
}
Expand Down Expand Up @@ -68,7 +69,14 @@ impl Default for Factory {

#[test]
fn test_create_vm() {
let _vm = Factory::default().create(&U256::zero());
use vm::Ext;
use vm::tests::FakeExt;
use bytes::Bytes;

let mut params = ActionParams::default();
params.code = Some(Arc::new(Bytes::default()));
let ext = FakeExt::new();
let _vm = Factory::default().create(params, ext.schedule(), ext.depth());
}

/// Create tests by injecting different VM factories
Expand Down
15 changes: 10 additions & 5 deletions ethcore/evm/src/interpreter/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,19 @@ impl Memory for Vec<u8> {
fn into_return_data(mut self, offset: U256, size: U256) -> ReturnData {
let mut offset = offset.low_u64() as usize;
let size = size.low_u64() as usize;

if !is_valid_range(offset, size) {
return ReturnData::empty()
return ReturnData::empty();
}

if self.len() - size > MAX_RETURN_WASTE_BYTES {
{ let _ = self.drain(..offset); }
self.truncate(size);
self.shrink_to_fit();
offset = 0;
if offset == 0 {
self.truncate(size);
self.shrink_to_fit();
} else {
self = self[offset..(offset + size)].to_vec();
offset = 0;
}
}
ReturnData::new(self, offset, size)
}
Expand Down
Loading