Skip to content

Commit ebebf30

Browse files
committed
Other fixes
1 parent 8fc7cbb commit ebebf30

File tree

6 files changed

+72
-20
lines changed

6 files changed

+72
-20
lines changed

Cargo.lock

Lines changed: 25 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ pallet-bridge-parachains = { git = "https://github.com/paritytech/polkadot-sdk.g
7474
pallet-bridge-messages = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "0e09ad448bce27fcd255370cc2827ea5d2cf3892", default-features = false }
7575
pallet-bridge-relayers = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "0e09ad448bce27fcd255370cc2827ea5d2cf3892", default-features = false }
7676
pallet-xcm-bridge-hub = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "0e09ad448bce27fcd255370cc2827ea5d2cf3892", default-features = false }
77+
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "0e09ad448bce27fcd255370cc2827ea5d2cf3892", default-features = false }
78+
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "0e09ad448bce27fcd255370cc2827ea5d2cf3892", default-features = false }
7779

7880
# XCM dependencies
7981
xcm = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "0e09ad448bce27fcd255370cc2827ea5d2cf3892", package = "staging-xcm" }
@@ -133,6 +135,8 @@ std = [
133135
"frame-system-benchmarking?/std",
134136

135137
"pallet-relayer-set/std",
138+
"pallet-transaction-payment/std",
139+
"pallet-transaction-payment-rpc-runtime-api/std",
136140
"pallet-transaction-storage/std",
137141
"pallet-validator-set/std",
138142

@@ -179,6 +183,7 @@ runtime-benchmarks = [
179183
"pallet-xcm-bridge-hub/runtime-benchmarks",
180184

181185
"pallet-relayer-set/runtime-benchmarks",
186+
"pallet-transaction-payment/runtime-benchmarks",
182187
"pallet-transaction-storage/runtime-benchmarks",
183188
"pallet-validator-set/runtime-benchmarks",
184189

@@ -205,6 +210,7 @@ try-runtime = [
205210
"pallet-xcm-bridge-hub/try-runtime",
206211

207212
"pallet-relayer-set/try-runtime",
213+
"pallet-transaction-payment/try-runtime",
208214
"pallet-transaction-storage/try-runtime",
209215
"pallet-validator-set/try-runtime",
210216
]

runtime/src/genesis_config_presets.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
2-
opaque::SessionKeys, AccountId, BabeConfig, BridgePolkadotGrandpaConfig,
3-
BridgePolkadotMessagesConfig, BridgePolkadotParachainsConfig, RelayerSetConfig,
4-
RuntimeGenesisConfig, SessionConfig, Signature, SudoConfig, ValidatorSetConfig,
5-
BABE_GENESIS_EPOCH_CONFIG,
2+
bridge_config::XCM_LANE, opaque::SessionKeys, AccountId, BabeConfig,
3+
BridgePolkadotGrandpaConfig, BridgePolkadotMessagesConfig, BridgePolkadotParachainsConfig,
4+
RelayerSetConfig, RuntimeGenesisConfig, SessionConfig, Signature, SudoConfig,
5+
ValidatorSetConfig, BABE_GENESIS_EPOCH_CONFIG,
66
};
77
use scale_info::prelude::format;
88
use sp_consensus_babe::AuthorityId as BabeId;
@@ -84,6 +84,7 @@ fn testnet_genesis(
8484
},
8585
bridge_polkadot_messages: BridgePolkadotMessagesConfig {
8686
owner: Some(root_key),
87+
opened_lanes: vec![XCM_LANE],
8788
..Default::default()
8889
},
8990
..Default::default()

runtime/src/lib.rs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use sp_version::NativeVersion;
3636
use sp_version::RuntimeVersion;
3737

3838
// A few exports that help ease life for downstream crates.
39-
use frame_support::genesis_builder_helper::{build_state, get_preset};
4039
pub use frame_support::{
4140
construct_runtime, parameter_types,
4241
traits::{
@@ -51,8 +50,13 @@ pub use frame_support::{
5150
},
5251
StorageValue,
5352
};
53+
use frame_support::{
54+
dispatch::{DispatchInfo, GetDispatchInfo},
55+
genesis_builder_helper::{build_state, get_preset},
56+
};
5457
pub use frame_system::Call as SystemCall;
5558
pub use pallet_timestamp::Call as TimestampCall;
59+
use pallet_transaction_payment::RuntimeDispatchInfo;
5660
use sp_runtime::traits::transaction_extension::AsTransactionExtension;
5761
#[cfg(any(feature = "std", test))]
5862
pub use sp_runtime::BuildStorage;
@@ -406,6 +410,7 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
406410
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
407411

408412
fn validate_sudo(_who: &AccountId) -> TransactionValidity {
413+
// TODO: make Sudo::key() accessible and uncomment this.
409414
// // Only allow sudo transactions signed by the sudo account. The sudo pallet obviously checks
410415
// // this, but not until transaction execution.
411416
// if Sudo::key().map_or(false, |k| who == &k) {
@@ -784,7 +789,7 @@ impl_runtime_apis! {
784789
impl bp_bridge_hub_polkadot::BridgeHubPolkadotFinalityApi<Block> for Runtime {
785790
fn best_finalized() -> Option<bp_runtime::HeaderId<bp_bridge_hub_polkadot::Hash, bp_bridge_hub_polkadot::BlockNumber>> {
786791
BridgePolkadotParachains::best_parachain_head_id::<
787-
bp_bridge_hub_polkadot::BridgeHubPolkadot
792+
bp_bridge_hub_rococo::BridgeHubRococo
788793
>().unwrap_or(None)
789794
}
790795

@@ -901,4 +906,30 @@ impl_runtime_apis! {
901906
Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed")
902907
}
903908
}
909+
910+
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, u128> for Runtime {
911+
fn query_info(
912+
uxt: <Block as BlockT>::Extrinsic,
913+
_len: u32,
914+
) -> RuntimeDispatchInfo<u128> {
915+
let dispatch_info = <<Block as BlockT>::Extrinsic as GetDispatchInfo>::get_dispatch_info(&uxt);
916+
RuntimeDispatchInfo {
917+
weight: dispatch_info.total_weight(),
918+
class: dispatch_info.class,
919+
partial_fee: 0
920+
}
921+
}
922+
fn query_fee_details(
923+
_uxt: <Block as BlockT>::Extrinsic,
924+
_len: u32,
925+
) -> pallet_transaction_payment::FeeDetails<u128> {
926+
todo!()
927+
}
928+
fn query_weight_to_fee(_weight: Weight) -> u128 {
929+
todo!()
930+
}
931+
fn query_length_to_fee(_len: u32) -> u128 {
932+
todo!()
933+
}
934+
}
904935
}

runtime/src/xcm_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ parameter_types! {
4848
// TODO [bridge]: how we are supposed to set it? Named? ByGenesis - if so, when?
4949
// After generating chain spec?
5050
/// The Polkadot Bulletin Chain network ID.
51-
pub const ThisNetwork: NetworkId = NetworkId::ByGenesis([42u8; 32]);
51+
pub const ThisNetwork: NetworkId = NetworkId::PolkadotBulletin;
5252
/// Our location in the universe of consensus systems.
5353
pub UniversalLocation: InteriorLocation = ThisNetwork::get().into();
5454

zombienet/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
[relaychain]
66
chain = "local"
7-
default_command = "/home/serban/workplace/sources/polkadot-bulletin-chain/target/release/polkadot-bulletin-chain"
7+
default_command = "{{POLKADOT_BULLETIN_BINARY_PATH}}"
88

99
[[relaychain.nodes]]
1010
name = "alice"
1111
ws_port = 10000
1212
validator = true
13-
args = [ "--ipfs-server", "-lbitswap=trace", "-lruntime=trace", "-lxcm=trace" ]
13+
args = [ "--ipfs-server", "-lruntime=trace", "-lxcm=trace" ]
1414

1515
[[relaychain.nodes]]
1616
name = "bob"

0 commit comments

Comments
 (0)