darwinia-network / bridger

Relayer client implementation for Darwinia LCMP protocols.
https://rust-docs.darwinia.network/bridger
GNU General Public License v3.0
11 stars 10 forks source link

Refactor: split to multiple binaries #267

Closed fewensa closed 2 years ago

fewensa commented 3 years ago

Description

Execution failed (exit code 101).
/.cargo/bin/cargo.exe metadata --verbose --format-version 1 --all-features
stdout : error: failed to select a version for the requirement `pallet-grandpa = "=3.1.0"`
candidate versions found which didn't match: 3.0.0
location searched: Git repository https://github.com/darwinia-network/substrate.git?branch=main#c94e0cdf
required by package `pangolin-runtime v2.6.2 (https://github.com/darwinia-network/darwinia-common.git?branch=master#b2c11c25)`
    ... which is depended on by `task-pangolin-pangoro v0.4.5 (/bridger/task/task-pangolin-pangoro)`
    ... which is depended on by `darwinia-bridger v0.4.5 (/bridger/bin)`

stderr : 

With the increase of bridges, similar dependency problems will increase. maybe we can change a strategy and generate each bridge as a binary, like cargo

.cargo/bin $ ls cargo*
cargo-clippy  cargo-expand  cargo-fmt     cargo-miri    cargo-tree    cargo

execute

cargo fmt
cargo clippy

for bridger

bridger  brdger-darwinia-ethereum bridger-pangolin-pangoro

execute

bridger darwinia-ethereum <COMMAND>
bridger pangolin-pangoro <COMMAND>
fewensa commented 2 years ago

Another advantage is that each bridge can set custom commands, such as https://github.com/darwinia-network/parity-bridges-common/blob/7be2b478b49bc8e87ddfe034076e9e80e2f126f6/relays/bin-substrate/src/cli/encode_call.rs#L38-L81

hackfisher commented 2 years ago

This might be a good approach, considering the complexity of dependancy management and long compile time(test/ci/cd).

But at the same time, we might still need a way to manage different bridge task services and share a common framework lib.

If we going to do this, split to multiple binaries should be straight forward, and I does not expect to much refactor work related to this.

hackfisher commented 2 years ago

https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands

You can skip this sub-command management tool first, or consider fork cargo when you have time later, and change the name to bridger to manage different bridge relay commands in a similar way. It is recommended that the services of each bridge relay be separated and kept simple.