Crate eth_bridge
source ·Expand description
Multi-network Ethereum Bridge pallet
Description
Provides functionality for cross-chain transfers of assets between Sora and Ethereum-based networks.
Overview
Bridge can be divided into 3 main parts:
- Bridge pallet. A Substrate pallet (this one).
- Middle-layer. A part of the bridge pallet, more precisely, off-chain workers.
- Bridge contracts. A set of smart-contracts deployed on Ethereum-based networks.
Definitions
Thischain - working chain/network. Sidechain - external chain/network. Network - an ethereum-based network with a bridge contract.
Bridge pallet
Stores basic information about networks: peers’ accounts, requests and registered assets/tokens.
Networks can be added and managed through requests. Requests can be incoming
(came from sidechain) or outgoing (to sidechain). Each request has it’s own
hash (differs from extrinsic hash), status (RequestStatus
), some specific data and additional information.
The requests life-cycle consists of 3 stages: validation, preparation and finalization.
Requests are registered by accounts and finalized by bridge peers.
Middle-layer
Works through off-chain workers. Any substrate node can be a bridge peer with its own
secret key (differs from validator’s key) and participate in bridge consensus (after election).
The bridge peer set (Peers
in storage) forms an n-of-m-multisignature account (BridgeAccount
in storage), which is used to finalize all requests.
Bridge contract
Persists the same multi-sig account (+- 1 signatory) for validating all its incoming requests.
Re-exports
pub use weights::WeightInfo;
pub use pallet::*;
Modules
- The module that hosts all the FRAME types needed to add this pallet to a runtime.
- Web3 Types
- Autogenerated weights for eth_bridge
Macros
Structs
- Network configuration.
- Network-specific parameters.
- Ethereum node parameters (url, credentials).
- Local peer config. Contains a set of networks that the peer is responsible for.
Enums
- Bridge asset parameters.
- Bridge function signature version
- Bridge status.
Constants
- A number of sidechain blocks needed to consider transaction as confirmed.
- Contract’s
Deposit(bytes32,uint256,address,bytes32)
event topic. - Maximum number of
Log
items pereth_getLogs
request. - Minimum peers required to start bridge migration