Rewards refund for relaying BridgeHubRococo/BridgeHubWococo (#1894)

* Rewards refund for relaying BridgeHubRococo/BridgeHubWococo

* spellcheck + clippy

* RefundBridgedParachainMessages move to bp-runtime

* Dedicated RewardingBridgeSignedExtra for Rococo/Wococo shared runtime with two instances of `RefundBridgedParachainMessages`

* RefundBridgedParachainMessages with Tuple support for multiple

* Fix additional_signed

* revert fix

* Refactor to `RefundBridgedParachainMessagesSchema`

* removed unused deps
This commit is contained in:
Branislav Kontur
2023-02-21 12:22:59 +01:00
committed by Bastian Köcher
parent 623bd85a5e
commit 1aa6da448f
7 changed files with 111 additions and 16 deletions
@@ -17,7 +17,6 @@
//! Types used to connect to the BridgeHub-Rococo-Substrate parachain.
use bp_bridge_hub_rococo::AVERAGE_BLOCK_INTERVAL;
use bp_bridge_hub_wococo::PolkadotSignedExtension;
use bp_messages::MessageNonce;
use codec::Encode;
use relay_substrate_client::{
@@ -72,7 +71,7 @@ impl ChainWithTransactions for BridgeHubRococo {
) -> Result<Self::SignedTransaction, SubstrateError> {
let raw_payload = SignedPayload::new(
unsigned.call,
bp_bridge_hub_rococo::SignedExtension::from_params(
runtime::rewarding_bridge_signed_extension::from_params(
param.spec_version,
param.transaction_version,
unsigned.era,
@@ -86,7 +85,7 @@ impl ChainWithTransactions for BridgeHubRococo {
let signer: sp_runtime::MultiSigner = param.signer.public().into();
let (call, extra, _) = raw_payload.deconstruct();
Ok(bp_bridge_hub_rococo::UncheckedExtrinsic::new_signed(
Ok(runtime::UncheckedExtrinsic::new_signed(
call,
signer.into_account().into(),
signature.into(),
@@ -109,7 +108,13 @@ impl ChainWithTransactions for BridgeHubRococo {
fn parse_transaction(tx: Self::SignedTransaction) -> Option<UnsignedTransaction<Self>> {
let extra = &tx.signature.as_ref()?.2;
Some(UnsignedTransaction::new(tx.function, extra.nonce()).tip(extra.tip()))
Some(
UnsignedTransaction::new(
tx.function,
runtime::rewarding_bridge_signed_extension::nonce(extra),
)
.tip(runtime::rewarding_bridge_signed_extension::tip(extra)),
)
}
}
@@ -14,21 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
// TODO: join with primitives do we need this here or move to the primitives?
//! Types that are specific to the BridgeHubRococo runtime.
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use bp_bridge_hub_rococo::SignedExtension;
pub use bp_bridge_hub_rococo::rewarding_bridge_signed_extension;
pub use bp_header_chain::BridgeGrandpaCallOf;
pub use bp_parachains::BridgeParachainCall;
pub use bridge_runtime_common::messages::BridgeMessagesCallOf;
pub use relay_substrate_client::calls::{SystemCall, UtilityCall};
/// Unchecked BridgeHubRococo extrinsic.
pub type UncheckedExtrinsic = bp_bridge_hub_rococo::UncheckedExtrinsic<Call, SignedExtension>;
pub type UncheckedExtrinsic = bp_bridge_hub_rococo::UncheckedExtrinsic<
Call,
rewarding_bridge_signed_extension::RewardingBridgeSignedExtension,
>;
// The indirect pallet call used to sync `Wococo` GRANDPA finality to `BHRococo`.
pub type BridgeWococoGrandpaCall = BridgeGrandpaCallOf<bp_wococo::Wococo>;