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

Migrate to new s2s bridge #479

Merged
merged 37 commits into from
Jul 1, 2022
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d3366da
try fix subscribe service stopped
fewensa Jun 24, 2022
09cebe0
Add bridge_pangolinparachain to pangolin
furoxr Jun 24, 2022
ef00959
update pangolin-pangolinparachain
fewensa Jun 24, 2022
db14513
fix features
fewensa Jun 24, 2022
24b60ce
add fastapi
fewensa Jun 24, 2022
b4a1ca7
fill implements
fewensa Jun 24, 2022
272da1c
Update pangolin-pangolinparachain
fewensa Jun 24, 2022
daf9ea5
bridge pangolin-pangolinparachain
fewensa Jun 25, 2022
d1efa8b
fix chain name
fewensa Jun 25, 2022
107d5e6
update rust toolchain
fewensa Jun 25, 2022
03bbece
bump deps
fewensa Jun 25, 2022
3629ccb
update log
fewensa Jun 25, 2022
c0ded67
fix pangolin parachain dispatch on-demand header relay
fewensa Jun 25, 2022
71988f4
fix initialize
fewensa Jun 25, 2022
af9fbde
bump deps
fewensa Jun 27, 2022
864b905
fix pangolin-pangoro
fewensa Jun 27, 2022
e6c450b
bridge darwinia-crab
fewensa Jun 27, 2022
2d0c4bb
bridge crab-crabparachain
fewensa Jun 28, 2022
b712583
migrate initialize to s2sclientrelay
fewensa Jun 28, 2022
59e5109
make changes follow array-bytes upgraded
fewensa Jun 28, 2022
989518f
Remove useless file
fewensa Jun 28, 2022
5f1984c
Update rust toolchain
fewensa Jun 28, 2022
97f5a86
Update rust toolchain
fewensa Jun 28, 2022
3239b2d
migrate feemarket-ns2s to feemarket-s2s
fewensa Jun 28, 2022
6bc3862
fix compile
fewensa Jun 28, 2022
ba9379a
bump subxt
fewensa Jun 30, 2022
af15666
bump deps
fewensa Jun 30, 2022
01ce005
bump deps
fewensa Jun 30, 2022
a69574a
fix substrate version and compile
fewensa Jun 30, 2022
a53e65f
Trigger ci
fewensa Jun 30, 2022
ea7eee0
Add subql-s2s-darwinia
fewensa Jun 30, 2022
5f0447a
fix tests
fewensa Jun 30, 2022
adfc6d8
fix wrong feemarket orders stroage key
fewensa Jun 30, 2022
99a7b00
rename abstract to traits
fewensa Jul 1, 2022
43cf841
fix tests
fewensa Jul 1, 2022
39eb18d
Lint
fewensa Jul 1, 2022
e94b39b
Update subql
fewensa Jul 1, 2022
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
Prev Previous commit
Next Next commit
add fastapi
fewensa committed Jun 24, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 24b60ce71df230c2cf11cdd08e679a3b5002eef4
49 changes: 32 additions & 17 deletions bridges/pangolin-pangolinparachain/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions frame/assistants/client-pangolin-parachain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@ tracing = "0.1"

serde = { version = "1", features = ["derive"] }

array-bytes = "1.4"
codec = { package = "parity-scale-codec", version = "2" }
subxt = { git = "https://github.com/darwinia-network/subxt.git", branch = "darwinia-v0.12.2" }
bp-rococo = { git = "https://github.com/darwinia-network/darwinia-bridges-substrate.git", branch = "darwinia-v0.12.2" }
array-bytes = "1.4"
codec = { package = "parity-scale-codec", version = "2" }
subxt = { git = "https://github.com/darwinia-network/subxt.git", branch = "darwinia-v0.12.2" }
bp-pangolin-parachain = { git = "https://github.com/darwinia-network/darwinia-bridges-substrate.git", branch = "darwinia-v0.12.2" }

