Skip to content
  1. Apr 08, 2024
    • Hernando Castano's avatar
      Initial Substrate Header Chain Implementation (#296) · 367bdfad
      Hernando Castano authored
      * Add pallet template from Substrate Dev Hub
      
      * Clean up un-needed stuff from template
      
      * Sketch out dispatchable interface
      
      * Introduce notion of finality chain
      
      * Add dependencies which were removed during a rebase
      
      * Sketch out idea for finality header-chain pallet
      
      * Sketch out ChainVerifier trait
      
      * Add storage parameter to verifier
      
      * Write out some things I think I need for finality verification
      
      * Add some pseudocode for marking finalized headers
      
      * Remove parity_scale_codec duplicate
      
      * Move verification logic into pallet
      
      I've been struggling with getting the generic types between the storage and verifier
      traits to play nice with each other. As a way to continue making progress I'm moving
      everything to the pallet. This way I hope to make progress towards a functional
      pallet.
      
      * Start doing verification around authority set changes
      
      * Remove commented BridgeStorage and ChainVerifier traits
      
      * Create Substrate bridge primitives crate
      
      * Add logic for updating scheduled authority sets
      
      * Introduce notion of imported headers
      
      * Implement basic header ancestry checker
      
      * Add mock runtime for tests
      
      * Add testing boilerplate
      
      * Add some storage read/write sanity tests
      
      * Add some basic header import tests
      
      * Add tests for ancestry proofs
      
      * Create helper for changing authority sets
      
      * Fix authority set test
      
      Fixes a problem with how the scheduled change was counted as well as
      a SCALE encoding issue
      
      * Correctly check for scheduled change digests
      
      There's no guarantee that the consensus digest item will be the last
      one in a header, which is how it was previously being checked.
      
      Thanks to Andre for pointing me to the Grandpa code that does this.
      
      * Mark imported headers as finalized when appropriate
      
      When a header that finalizes a chain of headers is succesfully imported
      we also want to mark its ancestors as finalized.
      
      * Add helper for writing test headers
      
      * Add test helper for scheduling authority set changes
      
      * Bump Substrate pallet and primitives to rc6
      
      * Remove Millau verifier implementation
      
      * Add some doc comments
      
      * Remove some needless returns
      
      * Make Clippy happy
      
      * Split block import from finalization
      
      * Make tests compile again
      
      * Add test for finalizing header after importing children
      
      * Create a test stub for importing future justifications
      
      * Start adding genesis config
      
      * Reject justifications from future
      
      We should only be accepting justifications for the header
      which enacted the current authority set. Any ancestors of
      that header which require a justification can be imported
      but they must not be finalized.
      
      * Add explanation to some `expect()` calls
      
      * Start adding GenesisConfig
      
      * Plug genesis config into runtime
      
      * Remove tests module
      
      * Check for overflow when updating authority sets
      
      * Make verifier take ownership of headers during import
      
      * Only store best finalized header hash
      
      Removed the need to store the whole header, since we store
      it was part of the ImportedHeaders structure anyways
      
      * Add some helpers to ImportedHeader
      
      * Update ancestry checker to work with ImportedHeaders
      
      * Update ancestry tests to use ImportedHeaders
      
      * Update import tests to use ImportedHeaders
      
      * Clean up some of the test helpers
      
      * Remove stray dbg!
      
      * Add doc comments throughout
      
      * Remove runtime related code
      
      * Fix Clippy warnings
      
      * Remove trait bound on ImportedHeader struct
      
      * Simplify checks in GenesisConfig
      
      * Rename `get_header_by_hash()`
      
      * Alias `parity_scale_codec` to `codec`
      
      * Reword Verifier documentation
      
      * Missed codec rename in tests
      
      * Split ImportError into FinalizationError
      
      * Remove ChainVerifier trait
      
      This trait was a remenant of the original design, and it is not required
      at the moment. Something like it should be added back in the future to
      ensure that other chains which conform to this interface can be used
      by higher-level bridge applications.
      
      * Fix the verifier tests so they compile
      
      * Implement Deref for ImportedHeader
      
      * Get rid of `new` methods for some Substrate primitives
      
      * Ensure that a child header's number follows its parent's
      
      * Prevent ancestry checker from aimlessly traversing to genesis
      
      If an ancestor which was newer than the child header we were checking we
      would walk all the way to genesis before realizing that we weren't related.
      This commit fixes that.
      
      * Remove redundant clones
      
      * Ensure that old headers are not finalized
      
      Prevents a panic where if the header being imported and `best_finalized`
      were the same header the ancestry checker would return an empty list. We
      had made an assumption that the list would always be populated, and if this
      didn't hold we would end up panicking.
      
      * Disallow imports at same height as `best_finalized`
      
      * Fix Clippy warnings
      
      * Make NextScheduledChange optional
      
      * Rework how scheduled authority set changes are enacted
      
      We now require a justification for headers which _enact_ changes
      instead of those which _schedule_ changes. A few changes had to
      be made to accomodate this, such as changing when we check for
      scheduled change logs in incoming headers.
      
      * Update documentation for Substrate Primitives
      
      * Clarify why we skip header in requires_justification check
      
      * Add description to assert! call
      
      * Fix formatting within macros
      
      * Remove unused dependencies from runtime
      
      * Remove expect call in GenesisConfig
      
      * Turn FinalityProof into a struct
      
      * Add some inline TODOs for follow up PRs
      
      * Remove test which enacted multiple changes
      
      This should be added back at some later point in time, but right now
      the code doesn't allow for this behaviour.
      
      * Use `contains_key` when checking for header
      
      This is better than using `get().is_some()` since we skip
      decoding the storage value
      
      * Use initial hash when updating best_finalized
      
      * Add better checks around enacting scheduled changes
      
      * Rename finality related functions
      
      * Appease Clippy
      367bdfad
    • Svyatoslav Nikolsky's avatar
      Extract minimal ethereum client (#359) · c84d8b4e
      Svyatoslav Nikolsky authored
      * relay-ethereum-client
      
      * use relay-ethereum-client from ethereum-poa-relay
      
      * cargo fmt --all
      
      * #![warn(missing_docs)]
      
      * EthereumRpcClient -> EthereumClient
      
      * make EthereumHeadersSyncPipeline private
      
      * return concrete type from crate::new
      
      * cleanup dependencies
      
      * *self -> self
      
      * remove trait Client
      
      * sort deps
      c84d8b4e
    • Svyatoslav Nikolsky's avatar
      Extract (headers, exchange, messages) relay loops into separate crates (#357) · 0d4479a4
      Svyatoslav Nikolsky authored
      
      
      * extracted relay crates
      
      * moved metrics to utils
      
      * exchange-relay compilation
      
      * fix compilation of headers-relay
      
      * fixed messages-relay compilation
      
      * fixed ethereum-poa-relay compilation
      
      * cargo lock
      
      * cargo fmt --all
      
      * clippy
      
      * cargo fmt --all
      
      * fix tests compilation
      
      * clippy
      
      * eof
      
      * module level docs
      
      * removed obsolete comment
      
      * #![warn(missing_docs)]
      
      * .0 -> Deref
      
      * post-merge fix
      
      * cargo fmt
      
      * Update relays/headers-relay/src/headers.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update relays/headers-relay/src/headers.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update relays/headers-relay/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      0d4479a4
    • Svyatoslav Nikolsky's avatar
      Support user-provided origins in Call-dispatch module (#355) · d3f35167
      Svyatoslav Nikolsky authored
      
      
      * call dispatch origin
      
      * Update modules/call-dispatch/src/lib.rs
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      
      * cargo fmt --all
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      d3f35167
    • Svyatoslav Nikolsky's avatar
      Relay receiving + processing confirmations (#351) · 9ac9ceeb
      Svyatoslav Nikolsky authored
      * relay receiving + processing confirmations
      
      * fmt && clippy
      
      * removed message processing race
      
      * remove more traces
      
      * generic args names
      9ac9ceeb
    • Hernando Castano's avatar
      Rename Ethereum Headers to AuraHeader (#354) · f4861dd5
      Hernando Castano authored
      * Rename Header to AuraHeader
      
      This prevents some type conflicts with the PolkadotJS Apps types.
      
      * Fix test and benchmark builds
      
      * Update AuraHeader in types.json
      f4861dd5
    • Svyatoslav Nikolsky's avatar
      Verify GRANDPA justifications from runtime (#353) · 6698b502
      Svyatoslav Nikolsky authored
      * verify justifications from runtime
      
      * unreachable
      6698b502
    • Svyatoslav Nikolsky's avatar
      Remove queueing from message-lane (#352) · 7b9b0104
      Svyatoslav Nikolsky authored
      * remove queueing from message-lane
      
      * also remove queueing from RPCs
      
      * another trace
      
      * new clippy
      7b9b0104
    • Svyatoslav Nikolsky's avatar
      Fix Rialto test-poa genesis state root (#350) · bc3ccec9
      Svyatoslav Nikolsky authored
      * fix test-poa genesis state root
      
      * fix test
      bc3ccec9
    • Svyatoslav Nikolsky's avatar
      Prepare separate runtime for testing sub2sub bridge (#341) · 89b19b73
      Svyatoslav Nikolsky authored
      * renamed bin/node/runtime to bin/node/rialto-runtime
      
      * replaced bridge-node-runtime references with rialto-runtime references
      
      * separate folders for millau/rialto nodes+runtimes
      
      * extracted pallet-shift-session-manager
      
      * bridge-node -> bridge-node-runtime
      
      * uninstall previous rust (temp solution???)
      
      * fix dockerfile
      
      * cargo fmt
      
      * fix benchmarks check
      
      * fix benchmarks again
      
      * update LAST_RUST_UPDATE to clear the cache
      
      * changed runtime comments
      
      * move bin/node/* to bin/
      
      * REVERT ME
      
      * Revert "REVERT ME"
      
      This reverts commit 7c335f946308ed11d9ed6ffec7c1c13dbe2743ed.
      
      * specify container name
      
      * REVERT ME
      
      * container_name -> hostname
      
      * fix typo
      
      * aliases
      
      * Revert "REVERT ME"
      
      This reverts commit 0e74af5f8430f1975a3fc924d8b52079f266bda1.
      
      * removed prefixes
      89b19b73
    • Svyatoslav Nikolsky's avatar
      Relay DummyOrdered messages (#318) · 77d94cb2
      Svyatoslav Nikolsky authored
      
      
      * DummyOrdered relay: initial commit
      
      * 1 ML file -> 3 files
      
      * extracted generic message race loop
      
      * uncommented race error procesing
      
      * lane loop tests
      
      * cargo fmt
      
      * moved HeaderId to utils.rs
      
      * restart lane loop on stall
      
      * message delivery strategy tests
      
      * removed obsolete code
      
      * clippy
      
      * Update relays/ethereum/src/message_lane_loop.rs
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      
      * Update relays/ethereum/src/message_lane_loop.rs
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      
      * added more races docs
      
      * Update relays/ethereum/src/message_race_delivery.rs
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      
      * update docs
      
      * Update relays/ethereum/src/message_race_loop.rs
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      
      * deal with TODOs
      
      * removed docs
      
      * docs
      
      * cargo fmt --all
      
      * Update relays/ethereum/src/message_race_loop.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      Co-authored-by: default avatarHernando Castano <[email protected]>
      77d94cb2
    • dependabot-preview[bot]'s avatar
      6ef25962
    • Svyatoslav Nikolsky's avatar
      Make message-lane Event generic (#345) · 4ba79180
      Svyatoslav Nikolsky authored
      
      
      * make message-lane Event generic
      
      * cargo fmt --all
      
      * Update modules/message-lane/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      4ba79180
    • Svyatoslav Nikolsky's avatar
      46fabba5
    • Svyatoslav Nikolsky's avatar
    • Tomasz Drwięga's avatar
      Initial version of `Call::decode` dispatch. (#300) · 4816e3d6
      Tomasz Drwięga authored
      
      
      * Initial version of call dispatch.
      
      * cargo fmt --all
      
      * Remove unused stuff.
      
      * cargo fmt --all
      
      * weight is part of msg + events
      
      * should_fail_on_weight_mismatch
      
      * plug into runtime
      
      * cargo fmt --all
      
      * fix benchmarks compilation?
      
      * expected/actual values in events
      
      * return actual weight from MessageDispatch::dispatch()
      
      * MessageOrigin -> InstanceId + move bridge_account_id to bp-runtime
      
      * fix benchmarks again
      
      * cargo fmt --all
      
      * clippy
      
      Co-authored-by: default avatarSvyatoslav Nikolsky <[email protected]>
      4816e3d6
    • Svyatoslav Nikolsky's avatar
      Custom RPC methods for DummyOrdered pallet (#317) · 7b1d8c6f
      Svyatoslav Nikolsky authored
      
      
      * RPC for DummyOrdered
      
      * add test for RPC
      
      * proof returned by RPC is Vec<<Vec<u8>>>.encode()
      
      * retrieval -> receiving
      
      * bp-runtime crate
      
      * bp-runtime supports no_std
      
      * cargo fmt --all
      
      * jsonrpc_core::BoxFuture
      
      * Update modules/message-lane/rpc/Cargo.toml
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update modules/message-lane/rpc/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * messageLane_ prefix for RPC methods
      
      * Update primitives/runtime/Cargo.toml
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update primitives/runtime/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update modules/message-lane/rpc/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update modules/message-lane/rpc/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update modules/message-lane/rpc/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      7b1d8c6f
    • Svyatoslav Nikolsky's avatar
      Initial version of DummyOrdered pallet (#299) · 35907f94
      Svyatoslav Nikolsky authored
      
      
      * initial commit of DummyOrdered (aka message-lane) pallet
      
      * API for relay
      
      * cargo fmt --all
      
      * some clippy + no_std
      
      * more clippy + no_std
      
      * inbound lane tests
      
      * outbound lane tests
      
      * cargo fmt --all
      
      * prune old messages whenever outbound lane is updated
      
      * do not care about MessageNonce overflow
      
      * cargo fmt --all
      
      * update crate docs
      
      * MaxHeadersToPruneAtOnce -> MaxMessagesToPruneAtOnce
      
      * MessageAction -> MessageResult
      
      * cargo fmt --all
      
      * fire MessageAccepted + MessagesDelivered
      
      * confirm message processing
      
      * cargo fmt --all
      
      * clippy
      
      * cargo fmt again
      
      * Update modules/message-lane/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Update modules/message-lane/src/lib.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * use crate::*
      
      * cargo fmt --all
      
      * Storage -> S
      
      * Update modules/message-lane/src/outbound_lane.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * add method doc
      
      * Update modules/message-lane/src/inbound_lane.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * added detailed module docs
      
      * Update modules/message-lane/src/lib.rs
      
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      
      * updated OnMessageReceived docs
      
      * prune only when new message is sent
      
      * removed #![warn(missing_docs)]
      
      * fixed merge with overlapped PR
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      35907f94
    • dependabot-preview[bot]'s avatar
      6a13c9e1
    • dependabot-preview[bot]'s avatar
    • dependabot-preview[bot]'s avatar
    • Svyatoslav Nikolsky's avatar
      Update substrate reference to rc6 (#321) · f6716106
      Svyatoslav Nikolsky authored
      
      
      * update substrate to rc6
      
      * clippy
      
      * fixed benchmarks compilation
      
      * Update bin/node/node/src/service.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      f6716106
    • Svyatoslav Nikolsky's avatar
      Fix (workaround) for "cannot read property 'toFixed' of null" (#297) · 9976b49a
      Svyatoslav Nikolsky authored
      * fix (workaround) for NaN CPU usage
      
      * cargo fmt --all
      9976b49a
    • Svyatoslav Nikolsky's avatar
      Remove errors from log (#294) · 40cab92c
      Svyatoslav Nikolsky authored
      * changed log level from error to trace
      
      * incomplete during submit != synced
      40cab92c
    • Svyatoslav Nikolsky's avatar
      MAX_SUBMITTED_HEADERS = 4 (#293) · 0cd69562
      Svyatoslav Nikolsky authored
      0cd69562
    • Hernando Castano's avatar
      Remove old Substrate pallet (#292) · 7bd9cd9d
      Hernando Castano authored
      7bd9cd9d
    • Hernando Castano's avatar
      Introduce Minimal Header Chain: Proving Interface (#287) · 547c048f
      Hernando Castano authored
      * Add header-chain primitive crate
      
      * Make MinimalHeaderChain functionaly the same as PeerBlockchain
      
      * Use a better doc comment for MinimalHeaderChain
      
      * Fix benchmark compilation
      
      * Rust Fmt
      
      * Remove Substrate based dependencies
      
      * Rename MinimalHeaderChain to BaseHeaderChain
      547c048f
    • Svyatoslav Nikolsky's avatar
      Parse all deploy contract arguments (#289) · 6fac7faf
      Svyatoslav Nikolsky authored
      * parse all deploy contract arguments
      
      * cargo fmt --all
      6fac7faf
    • Tomasz Drwięga's avatar
      Update open ethereum. (#290) · 883f816d
      Tomasz Drwięga authored
      * Update open ethereum.
      
      * Remove extra line break.
      
      * Remove branch comment.
      883f816d
    • dependabot-preview[bot]'s avatar
      4c34c4ed
    • dependabot-preview[bot]'s avatar
      83f0bdd1
    • dependabot-preview[bot]'s avatar
    • Hernando Castano's avatar
      Add instructions and scripts for local development (#280) · 050939c8
      Hernando Castano authored
      * Add dev deployment profile with Ethereum PoA config
      
      * Add scripts for running local components
      
      * Use `openethereum` folder
      
      * Add local development instructions in README
      
      * Add note about clone location
      
      * Point to right folder for scripts
      
      * Add some missing back-ticks
      
      * Remove Bertha and Carlos as authorities
      
      * Fix a line length issue
      050939c8
    • dependabot-preview[bot]'s avatar
      f88ab5ae
    • dependabot-preview[bot]'s avatar
    • dependabot-preview[bot]'s avatar
      fec7c0fe
    • Hernando Castano's avatar
    • Hernando Castano's avatar
      Rename Primitive Crates (#271) · a6d7d974
      Hernando Castano authored
      
      
      * 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: default avatarTomasz Drwięga <[email protected]>
      a6d7d974
    • Svyatoslav Nikolsky's avatar
      Prepare for sub to eth relay - part2 (#253) · 13a55c51
      Svyatoslav Nikolsky authored
      
      
      * fixed PoA contract deploy (granda_authorities call)
      
      * pause if all submitted headers were rejected
      
      * give funds to Bertha and Carlos
      
      * max 1 active PoA transaction in headers sync :(
      
      * display initial header id when deploying PoA contract
      
      * cargo fmt + clipy
      
      * update PoA contract to accept <= 4 Substrate headers at once
      
      * pause submitting headers when contract rejects all new headers + we have active transactions
      
      * fix compilation
      
      * cargo fmt --all
      
      * does_not_select_new_headers_to_submit_when_submit_is_paused
      
      * updated bridge contract
      
      * Update relays/ethereum/src/sync.rs
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * WiP.
      
      * Submit first incomplete header.
      
      * Finish up test.
      
      * cargo fmt --all
      
      * Remove redundant clone.
      
      * Address review comments.
      
      * cargo fmt --all
      
      * Fix clippy.
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      Co-authored-by: default avatarTomasz Drwięga <[email protected]>
      13a55c51
    • Hernando Castano's avatar
      Support Pallet Instances in Relay (#238) · a00f5649
      Hernando Castano authored
      * Sketch out how to support different bridge pallet instances
      
      * Create a common interface for using pallet instances
      
      * Start introducing generic instance parameter
      
      Attemps to make the compiler happy, but I'm having second thoughts about
      this approach. Commiting now as a way to have a checkpoint, but I think
      I'm going to need to re-consider my approach here.
      
      Ideally I want a change which introduces minimal changes, but this seems
      to be propagating around the codebase in ways I don't want.
      
      * Use trait objects instead of generics
      
      * Implement traits for Boxed trait objects
      
      This is done in order to statisfy trait bounds by types
      which use these new trait objects
      
      * Remove Clone usage for sync parameters
      
      * Remove implementation of Default for sync params
      
      * Require that BridgeInstance implements Debug
      
      * Ensure that BridgeInstance trait implements Send/Sync
      
      * Add documentation related to instances
      
      * Rust Fmt
      
      * Remove needless format
      
      * Make instance CLI option case insensitive
      
      * Replace `with_*` constructors with `new`
      
      * Clean up usage of instance structs
      
      * Enforce a default instance in the CLI params
      
      * Build sync params as we process input from CLI
      
      * Remove case insensitivity from sub-tx-mode
      
      I think this should happen, but maybe as part of a different PR
      
      * Process default Eth contract deployment config in CLI
      
      * Build EthereumExchangeParams in CLI
      
      * Process EthereumExchangeSubmitParams params in CLI
      a00f5649