Skip to content

Commit

Permalink
Merge branch 'master' into oty-try-runtime-mbm
Browse files Browse the repository at this point in the history
  • Loading branch information
ggwpez authored Oct 7, 2024
2 parents dcca116 + e354d66 commit 35abe8a
Show file tree
Hide file tree
Showing 159 changed files with 3,484 additions and 2,289 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ jobs:
fi
if [[ $BODY == "/cmd bench"* ]]; then
echo "RUNNER=arc-runners-polkadot-sdk-benchmark" >> $GITHUB_OUTPUT
echo "RUNNER=parity-weights" >> $GITHUB_OUTPUT
elif [[ $BODY == "/cmd update-ui"* ]]; then
echo "RUNNER=arc-runners-polkadot-sdk-beefy" >> $GITHUB_OUTPUT
echo "RUNNER=parity-large" >> $GITHUB_OUTPUT
else
echo "RUNNER=ubuntu-latest" >> $GITHUB_OUTPUT
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
env:
SKIP_WASM_BUILD: 1
test-doc:
runs-on: arc-runners-polkadot-sdk-beefy
runs-on: ${{ needs.preflight.outputs.RUNNER }}
needs: [preflight]
container:
image: ${{ needs.preflight.outputs.IMAGE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-50_publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ jobs:
- name: Build and push
id: docker_build
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0
with:
push: true
file: docker/dockerfiles/polkadot/polkadot_injected_debian.Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/pipeline/zombienet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.zombienet-refs:
extends: .build-refs
variables:
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.112"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.113"
PUSHGATEWAY_URL: "http://zombienet-prometheus-pushgateway.managed-monitoring:9091/metrics/job/zombie-metrics"
DEBUG: "zombie,zombie::network-node,zombie::kube::client::logs"
ZOMBIE_PROVIDER: "k8s"
Expand Down
69 changes: 5 additions & 64 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ members = [
"polkadot/node/core/runtime-api",
"polkadot/node/gum",
"polkadot/node/gum/proc-macro",
"polkadot/node/jaeger",
"polkadot/node/malus",
"polkadot/node/metrics",
"polkadot/node/network/approval-distribution",
Expand Down Expand Up @@ -843,7 +842,6 @@ merkleized-metadata = { version = "0.1.0" }
merlin = { version = "3.0", default-features = false }
messages-relay = { path = "bridges/relays/messages" }
metered = { version = "0.6.1", default-features = false, package = "prioritized-metered-channel" }
mick-jaeger = { version = "0.1.8" }
milagro-bls = { version = "1.5.4", default-features = false, package = "snowbridge-milagro-bls" }
minimal-template-node = { path = "templates/minimal/node" }
minimal-template-runtime = { path = "templates/minimal/runtime" }
Expand Down Expand Up @@ -1047,7 +1045,6 @@ polkadot-node-core-pvf-common = { path = "polkadot/node/core/pvf/common", defaul
polkadot-node-core-pvf-execute-worker = { path = "polkadot/node/core/pvf/execute-worker", default-features = false }
polkadot-node-core-pvf-prepare-worker = { path = "polkadot/node/core/pvf/prepare-worker", default-features = false }
polkadot-node-core-runtime-api = { path = "polkadot/node/core/runtime-api", default-features = false }
polkadot-node-jaeger = { path = "polkadot/node/jaeger", default-features = false }
polkadot-node-metrics = { path = "polkadot/node/metrics", default-features = false }
polkadot-node-network-protocol = { path = "polkadot/node/network/protocol", default-features = false }
polkadot-node-primitives = { path = "polkadot/node/primitives", default-features = false }
Expand Down
52 changes: 49 additions & 3 deletions bridges/relays/lib-substrate-relay/src/messages/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ use bp_messages::{
storage_keys::{operating_mode_key, outbound_lane_data_key},
target_chain::FromBridgedChainMessagesProof,
ChainWithMessages as _, InboundMessageDetails, MessageNonce, MessagePayload,
MessagesOperatingMode, OutboundLaneData, OutboundMessageDetails,
MessagesOperatingMode, OutboundMessageDetails,
};
use bp_runtime::{BasicOperatingMode, HeaderIdProvider, RangeInclusiveExt};
use codec::Encode;
use codec::{Decode, Encode};
use frame_support::weights::Weight;
use messages_relay::{
message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf},
Expand All @@ -63,6 +63,18 @@ use std::ops::RangeInclusive;
pub type SubstrateMessagesProof<C, L> = (Weight, FromBridgedChainMessagesProof<HashOf<C>, L>);
type MessagesToRefine<'a> = Vec<(MessagePayload, &'a mut OutboundMessageDetails)>;

/// Outbound lane data - for backwards compatibility with `bp_messages::OutboundLaneData` which has
/// additional `lane_state` attribute.
///
/// TODO: remove - https://github.com/paritytech/polkadot-sdk/issues/5923
#[derive(Decode)]
struct LegacyOutboundLaneData {
#[allow(unused)]
oldest_unpruned_nonce: MessageNonce,
latest_received_nonce: MessageNonce,
latest_generated_nonce: MessageNonce,
}

/// Substrate client as Substrate messages source.
pub struct SubstrateMessagesSource<P: SubstrateMessageLane, SourceClnt, TargetClnt> {
source_client: SourceClnt,
Expand Down Expand Up @@ -98,7 +110,7 @@ impl<P: SubstrateMessageLane, SourceClnt: Client<P::SourceChain>, TargetClnt>
async fn outbound_lane_data(
&self,
id: SourceHeaderIdOf<MessageLaneAdapter<P>>,
) -> Result<Option<OutboundLaneData>, SubstrateError> {
) -> Result<Option<LegacyOutboundLaneData>, SubstrateError> {
self.source_client
.storage_value(
id.hash(),
Expand Down Expand Up @@ -743,4 +755,38 @@ mod tests {
Ok(vec![2, 4, 3]),
);
}

#[test]
fn outbound_lane_data_wrapper_is_compatible() {
let bytes_without_state =
vec![1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0];
let bytes_with_state = {
// add state byte `bp_messages::LaneState::Opened`
let mut b = bytes_without_state.clone();
b.push(0);
b
};

let full = bp_messages::OutboundLaneData {
oldest_unpruned_nonce: 1,
latest_received_nonce: 2,
latest_generated_nonce: 3,
state: bp_messages::LaneState::Opened,
};
assert_eq!(full.encode(), bytes_with_state);
assert_ne!(full.encode(), bytes_without_state);

// decode from `bytes_with_state`
let decoded: LegacyOutboundLaneData = Decode::decode(&mut &bytes_with_state[..]).unwrap();
assert_eq!(full.oldest_unpruned_nonce, decoded.oldest_unpruned_nonce);
assert_eq!(full.latest_received_nonce, decoded.latest_received_nonce);
assert_eq!(full.latest_generated_nonce, decoded.latest_generated_nonce);

// decode from `bytes_without_state`
let decoded: LegacyOutboundLaneData =
Decode::decode(&mut &bytes_without_state[..]).unwrap();
assert_eq!(full.oldest_unpruned_nonce, decoded.oldest_unpruned_nonce);
assert_eq!(full.latest_received_nonce, decoded.latest_received_nonce);
assert_eq!(full.latest_generated_nonce, decoded.latest_generated_nonce);
}
}
Loading

0 comments on commit 35abe8a

Please sign in to comment.