## maybe common
async-trait = { optional = true, version = "0.1" }
16 changes: 8 additions & 8 deletions frame/assistants/client-pangolin-parachain/src/config.rs
Original file line number Diff line number Diff line change
@@ -16,13 +16,13 @@ pub struct ClientConfig {
pub enum PangolinParachainSubxtConfig {}

impl subxt::Config for PangolinParachainSubxtConfig {
type Index = u32;
type BlockNumber = u32;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = sp_runtime::AccountId32;
type Address = sp_runtime::MultiAddress<Self::AccountId, u32>;
type Header = sp_runtime::generic::Header<Self::BlockNumber, sp_runtime::traits::BlakeTwo256>;
type Signature = sp_runtime::MultiSignature;
type Index = bp_pangolin_parachain::Nonce;
type BlockNumber = bp_pangolin_parachain::BlockNumber;
type Hash = bp_pangolin_parachain::Hash;
type Hashing = bp_pangolin_parachain::Hashing;
type AccountId = bp_pangolin_parachain::AccountId;
type Address = bp_pangolin_parachain::Address;
type Header = bp_pangolin_parachain::Header;
type Signature = bp_pangolin_parachain::Signature;
type Extrinsic = sp_runtime::OpaqueExtrinsic;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
use abstract_bridge_s2s::config::Config;
use abstract_bridge_s2s::error::{S2SClientError, S2SClientResult};
use abstract_bridge_s2s::{
client::{S2SClientBase, S2SClientGeneric},
types::bp_header_chain,
};
use finality_grandpa::voter_set::VoterSet;
use sp_finality_grandpa::{AuthorityList, ConsensusLog, ScheduledChange};
use sp_runtime::{ConsensusEngineId, DigestItem};
use subxt::rpc::{ClientT, Subscription, SubscriptionClientT};
use subxt::{sp_core, sp_runtime};

use crate::client::PangolinParachainClient;
use crate::error::{ClientError, ClientResult};
use crate::types::runtime_types::bp_header_chain::InitializationData;

const GRANDPA_ENGINE_ID: ConsensusEngineId = *b"FRNK";

impl S2SClientBase for PangolinParachainClient {
const CHAIN: &'static str = "pangolin";

type Config = bp_pangolin_parachain::PangolinParachain;
type Extrinsic = sp_runtime::OpaqueExtrinsic;
}

#[async_trait::async_trait]
impl S2SClientGeneric for PangolinParachainClient {
type InitializationData = InitializationData<BundleHeader>;

async fn subscribe_grandpa_justifications(
&self,
) -> S2SClientResult<Subscription<sp_core::Bytes>> {
Ok(self
.subxt()
.rpc()
.client
.subscribe(
"grandpa_subscribeJustifications",
None,
"grandpa_unsubscribeJustifications",
)
.await?)
}

async fn prepare_initialization_data(&self) -> S2SClientResult<Self::InitializationData> {
Err(S2SClientError::Custom("Not need".to_string()))
}

async fn initialize(
&self,
initialization_data: Self::InitializationData,
) -> S2SClientResult<<Self::Config as Config>::Hash> {
Err(S2SClientError::Custom("Not need".to_string()))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[cfg(feature = "bridge-s2s-pangolin")]
mod bridge_pangolin;
mod generic;
2 changes: 2 additions & 0 deletions frame/assistants/client-pangolin-parachain/src/fastapi/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[cfg(feature = "bridge-s2s")]
pub mod bridge_s2s;
3 changes: 2 additions & 1 deletion frame/assistants/client-pangolin-parachain/src/lib.rs
Original file line number Diff line number Diff line change
@@ -2,5 +2,6 @@ pub mod client;
pub mod component;
pub mod config;
pub mod error;
pub mod fastapi;
pub mod subxt_runtime;
pub mod types;
pub mod subxt_runtime;
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ impl PangolinClient {
}

impl S2SClientBase for PangolinClient {
const CHAIN: &'static str = "pangolin";
const CHAIN: &'static str = "pangolinparachain";

type Config = bp_pangolin::Pangolin;
type Extrinsic = sp_runtime::OpaqueExtrinsic;
16 changes: 8 additions & 8 deletions frame/assistants/client-rococo/src/config.rs
Original file line number Diff line number Diff line change
@@ -16,13 +16,13 @@ pub struct ClientConfig {
pub enum RococoSubxtConfig {}

impl subxt::Config for RococoSubxtConfig {
type Index = u32;
type BlockNumber = u32;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = sp_runtime::AccountId32;
type Address = sp_runtime::MultiAddress<Self::AccountId, u32>;
type Header = sp_runtime::generic::Header<Self::BlockNumber, sp_runtime::traits::BlakeTwo256>;
type Signature = sp_runtime::MultiSignature;
type Index = bp_rococo::Nonce;
type BlockNumber = bp_rococo::BlockNumber;
type Hash = bp_rococo::Hash;
type Hashing = bp_rococo::Hashing;
type AccountId = bp_rococo::AccountId;
type Address = bp_rococo::Address;
type Header = bp_rococo::Header;
type Signature = bp_rococo::Signature;
type Extrinsic = sp_runtime::OpaqueExtrinsic;
}
Loading