Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthDesai committed Nov 27, 2024
1 parent de6076d commit ec38f23
Show file tree
Hide file tree
Showing 13 changed files with 948 additions and 512 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ xcm-runtime-apis = { git = "https://github.com/moondance-labs/polkadot-sdk", bra


# Bridges (wasm)
alloy-primitives = { version = "0.4.2", default-features = false }
alloy-sol-types = { version = "0.4.2", default-features = false }
milagro-bls = { package = "snowbridge-milagro-bls", version = "1.5.4", default-features = false }
snowbridge-beacon-primitives = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2409", default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions primitives/bridge/src/symbiotic_message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ pub enum Message<T>
where
T: pallet_external_validators::Config,
{
V1(Command<T>),
V1(InboundCommand<T>),
}

#[derive(Encode, Decode)]
pub enum Command<T>
pub enum InboundCommand<T>
where
T: pallet_external_validators::Config,
{
Expand Down Expand Up @@ -76,11 +76,11 @@ where
let message = if let Ok(payload) = decode_result {
payload.message
} else {
return Err(DispatchError::Other("unable to parse the payload"));
return Err(DispatchError::Other("unable to parse the envelope payload"));
};

match message {
Message::V1(Command::ReceiveValidators { validators }) => {
Message::V1(InboundCommand::ReceiveValidators { validators }) => {
pallet_external_validators::Pallet::<T>::set_external_validators(validators)?;
Ok(())
}
Expand Down
4 changes: 3 additions & 1 deletion solo-chains/runtime/dancelight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ std = [
"snowbridge-core/std",
"snowbridge-pallet-ethereum-client/fuzzing",
"snowbridge-pallet-ethereum-client/std",
"snowbridge-pallet-inbound-queue-fixtures/std",
"snowbridge-pallet-inbound-queue/std",
"snowbridge-pallet-outbound-queue/std",
"snowbridge-pallet-system/std",
Expand Down Expand Up @@ -366,8 +367,9 @@ runtime-benchmarks = [
"runtime-parachains/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"snowbridge-pallet-inbound-queue/runtime-benchmarks",
"snowbridge-pallet-inbound-queue-fixtures",
"snowbridge-pallet-inbound-queue-fixtures/runtime-benchmarks",
"snowbridge-pallet-inbound-queue/runtime-benchmarks",
"snowbridge-pallet-outbound-queue/runtime-benchmarks",
"snowbridge-pallet-system/runtime-benchmarks",
"snowbridge-router-primitives/runtime-benchmarks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>

use tp_bridge::symbiotic_message_processor::{Message as SymbioticMessage, Command, Payload, MAGIC_BYTES};
use crate::tests::common::ExtBuilder;
use crate::{AccountId, EthereumInboundQueue, ExternalValidators, Runtime};
use alloy_sol_types::SolEvent;
Expand All @@ -30,6 +29,9 @@ use snowbridge_core::{
use snowbridge_router_primitives::inbound::envelope::OutboundMessageAccepted;
use sp_core::H256;
use sp_runtime::DispatchError;
use tp_bridge::symbiotic_message_processor::{
InboundCommand, Message as SymbioticMessage, Payload, MAGIC_BYTES,
};

const MOCK_CHANNEL_ID: [u8; 32] = [0; 32];

Expand Down Expand Up @@ -94,7 +96,7 @@ fn test_inbound_queue_message_passing() {

let payload = Payload {
magic_bytes: MAGIC_BYTES,
message: SymbioticMessage::V1(Command::<Runtime>::ReceiveValidators {
message: SymbioticMessage::V1(InboundCommand::<Runtime>::ReceiveValidators {
validators: payload_validators.clone()
}),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>

use tp_bridge::symbiotic_message_processor::{
Command, Message, Payload, SymbioticMessageProcessor, MAGIC_BYTES,
};
use crate::tests::common::ExtBuilder;
use crate::{ExternalValidators, Runtime};
use frame_support::pallet_prelude::*;
Expand All @@ -26,6 +23,9 @@ use snowbridge_router_primitives::inbound::envelope::Envelope;
use snowbridge_router_primitives::inbound::MessageProcessor;
use sp_core::{H160, H256};
use sp_runtime::DispatchError;
use tp_bridge::symbiotic_message_processor::{
InboundCommand, Message, Payload, SymbioticMessageProcessor, MAGIC_BYTES,
};

#[test]
fn test_symbiotic_message_processor() {
Expand Down Expand Up @@ -55,12 +55,14 @@ fn test_symbiotic_message_processor() {
default_channel.clone(),
envelope_with_invalid_payload
),
Err(DispatchError::Other("unable to parse the payload"))
Err(DispatchError::Other("unable to parse the envelope payload"))
);

let payload_with_incorrect_magic_bytes = Payload {
magic_bytes: [1, 2, 3, 4],
message: Message::V1(Command::<Runtime>::ReceiveValidators { validators: vec![] }),
message: Message::V1(InboundCommand::<Runtime>::ReceiveValidators {
validators: vec![],
}),
};
let envelope = Envelope {
channel_id: H256::default().into(),
Expand Down Expand Up @@ -88,7 +90,7 @@ fn test_symbiotic_message_processor() {

let payload_with_correct_magic_bytes = Payload {
magic_bytes: MAGIC_BYTES,
message: Message::V1(Command::<Runtime>::ReceiveValidators {
message: Message::V1(InboundCommand::<Runtime>::ReceiveValidators {
validators: payload_validators.clone(),
}),
};
Expand Down

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

26 changes: 26 additions & 0 deletions typescript-api/src/dancelight/interfaces/augment-api-errors.ts

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

16 changes: 16 additions & 0 deletions typescript-api/src/dancelight/interfaces/augment-api-events.ts

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

18 changes: 18 additions & 0 deletions typescript-api/src/dancelight/interfaces/augment-api-query.ts

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

19 changes: 19 additions & 0 deletions typescript-api/src/dancelight/interfaces/augment-api-tx.ts

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

Loading

0 comments on commit ec38f23

Please sign in to comment.