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 ao-lmdb
Browse files Browse the repository at this point in the history
* master:
  no volumes are needed, just run -v volume:/path/in/the/container (#10345)
  Fixed misstype (#10351)
  snap: prefix version and populate candidate channel (#10343)
  Bundle protocol and packet_id together in chain sync (#10315)
  role back docker build image and docker deploy image to ubuntu:xenial based (#10338)
  change docker image based on debian instead of ubuntu due to the chan… (#10336)
  Don't add discovery initiators to the node table (#10305)
  fix(docker): fix not receives SIGINT (#10059)
  snap: official image / test (#10168)
  fix(add helper for timestamp overflows) (#10330)
  Additional error for invalid gas (#10327)
  Revive parity_setMinGasPrice RPC call (#10294)
  Add Statetest support for Constantinople Fix (#10323)
  fix(parity-clib): grumbles that were not addressed in #9920 (#10154)
  fix(light-rpc): Make `light_sync` generic (#10238)
  fix publish job (#10317)
  Secure WS-RPC: grant access to all apis (#10246)
  Make specification of protocol in SyncRequester::send_request explicit (#10295)
  • Loading branch information
ordian committed Feb 19, 2019
2 parents 48e44cb + bff0bed commit 0695f94
Show file tree
Hide file tree
Showing 57 changed files with 1,117 additions and 571 deletions.
19 changes: 10 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stages:
- publish-onchain
- optional

image: parity/rust-parity-ethereum-build:stretch
image: parity/rust:gitlab-ci

variables:
GIT_STRATEGY: fetch
Expand Down Expand Up @@ -44,6 +44,7 @@ test-linux:
RUN_TESTS: all
script:
- scripts/gitlab/test-all.sh
- sccache -s
tags:
- linux-docker

Expand Down Expand Up @@ -102,9 +103,9 @@ publish-docker:
- scripts/gitlab/publish-docker.sh parity

publish-snap:
stage: publish
stage: optional #publish
only: *releaseable_branches
image: parity/snapcraft:gitlab-ci
image: snapcore/snapcraft
variables:
BUILD_ARCH: amd64
cache: {}
Expand All @@ -118,23 +119,23 @@ publish-snap:
allow_failure: true
<<: *collect_artifacts

publish:onnet:update:
publish-onnet-update:
stage: publish-onchain
only: *releaseable_branches
cache: {}
dependencies:
- build-linux
- build-darwin
- build-windows
- publish:awss3:release
- publish-awss3-release
before_script: *determine_version
script:
- scripts/gitlab/publish-onnet-update.sh
tags:
- linux-docker

# configures aws for fast uploads/syncs
.s3_before_script: &s3_before_script
.s3-before-script: &s3-before-script
before_script:
- mkdir -p ${HOME}/.aws
- |
Expand All @@ -150,7 +151,7 @@ publish:onnet:update:
addressing_style = path
EOC
publish:awss3:release:
publish-awss3-release:
image: parity/awscli:latest
stage: publish
only: *releaseable_branches
Expand All @@ -161,7 +162,7 @@ publish:awss3:release:
- build-windows
variables:
GIT_STRATEGY: none
<<: *s3_before_script
<<: *s3-before-script
script:
- echo "__________Push binaries to AWS S3____________"
- case "${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}" in
Expand All @@ -174,7 +175,7 @@ publish:awss3:release:
esac
- aws s3 sync ./artifacts s3://${BUCKET}/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/
after_script:
- aws s3 ls s3://${BUCKET}/latest/
- aws s3 ls s3://${BUCKET}/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/
--recursive --human-readable --summarize
tags:
- linux-docker
Expand Down
15 changes: 15 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ blooms-db = { path = "../util/blooms-db" }
criterion = "0.2"
env_logger = "0.5"
ethcore-accounts = { path = "../accounts" }
fetch = { path = "../util/fetch" }
kvdb-rocksdb = "0.1.3"
parity-runtime = { path = "../util/runtime" }
rlp_compress = { path = "../util/rlp-compress" }
tempdir = "0.3"
trie-standardmap = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions ethcore/evm/src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ impl<Cost: CostType> Interpreter<Cost> {
let out_size = self.stack.pop_back();

// Add stipend (only CALL|CALLCODE when value > 0)
let call_gas = call_gas + value.map_or_else(|| Cost::from(0), |val| match val.is_zero() {
let call_gas = call_gas.overflow_add(value.map_or_else(|| Cost::from(0), |val| match val.is_zero() {
false => Cost::from(ext.schedule().call_stipend),
true => Cost::from(0),
});
})).0;

// Get sender & receive addresses, check if we have balance
let (sender_address, receive_address, has_balance, call_type) = match instruction {
Expand Down
4 changes: 2 additions & 2 deletions ethcore/light/src/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl AccountTransactions {
}

fn next_nonce(&self) -> U256 {
self.current.last().map(|last| last.nonce + 1)
self.current.last().map(|last| last.nonce.saturating_add(1.into()))
.unwrap_or_else(|| *self.cur_nonce.value())
}

Expand All @@ -107,7 +107,7 @@ impl AccountTransactions {
while let Some(tx) = self.future.remove(&next_nonce) {
promoted.push(tx.hash);
self.current.push(tx);
next_nonce = next_nonce + 1;
next_nonce = next_nonce.saturating_add(1.into());
}

promoted
Expand Down
2 changes: 1 addition & 1 deletion ethcore/private-tx/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ error_chain! {
}

#[doc = "Wrong private transaction type."]
BadTransactonType {
BadTransactionType {
description("Wrong private transaction type."),
display("Wrong private transaction type"),
}
Expand Down
8 changes: 4 additions & 4 deletions ethcore/private-tx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Provider {
bail!(ErrorKind::SignerAccountNotSet);
}
let tx_hash = signed_transaction.hash();
let contract = Self::contract_address_from_transaction(&signed_transaction).map_err(|_| ErrorKind::BadTransactonType)?;
let contract = Self::contract_address_from_transaction(&signed_transaction).map_err(|_| ErrorKind::BadTransactionType)?;
let data = signed_transaction.rlp_bytes();
let encrypted_transaction = self.encrypt(&contract, &Self::iv_from_transaction(&signed_transaction), &data)?;
let private = PrivateTransaction::new(encrypted_transaction, contract);
Expand Down Expand Up @@ -415,7 +415,7 @@ impl Provider {
Action::Call(contract) => Ok(contract),
_ => {
warn!(target: "privatetx", "Incorrect type of action for the transaction");
bail!(ErrorKind::BadTransactonType);
bail!(ErrorKind::BadTransactionType);
}
}
}
Expand Down Expand Up @@ -610,7 +610,7 @@ impl Provider {
/// Create encrypted public contract deployment transaction.
pub fn public_creation_transaction(&self, block: BlockId, source: &SignedTransaction, validators: &[Address], gas_price: U256) -> Result<(Transaction, Address), Error> {
if let Action::Call(_) = source.action {
bail!(ErrorKind::BadTransactonType);
bail!(ErrorKind::BadTransactionType);
}
let sender = source.sender();
let state = self.client.state_at(block).ok_or(ErrorKind::StatePruned)?;
Expand Down Expand Up @@ -649,7 +649,7 @@ impl Provider {
/// Create encrypted public contract deployment transaction. Returns updated encrypted state.
pub fn execute_private_transaction(&self, block: BlockId, source: &SignedTransaction) -> Result<Bytes, Error> {
if let Action::Create = source.action {
bail!(ErrorKind::BadTransactonType);
bail!(ErrorKind::BadTransactionType);
}
let result = self.execute_private(source, TransactOptions::with_no_tracing(), block)?;
Ok(result.state)
Expand Down
65 changes: 65 additions & 0 deletions ethcore/res/ethereum/st_peters_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "St. Peter's (test)",
"engine": {
"Ethash": {
"params": {
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x1BC16D674EC80000",
"homesteadTransition": "0x0",
"eip100bTransition": "0x0",
"difficultyBombDelays": {
"0": 5000000
}
}
}
},
"params": {
"gasLimitBoundDivisor": "0x0400",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"accountStartNonce": "0x00",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x1",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0",
"eip150Transition": "0x0",
"eip160Transition": "0x0",
"eip161abcTransition": "0x0",
"eip161dTransition": "0x0",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
"eip155Transition": "0x0",
"eip658Transition": "0x0",
"eip145Transition": "0x0",
"eip1014Transition": "0x0",
"eip1052Transition": "0x0",
"eip1283DisableTransition": "0x0"
},
"genesis": {
"seal": {
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x400000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"gasLimit": "0x1388"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 20 } } } },
"0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": "0x00", "pricing": { "linear": { "base": 500, "word": 0 } } } },
"0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": "0x00", "pricing": { "linear": { "base": 40000, "word": 0 } } } },
"0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": "0x00", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } }
}
}
2 changes: 1 addition & 1 deletion ethcore/res/ethereum/tests
Submodule tests updated 10615 files
1 change: 1 addition & 0 deletions ethcore/src/client/evm_test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ impl<'a> EvmTestClient<'a> {
ForkSpec::EIP158 => Some(ethereum::new_eip161_test()),
ForkSpec::Byzantium => Some(ethereum::new_byzantium_test()),
ForkSpec::Constantinople => Some(ethereum::new_constantinople_test()),
ForkSpec::ConstantinopleFix => Some(ethereum::new_constantinople_fix_test()),
ForkSpec::EIP158ToByzantiumAt5 => Some(ethereum::new_transition_test()),
ForkSpec::FrontierToHomesteadAt5 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => None,
}
Expand Down
3 changes: 3 additions & 0 deletions ethcore/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub enum BlockError {
InvalidNumber(Mismatch<BlockNumber>),
/// Block number isn't sensible.
RidiculousNumber(OutOfBounds<BlockNumber>),
/// Timestamp header overflowed
TimestampOverflow,
/// Too many transactions from a particular address.
TooManyTransactions(Address),
/// Parent given is unknown.
Expand Down Expand Up @@ -138,6 +140,7 @@ impl fmt::Display for BlockError {
UnknownParent(ref hash) => format!("Unknown parent: {}", hash),
UnknownUncleParent(ref hash) => format!("Unknown uncle parent: {}", hash),
UnknownEpochTransition(ref num) => format!("Unknown transition to epoch number: {}", num),
TimestampOverflow => format!("Timestamp overflow"),
TooManyTransactions(ref address) => format!("Too many transactions from: {}", address),
};

Expand Down
6 changes: 6 additions & 0 deletions ethcore/src/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ pub fn new_byzantium_test() -> Spec { load(None, include_bytes!("../../res/ether
/// Create a new Foundation Constantinople era spec.
pub fn new_constantinople_test() -> Spec { load(None, include_bytes!("../../res/ethereum/constantinople_test.json")) }

/// Create a new Foundation St. Peter's (Contantinople Fix) era spec.
pub fn new_constantinople_fix_test() -> Spec { load(None, include_bytes!("../../res/ethereum/st_peters_test.json")) }

/// Create a new Musicoin-MCIP3-era spec.
pub fn new_mcip3_test() -> Spec { load(None, include_bytes!("../../res/ethereum/mcip3_test.json")) }

Expand All @@ -168,6 +171,9 @@ pub fn new_byzantium_test_machine() -> EthereumMachine { load_machine(include_by
/// Create a new Foundation Constantinople era spec.
pub fn new_constantinople_test_machine() -> EthereumMachine { load_machine(include_bytes!("../../res/ethereum/constantinople_test.json")) }

/// Create a new Foundation St. Peter's (Contantinople Fix) era spec.
pub fn new_constantinople_fix_test_machine() -> EthereumMachine { load_machine(include_bytes!("../../res/ethereum/st_peters_test.json")) }

/// Create a new Musicoin-MCIP3-era spec.
pub fn new_mcip3_test_machine() -> EthereumMachine { load_machine(include_bytes!("../../res/ethereum/mcip3_test.json")) }

Expand Down
14 changes: 9 additions & 5 deletions ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl<'a> CallCreateExecutive<'a> {
let prev_bal = state.balance(&params.address)?;
if let ActionValue::Transfer(val) = params.value {
state.sub_balance(&params.sender, &val, &mut substate.to_cleanup_mode(&schedule))?;
state.new_contract(&params.address, val + prev_bal, nonce_offset)?;
state.new_contract(&params.address, val.saturating_add(prev_bal), nonce_offset)?;
} else {
state.new_contract(&params.address, prev_bal, nonce_offset)?;
}
Expand Down Expand Up @@ -1103,9 +1103,13 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
let refunded = cmp::min(refunds_bound, (t.gas - gas_left_prerefund) >> 1);
let gas_left = gas_left_prerefund + refunded;

let gas_used = t.gas - gas_left;
let refund_value = gas_left * t.gas_price;
let fees_value = gas_used * t.gas_price;
let gas_used = t.gas.saturating_sub(gas_left);
let (refund_value, overflow_1) = gas_left.overflowing_mul(t.gas_price);
let (fees_value, overflow_2) = gas_used.overflowing_mul(t.gas_price);
if overflow_1 || overflow_2 {
return Err(ExecutionError::TransactionMalformed("U256 Overflow".to_string()));
}


trace!("exec::finalize: t.gas={}, sstore_refunds={}, suicide_refunds={}, refunds_bound={}, gas_left_prerefund={}, refunded={}, gas_left={}, gas_used={}, refund_value={}, fees_value={}\n",
t.gas, sstore_refunds, suicide_refunds, refunds_bound, gas_left_prerefund, refunded, gas_left, gas_used, refund_value, fees_value);
Expand All @@ -1123,7 +1127,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
}

// perform garbage-collection
let min_balance = if schedule.kill_dust != CleanDustMode::Off { Some(U256::from(schedule.tx_gas) * t.gas_price) } else { None };
let min_balance = if schedule.kill_dust != CleanDustMode::Off { Some(U256::from(schedule.tx_gas).overflowing_mul(t.gas_price).0) } else { None };
self.state.kill_garbage(&substate.touched, schedule.kill_empty, &min_balance, schedule.kill_dust == CleanDustMode::WithCodeAndStorage)?;

match result {
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/json_tests/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ mod state_tests {
declare_test!{GeneralStateTest_stRefundTest, "GeneralStateTests/stRefundTest/"}
declare_test!{GeneralStateTest_stReturnDataTest, "GeneralStateTests/stReturnDataTest/"}
declare_test!{GeneralStateTest_stRevertTest, "GeneralStateTests/stRevertTest/"}
declare_test!{GeneralStateTest_stSStoreTest, "GeneralStateTests/stSStoreTest/"}
declare_test!{GeneralStateTest_stShift, "GeneralStateTests/stShift/"}
declare_test!{GeneralStateTest_stSolidityTest, "GeneralStateTests/stSolidityTest/"}
declare_test!{GeneralStateTest_stSpecialTest, "GeneralStateTests/stSpecialTest/"}
Expand All @@ -177,7 +178,6 @@ mod state_tests {
declare_test!{GeneralStateTest_stZeroCallsRevert, "GeneralStateTests/stZeroCallsRevert/"}
declare_test!{GeneralStateTest_stZeroCallsTest, "GeneralStateTests/stZeroCallsTest/"}
declare_test!{GeneralStateTest_stZeroKnowledge, "GeneralStateTests/stZeroKnowledge/"}
declare_test!{GeneralStateTest_stSStoreTest, "GeneralStateTests/stSStoreTest/"}

// Attempts to send a transaction that requires more than current balance:
// Tx:
Expand Down
Loading

0 comments on commit 0695f94

Please sign in to comment.