Skip to content

Commit

Permalink
Merge pull request openethereum#75 from paritytech/master
Browse files Browse the repository at this point in the history
backports from upstream
  • Loading branch information
soc1c authored Mar 23, 2019
2 parents 10755f9 + 023e511 commit 218aa55
Show file tree
Hide file tree
Showing 63 changed files with 704 additions and 505 deletions.
36 changes: 35 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
## Parity-Ethereum [v2.4.3](https://github.com/paritytech/parity-ethereum/releases/tag/v2.4.3) (2019-03-22)

Parity-Ethereum 2.4.3-beta is a bugfix release that improves performance and stability. This patch release contains a critical bug fix where serving light clients previously led to client crashes. Upgrading is highly recommended.

The full list of included changes:
- 2.4.3 beta backports ([#10508](https://github.com/paritytech/parity-ethereum/pull/10508))
- Version: bump beta
- Add additional request tests ([#10503](https://github.com/paritytech/parity-ethereum/pull/10503))

## Parity-Ethereum [v2.4.2](https://github.com/paritytech/parity-ethereum/releases/tag/v2.4.2) (2019-03-20)

Parity-Ethereum 2.4.2-beta is a bugfix release that improves performance and stability.

The full list of included changes:
- 2.4.2 beta backports ([#10488](https://github.com/paritytech/parity-ethereum/pull/10488))
- Version: bump beta
- Сaching through docker volume ([#10477](https://github.com/paritytech/parity-ethereum/pull/10477))
- fix win&mac build ([#10486](https://github.com/paritytech/parity-ethereum/pull/10486))
- fix(extract `timestamp_checked_add` as lib) ([#10383](https://github.com/paritytech/parity-ethereum/pull/10383))

## Parity-Ethereum [v2.4.1](https://github.com/paritytech/parity-ethereum/releases/tag/v2.4.1) (2019-03-19)

Parity-Ethereum 2.4.1-beta is a bugfix release that improves performance and stability.

The full list of included changes:
- 2.4.1 beta backports ([#10471](https://github.com/paritytech/parity-ethereum/pull/10471))
- Version: bump beta
- Implement parity_versionInfo & parity_setChain on LC; fix parity_setChain ([#10312](https://github.com/paritytech/parity-ethereum/pull/10312))
- CI publish to aws ([#10446](https://github.com/paritytech/parity-ethereum/pull/10446))
- CI aws git checkout ([#10451](https://github.com/paritytech/parity-ethereum/pull/10451))
- Revert "CI aws git checkout ([#10451](https://github.com/paritytech/parity-ethereum/pull/10451))" ([#10456](https://github.com/paritytech/parity-ethereum/pull/10456))
- Tests parallelized ([#10452](https://github.com/paritytech/parity-ethereum/pull/10452))
- Ensure static validator set changes are recognized ([#10467](https://github.com/paritytech/parity-ethereum/pull/10467))

## Parity-Ethereum [v2.4.0](https://github.com/paritytech/parity-ethereum/releases/tag/v2.4.0) (2019-02-25)

Parity-Ethereum 2.4.0-beta is our trifortnightly minor version release coming with a lot of new features as well as bugfixes and performance improvements.
Expand All @@ -6,7 +40,7 @@ Notable changes:
- Account management is now deprecated ([#10213](https://github.com/paritytech/parity-ethereum/pull/10213))
- Local accounts can now be specified via CLI ([#9960](https://github.com/paritytech/parity-ethereum/pull/9960))
- Chains can now be reset to a particular block via CLI ([#9782](https://github.com/paritytech/parity-ethereum/pull/9782))
- Ethash now additionally implements ProgPoW ([#9762](https://github.com/paritytech/parity-ethereum/pull/9762))
- Ethash now additionally implements ProgPoW ([#9762](https://github.com/paritytech/parity-ethereum/pull/9762))
- The `eip1283DisableTransition` flag was added to revert EIP-1283 ([#10214](https://github.com/paritytech/parity-ethereum/pull/10214))

The full list of included changes:
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

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

35 changes: 34 additions & 1 deletion docs/CHANGELOG-2.3.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
## Parity-Ethereum [v2.3.8](https://github.com/paritytech/parity-ethereum/releases/tag/v2.3.8) (2019-03-22)

Parity-Ethereum 2.3.8-stable is a bugfix release that improves performance and stability. This patch release contains a critical bug fix where serving light clients previously led to client crashes. Upgrading is highly recommended.

The full list of included changes:
- 2.3.8 stable backports ([#10507](https://github.com/paritytech/parity-ethereum/pull/10507))
- Version: bump stable
- Add additional request tests ([#10503](https://github.com/paritytech/parity-ethereum/pull/10503))

## Parity-Ethereum [v2.3.7](https://github.com/paritytech/parity-ethereum/releases/tag/v2.3.7) (2019-03-20)

Parity-Ethereum 2.3.7-stable is a bugfix release that improves performance and stability.

The full list of included changes:
- 2.3.7 stable backports ([#10487](https://github.com/paritytech/parity-ethereum/pull/10487))
- Version: bump stable
- Сaching through docker volume ([#10477](https://github.com/paritytech/parity-ethereum/pull/10477))
- fix win&mac build ([#10486](https://github.com/paritytech/parity-ethereum/pull/10486))
- fix(extract `timestamp_checked_add` as lib) ([#10383](https://github.com/paritytech/parity-ethereum/pull/10383))

## Parity-Ethereum [v2.3.6](https://github.com/paritytech/parity-ethereum/releases/tag/v2.3.6) (2019-03-19)

Parity-Ethereum 2.3.6-stable is a bugfix release that improves performance and stability.

The full list of included changes:
- 2.3.6 stable backports ([#10470](https://github.com/paritytech/parity-ethereum/pull/10470))
- Version: bump stable
- CI publish to aws ([#10446](https://github.com/paritytech/parity-ethereum/pull/10446))
- Ensure static validator set changes are recognized ([#10467](https://github.com/paritytech/parity-ethereum/pull/10467))
- CI aws git checkout ([#10451](https://github.com/paritytech/parity-ethereum/pull/10451))
- Revert "CI aws git checkout ([#10451](https://github.com/paritytech/parity-ethereum/pull/10451))" ([#10456](https://github.com/paritytech/parity-ethereum/pull/10456))
- Tests parallelized ([#10452](https://github.com/paritytech/parity-ethereum/pull/10452))

## Parity-Ethereum [v2.3.5](https://github.com/paritytech/parity-ethereum/releases/tag/v2.3.5) (2019-02-25)

Parity-Ethereum 2.3.5-stable is a bugfix release that improves performance and stability.
Expand All @@ -18,7 +51,7 @@ The full list of included changes:
- Snap: reenable i386, arm64, armhf architecture publishing ([#10386](https://github.com/paritytech/parity-ethereum/pull/10386))
- Tx pool: always accept local transactions ([#10375](https://github.com/paritytech/parity-ethereum/pull/10375))
- Fix to_pod storage trie value decoding ([#10368)](https://github.com/paritytech/parity-ethereum/pull/10368))
- Version: mark 2.3.5 as stable
- Version: mark 2.3.5 as stable

## Parity-Ethereum [v2.3.4](https://github.com/paritytech/parity-ethereum/releases/tag/v2.3.4) (2019-02-21)

Expand Down
74 changes: 74 additions & 0 deletions ethcore/light/src/types/request/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,78 @@ mod tests {
hash: Field::BackReference(0, 0),
})).unwrap();
}

#[test]
fn batch_tx_index_backreference() {
let mut builder = Builder::default();
builder.push(Request::HeaderProof(IncompleteHeaderProofRequest {
num: 100.into(), // header proof puts hash at output 0.
})).unwrap();
builder.push(Request::TransactionIndex(IncompleteTransactionIndexRequest {
hash: Field::BackReference(0, 0),
})).unwrap();

let mut batch = builder.build();
batch.requests[1].fill(|_req_idx, _out_idx| Ok(Output::Hash(42.into())));

assert!(batch.next_complete().is_some());
batch.answered += 1;
assert!(batch.next_complete().is_some());
}

#[test]
#[should_panic]
fn batch_tx_index_backreference_wrong_output() {
let mut builder = Builder::default();
builder.push(Request::HeaderProof(IncompleteHeaderProofRequest {
num: 100.into(), // header proof puts hash at output 0.
})).unwrap();
builder.push(Request::TransactionIndex(IncompleteTransactionIndexRequest {
hash: Field::BackReference(0, 0),
})).unwrap();

let mut batch = builder.build();
batch.requests[1].fill(|_req_idx, _out_idx| Ok(Output::Number(42)));

batch.next_complete();
batch.answered += 1;
batch.next_complete();
}

#[test]
fn batch_receipts_backreference() {
let mut builder = Builder::default();
builder.push(Request::HeaderProof(IncompleteHeaderProofRequest {
num: 100.into(), // header proof puts hash at output 0.
})).unwrap();
builder.push(Request::Receipts(IncompleteReceiptsRequest {
hash: Field::BackReference(0, 0),
})).unwrap();

let mut batch = builder.build();
batch.requests[1].fill(|_req_idx, _out_idx| Ok(Output::Hash(42.into())));

assert!(batch.next_complete().is_some());
batch.answered += 1;
assert!(batch.next_complete().is_some());
}

#[test]
#[should_panic]
fn batch_receipts_backreference_wrong_output() {
let mut builder = Builder::default();
builder.push(Request::HeaderProof(IncompleteHeaderProofRequest {
num: 100.into(), // header proof puts hash at output 0.
})).unwrap();
builder.push(Request::Receipts(IncompleteReceiptsRequest {
hash: Field::BackReference(0, 0),
})).unwrap();

let mut batch = builder.build();
batch.requests[1].fill(|_req_idx, _out_idx| Ok(Output::Number(42)));

batch.next_complete();
batch.answered += 1;
batch.next_complete();
}
}
4 changes: 2 additions & 2 deletions ethcore/light/src/types/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ pub mod transaction_index {
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
if let Field::BackReference(req, idx) = self.hash {
self.hash = match oracle(req, idx) {
Ok(Output::Number(hash)) => Field::Scalar(hash.into()),
Ok(Output::Hash(hash)) => Field::Scalar(hash.into()),
_ => Field::BackReference(req, idx),
}
}
Expand Down Expand Up @@ -982,7 +982,7 @@ pub mod block_receipts {
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
if let Field::BackReference(req, idx) = self.hash {
self.hash = match oracle(req, idx) {
Ok(Output::Number(hash)) => Field::Scalar(hash.into()),
Ok(Output::Hash(hash)) => Field::Scalar(hash.into()),
_ => Field::BackReference(req, idx),
}
}
Expand Down
4 changes: 2 additions & 2 deletions parity/rpc_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl FullDependencies {
handler.extend_with(DebugClient::new(self.client.clone()).to_delegate());
}
Api::Web3 => {
handler.extend_with(Web3Client::new().to_delegate());
handler.extend_with(Web3Client::default().to_delegate());
}
Api::Net => {
handler.extend_with(NetClient::new(&self.sync).to_delegate());
Expand Down Expand Up @@ -529,7 +529,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
warn!(target: "rpc", "Debug API is not available in light client mode.")
}
Api::Web3 => {
handler.extend_with(Web3Client::new().to_delegate());
handler.extend_with(Web3Client::default().to_delegate());
}
Api::Net => {
handler.extend_with(light::NetClient::new(self.sync.clone()).to_delegate());
Expand Down
12 changes: 6 additions & 6 deletions rpc/src/authcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const TIME_THRESHOLD: u64 = 7;
/// minimal length of hash
const TOKEN_LENGTH: usize = 16;
/// Separator between fields in serialized tokens file.
const SEPARATOR: &'static str = ";";
const SEPARATOR: &str = ";";
/// Number of seconds to keep unused tokens.
const UNUSED_TOKEN_TIMEOUT: u64 = 3600 * 24; // a day

Expand Down Expand Up @@ -115,7 +115,7 @@ impl AuthCodes<DefaultTimeProvider> {
})
.collect();
Ok(AuthCodes {
codes: codes,
codes,
now: time_provider,
})
}
Expand All @@ -128,7 +128,7 @@ impl<T: TimeProvider> AuthCodes<T> {
pub fn to_file(&self, file: &Path) -> io::Result<()> {
let mut file = fs::File::create(file)?;
let content = self.codes.iter().map(|code| {
let mut data = vec![code.code.clone(), encode_time(code.created_at.clone())];
let mut data = vec![code.code.clone(), encode_time(code.created_at)];
if let Some(used_at) = code.last_used_at {
data.push(encode_time(used_at));
}
Expand All @@ -141,11 +141,11 @@ impl<T: TimeProvider> AuthCodes<T> {
pub fn new(codes: Vec<String>, now: T) -> Self {
AuthCodes {
codes: codes.into_iter().map(|code| Code {
code: code,
code,
created_at: time::Duration::from_secs(now.now()),
last_used_at: None,
}).collect(),
now: now,
now,
}
}

Expand Down Expand Up @@ -183,7 +183,7 @@ impl<T: TimeProvider> AuthCodes<T> {
.join("-");
trace!(target: "signer", "New authentication token generated.");
self.codes.push(Code {
code: code,
code,
created_at: time::Duration::from_secs(self.now.now()),
last_used_at: None,
});
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/http_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<M, T> http::MetaExtractor<M> for MetaExtractor<T> where
{
fn read_metadata(&self, req: &hyper::Request<hyper::Body>) -> M {
let as_string = |header: Option<&hyper::header::HeaderValue>| {
header.and_then(|val| val.to_str().ok().map(|s| s.to_owned()))
header.and_then(|val| val.to_str().ok().map(ToOwned::to_owned))
};

let origin = as_string(req.headers().get("origin"));
Expand Down
27 changes: 23 additions & 4 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
//! Parity RPC.
#![warn(missing_docs, unused_extern_crates)]
#![cfg_attr(feature = "cargo-clippy", warn(clippy::all, clippy::pedantic))]
#![cfg_attr(
feature = "cargo-clippy",
allow(
// things are often more readable this way
clippy::cast_lossless,
clippy::module_name_repetitions,
clippy::single_match_else,
clippy::type_complexity,
clippy::use_self,
// not practical
clippy::match_bool,
clippy::needless_pass_by_value,
clippy::similar_names,
// don't require markdown syntax for docs
clippy::doc_markdown,
),
warn(clippy::indexing_slicing)
)]

#[macro_use]
extern crate futures;
Expand Down Expand Up @@ -145,8 +164,8 @@ pub fn start_http<M, S, H, T>(
Ok(http::ServerBuilder::with_meta_extractor(handler, extractor)
.keep_alive(keep_alive)
.threads(threads)
.cors(cors_domains.into())
.allowed_hosts(allowed_hosts.into())
.cors(cors_domains)
.allowed_hosts(allowed_hosts)
.health_api(("/api/health", "parity_nodeStatus"))
.cors_allow_headers(AccessControlAllowHeaders::Any)
.max_request_body_size(max_payload * 1024 * 1024)
Expand Down Expand Up @@ -176,8 +195,8 @@ pub fn start_http_with_middleware<M, S, H, T, R>(
Ok(http::ServerBuilder::with_meta_extractor(handler, extractor)
.keep_alive(keep_alive)
.threads(threads)
.cors(cors_domains.into())
.allowed_hosts(allowed_hosts.into())
.cors(cors_domains)
.allowed_hosts(allowed_hosts)
.cors_allow_headers(AccessControlAllowHeaders::Any)
.max_request_body_size(max_payload * 1024 * 1024)
.request_middleware(middleware)
Expand Down
6 changes: 3 additions & 3 deletions rpc/src/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<T> Server<T> {

Server {
server: f(remote),
event_loop: event_loop,
event_loop,
}
}
}
Expand All @@ -60,8 +60,8 @@ pub struct GuardedAuthCodes {
pub path: PathBuf,
}

impl GuardedAuthCodes {
pub fn new() -> Self {
impl Default for GuardedAuthCodes {
fn default() -> Self {
let tempdir = TempDir::new("").unwrap();
let path = tempdir.path().join("file");

Expand Down
Loading

0 comments on commit 218aa55

Please sign in to comment.