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

Commit

Permalink
Merge branch 'bernhard-malus-fx' of github.com:paritytech/polkadot in…
Browse files Browse the repository at this point in the history
…to bernhard-malus-fx
  • Loading branch information
radupopa2010 committed Aug 26, 2021
2 parents 2926a80 + 26a808f commit 77574c8
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 72 deletions.
13 changes: 6 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ test-build-linux-stable:
# we're using the bin built here, instead of having a parallel `build-linux-release`
# disputes feature is needed for simnet parachains malus test
- time cargo build --release --verbose --bin polkadot --features disputes
- time c
- sccache -s
# pack artifacts
- mkdir -p ./artifacts
Expand Down Expand Up @@ -215,7 +214,7 @@ build-malus:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME == "rococo-v1"
script:
- time cargo build --release --verbose -p polkadot-test-malus
- time cargo build --release --verbose -p polkadot-test-malus --features disputes
- sccache -s
# pack artifacts
- mkdir -p ./artifacts
Expand Down Expand Up @@ -523,7 +522,7 @@ deploy-polkasync-kusama:
allow_failure: true
trigger: "parity/infrastructure/parity-testnet"

simnet-tests-parachians-smoketest:
simnet-tests-parachains-smoketest:
stage: deploy
<<: *kubernetes-env
rules:
Expand Down Expand Up @@ -559,8 +558,8 @@ simnet-tests-parachians-smoketest:
--github-remote-dir="${GH_DIR}"
--config="${NETWORK_CONFIG}"
--image="${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}"
-e "SYNTHIMAGE=${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}"
-e "COLIMAGE=${COLLATOR_IMAGE_NAME}:${COLLATOR_IMAGE_TAG}"
-e "SYNTHIMAGE=${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}"
-e "COLIMAGE=${COLLATOR_IMAGE_NAME}:${COLLATOR_IMAGE_TAG}"
-e "SCRIPTSIMAGE=${SIMNET_IMAGE_NAME}:${SIMNET_IMAGE_TAG}"
allow_failure: true
retry: 2
Expand Down Expand Up @@ -601,8 +600,8 @@ simnet-tests-malus-dispute-valid:
--github-remote-dir="${GH_DIR}"
--config="${NETWORK_CONFIG}"
--image="${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}"
-e "SYNTHIMAGE=${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}"
-e "MALUSIMAGE=${MALUS_IMAGE_NAME}:${MALUS_IMAGE_TAG}"
-e "SYNTHIMAGE=${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}"
-e "MALUSIMAGE=${MALUS_IMAGE_NAME}:${MALUS_IMAGE_TAG}"
allow_failure: true
retry: 2
tags:
Expand Down
7 changes: 5 additions & 2 deletions node/malus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ polkadot-cli = { path = "../../cli", default-features = false, features = [ "cli
polkadot-node-subsystem = { path = "../subsystem" }
polkadot-node-subsystem-util = { path = "../subsystem-util" }
polkadot-node-subsystem-types = { path = "../subsystem-types" }
polkadot-node-core-dispute-coordinator = { path = "../core/dispute-coordinator"}
polkadot-node-core-candidate-validation = { path = "../core/candidate-validation"}
polkadot-node-core-dispute-coordinator = { path = "../core/dispute-coordinator" }
polkadot-node-core-candidate-validation = { path = "../core/candidate-validation" }
polkadot-node-core-backing = { path = "../core/backing" }
polkadot-node-primitives = { path = "../primitives" }
polkadot-primitives = { path = "../../primitives" }
Expand All @@ -44,3 +44,6 @@ async-trait = "0.1.50"
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
tracing = "0.1.26"
futures = "0.3.16"

[features]
disputes = ["polkadot-node-core-dispute-coordinator/disputes"]
44 changes: 22 additions & 22 deletions node/malus/container/malus.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ ARG BUILD_DATE
ARG IMAGE_NAME

LABEL io.parity.image.authors="[email protected]" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="polkadot: a platform for web3" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/malus.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${IMAGE_NAME}" \
io.parity.image.description="polkadot: a platform for web3" \
io.parity.image.source="https://github.com/paritytech/polkadot/blob/${VCS_REF}/scripts/docker/malus.Dockerfile" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}" \
io.parity.image.documentation="https://github.com/paritytech/polkadot/"

# show backtraces
ENV RUST_BACKTRACE 1

# install tools and dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
curl \
libssl1.1 \
tini && \
# apt cleanup
apt-get autoremove -y && \
apt-get clean && \
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
# add user
groupadd --gid 10000 nonroot && \
useradd --home-dir /home/nonroot \
--create-home \
--shell /bin/bash \
--gid nonroot \
--groups nonroot \
--uid 10000 nonroot


# add adder-collator binary to docker image
apt-get autoremove -y && \
apt-get clean && \
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
# add user
groupadd --gid 10000 nonroot && \
useradd --home-dir /home/nonroot \
--create-home \
--shell /bin/bash \
--gid nonroot \
--groups nonroot \
--uid 10000 nonroot


# add malus binaries to the docker image
COPY ./malus-dispute-ancestor /usr/local/bin
COPY ./malus-suggest-garbage-candidate /usr/local/bin

Expand Down
26 changes: 13 additions & 13 deletions node/malus/integrationtests/0001-dispute-valid-block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ Feature: Disputes
Then alice is up
And alice reports node_roles is 4
And alice reports sub_libp2p_is_major_syncing is 0
Then sleep 60 seconds
Then alice reports block height is greater than 10
Then sleep 15 seconds
Then alice reports block height is greater than 2
And alice reports peers count is at least 2
Then bob is up
And bob reports block height is greater than 10
And bob reports block height is greater than 2
And bob reports peers count is at least 2
Then charlie is up
And charlie reports block height is greater than 10
And charlie reports block height is greater than 2
And charlie reports peers count is at least 2
Then david is up
And alice reports parachain_candidate_open_disputes is 1
And bob reports parachain_candidate_open_disputes is 1
And charlie reports parachain_candidate_open_disputes is 1
Then alice parachain_candidate_dispute_votes is at least 1
And bob parachain_candidate_dispute_votes is is at least 2
And charlie parachain_candidate_dispute_votes is at least 3
Then alice parachain_candidate_dispute_concluded is "valid"
And bob parachain_candidate_dispute_concluded is "valid"
And charlie parachain_candidate_dispute_concluded is "valid"
And alice reports polkadot_parachain_candidate_open_disputes is 1
And bob reports polkadot_parachain_candidate_open_disputes is 1
And charlie reports polkadot_parachain_candidate_open_disputes is 1
Then alice polkadot_parachain_candidate_dispute_votes is at least 1
And bob polkadot_parachain_candidate_dispute_votes is is at least 2
And charlie polkadot_parachain_candidate_dispute_votes is at least 3
Then alice polkadot_parachain_candidate_dispute_concluded is "valid"
And bob polkadot_parachain_candidate_dispute_concluded is "valid"
And charlie polkadot_parachain_candidate_dispute_concluded is "valid"
26 changes: 13 additions & 13 deletions node/malus/integrationtests/0002-dispute-invalid-block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ Feature: Disputes
Then alice is up
And alice reports node_roles is 4
And alice reports sub_libp2p_is_major_syncing is 0
Then sleep 60 seconds
Then alice reports block height is greater than 10
Then sleep 15 seconds
Then alice reports block height is greater than 2
And alice reports peers count is at least 2
Then bob is up
And bob reports block height is greater than 10
And bob reports block height is greater than 2
And bob reports peers count is at least 2
Then charlie is up
And charlie reports block height is greater than 10
And charlie reports block height is greater than 2
And charlie reports peers count is at least 2
Then david is up
Then eve is up
And alice reports parachain_candidate_open_disputes is 1
And bob reports parachain_candidate_open_disputes is 1
And charlie reports parachain_candidate_open_disputes is 1
Then alice parachain_candidate_dispute_votes is at least 1
And bob parachain_candidate_dispute_votes is is at least 2
And charlie parachain_candidate_dispute_votes is at least 3
Then alice parachain_candidate_dispute_concluded is "valid"
And bob parachain_candidate_dispute_concluded is "valid"
And charlie parachain_candidate_dispute_concluded is "valid"
And alice reports polkadot_parachain_candidate_open_disputes is 1
And bob reports polkadot_parachain_candidate_open_disputes is 1
And charlie reports polkadot_parachain_candidate_open_disputes is 1
Then alice polkadot_parachain_candidate_dispute_votes is at least 1
And bob polkadot_parachain_candidate_dispute_votes is is at least 2
And charlie polkadot_parachain_candidate_dispute_votes is at least 3
Then alice polkadot_parachain_candidate_dispute_concluded is "valid"
And bob polkadot_parachain_candidate_dispute_concluded is "valid"
And charlie polkadot_parachain_candidate_dispute_concluded is "valid"
20 changes: 10 additions & 10 deletions node/malus/integrationtests/0002-dispute-invalid-block.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[settings.defaults]
image = "parity/polkadot"
image = "{{get_env(name="SYNTHIMAGE") | safe }}"
command = "polkadot"
chain-name = "polkadot-local"
timeout = 1000

[nodes.alice]
validator = true
extra-args = ["--alice"]
image = "parity/polkadot"
image = "{{get_env(name="SYNTHIMAGE") | safe }}"
command = "polkadot"

[nodes.bob]
validator = true
extra-args = ["--bob"]
image = "parity/polkadot"
command = "/usr/local/bin/malus-back-garbage-block"
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-back-garbage-candidate"

[nodes.charlie]
validator = true
extra-args = ["--charlie"]
image = "parity/polkadot"
command = "/usr/local/bin/malus-back-garbage-block"
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-back-garbage-candidate"

[nodes.david]
validator = true
extra-args = ["--dave"]
image = "paritypr/malus"
command = "/usr/local/bin/malus-back-garbage-block"
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-back-garbage-candidate"

[nodes.eve]
validator = true
extra-args = ["--eve"]
image = "paritypr/malus"
command = "/usr/local/bin/malus-suggest-garbage-block"
image = "{{get_env(name="MALUSIMAGE") | safe }}"
command = "/usr/local/bin/malus-suggest-garbage-candidate"
4 changes: 0 additions & 4 deletions node/malus/src/malus-back-garbage-candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ where
msg: FromOverseer<Self::Message>,
) -> Option<FromOverseer<Self::Message>> {
match msg {
// FromOverseer::Communication {
// msg:
// DisputeCoordinatorMessage::
// }
FromOverseer::Communication {
msg:
CandidateValidationMessage::ValidateFromExhaustive(
Expand Down
1 change: 0 additions & 1 deletion node/malus/src/malus-suggest-garbage-candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ where
.unbounded_send((sender.clone(), hash, candidate_receipt.clone()))
.unwrap();

// TODO not sure if this is necessary or not
Some(FromOverseer::Communication {
msg: CandidateBackingMessage::Second(
hash,
Expand Down

0 comments on commit 77574c8

Please sign in to comment.