Skip to content

Commit

Permalink
Update and companions
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed May 22, 2023
1 parent 408af7b commit b382acd
Show file tree
Hide file tree
Showing 16 changed files with 1,906 additions and 1,512 deletions.
3,009 changes: 1,700 additions & 1,309 deletions Cargo.lock

Large diffs are not rendered by default.

277 changes: 139 additions & 138 deletions Cargo.toml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions core/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version.workspace = true
dc-types = { workspace = true }

# moonbeam
account = { workspace = true }
fp-account = { workspace = true }

# substrate
sp-core = { workspace = true }
Expand All @@ -20,8 +20,8 @@ sp-runtime = { workspace = true }
[features]
default = ["std"]
std = [
# moonbeam
"account/std",
# frontier
"fp-account/std",

# substrate
"sp-core/std",
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
pub use dc_types::*;

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = account::EthereumSignature;
pub type Signature = fp_account::EthereumSignature;

/// Some way of identifying an account on the chain.
/// We intentionally make it equivalent to the public key of our transaction signing scheme.
Expand Down
1 change: 0 additions & 1 deletion pallet/deposit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ pub mod pallet {
StorageMap<_, Blake2_128Concat, T::AccountId, BoundedVec<Deposit, T::MaxDeposits>>;

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::call]
impl<T: Config> Pallet<T> {
Expand Down
1 change: 0 additions & 1 deletion pallet/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ pub mod pallet {
}

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::hooks]
impl<T: Config> Hooks<T::BlockNumber> for Pallet<T> {
Expand Down
10 changes: 3 additions & 7 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ dc-primitives = { workspace = true }
bp-darwinia-core = { workspace = true }

# frontier
fp-account = { workspace = true }
pallet-evm = { workspace = true }

# moonbeam
account = { workspace = true }

# polkadot
xcm = { workspace = true }
xcm-builder = { workspace = true }
Expand Down Expand Up @@ -55,11 +53,9 @@ std = [
"bp-darwinia-core/std",

# frontier
"fp-account/std",
"pallet-evm/std",

# moonbeam
"account/std",

# polkadot
"xcm/std",
"xcm-builder/std",
Expand All @@ -82,5 +78,5 @@ std = [
test = []

runtime-benchmarks = [
"pallet-assets/runtime-benchmarks"
"pallet-assets/runtime-benchmarks",
]
2 changes: 1 addition & 1 deletion runtime/common/src/gov_origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// darwinia
use dc_primitives::AccountId;
// moonbeam
use account::AccountId20;
use fp_account::AccountId20;
// substrate
use frame_support::traits::EitherOfDiverse;
use frame_system::EnsureRoot;
Expand Down
13 changes: 8 additions & 5 deletions runtime/crab/src/bridges_message/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,17 @@ impl BridgedChainWithMessages for Darwinia {
impl TargetHeaderChain<ToDarwiniaMessagePayload, <Self as ChainWithMessages>::AccountId>
for Darwinia
{
type Error = &'static str;
type MessagesDeliveryProof = ToDarwiniaMessagesDeliveryProof;

fn verify_message(payload: &ToDarwiniaMessagePayload) -> Result<(), Self::Error> {
fn verify_message(
payload: &ToDarwiniaMessagePayload,
) -> Result<(), bp_messages::VerificationError> {
source::verify_chain_message::<WithDarwiniaMessageBridge>(payload)
}

fn verify_messages_delivery_proof(
proof: Self::MessagesDeliveryProof,
) -> Result<(LaneId, InboundLaneData<bp_darwinia::AccountId>), Self::Error> {
) -> Result<(LaneId, InboundLaneData<bp_darwinia::AccountId>), bp_messages::VerificationError> {
source::verify_messages_delivery_proof_from_parachain::<
WithDarwiniaMessageBridge,
bp_darwinia::Header,
Expand All @@ -138,13 +139,15 @@ impl TargetHeaderChain<ToDarwiniaMessagePayload, <Self as ChainWithMessages>::Ac
}
}
impl SourceHeaderChain<<Self as ChainWithMessages>::Balance> for Darwinia {
type Error = &'static str;
type MessagesProof = FromDarwiniaMessagesProof;

fn verify_messages_proof(
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>, Self::Error> {
) -> Result<
ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>,
bp_messages::VerificationError,
> {
target::verify_messages_proof_from_parachain::<
WithDarwiniaMessageBridge,
bp_darwinia::Header,
Expand Down
16 changes: 8 additions & 8 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ sp_api::impl_runtime_apis! {
}

fn account_code_at(address: sp_core::H160) -> Vec<u8> {
EVM::account_codes(address)
pallet_evm::AccountCodes::<Runtime>::get(address)
}

fn author() -> sp_core::H160 {
Expand All @@ -380,7 +380,7 @@ sp_api::impl_runtime_apis! {

index.to_big_endian(&mut tmp);

EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..]))
pallet_evm::AccountStorages::<Runtime>::get(address, sp_core::H256::from_slice(&tmp[..]))
}

fn call(
Expand Down Expand Up @@ -472,15 +472,15 @@ sp_api::impl_runtime_apis! {
}

fn current_transaction_statuses() -> Option<Vec<fp_rpc::TransactionStatus>> {
Ethereum::current_transaction_statuses()
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
}

fn current_block() -> Option<pallet_ethereum::Block> {
Ethereum::current_block()
pallet_ethereum::CurrentBlock::<Runtime>::get()
}

fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
Ethereum::current_receipts()
pallet_ethereum::CurrentReceipts::<Runtime>::get()
}

fn current_all() -> (
Expand All @@ -489,9 +489,9 @@ sp_api::impl_runtime_apis! {
Option<Vec<fp_rpc::TransactionStatus>>
) {
(
Ethereum::current_block(),
Ethereum::current_receipts(),
Ethereum::current_transaction_statuses()
pallet_ethereum::CurrentBlock::<Runtime>::get(),
pallet_ethereum::CurrentReceipts::<Runtime>::get(),
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

Expand Down
12 changes: 8 additions & 4 deletions runtime/darwinia/src/bridges_message/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,17 @@ impl BridgedChainWithMessages for Crab {
}
}
impl TargetHeaderChain<ToCrabMessagePayload, <Self as ChainWithMessages>::AccountId> for Crab {
type Error = &'static str;
type MessagesDeliveryProof = ToCrabMessagesDeliveryProof;

fn verify_message(payload: &ToCrabMessagePayload) -> Result<(), Self::Error> {
fn verify_message(
payload: &ToCrabMessagePayload,
) -> Result<(), bp_messages::VerificationError> {
source::verify_chain_message::<WithCrabMessageBridge>(payload)
}

fn verify_messages_delivery_proof(
proof: Self::MessagesDeliveryProof,
) -> Result<(LaneId, InboundLaneData<bp_crab::AccountId>), Self::Error> {
) -> Result<(LaneId, InboundLaneData<bp_crab::AccountId>), bp_messages::VerificationError> {
source::verify_messages_delivery_proof_from_parachain::<
WithCrabMessageBridge,
bp_crab::Header,
Expand All @@ -138,7 +139,10 @@ impl SourceHeaderChain<<Self as ChainWithMessages>::Balance> for Crab {
fn verify_messages_proof(
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>, Self::Error> {
) -> Result<
ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>,
bp_messages::VerificationError,
> {
target::verify_messages_proof_from_parachain::<
WithCrabMessageBridge,
bp_crab::Header,
Expand Down
16 changes: 8 additions & 8 deletions runtime/darwinia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ sp_api::impl_runtime_apis! {
}

fn account_code_at(address: sp_core::H160) -> Vec<u8> {
EVM::account_codes(address)
pallet_evm::AccountCodes::<Runtime>::get(address)
}

fn author() -> sp_core::H160 {
Expand All @@ -381,7 +381,7 @@ sp_api::impl_runtime_apis! {

index.to_big_endian(&mut tmp);

EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..]))
pallet_evm::AccountStorages::<Runtime>::get(address, sp_core::H256::from_slice(&tmp[..]))
}

fn call(
Expand Down Expand Up @@ -473,15 +473,15 @@ sp_api::impl_runtime_apis! {
}

fn current_transaction_statuses() -> Option<Vec<fp_rpc::TransactionStatus>> {
Ethereum::current_transaction_statuses()
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
}

fn current_block() -> Option<pallet_ethereum::Block> {
Ethereum::current_block()
pallet_ethereum::CurrentBlock::<Runtime>::get()
}

fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
Ethereum::current_receipts()
pallet_ethereum::CurrentReceipts::<Runtime>::get()
}

fn current_all() -> (
Expand All @@ -490,9 +490,9 @@ sp_api::impl_runtime_apis! {
Option<Vec<fp_rpc::TransactionStatus>>
) {
(
Ethereum::current_block(),
Ethereum::current_receipts(),
Ethereum::current_transaction_statuses()
pallet_ethereum::CurrentBlock::<Runtime>::get(),
pallet_ethereum::CurrentReceipts::<Runtime>::get(),
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

Expand Down
8 changes: 3 additions & 5 deletions runtime/pangolin/src/bridges_message/pangoro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,15 @@ impl BridgedChainWithMessages for Pangoro {
impl TargetHeaderChain<ToPangoroMessagePayload, <Self as ChainWithMessages>::AccountId>
for Pangoro
{
type Error = &'static str;
type MessagesDeliveryProof = ToPangoroMessagesDeliveryProof;

fn verify_message(payload: &ToPangoroMessagePayload) -> Result<(), Self::Error> {
fn verify_message(payload: &ToPangoroMessagePayload) -> Result<(), bp_messages::VerificationError> {
source::verify_chain_message::<WithPangoroMessageBridge>(payload)
}

fn verify_messages_delivery_proof(
proof: Self::MessagesDeliveryProof,
) -> Result<(LaneId, InboundLaneData<bp_pangoro::AccountId>), Self::Error> {
) -> Result<(LaneId, InboundLaneData<bp_pangoro::AccountId>), bp_messages::VerificationError> {
source::verify_messages_delivery_proof_from_parachain::<
WithPangoroMessageBridge,
bp_pangoro::Header,
Expand All @@ -138,13 +137,12 @@ impl TargetHeaderChain<ToPangoroMessagePayload, <Self as ChainWithMessages>::Acc
}
}
impl SourceHeaderChain<<Self as ChainWithMessages>::Balance> for Pangoro {
type Error = &'static str;
type MessagesProof = FromPangoroMessagesProof;

fn verify_messages_proof(
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>, Self::Error> {
) -> Result<ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>, bp_messages::VerificationError> {
target::verify_messages_proof_from_parachain::<
WithPangoroMessageBridge,
bp_pangoro::Header,
Expand Down
16 changes: 8 additions & 8 deletions runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ sp_api::impl_runtime_apis! {
}

fn account_code_at(address: sp_core::H160) -> Vec<u8> {
EVM::account_codes(address)
pallet_evm::AccountCodes::<Runtime>::get(address)
}

fn author() -> sp_core::H160 {
Expand All @@ -382,7 +382,7 @@ sp_api::impl_runtime_apis! {

index.to_big_endian(&mut tmp);

EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..]))
pallet_evm::AccountStorages::<Runtime>::get(address, sp_core::H256::from_slice(&tmp[..]))
}

fn call(
Expand Down Expand Up @@ -474,15 +474,15 @@ sp_api::impl_runtime_apis! {
}

fn current_transaction_statuses() -> Option<Vec<fp_rpc::TransactionStatus>> {
Ethereum::current_transaction_statuses()
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
}

fn current_block() -> Option<pallet_ethereum::Block> {
Ethereum::current_block()
pallet_ethereum::CurrentBlock::<Runtime>::get()
}

fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
Ethereum::current_receipts()
pallet_ethereum::CurrentReceipts::<Runtime>::get()
}

fn current_all() -> (
Expand All @@ -491,9 +491,9 @@ sp_api::impl_runtime_apis! {
Option<Vec<fp_rpc::TransactionStatus>>
) {
(
Ethereum::current_block(),
Ethereum::current_receipts(),
Ethereum::current_transaction_statuses()
pallet_ethereum::CurrentBlock::<Runtime>::get(),
pallet_ethereum::CurrentReceipts::<Runtime>::get(),
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

Expand Down
13 changes: 8 additions & 5 deletions runtime/pangoro/src/bridges_message/pangolin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,17 @@ impl BridgedChainWithMessages for Pangolin {
impl TargetHeaderChain<ToPangolinMessagePayload, <Self as ChainWithMessages>::AccountId>
for Pangolin
{
type Error = &'static str;
type MessagesDeliveryProof = ToPangolinMessagesDeliveryProof;

fn verify_message(payload: &ToPangolinMessagePayload) -> Result<(), Self::Error> {
fn verify_message(
payload: &ToPangolinMessagePayload,
) -> Result<(), bp_messages::VerificationError> {
source::verify_chain_message::<WithPangolinMessageBridge>(payload)
}

fn verify_messages_delivery_proof(
proof: Self::MessagesDeliveryProof,
) -> Result<(LaneId, InboundLaneData<bp_pangolin::AccountId>), Self::Error> {
) -> Result<(LaneId, InboundLaneData<bp_pangolin::AccountId>), bp_messages::VerificationError> {
source::verify_messages_delivery_proof_from_parachain::<
WithPangolinMessageBridge,
bp_pangolin::Header,
Expand All @@ -138,13 +139,15 @@ impl TargetHeaderChain<ToPangolinMessagePayload, <Self as ChainWithMessages>::Ac
}
}
impl SourceHeaderChain<<Self as ChainWithMessages>::Balance> for Pangolin {
type Error = &'static str;
type MessagesProof = FromPangolinMessagesProof;

fn verify_messages_proof(
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>, Self::Error> {
) -> Result<
ProvedMessages<Message<<Self as ChainWithMessages>::Balance>>,
bp_messages::VerificationError,
> {
target::verify_messages_proof_from_parachain::<
WithPangolinMessageBridge,
bp_pangolin::Header,
Expand Down
Loading

0 comments on commit b382acd

Please sign in to comment.