Move CI from GitHub Actions to GitLab (#814)

* CI: do not trust this CI 1

* CI: don't want to trigger unneded statuses

* CI: debug 1

* CI: new CI

* CI: temp allow failure

* CI: exclude paths

* doc: check if docs won't trigger pipelines

* doc: check hybrid changes pipeline

* doc: do not push excluded files together with others

* CI: undebug fmt

* CI: better deny

* CI: fix deny and spellcheck

* CI: global backtrace

* CI: deny config

* CI: publishing

* Dockerfile: metadata fix [skip ci]

* CI: revert me

* CI: debug bash

* CI: mv ci.Dockerfile; fix buildah bug

* CI: fix artifact name

* Dockerfile: fix context

* CI: separate deny check licenses

* CI: when to run

* CI: unneded stuff in these Dockerfiles

* CI: merged test-refs and build-refs

* CI: test-build optimizations

* CI: changes, web, scheduled pipelines now work as intended

* CI: use tested production CI image

* CI: substitute GHA

* Fix clippy.

* Moar clippy fixes.

* Fix more.

* Finally fix all?

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
Denis Pisarev
2021-06-02 22:21:40 +02:00
committed by Bastian Köcher
parent 700d63672b
commit 0b7f40a371
9 changed files with 108 additions and 134 deletions
+5 -4
View File
@@ -24,14 +24,14 @@ Substrate chains or Ethereum Proof-of-Authority chains.
To get up and running you need both stable and nightly Rust. Rust nightly is used to build the Web
Assembly (WASM) runtime for the node. You can configure the WASM support as so:
```
```bash
rustup install nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
```
Once this is configured you can build and test the repo as follows:
```
```bash
git clone https://github.com/paritytech/parity-bridges-common.git
cd parity-bridges-common
cargo build --all
@@ -49,7 +49,7 @@ and external processes called relayers. A bridge chain is one that is able to fo
of a foreign chain independently. For example, consider the case below where we want to bridge two
Substrate based chains.
```
```bash
+---------------+ +---------------+
| | | |
| Rialto | | Millau |
@@ -77,7 +77,7 @@ Here's an overview of how the project is laid out. The main bits are the `node`,
"blockchain", the `modules` which are used to build the blockchain's logic (a.k.a the runtime) and
the `relays` which are used to pass messages between chains.
```
```bash
├── bin // Node and Runtime for the various Substrate chains
│ └── ...
├── deployments // Useful tools for deploying test networks
@@ -103,6 +103,7 @@ To run the Bridge you need to be able to connect the bridge relay node to the RP
on each side of the bridge (source and target chain).
There are 3 ways to run the bridge, described below:
- building & running from source,
- building or using Docker images for each individual component,
- running a Docker Compose setup (recommended).
+2
View File
@@ -23,6 +23,8 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
// Generated by `decl_event!`
#![allow(clippy::unused_unit)]
use bp_message_dispatch::{CallOrigin, MessageDispatch, MessagePayload, SpecVersion, Weight};
use bp_runtime::{derive_account_id, ChainId, SourceAccount};
+63 -83
View File
@@ -1381,15 +1381,12 @@ pub(crate) mod tests {
fn verify_transaction_finalized_works_for_best_finalized_header() {
run_test_with_genesis(example_header(), TOTAL_VALIDATORS, |_| {
let storage = BridgeStorage::<TestRuntime>::new();
assert_eq!(
verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(true))],
),
true,
);
assert!(verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(true))],
));
});
}
@@ -1400,15 +1397,12 @@ pub(crate) mod tests {
insert_header(&mut storage, example_header_parent());
insert_header(&mut storage, example_header());
storage.finalize_and_prune_headers(Some(example_header().compute_id()), 0);
assert_eq!(
verify_transaction_finalized(
&storage,
example_header_parent().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(true))],
),
true,
);
assert!(verify_transaction_finalized(
&storage,
example_header_parent().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(true))],
));
});
}
@@ -1416,10 +1410,12 @@ pub(crate) mod tests {
fn verify_transaction_finalized_rejects_proof_with_missing_tx() {
run_test_with_genesis(example_header(), TOTAL_VALIDATORS, |_| {
let storage = BridgeStorage::<TestRuntime>::new();
assert_eq!(
verify_transaction_finalized(&storage, example_header().compute_hash(), 1, &[],),
false,
);
assert!(!verify_transaction_finalized(
&storage,
example_header().compute_hash(),
1,
&[],
),);
});
}
@@ -1427,10 +1423,12 @@ pub(crate) mod tests {
fn verify_transaction_finalized_rejects_unknown_header() {
run_test(TOTAL_VALIDATORS, |_| {
let storage = BridgeStorage::<TestRuntime>::new();
assert_eq!(
verify_transaction_finalized(&storage, example_header().compute_hash(), 1, &[],),
false,
);
assert!(!verify_transaction_finalized(
&storage,
example_header().compute_hash(),
1,
&[],
));
});
}
@@ -1440,15 +1438,12 @@ pub(crate) mod tests {
let mut storage = BridgeStorage::<TestRuntime>::new();
insert_header(&mut storage, example_header_parent());
insert_header(&mut storage, example_header());
assert_eq!(
verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(true))],
),
false,
);
assert!(!verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(true))],
));
});
}
@@ -1464,15 +1459,12 @@ pub(crate) mod tests {
insert_header(&mut storage, example_header());
insert_header(&mut storage, finalized_header_sibling);
storage.finalize_and_prune_headers(Some(example_header().compute_id()), 0);
assert_eq!(
verify_transaction_finalized(
&storage,
finalized_header_sibling_hash,
0,
&[(example_tx(), example_tx_receipt(true))],
),
false,
);
assert!(!verify_transaction_finalized(
&storage,
finalized_header_sibling_hash,
0,
&[(example_tx(), example_tx_receipt(true))],
));
});
}
@@ -1488,15 +1480,12 @@ pub(crate) mod tests {
insert_header(&mut storage, finalized_header_uncle);
insert_header(&mut storage, example_header());
storage.finalize_and_prune_headers(Some(example_header().compute_id()), 0);
assert_eq!(
verify_transaction_finalized(
&storage,
finalized_header_uncle_hash,
0,
&[(example_tx(), example_tx_receipt(true))],
),
false,
);
assert!(!verify_transaction_finalized(
&storage,
finalized_header_uncle_hash,
0,
&[(example_tx(), example_tx_receipt(true))],
));
});
}
@@ -1504,18 +1493,15 @@ pub(crate) mod tests {
fn verify_transaction_finalized_rejects_invalid_transactions_in_proof() {
run_test_with_genesis(example_header(), TOTAL_VALIDATORS, |_| {
let storage = BridgeStorage::<TestRuntime>::new();
assert_eq!(
verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[
(example_tx(), example_tx_receipt(true)),
(example_tx(), example_tx_receipt(true))
],
),
false,
);
assert!(!verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[
(example_tx(), example_tx_receipt(true)),
(example_tx(), example_tx_receipt(true))
],
));
});
}
@@ -1523,15 +1509,12 @@ pub(crate) mod tests {
fn verify_transaction_finalized_rejects_invalid_receipts_in_proof() {
run_test_with_genesis(example_header(), TOTAL_VALIDATORS, |_| {
let storage = BridgeStorage::<TestRuntime>::new();
assert_eq!(
verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[(example_tx(), vec![42])],
),
false,
);
assert!(!verify_transaction_finalized(
&storage,
example_header().compute_hash(),
0,
&[(example_tx(), vec![42])],
));
});
}
@@ -1539,15 +1522,12 @@ pub(crate) mod tests {
fn verify_transaction_finalized_rejects_failed_transaction() {
run_test_with_genesis(example_header_with_failed_receipt(), TOTAL_VALIDATORS, |_| {
let storage = BridgeStorage::<TestRuntime>::new();
assert_eq!(
verify_transaction_finalized(
&storage,
example_header_with_failed_receipt().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(false))],
),
false,
);
assert!(!verify_transaction_finalized(
&storage,
example_header_with_failed_receipt().compute_hash(),
0,
&[(example_tx(), example_tx_receipt(false))],
));
});
}
}
+1 -1
View File
@@ -693,7 +693,7 @@ mod tests {
CurrentAuthoritySet::<TestRuntime>::get().authorities,
init_data.authority_list
);
assert_eq!(IsHalted::<TestRuntime>::get(), false);
assert!(!IsHalted::<TestRuntime>::get());
})
}
+25 -36
View File
@@ -291,23 +291,17 @@ mod tests {
));
}
// Fails to dispatch new message from different than latest relayer.
assert_eq!(
false,
lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_A + max_nonce + 1,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
)
);
assert!(!lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_A + max_nonce + 1,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
));
// Fails to dispatch new messages from latest relayer. Prevents griefing attacks.
assert_eq!(
false,
lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_A + max_nonce,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
)
);
assert!(!lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_A + max_nonce,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
));
});
}
@@ -324,23 +318,17 @@ mod tests {
));
}
// Fails to dispatch new message from different than latest relayer.
assert_eq!(
false,
lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_B,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
)
);
assert!(!lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_B,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
));
// Fails to dispatch new messages from latest relayer.
assert_eq!(
false,
lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_A,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
)
);
assert!(!lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_A,
max_nonce + 1,
message_data(REGULAR_PAYLOAD).into()
));
});
}
@@ -379,10 +367,11 @@ mod tests {
1,
message_data(REGULAR_PAYLOAD).into()
));
assert_eq!(
false,
lane.receive_message::<TestMessageDispatch>(TEST_RELAYER_B, 1, message_data(REGULAR_PAYLOAD).into())
);
assert!(!lane.receive_message::<TestMessageDispatch>(
TEST_RELAYER_B,
1,
message_data(REGULAR_PAYLOAD).into()
));
});
}
+2
View File
@@ -34,6 +34,8 @@
//! or some benchmarks assumptions are broken for your runtime.
#![cfg_attr(not(feature = "std"), no_std)]
// Generated by `decl_event!`
#![allow(clippy::unused_unit)]
pub use crate::weights_ext::{
ensure_able_to_receive_confirmation, ensure_able_to_receive_message, ensure_weights_are_correct, WeightInfoExt,
@@ -342,7 +342,7 @@ fn read_finality_proofs_from_stream_works() {
let mut stream = futures::stream::pending().into();
read_finality_proofs_from_stream::<TestFinalitySyncPipeline, _>(&mut stream, &mut recent_finality_proofs);
assert_eq!(recent_finality_proofs, vec![(1, TestFinalityProof(1))]);
assert_eq!(stream.needs_restart, false);
assert!(!stream.needs_restart);
// when stream has entry with target, it is added to the recent proofs container
let mut stream = futures::stream::iter(vec![TestFinalityProof(4)])
@@ -353,7 +353,7 @@ fn read_finality_proofs_from_stream_works() {
recent_finality_proofs,
vec![(1, TestFinalityProof(1)), (4, TestFinalityProof(4))]
);
assert_eq!(stream.needs_restart, false);
assert!(!stream.needs_restart);
// when stream has ended, we'll need to restart it
let mut stream = futures::stream::empty().into();
@@ -362,7 +362,7 @@ fn read_finality_proofs_from_stream_works() {
recent_finality_proofs,
vec![(1, TestFinalityProof(1)), (4, TestFinalityProof(4))]
);
assert_eq!(stream.needs_restart, true);
assert!(stream.needs_restart);
}
#[test]
+5 -5
View File
@@ -1505,7 +1505,7 @@ pub(crate) mod tests {
let mut queue = QueuedHeaders::<TestHeadersSyncPipeline>::default();
// when we do not know header itself
assert_eq!(queue.is_parent_incomplete(&id(50)), false);
assert!(!queue.is_parent_incomplete(&id(50)));
// when we do not know parent
queue
@@ -1514,7 +1514,7 @@ pub(crate) mod tests {
.or_default()
.insert(hash(100), HeaderStatus::Incomplete);
queue.incomplete.entry(100).or_default().insert(hash(100), header(100));
assert_eq!(queue.is_parent_incomplete(&id(100)), false);
assert!(!queue.is_parent_incomplete(&id(100)));
// when parent is inside incomplete queue (i.e. some other ancestor is actually incomplete)
queue
@@ -1523,7 +1523,7 @@ pub(crate) mod tests {
.or_default()
.insert(hash(101), HeaderStatus::Submitted);
queue.submitted.entry(101).or_default().insert(hash(101), header(101));
assert_eq!(queue.is_parent_incomplete(&id(101)), true);
assert!(queue.is_parent_incomplete(&id(101)));
// when parent is the incomplete header and we do not have completion data
queue.incomplete_headers.insert(id(199), None);
@@ -1533,7 +1533,7 @@ pub(crate) mod tests {
.or_default()
.insert(hash(200), HeaderStatus::Submitted);
queue.submitted.entry(200).or_default().insert(hash(200), header(200));
assert_eq!(queue.is_parent_incomplete(&id(200)), true);
assert!(queue.is_parent_incomplete(&id(200)));
// when parent is the incomplete header and we have completion data
queue.completion_data.insert(id(299), 299_299);
@@ -1543,7 +1543,7 @@ pub(crate) mod tests {
.or_default()
.insert(hash(300), HeaderStatus::Submitted);
queue.submitted.entry(300).or_default().insert(hash(300), header(300));
assert_eq!(queue.is_parent_incomplete(&id(300)), true);
assert!(queue.is_parent_incomplete(&id(300)));
}
#[test]
@@ -318,9 +318,9 @@ mod tests {
#[test]
fn strategy_is_empty_works() {
let mut strategy = BasicStrategy::<TestMessageLane>::new();
assert_eq!(strategy.is_empty(), true);
assert!(strategy.is_empty());
strategy.source_nonces_updated(header_id(1), source_nonces(1..=1));
assert_eq!(strategy.is_empty(), false);
assert!(!strategy.is_empty());
}
#[test]