Rename Primitive Crates (#271)

* Rename Ethereum PoA primitives crate

The "sp" prefix comes from Substrate primitives, since this crate originated
in that repo. However, it is not part of Substrate anymore and its name should
be updated to reflect that.

* Rename currency exchange primitives

* Rust Fmt

* Update import in benchmarking module

* Rust Fmt

* Split pub and no-pub

* Sort toml files.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
Hernando Castano
2020-08-07 10:23:40 -04:00
committed by Bastian Köcher
parent 868814e4b6
commit 9f6bd28384
25 changed files with 104 additions and 102 deletions
+22 -22
View File
@@ -251,9 +251,9 @@ impl pallet_bridge_currency_exchange::Trait<RialtoCurrencyExchange> for Runtime
type OnTransactionSubmitted = ();
type PeerBlockchain = rialto::RialtoBlockchain;
type PeerMaybeLockFundsTransaction = exchange::EthTransaction;
type RecipientsMap = sp_currency_exchange::IdentityRecipients<AccountId>;
type RecipientsMap = bp_currency_exchange::IdentityRecipients<AccountId>;
type Amount = Balance;
type CurrencyConverter = sp_currency_exchange::IdentityCurrencyConverter<Balance>;
type CurrencyConverter = bp_currency_exchange::IdentityCurrencyConverter<Balance>;
type DepositInto = DepositInto;
}
@@ -262,19 +262,19 @@ impl pallet_bridge_currency_exchange::Trait<KovanCurrencyExchange> for Runtime {
type OnTransactionSubmitted = ();
type PeerBlockchain = kovan::KovanBlockchain;
type PeerMaybeLockFundsTransaction = exchange::EthTransaction;
type RecipientsMap = sp_currency_exchange::IdentityRecipients<AccountId>;
type RecipientsMap = bp_currency_exchange::IdentityRecipients<AccountId>;
type Amount = Balance;
type CurrencyConverter = sp_currency_exchange::IdentityCurrencyConverter<Balance>;
type CurrencyConverter = bp_currency_exchange::IdentityCurrencyConverter<Balance>;
type DepositInto = DepositInto;
}
pub struct DepositInto;
impl sp_currency_exchange::DepositInto for DepositInto {
impl bp_currency_exchange::DepositInto for DepositInto {
type Recipient = AccountId;
type Amount = Balance;
fn deposit_into(recipient: Self::Recipient, amount: Self::Amount) -> sp_currency_exchange::Result<()> {
fn deposit_into(recipient: Self::Recipient, amount: Self::Amount) -> bp_currency_exchange::Result<()> {
// let balances module make all checks for us (it won't allow depositing lower than existential
// deposit, balance overflow, ...)
let deposited = <pallet_balances::Module<Runtime> as Currency<AccountId>>::deposit_creating(&recipient, amount);
@@ -307,7 +307,7 @@ impl sp_currency_exchange::DepositInto for DepositInto {
recipient,
);
Err(sp_currency_exchange::Error::DepositFailed)
Err(bp_currency_exchange::Error::DepositFailed)
}
_ => {
frame_support::debug::error!(
@@ -319,7 +319,7 @@ impl sp_currency_exchange::DepositInto for DepositInto {
);
// we can't return DepositFailed error here, because storage changes were made
Err(sp_currency_exchange::Error::DepositPartiallyFailed)
Err(bp_currency_exchange::Error::DepositPartiallyFailed)
}
}
}
@@ -557,53 +557,53 @@ impl_runtime_apis! {
}
}
impl sp_bridge_eth_poa::RialtoHeaderApi<Block> for Runtime {
fn best_block() -> (u64, sp_bridge_eth_poa::H256) {
impl bp_eth_poa::RialtoHeaderApi<Block> for Runtime {
fn best_block() -> (u64, bp_eth_poa::H256) {
let best_block = BridgeRialto::best_block();
(best_block.number, best_block.hash)
}
fn finalized_block() -> (u64, sp_bridge_eth_poa::H256) {
fn finalized_block() -> (u64, bp_eth_poa::H256) {
let finalized_block = BridgeRialto::finalized_block();
(finalized_block.number, finalized_block.hash)
}
fn is_import_requires_receipts(header: sp_bridge_eth_poa::Header) -> bool {
fn is_import_requires_receipts(header: bp_eth_poa::Header) -> bool {
BridgeRialto::is_import_requires_receipts(header)
}
fn is_known_block(hash: sp_bridge_eth_poa::H256) -> bool {
fn is_known_block(hash: bp_eth_poa::H256) -> bool {
BridgeRialto::is_known_block(hash)
}
}
impl sp_bridge_eth_poa::KovanHeaderApi<Block> for Runtime {
fn best_block() -> (u64, sp_bridge_eth_poa::H256) {
impl bp_eth_poa::KovanHeaderApi<Block> for Runtime {
fn best_block() -> (u64, bp_eth_poa::H256) {
let best_block = BridgeKovan::best_block();
(best_block.number, best_block.hash)
}
fn finalized_block() -> (u64, sp_bridge_eth_poa::H256) {
fn finalized_block() -> (u64, bp_eth_poa::H256) {
let finalized_block = BridgeKovan::finalized_block();
(finalized_block.number, finalized_block.hash)
}
fn is_import_requires_receipts(header: sp_bridge_eth_poa::Header) -> bool {
fn is_import_requires_receipts(header: bp_eth_poa::Header) -> bool {
BridgeKovan::is_import_requires_receipts(header)
}
fn is_known_block(hash: sp_bridge_eth_poa::H256) -> bool {
fn is_known_block(hash: bp_eth_poa::H256) -> bool {
BridgeKovan::is_known_block(hash)
}
}
impl sp_currency_exchange::RialtoCurrencyExchangeApi<Block, exchange::EthereumTransactionInclusionProof> for Runtime {
impl bp_currency_exchange::RialtoCurrencyExchangeApi<Block, exchange::EthereumTransactionInclusionProof> for Runtime {
fn filter_transaction_proof(proof: exchange::EthereumTransactionInclusionProof) -> bool {
BridgeRialtoCurrencyExchange::filter_transaction_proof(&proof)
}
}
impl sp_currency_exchange::KovanCurrencyExchangeApi<Block, exchange::EthereumTransactionInclusionProof> for Runtime {
impl bp_currency_exchange::KovanCurrencyExchangeApi<Block, exchange::EthereumTransactionInclusionProof> for Runtime {
fn filter_transaction_proof(proof: exchange::EthereumTransactionInclusionProof) -> bool {
BridgeKovanCurrencyExchange::filter_transaction_proof(&proof)
}
@@ -714,7 +714,7 @@ impl_runtime_apis! {
fn make_proof(
proof_params: BridgeCurrencyExchangeProofParams<AccountId>,
) -> crate::exchange::EthereumTransactionInclusionProof {
use sp_currency_exchange::DepositInto;
use bp_currency_exchange::DepositInto;
if proof_params.recipient_exists {
<Runtime as pallet_bridge_currency_exchange::Trait<KovanCurrencyExchange>>::DepositInto::deposit_into(
@@ -761,7 +761,7 @@ impl_runtime_apis! {
#[cfg(test)]
mod tests {
use super::*;
use sp_currency_exchange::DepositInto;
use bp_currency_exchange::DepositInto;
#[test]
fn shift_session_manager_works() {