Skip to content

Commit

Permalink
polkadot 1.2 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
joepetrowski authored Apr 21, 2024
1 parent 17be617 commit 35a5d6b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
21 changes: 9 additions & 12 deletions src/build_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,27 +539,24 @@ async fn send_as_superuser_from_polkadot(auth: &CallInfo) -> PolkadotRuntimeCall
use polkadot_relay::runtime_types::{
pallet_xcm::pallet::Call as XcmCall,
sp_weights::weight_v2::Weight as PolkadotWeight,
staging_xcm::v3::multilocation::MultiLocation,
staging_xcm::v4::{
junction::Junction::Parachain, junctions::Junctions::X1, location::Location,
Instruction, Xcm,
},
xcm::{
double_encoded::DoubleEncoded,
v2::OriginKind,
v3::{
junction::Junction::Parachain, junctions::Junctions::X1, Instruction, WeightLimit,
Xcm,
},
VersionedMultiLocation,
VersionedXcm::V3,
double_encoded::DoubleEncoded, v2::OriginKind, v3::WeightLimit, VersionedLocation,
VersionedXcm::V4,
},
};

let (ref_time, proof_size) = get_weight(auth).await;
let para_id = auth.network.get_para_id().unwrap();
PolkadotRuntimeCall::XcmPallet(XcmCall::send {
dest: Box::new(VersionedMultiLocation::V3(MultiLocation {
dest: Box::new(VersionedLocation::V4(Location {
parents: 0,
interior: X1(Parachain(para_id)),
interior: X1([Parachain(para_id)]),
})),
message: Box::new(V3(Xcm(vec![
message: Box::new(V4(Xcm(vec![
Instruction::UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
Expand Down
16 changes: 5 additions & 11 deletions src/submit_referendum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,10 @@ async fn polkadot_fellowship_referenda(
pallet_preimage::pallet::Call as CollectivesPreimageCall,
pallet_referenda::pallet::Call as FellowshipReferendaCall,
pallet_xcm::pallet::Call as CollectivesXcmCall,
staging_xcm::v3::multilocation::MultiLocation,
staging_xcm::v4::{junctions::Junctions::Here, location::Location, Instruction, Xcm},
xcm::{
double_encoded::DoubleEncoded,
v2::OriginKind,
v3::{junctions::Junctions::Here, Instruction, WeightLimit, Xcm},
VersionedMultiLocation,
VersionedXcm::V3,
double_encoded::DoubleEncoded, v2::OriginKind, v3::WeightLimit, VersionedLocation,
VersionedXcm::V4,
},
};
use polkadot_relay::runtime_types::{
Expand Down Expand Up @@ -410,11 +407,8 @@ async fn polkadot_fellowship_referenda(
// This is what the Fellowship will actually vote on enacting.
let whitelist_over_xcm = CallInfo::from_runtime_call(NetworkRuntimeCall::PolkadotCollectives(
CollectivesRuntimeCall::PolkadotXcm(CollectivesXcmCall::send {
dest: Box::new(VersionedMultiLocation::V3(MultiLocation {
parents: 1,
interior: Here,
})),
message: Box::new(V3(Xcm(vec![
dest: Box::new(VersionedLocation::V4(Location { parents: 1, interior: Here })),
message: Box::new(V4(Xcm(vec![
Instruction::UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
Expand Down
4 changes: 2 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ async fn it_starts_polkadot_fellowship_referenda_correctly() {
let proposal_details = polkadot_whitelist_remark_user_input();
let calls = generate_calls(&proposal_details).await;

let fellowship_preimage = hex::decode("0x2b00dc1f0003010003082f0000060302286bee02093d008817008821e8db19b8e34b62ee8bc618a5ed3eecb9761d7d81349b00aa5ce5dfca2534".trim_start_matches("0x")).expect("Valid call");
let fellowship_referendum = hex::decode("0x3d003e0202adb9e4e4165f92f984690cac8816898978b7dfc8aff6db735ffd5ec9b043009737000000010a000000".trim_start_matches("0x")).expect("Valid call");
let fellowship_preimage = hex::decode("0x2b00dc1f0004010004082f0000060302286bee02093d008817008821e8db19b8e34b62ee8bc618a5ed3eecb9761d7d81349b00aa5ce5dfca2534".trim_start_matches("0x")).expect("Valid call");
let fellowship_referendum = hex::decode("0x3d003e020270ace20636863d9122dea540102dda7df4a52d3a0fe5eaf673e4eca7598aeeca37000000010a000000".trim_start_matches("0x")).expect("Valid call");
let public_preimage = hex::decode(
"0x0a0060170300004c6f70656e676f762d7375626d69742074657374".trim_start_matches("0x"),
)
Expand Down
4 changes: 2 additions & 2 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) use kusama_asset_hub::runtime_types::asset_hub_kusama_runtime::Runtim
pub mod kusama_bridge_hub {}
pub(super) use kusama_bridge_hub::runtime_types::bridge_hub_kusama_runtime::RuntimeCall as KusamaBridgeHubRuntimeCall;

#[subxt::subxt(runtime_metadata_insecure_url = "wss://kusama.api.encointer.org:443")]
#[subxt::subxt(runtime_metadata_insecure_url = "wss://encointer-kusama-rpc.dwellir.com:443")]
pub mod kusama_encointer {}
pub(super) use kusama_encointer::runtime_types::encointer_kusama_runtime::RuntimeCall as KusamaEncointerRuntimeCall;

Expand Down Expand Up @@ -382,7 +382,7 @@ impl CallInfo {
Network::KusamaAssetHub => "wss://kusama-asset-hub-rpc.polkadot.io:443",
Network::KusamaBridgeHub => "wss://kusama-bridge-hub-rpc.polkadot.io:443",
Network::KusamaCoretime => "wss://kusama-coretime-rpc.polkadot.io:443",
Network::KusamaEncointer => "wss://kusama.api.encointer.org:443",
Network::KusamaEncointer => "wss://encointer-kusama-rpc.dwellir.com:443",
Network::Polkadot => "wss://polkadot-rpc.dwellir.com:443",
Network::PolkadotAssetHub => "wss://polkadot-asset-hub-rpc.polkadot.io:443",
Network::PolkadotCollectives => "wss://polkadot-collectives-rpc.polkadot.io:443",
Expand Down

0 comments on commit 35a5d6b

Please sign in to comment.