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

Commit 72c8b79

Browse files
authored
2.4.1 beta backports (#10471)
* version: bump beta * Implement parity_versionInfo & parity_setChain on LC; fix parity_setChain (#10312) * Light client: implement parity_versionInfo RPC * Light client: implement set_exit_handler & parity_setChain RPC * parity_setChain RPC: return an error if failed (instead of `true`) * Implement eth_subscribe('syncing') RPC for full node & light node * Fix indentation * Revert commit: Implement eth_subscribe('syncing') * Revert change to Cr callback function * CI publish to aws (#10446) * move publish aws from gitlab.yml to gitlab scripts * gitlab.yml cleaning move publish AWS to gitlab scripts remove dependencies from android build * CI aws git checkout (#10451) * Updating the CI system with the publication of releases and binary files on github Signed-off-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com> * move publish aws from gitlab.yml to gitlab scripts Signed-off-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com> * gitlab.yml cleaning move publish AWS to gitlab scripts remove dependencies from android build Signed-off-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com> * Revert "Updating the CI system with the publication of releases and binary files on github" This reverts commit da87e06. * remove no-git for aws * microfix * no need in no_git then * Revert "CI aws git checkout (#10451)" (#10456) * Revert "CI aws git checkout (#10451)" This reverts commit 3e1d731. * Update .gitlab-ci.yml revert aws script with small fixes * Delete publish-aws.sh * Tests parallelized (#10452) * tests splitted, phase 1 * typo * fix wrong launch commands * typos * rearrangements * use `nproc` function for threads * use nproc for threads * let theads be auto, build-andriod no more in regular run * split val chain and cargo check * renamed some files * wrong phase * check rust files before test jobs * lint error * rust files modivied var * test except changes * add rust_changes except * lint error * fixes * .gitlab-ci.yml can't be excluded * pipeline shouldn't start * pipeline must go * pipeline must go 2 * pipeline must go 3 * pipeline must go 4 * pipeline must go 5 * pipeline must go 6 * pipeline must go 7 * pipeline must not go 1 * pipeline must go 8 * avoid skippng tests yet, reintroducing them after the caching * test theory * parallelized cargo check with combusting helicopters * less uploads * alias for cargo checks * nice template * Ensure static validator set changes are recognized (#10467)
1 parent c7d8ee1 commit 72c8b79

File tree

21 files changed

+166
-138
lines changed

21 files changed

+166
-138
lines changed

.gitlab-ci.yml

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ variables:
1212
CARGO_HOME: "${CI_PROJECT_DIR}/.cargo"
1313
CARGO_TARGET: x86_64-unknown-linux-gnu
1414

15-
.no_git: &no_git
15+
.no_git: &no_git #disable git strategy
1616
variables:
1717
GIT_STRATEGY: none
1818
GIT_SUBMODULE_STRATEGY: none
1919

20-
2120
.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries")
2221
only: &releaseable_branches
2322
- stable
2423
- beta
2524
- tags
2625
- schedules
2726

28-
2927
.collect_artifacts: &collect_artifacts
3028
artifacts:
3129
name: "${CI_JOB_NAME}_${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
@@ -34,34 +32,66 @@ variables:
3432
paths:
3533
- artifacts/
3634

37-
test-linux:
38-
stage: test
39-
variables:
40-
RUN_TESTS: all
41-
script:
42-
- scripts/gitlab/test-all.sh
35+
.docker-cache-status: &docker-cache-status
36+
dependencies: []
37+
before_script:
38+
- sccache -s
39+
after_script:
4340
- sccache -s
4441
tags:
4542
- linux-docker
4643

47-
test-audit:
44+
45+
cargo-check 0 3:
46+
stage: test
47+
<<: *docker-cache-status
48+
script:
49+
- time cargo check --target $CARGO_TARGET --locked --no-default-features
50+
51+
cargo-check 1 3:
52+
stage: test
53+
<<: *docker-cache-status
54+
script:
55+
- time cargo check --target $CARGO_TARGET --locked --manifest-path util/io/Cargo.toml --no-default-features
56+
57+
cargo-check 2 3:
58+
stage: test
59+
<<: *docker-cache-status
60+
script:
61+
- time cargo check --target $CARGO_TARGET --locked --manifest-path util/io/Cargo.toml --features "mio"
62+
63+
cargo-audit:
4864
stage: test
4965
script:
50-
- set -e
51-
- set -u
5266
- cargo audit
5367
tags:
5468
- linux-docker
5569

70+
validate-chainspecs:
71+
stage: test
72+
<<: *docker-cache-status
73+
script:
74+
- ./scripts/gitlab/validate-chainspecs.sh
75+
76+
test-cpp:
77+
stage: build
78+
<<: *docker-cache-status
79+
script:
80+
- ./scripts/gitlab/test-cpp.sh
81+
82+
test-linux:
83+
stage: build
84+
<<: *docker-cache-status
85+
script:
86+
- ./scripts/gitlab/test-linux.sh
87+
5688
build-linux: &build-linux
5789
stage: build
5890
only: *releaseable_branches
91+
<<: *docker-cache-status
5992
script:
60-
- scripts/gitlab/build-unix.sh
61-
- sccache -s
93+
- scripts/gitlab/build-linux.sh
6294
<<: *collect_artifacts
63-
tags:
64-
- linux-docker
6595

6696
build-linux-i386:
6797
<<: *build-linux
@@ -89,7 +119,7 @@ build-darwin:
89119
CC: gcc
90120
CXX: g++
91121
script:
92-
- scripts/gitlab/build-unix.sh
122+
- scripts/gitlab/build-linux.sh
93123
tags:
94124
- rust-osx
95125
<<: *collect_artifacts
@@ -102,7 +132,7 @@ build-windows:
102132
script:
103133
- sh scripts/gitlab/build-windows.sh
104134
tags:
105-
- rust-windows
135+
- rust-windows
106136
<<: *collect_artifacts
107137

108138
publish-docker:
@@ -178,17 +208,16 @@ publish-awss3-release:
178208
script:
179209
- echo "__________Push binaries to AWS S3____________"
180210
- case "${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}" in
181-
(beta|stable|nightly)
182-
export BUCKET=releases.parity.io/ethereum;
183-
;;
184-
(*)
185-
export BUCKET=builds-parity;
186-
;;
187-
esac
211+
(beta|stable|nightly)
212+
export BUCKET=releases.parity.io/ethereum;
213+
;;
214+
(*)
215+
export BUCKET=builds-parity;
216+
;;
217+
esac
188218
- aws s3 sync ./artifacts s3://${BUCKET}/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/
189-
after_script:
190-
- aws s3 ls s3://${BUCKET}/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}/
191-
--recursive --human-readable --summarize
219+
- echo "__________Read from S3____________"
220+
- aws s3 ls s3://${BUCKET}/${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}} --recursive --human-readable --summarize
192221
tags:
193222
- linux-docker
194223

@@ -206,13 +235,12 @@ publish-docs:
206235
- linux-docker
207236

208237
build-android:
209-
stage: optional
238+
stage: build
210239
image: parity/rust-android:gitlab-ci
211240
variables:
212241
CARGO_TARGET: armv7-linux-androideabi
213242
script:
214-
- scripts/gitlab/build-unix.sh
243+
- scripts/gitlab/build-linux.sh
215244
tags:
216245
- linux-docker
217-
allow_failure: true
218246
<<: *collect_artifacts

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Parity Ethereum client"
33
name = "parity-ethereum"
44
# NOTE Make sure to update util/version/Cargo.toml as well
5-
version = "2.4.0"
5+
version = "2.4.1"
66
license = "GPL-3.0"
77
authors = ["Parity Technologies <admin@parity.io>"]
88

ethcore/light/src/client/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ pub trait LightChainClient: Send + Sync {
116116
/// Query whether a block is known.
117117
fn is_known(&self, hash: &H256) -> bool;
118118

119+
/// Set the chain via a spec name.
120+
fn set_spec_name(&self, new_spec_name: String) -> Result<(), ()>;
121+
119122
/// Clear the queue.
120123
fn clear_queue(&self);
121124

@@ -164,6 +167,8 @@ pub struct Client<T> {
164167
listeners: RwLock<Vec<Weak<LightChainNotify>>>,
165168
fetcher: T,
166169
verify_full: bool,
170+
/// A closure to call when we want to restart the client
171+
exit_handler: Mutex<Option<Box<Fn(String) + 'static + Send>>>,
167172
}
168173

169174
impl<T: ChainDataFetcher> Client<T> {
@@ -190,6 +195,7 @@ impl<T: ChainDataFetcher> Client<T> {
190195
listeners: RwLock::new(vec![]),
191196
fetcher,
192197
verify_full: config.verify_full,
198+
exit_handler: Mutex::new(None),
193199
})
194200
}
195201

@@ -360,6 +366,14 @@ impl<T: ChainDataFetcher> Client<T> {
360366
self.chain.heap_size_of_children()
361367
}
362368

369+
/// Set a closure to call when the client wants to be restarted.
370+
///
371+
/// The parameter passed to the callback is the name of the new chain spec to use after
372+
/// the restart.
373+
pub fn set_exit_handler<F>(&self, f: F) where F: Fn(String) + 'static + Send {
374+
*self.exit_handler.lock() = Some(Box::new(f));
375+
}
376+
363377
/// Get a handle to the verification engine.
364378
pub fn engine(&self) -> &Arc<EthEngine> {
365379
&self.engine
@@ -563,6 +577,17 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
563577
Client::engine(self)
564578
}
565579

580+
fn set_spec_name(&self, new_spec_name: String) -> Result<(), ()> {
581+
trace!(target: "mode", "Client::set_spec_name({:?})", new_spec_name);
582+
if let Some(ref h) = *self.exit_handler.lock() {
583+
(*h)(new_spec_name);
584+
Ok(())
585+
} else {
586+
warn!("Not hypervised; cannot change chain.");
587+
Err(())
588+
}
589+
}
590+
566591
fn is_known(&self, hash: &H256) -> bool {
567592
self.status(hash) == BlockStatus::InChain
568593
}

ethcore/src/client/client.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,15 +1706,17 @@ impl BlockChainClient for Client {
17061706
self.config.spec_name.clone()
17071707
}
17081708

1709-
fn set_spec_name(&self, new_spec_name: String) {
1709+
fn set_spec_name(&self, new_spec_name: String) -> Result<(), ()> {
17101710
trace!(target: "mode", "Client::set_spec_name({:?})", new_spec_name);
17111711
if !self.enabled.load(AtomicOrdering::Relaxed) {
1712-
return;
1712+
return Err(());
17131713
}
17141714
if let Some(ref h) = *self.exit_handler.lock() {
17151715
(*h)(new_spec_name);
1716+
Ok(())
17161717
} else {
17171718
warn!("Not hypervised; cannot change chain.");
1719+
Err(())
17181720
}
17191721
}
17201722

ethcore/src/client/test_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ impl BlockChainClient for TestBlockChainClient {
863863

864864
fn spec_name(&self) -> String { "foundation".into() }
865865

866-
fn set_spec_name(&self, _: String) { unimplemented!(); }
866+
fn set_spec_name(&self, _: String) -> Result<(), ()> { unimplemented!(); }
867867

868868
fn disable(&self) { self.disabled.store(true, AtomicOrder::Relaxed); }
869869

ethcore/src/client/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ pub trait BlockChainClient : Sync + Send + AccountData + BlockChain + CallContra
360360
fn spec_name(&self) -> String;
361361

362362
/// Set the chain via a spec name.
363-
fn set_spec_name(&self, spec_name: String);
363+
fn set_spec_name(&self, spec_name: String) -> Result<(), ()>;
364364

365365
/// Disable the client from importing blocks. This cannot be undone in this session and indicates
366366
/// that a subsystem has reason to believe this executable incapable of syncing the chain.

ethcore/src/engines/authority_round/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,10 @@ impl Engine<EthereumMachine> for AuthorityRound {
14051405

14061406
let first = chain_head.number() == 0;
14071407

1408-
// apply immediate transitions.
1408+
// Apply transitions that don't require finality and should be enacted immediately (e.g from chain spec)
14091409
if let Some(change) = self.validators.is_epoch_end(first, chain_head) {
1410+
info!(target: "engine", "Immediately applying validator set change signalled at block {}", chain_head.number());
1411+
self.epoch_manager.lock().note_new_epoch();
14101412
let change = combine_proofs(chain_head.number(), &change, &[]);
14111413
return Some(change)
14121414
}

parity/rpc_apis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
634634
handler.extend_with(ParityAccounts::to_delegate(ParityAccountsClient::new(&self.accounts)));
635635
}
636636
Api::ParitySet => handler.extend_with(
637-
light::ParitySetClient::new(self.sync.clone(), self.fetch.clone())
637+
light::ParitySetClient::new(self.client.clone(), self.sync.clone(), self.fetch.clone())
638638
.to_delegate(),
639639
),
640640
Api::Traces => handler.extend_with(light::TracesClient.to_delegate()),

parity/run.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ impl ::local_store::NodeInfo for FullNodeInfo {
165165
type LightClient = ::light::client::Client<::light_helpers::EpochFetch>;
166166

167167
// helper for light execution.
168-
fn execute_light_impl(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient, String> {
168+
fn execute_light_impl<Cr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq: Cr) -> Result<RunningClient, String>
169+
where Cr: Fn(String) + 'static + Send
170+
{
169171
use light::client as light_client;
170172
use sync::{LightSyncParams, LightSync, ManageNetwork};
171173
use parking_lot::{Mutex, RwLock};
@@ -367,6 +369,8 @@ fn execute_light_impl(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<Runnin
367369
service.add_notify(informant.clone());
368370
service.register_handler(informant.clone()).map_err(|_| "Unable to register informant handler".to_owned())?;
369371

372+
client.set_exit_handler(on_client_rq);
373+
370374
Ok(RunningClient {
371375
inner: RunningClientInner::Light {
372376
rpc: rpc_direct,
@@ -930,7 +934,7 @@ pub fn execute<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>,
930934
Rr: Fn() + 'static + Send
931935
{
932936
if cmd.light {
933-
execute_light_impl(cmd, logger)
937+
execute_light_impl(cmd, logger, on_client_rq)
934938
} else {
935939
execute_impl(cmd, logger, on_client_rq, on_updater_rq)
936940
}

0 commit comments

Comments
 (0)