Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge: added free headers submission support to the substrate-relay #4157

Merged
merged 72 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
bc26ff5
move bridge extensions to a separate folder
svyatonik Apr 12, 2024
812d474
added FreeHeadersInterval to pallet-bridge-grandpa configuration
svyatonik Mar 12, 2024
b45fde5
added is_free_execution_expected parameter to the submit_finality_pro…
svyatonik Mar 12, 2024
1161805
move grandpa call result check from RefundTransactionExtensionAdapter…
svyatonik Mar 13, 2024
148d9b3
added RefundBridgedMessages to refund and bump priority of standalone…
svyatonik Mar 13, 2024
3cfd666
check_obsolete_submit_finality_proof may now boost transaction priori…
svyatonik Mar 13, 2024
38c558b
added CheckAndBoostBridgeGrandpaTransactions that checks whether brid…
svyatonik Mar 13, 2024
ad8edb5
relayer may be slashed to explicit account
svyatonik Mar 13, 2024
791ea6a
slash registered relayer if it has submitted failed GRANDPA transaction
svyatonik Mar 13, 2024
b90615a
allow accepting some parachain headers for free
svyatonik Mar 13, 2024
df1928f
added FreeParachainUpdateForFreeRelayHeader
svyatonik Mar 13, 2024
6d852d4
fix benchmarks compilation
svyatonik Mar 15, 2024
3209053
added WeightInfoExt for pallet-bridge-grandpa to include extra wight …
svyatonik Mar 15, 2024
3f95fb0
also refund for submitting initial parachain head
svyatonik Mar 20, 2024
84c9757
make FreeHeadersRemaining an Option => we know that when we are outsi…
svyatonik Mar 20, 2024
a3831e2
add more traces to pallets
svyatonik Mar 20, 2024
1a6baf9
check for reorgs in signed ext for parachains module
svyatonik Mar 20, 2024
3922d6a
fix benchmarks compilation
svyatonik Mar 20, 2024
666aad2
free interval instead of fixed free headers
svyatonik Mar 22, 2024
efeba93
fixed trace
svyatonik Mar 22, 2024
85a5a40
CannotAcceptMoreFreeHeaders -> FreeHeadersLimitExceded
svyatonik Mar 22, 2024
0c87d48
additional_call_result_check -> check_call_result_ex
svyatonik Mar 22, 2024
c3f0bc5
is_granda_call_succeeded -> is_grandpa_call_successful
svyatonik Mar 22, 2024
8e710d2
move tx priority boost from check_obsolete_submit_finality_proof to e…
svyatonik Mar 22, 2024
3ca9d7e
lost changes
svyatonik Mar 22, 2024
7f1375b
dec counter when importing new para header
svyatonik Mar 22, 2024
5772858
cherry pick https://github.com/paritytech/parity-bridges-common/pull/…
svyatonik Apr 12, 2024
61c7ff5
added grandpa_and_parachain_pallets_share_free_headers_counter test
svyatonik Mar 25, 2024
e0817e9
with free intervals (instead of fixed free headers) we need to check …
svyatonik Mar 25, 2024
380fe97
fix test name
svyatonik Mar 25, 2024
779bf9d
added CheckAndBoostBridgeParachainsTransactions to boost parachain tr…
svyatonik Mar 25, 2024
19fb766
check parachain id in CheckAndBoostBridgeParachainsTransactions
svyatonik Mar 25, 2024
7a89e16
use submit_parachain_head_call_ex in tests
svyatonik Mar 25, 2024
b984204
removed commented code
svyatonik Mar 25, 2024
d4533e2
changed condition for consistency
svyatonik Mar 25, 2024
3c9acee
include overweight from runtime signed extensions into submit_paracha…
svyatonik Mar 25, 2024
75b4bc0
fixed comment
svyatonik Mar 25, 2024
1effc3d
removed obsolete code comment
svyatonik Mar 25, 2024
3a7e5aa
added important comment + test
svyatonik Mar 25, 2024
d1eaba0
fix no-std compile
svyatonik Mar 25, 2024
50a44ee
again fix lost change
svyatonik Mar 25, 2024
346cb7c
fix for mandatory + interval check in ext
svyatonik Mar 25, 2024
aea38c0
apply review suggestions
svyatonik Apr 11, 2024
0b1fc99
Update modules/grandpa/src/lib.rs
svyatonik Apr 11, 2024
66d1d96
remove unused getter
svyatonik Apr 12, 2024
561e663
Merge branch 'master' into sv-refund-non-mandatory-headers-fee-polkad…
svyatonik Apr 15, 2024
bea7677
fixed TODOs and added some more tests
svyatonik Apr 15, 2024
c049082
apply new extensions and configurations to bridge-hub-rococo-runtime …
svyatonik Apr 15, 2024
cbf08d0
added tooling to compute `PriorityBoostPerRelayHeader` and `PriorityB…
svyatonik Apr 15, 2024
7aba809
fixed tests in BH runtimes
svyatonik Apr 15, 2024
21962bd
port FinalityApi::free_headers_interval from https://github.com/parit…
svyatonik Apr 16, 2024
aa89040
adapted 0001-asset-transfer test for new fee scheme
svyatonik Apr 16, 2024
51e51d7
fix `bridge-runtime-common` compilation after recent refactoring
svyatonik Apr 16, 2024
f07eddb
added prdoc
svyatonik Apr 16, 2024
c5471c9
fixed messages pallet benchmarks
svyatonik Apr 16, 2024
360614c
added --only-free-headers CLI parameter (not used yet) to finality an…
svyatonik Mar 15, 2024
f096726
actually use HeadersToRelay::Free in finality-relay
svyatonik Mar 15, 2024
6375100
actually support only-free-headers mode in parachains relay
svyatonik Mar 18, 2024
56eb755
removed inactual comment (free_source_headers_interval is cached at r…
svyatonik Mar 18, 2024
9e2a6c9
added comment re free-headers-only support in on-demand parachains relay
svyatonik Mar 18, 2024
3eb1c14
added --only-free-headers support to standalone parachains relay
svyatonik Mar 18, 2024
124a9ff
update RBH and WBH runtimes + ask for free execution if we are runnin…
svyatonik Mar 19, 2024
c9a0e6a
add some traces to relay
svyatonik Mar 20, 2024
19689dc
updated relays for new free headers criteria
svyatonik Mar 22, 2024
874f0e2
some fixes
svyatonik Mar 25, 2024
ad16bfa
use submit_parachain_heads_ex for Rococo<>Westend bridge
svyatonik Mar 25, 2024
9af2e75
Merge branch 'master' into sv-relay-free-headers-polkadot-sdk
svyatonik Apr 25, 2024
55f2095
merge damage
svyatonik Apr 25, 2024
a4ca502
revert unneeded change
svyatonik Apr 25, 2024
d67b7ec
added prdoc
svyatonik Apr 25, 2024
66e2070
fix prdoc
svyatonik Apr 25, 2024
6ed7cb4
another fix
svyatonik Apr 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bridges/chains/chain-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub const PARAS_PALLET_NAME: &str = "Paras";

/// Name of the With-Kusama GRANDPA pallet instance that is deployed at bridged chains.
pub const WITH_KUSAMA_GRANDPA_PALLET_NAME: &str = "BridgeKusamaGrandpa";
/// Name of the With-Kusama parachains pallet instance that is deployed at bridged chains.
pub const WITH_KUSAMA_BRIDGE_PARACHAINS_PALLET_NAME: &str = "BridgeKusamaParachains";

/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Polkadot
/// parachains.
Expand Down
2 changes: 2 additions & 0 deletions bridges/chains/chain-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ pub const PARAS_PALLET_NAME: &str = "Paras";

/// Name of the With-Polkadot GRANDPA pallet instance that is deployed at bridged chains.
pub const WITH_POLKADOT_GRANDPA_PALLET_NAME: &str = "BridgePolkadotGrandpa";
/// Name of the With-Polkadot parachains pallet instance that is deployed at bridged chains.
pub const WITH_POLKADOT_BRIDGE_PARACHAINS_PALLET_NAME: &str = "BridgePolkadotParachains";

/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Polkadot
/// parachains.
Expand Down
2 changes: 2 additions & 0 deletions bridges/chains/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub const PARAS_PALLET_NAME: &str = "Paras";

/// Name of the With-Rococo GRANDPA pallet instance that is deployed at bridged chains.
pub const WITH_ROCOCO_GRANDPA_PALLET_NAME: &str = "BridgeRococoGrandpa";
/// Name of the With-Rococo parachains pallet instance that is deployed at bridged chains.
pub const WITH_ROCOCO_BRIDGE_PARACHAINS_PALLET_NAME: &str = "BridgeRococoParachains";

/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Rococo
/// parachains.
Expand Down
2 changes: 2 additions & 0 deletions bridges/chains/chain-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub const PARAS_PALLET_NAME: &str = "Paras";

/// Name of the With-Westend GRANDPA pallet instance that is deployed at bridged chains.
pub const WITH_WESTEND_GRANDPA_PALLET_NAME: &str = "BridgeWestendGrandpa";
/// Name of the With-Westend parachains pallet instance that is deployed at bridged chains.
pub const WITH_WESTEND_BRIDGE_PARACHAINS_PALLET_NAME: &str = "BridgeWestendParachains";

/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Westend
/// parachains.
Expand Down
9 changes: 9 additions & 0 deletions bridges/relays/client-substrate/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ pub trait Chain: ChainBase + Clone {
/// Keep in mind that this method is normally provided by the other chain, which is
/// bridged with this chain.
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str;
/// Name of the runtime API method that is returning interval between source chain
/// headers that may be submitted for free to the target chain.
///
/// Keep in mind that this method is normally provided by the other chain, which is
/// bridged with this chain.
const FREE_HEADERS_INTERVAL_METHOD: &'static str;

/// Average block interval.
///
Expand Down Expand Up @@ -75,6 +81,9 @@ pub trait ChainWithRuntimeVersion: Chain {
pub trait RelayChain: Chain {
/// Name of the `runtime_parachains::paras` pallet in the runtime of this chain.
const PARAS_PALLET_NAME: &'static str;
/// Name of the `pallet-bridge-parachains`, deployed at the **bridged** chain to sync
/// parachains of **this** chain.
const WITH_CHAIN_BRIDGE_PARACHAINS_PALLET_NAME: &'static str;
}

/// Substrate-based chain that is using direct GRANDPA finality from minimal relay-client point of
Expand Down
2 changes: 2 additions & 0 deletions bridges/relays/client-substrate/src/test_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl bp_runtime::Chain for TestChain {
impl Chain for TestChain {
const NAME: &'static str = "Test";
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = "TestMethod";
const FREE_HEADERS_INTERVAL_METHOD: &'static str = "TestMethod";
acatangiu marked this conversation as resolved.
Show resolved Hide resolved
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_millis(0);

type SignedBlock = sp_runtime::generic::SignedBlock<
Expand Down Expand Up @@ -124,6 +125,7 @@ impl bp_runtime::UnderlyingChainProvider for TestParachain {
impl Chain for TestParachain {
const NAME: &'static str = "TestParachain";
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = "TestParachainMethod";
const FREE_HEADERS_INTERVAL_METHOD: &'static str = "TestParachainMethod";
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_millis(0);

type SignedBlock = sp_runtime::generic::SignedBlock<
Expand Down
4 changes: 3 additions & 1 deletion bridges/relays/finality/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ node. The transaction is then tracked by the relay until it is mined and finaliz
The main entrypoint for the crate is the [`run` function](./src/finality_loop.rs), which takes source and target
clients and [`FinalitySyncParams`](./src/finality_loop.rs) parameters. The most important parameter is the
`only_mandatory_headers` - it is set to `true`, the relay will only submit mandatory headers. Since transactions
with mandatory headers are fee-free, the cost of running such relay is zero (in terms of fees).
with mandatory headers are fee-free, the cost of running such relay is zero (in terms of fees). If a similar,
`only_free_headers` parameter, is set to `true`, then free headers (if configured in the runtime) are also
relayed.

## Finality Relay Metrics

Expand Down
Loading
Loading