Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Remove PoW light client from runtimes (paritytech#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeddes authored Aug 26, 2022
1 parent 83b09ef commit 6948bae
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 100 deletions.
3 changes: 0 additions & 3 deletions parachain/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 parachain/runtime/snowbase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ snowbridge-asset-registry = { path = "../../pallets/asset-registry", default-fea
snowbridge-basic-channel = { path = "../../pallets/basic-channel", default-features = false }
snowbridge-incentivized-channel = { path = "../../pallets/incentivized-channel", default-features = false }
dispatch = { path = "../../pallets/dispatch", package = "snowbridge-dispatch", default-features = false }
ethereum-light-client = { path = "../../pallets/ethereum-light-client", package = "snowbridge-ethereum-light-client", default-features = false }
ethereum-beacon-client = { path = "../../pallets/ethereum-beacon-client", package = "snowbridge-ethereum-beacon-client", default-features = false, features=["minimal"]}
dot-app = { path = "../../pallets/dot-app", package = "snowbridge-dot-app", default-features = false }
eth-app = { path = "../../pallets/eth-app", package = "snowbridge-eth-app", default-features = false }
Expand Down Expand Up @@ -140,7 +139,6 @@ std = [
"polkadot-parachain/std",
"snowbridge-basic-channel/std",
"snowbridge-incentivized-channel/std",
"ethereum-light-client/std",
"ethereum-beacon-client/std",
"dispatch/std",
"dot-app/std",
Expand Down Expand Up @@ -175,5 +173,4 @@ runtime-benchmarks = [
"dispatch/runtime-benchmarks",
"erc20-app/runtime-benchmarks",
"eth-app/runtime-benchmarks",
"ethereum-light-client/runtime-benchmarks"
]
21 changes: 0 additions & 21 deletions parachain/runtime/snowbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ pub use sp_runtime::{traits::AccountIdConversion, Perbill, Permill};
use dispatch::EnsureEthereumAccount;
pub use snowbridge_core::{ChannelId, MessageId};

pub use ethereum_light_client::{EthereumDifficultyConfig, EthereumHeader};

use polkadot_parachain::primitives::Sibling;

use pallet_xcm::XcmPassthrough;
Expand Down Expand Up @@ -612,22 +610,6 @@ impl incentivized_channel_outbound::Config for Runtime {
type WeightInfo = incentivized_channel_outbound::weights::SnowbridgeWeight<Self>;
}

parameter_types! {
pub const DescendantsUntilFinalized: u8 = 1;
pub const DifficultyConfig: EthereumDifficultyConfig = EthereumDifficultyConfig::ropsten();
pub const VerifyPoW: bool = false;
pub const MaxHeadersForNumber: u32 = 100;
}

impl ethereum_light_client::Config for Runtime {
type Event = Event;
type DescendantsUntilFinalized = DescendantsUntilFinalized;
type DifficultyConfig = DifficultyConfig;
type VerifyPoW = VerifyPoW;
type MaxHeadersForNumber = MaxHeadersForNumber;
type WeightInfo = ethereum_light_client::weights::SnowbridgeWeight<Self>;
}

impl ethereum_beacon_client::Config for Runtime {
type Event = Event;
}
Expand Down Expand Up @@ -760,7 +742,6 @@ construct_runtime!(
IncentivizedInboundChannel: incentivized_channel_inbound::{Pallet, Call, Config, Storage, Event<T>} = 14,
IncentivizedOutboundChannel: incentivized_channel_outbound::{Pallet, Call, Config<T>, Storage, Event<T>} = 15,
Dispatch: dispatch::{Pallet, Call, Storage, Event<T>, Origin} = 16,
EthereumLightClient: ethereum_light_client::{Pallet, Call, Config, Storage, Event<T>} = 17,
EthereumBeaconClient: ethereum_beacon_client::{Pallet, Call, Config, Storage, Event<T>} = 18,
Assets: pallet_assets::{Pallet, Call, Config<T>, Storage, Event<T>} = 19,
AssetRegistry: snowbridge_asset_registry::{Pallet, Storage, Config} = 20,
Expand Down Expand Up @@ -945,7 +926,6 @@ impl_runtime_apis! {
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_utility, Utility);
list_benchmark!(list, extra, pallet_scheduler, Scheduler);
list_benchmark!(list, extra, ethereum_light_client, EthereumLightClient);
list_benchmark!(list, extra, assets, Assets);
list_benchmark!(list, extra, basic_channel_outbound, BasicOutboundChannel);
list_benchmark!(list, extra, incentivized_channel_inbound, IncentivizedInboundChannel);
Expand Down Expand Up @@ -998,7 +978,6 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
add_benchmark!(params, batches, pallet_utility, Utility);
add_benchmark!(params, batches, pallet_scheduler, Scheduler);
add_benchmark!(params, batches, ethereum_light_client, EthereumLightClient);
add_benchmark!(params, batches, assets, Assets);
add_benchmark!(params, batches, basic_channel_outbound, BasicOutboundChannel);
add_benchmark!(params, batches, incentivized_channel_inbound, IncentivizedInboundChannel);
Expand Down
3 changes: 0 additions & 3 deletions parachain/runtime/snowblink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ snowbridge-asset-registry = { path = "../../pallets/asset-registry", default-fea
snowbridge-basic-channel = { path = "../../pallets/basic-channel", default-features = false }
snowbridge-incentivized-channel = { path = "../../pallets/incentivized-channel", default-features = false }
dispatch = { path = "../../pallets/dispatch", package = "snowbridge-dispatch", default-features = false }
ethereum-light-client = { path = "../../pallets/ethereum-light-client", package = "snowbridge-ethereum-light-client", default-features = false }
ethereum-beacon-client = { path = "../../pallets/ethereum-beacon-client", package = "snowbridge-ethereum-beacon-client", default-features = false}
dot-app = { path = "../../pallets/dot-app", package = "snowbridge-dot-app", default-features = false }
eth-app = { path = "../../pallets/eth-app", package = "snowbridge-eth-app", default-features = false }
Expand Down Expand Up @@ -139,7 +138,6 @@ std = [
"polkadot-parachain/std",
"snowbridge-basic-channel/std",
"snowbridge-incentivized-channel/std",
"ethereum-light-client/std",
"ethereum-beacon-client/std",
"dispatch/std",
"dot-app/std",
Expand Down Expand Up @@ -174,5 +172,4 @@ runtime-benchmarks = [
"dispatch/runtime-benchmarks",
"erc20-app/runtime-benchmarks",
"eth-app/runtime-benchmarks",
"ethereum-light-client/runtime-benchmarks"
]
21 changes: 0 additions & 21 deletions parachain/runtime/snowblink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ pub use sp_runtime::{traits::AccountIdConversion, Perbill, Permill};
use dispatch::EnsureEthereumAccount;
pub use snowbridge_core::{ChannelId, MessageId};

pub use ethereum_light_client::{EthereumDifficultyConfig, EthereumHeader};

use polkadot_parachain::primitives::Sibling;

use pallet_xcm::XcmPassthrough;
Expand Down Expand Up @@ -612,22 +610,6 @@ impl incentivized_channel_outbound::Config for Runtime {
type WeightInfo = incentivized_channel_outbound::weights::SnowbridgeWeight<Self>;
}

parameter_types! {
pub const DescendantsUntilFinalized: u8 = 16;
pub const DifficultyConfig: EthereumDifficultyConfig = EthereumDifficultyConfig::ropsten();
pub const VerifyPoW: bool = false;
pub const MaxHeadersForNumber: u32 = 100;
}

impl ethereum_light_client::Config for Runtime {
type Event = Event;
type DescendantsUntilFinalized = DescendantsUntilFinalized;
type DifficultyConfig = DifficultyConfig;
type VerifyPoW = VerifyPoW;
type MaxHeadersForNumber = MaxHeadersForNumber;
type WeightInfo = ethereum_light_client::weights::SnowbridgeWeight<Self>;
}

impl ethereum_beacon_client::Config for Runtime {
type Event = Event;
}
Expand Down Expand Up @@ -760,7 +742,6 @@ construct_runtime!(
IncentivizedInboundChannel: incentivized_channel_inbound::{Pallet, Call, Config, Storage, Event<T>} = 14,
IncentivizedOutboundChannel: incentivized_channel_outbound::{Pallet, Call, Config<T>, Storage, Event<T>} = 15,
Dispatch: dispatch::{Pallet, Call, Storage, Event<T>, Origin} = 16,
EthereumLightClient: ethereum_light_client::{Pallet, Call, Config, Storage, Event<T>} = 17,
EthereumBeaconClient: ethereum_beacon_client::{Pallet, Call, Config, Storage, Event<T>} = 18,
Assets: pallet_assets::{Pallet, Call, Config<T>, Storage, Event<T>} = 19,
AssetRegistry: snowbridge_asset_registry::{Pallet, Storage, Config} = 20,
Expand Down Expand Up @@ -945,7 +926,6 @@ impl_runtime_apis! {
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_utility, Utility);
list_benchmark!(list, extra, pallet_scheduler, Scheduler);
list_benchmark!(list, extra, ethereum_light_client, EthereumLightClient);
list_benchmark!(list, extra, assets, Assets);
list_benchmark!(list, extra, basic_channel_outbound, BasicOutboundChannel);
list_benchmark!(list, extra, incentivized_channel_inbound, IncentivizedInboundChannel);
Expand Down Expand Up @@ -998,7 +978,6 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
add_benchmark!(params, batches, pallet_utility, Utility);
add_benchmark!(params, batches, pallet_scheduler, Scheduler);
add_benchmark!(params, batches, ethereum_light_client, EthereumLightClient);
add_benchmark!(params, batches, assets, Assets);
add_benchmark!(params, batches, basic_channel_outbound, BasicOutboundChannel);
add_benchmark!(params, batches, incentivized_channel_inbound, IncentivizedInboundChannel);
Expand Down
3 changes: 0 additions & 3 deletions parachain/runtime/snowbridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ snowbridge-asset-registry = { path = "../../pallets/asset-registry", default-fea
snowbridge-basic-channel = { path = "../../pallets/basic-channel", default-features = false }
snowbridge-incentivized-channel = { path = "../../pallets/incentivized-channel", default-features = false }
dispatch = { path = "../../pallets/dispatch", package = "snowbridge-dispatch", default-features = false }
ethereum-light-client = { path = "../../pallets/ethereum-light-client", package = "snowbridge-ethereum-light-client", default-features = false }
ethereum-beacon-client = { path = "../../pallets/ethereum-beacon-client", package = "snowbridge-ethereum-beacon-client", default-features = false}
dot-app = { path = "../../pallets/dot-app", package = "snowbridge-dot-app", default-features = false }
eth-app = { path = "../../pallets/eth-app", package = "snowbridge-eth-app", default-features = false }
Expand Down Expand Up @@ -139,7 +138,6 @@ std = [
"polkadot-parachain/std",
"snowbridge-basic-channel/std",
"snowbridge-incentivized-channel/std",
"ethereum-light-client/std",
"ethereum-beacon-client/std",
"dispatch/std",
"dot-app/std",
Expand Down Expand Up @@ -174,5 +172,4 @@ runtime-benchmarks = [
"dispatch/runtime-benchmarks",
"erc20-app/runtime-benchmarks",
"eth-app/runtime-benchmarks",
"ethereum-light-client/runtime-benchmarks"
]
21 changes: 0 additions & 21 deletions parachain/runtime/snowbridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ pub use sp_runtime::{traits::AccountIdConversion, Perbill, Permill};
use dispatch::EnsureEthereumAccount;
pub use snowbridge_core::{ChannelId, MessageId};

pub use ethereum_light_client::{EthereumDifficultyConfig, EthereumHeader};

use polkadot_parachain::primitives::Sibling;

use pallet_xcm::XcmPassthrough;
Expand Down Expand Up @@ -612,22 +610,6 @@ impl incentivized_channel_outbound::Config for Runtime {
type WeightInfo = incentivized_channel_outbound::weights::SnowbridgeWeight<Self>;
}

parameter_types! {
pub const DescendantsUntilFinalized: u8 = 3;
pub const DifficultyConfig: EthereumDifficultyConfig = EthereumDifficultyConfig::mainnet();
pub const VerifyPoW: bool = true;
pub const MaxHeadersForNumber: u32 = 100;
}

impl ethereum_light_client::Config for Runtime {
type Event = Event;
type DescendantsUntilFinalized = DescendantsUntilFinalized;
type DifficultyConfig = DifficultyConfig;
type VerifyPoW = VerifyPoW;
type MaxHeadersForNumber = MaxHeadersForNumber;
type WeightInfo = ethereum_light_client::weights::SnowbridgeWeight<Self>;
}

impl ethereum_beacon_client::Config for Runtime {
type Event = Event;
}
Expand Down Expand Up @@ -760,7 +742,6 @@ construct_runtime!(
IncentivizedInboundChannel: incentivized_channel_inbound::{Pallet, Call, Config, Storage, Event<T>} = 14,
IncentivizedOutboundChannel: incentivized_channel_outbound::{Pallet, Call, Config<T>, Storage, Event<T>} = 15,
Dispatch: dispatch::{Pallet, Call, Storage, Event<T>, Origin} = 16,
EthereumLightClient: ethereum_light_client::{Pallet, Call, Config, Storage, Event<T>} = 17,
EthereumBeaconClient: ethereum_beacon_client::{Pallet, Call, Config, Storage, Event<T>} = 18,
Assets: pallet_assets::{Pallet, Call, Config<T>, Storage, Event<T>} = 19,
AssetRegistry: snowbridge_asset_registry::{Pallet, Storage, Config} = 20,
Expand Down Expand Up @@ -945,7 +926,6 @@ impl_runtime_apis! {
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_utility, Utility);
list_benchmark!(list, extra, pallet_scheduler, Scheduler);
list_benchmark!(list, extra, ethereum_light_client, EthereumLightClient);
list_benchmark!(list, extra, assets, Assets);
list_benchmark!(list, extra, basic_channel_outbound, BasicOutboundChannel);
list_benchmark!(list, extra, incentivized_channel_inbound, IncentivizedInboundChannel);
Expand Down Expand Up @@ -998,7 +978,6 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
add_benchmark!(params, batches, pallet_utility, Utility);
add_benchmark!(params, batches, pallet_scheduler, Scheduler);
add_benchmark!(params, batches, ethereum_light_client, EthereumLightClient);
add_benchmark!(params, batches, assets, Assets);
add_benchmark!(params, batches, basic_channel_outbound, BasicOutboundChannel);
add_benchmark!(params, batches, incentivized_channel_inbound, IncentivizedInboundChannel);
Expand Down
4 changes: 0 additions & 4 deletions parachain/src/chain_spec/snowbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ fn testnet_genesis(
},
asset_registry: snowbase_runtime::AssetRegistryConfig { next_asset_id: 1 },
xcm_support: snowbase_runtime::XcmSupportConfig {},
ethereum_light_client: snowbase_runtime::EthereumLightClientConfig {
initial_header: Default::default(),
initial_difficulty: Default::default(),
},
ethereum_beacon_client: snowbase_runtime::EthereumBeaconClientConfig {
initial_sync: Default::default(),
},
Expand Down
4 changes: 0 additions & 4 deletions parachain/src/chain_spec/snowblink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ fn testnet_genesis(
},
asset_registry: snowblink_runtime::AssetRegistryConfig { next_asset_id: 1 },
xcm_support: snowblink_runtime::XcmSupportConfig {},
ethereum_light_client: snowblink_runtime::EthereumLightClientConfig {
initial_header: Default::default(),
initial_difficulty: Default::default(),
},
ethereum_beacon_client: snowblink_runtime::EthereumBeaconClientConfig {
initial_sync: Default::default(),
},
Expand Down
4 changes: 0 additions & 4 deletions parachain/src/chain_spec/snowbridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ fn testnet_genesis(
},
asset_registry: snowbridge_runtime::AssetRegistryConfig { next_asset_id: 1 },
xcm_support: snowbridge_runtime::XcmSupportConfig {},
ethereum_light_client: snowbridge_runtime::EthereumLightClientConfig {
initial_header: Default::default(),
initial_difficulty: Default::default(),
},
ethereum_beacon_client: snowbridge_runtime::EthereumBeaconClientConfig {
initial_sync: Default::default(),
},
Expand Down
7 changes: 2 additions & 5 deletions test/scripts/helpers/mutateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ function run() {
rl.on('close', function() {
data = JSON.parse(buffer);

let header = JSON.parse(fs.readFileSync(process.argv[2]));
let contracts = JSON.parse(fs.readFileSync(process.argv[3]));
let initialSync = JSON.parse(fs.readFileSync(process.argv[4]));
let contracts = JSON.parse(fs.readFileSync(process.argv[2]));
let initialSync = JSON.parse(fs.readFileSync(process.argv[3]));

data['genesis']['runtime']['ethereumBeaconClient']['initialSync'] = initialSync;
data['genesis']['runtime']['ethereumLightClient']['initialHeader'] = header;
data['genesis']['runtime']['ethereumLightClient']['initialDifficulty'] = "0x0";
data['genesis']['runtime']['parachainInfo']['parachainId'] = 1000;
data['para_id'] = 1000;

Expand Down
9 changes: 1 addition & 8 deletions test/scripts/start-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@ start_polkadot_launch()
echo "Generating chain specification"
"$parachain_bin" build-spec --chain "$runtime" --disable-default-bootnode > "$output_dir/spec.json"

echo "Updating chain specification"
curl $infura_endpoint_http \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["latest", false],"id":1}' \
| node scripts/helpers/transformEthHeader.js > "$output_dir/initialHeader.json"

initial_beacon_block=$(curl "$beacon_endpoint_http/eth/v1/beacon/states/head/finality_checkpoints" \
| jq -r '.data.finalized.root')

Expand All @@ -162,7 +155,7 @@ start_polkadot_launch()
"$output_dir/initialBeaconSync_tmp.json" \
> "$output_dir/initialBeaconSync.json"

cat "$output_dir/spec.json" | node scripts/helpers/mutateSpec.js "$output_dir/initialHeader.json" "$output_dir/contracts.json" "$output_dir/initialBeaconSync.json" | sponge "$output_dir/spec.json"
cat "$output_dir/spec.json" | node scripts/helpers/mutateSpec.js "$output_dir/contracts.json" "$output_dir/initialBeaconSync.json" | sponge "$output_dir/spec.json"

# TODO: add back
# if [[ -n "${TEST_MALICIOUS_APP+x}" ]]; then
Expand Down

0 comments on commit 6948bae

Please sign in to comment.