-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes in dancelight to enable solochain message relay + integration…
… of scripts
- Loading branch information
1 parent
ec6c96f
commit 61798f7
Showing
25 changed files
with
5,517 additions
and
5,234 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[package] | ||
name = "pallet-outbound-message-commitment-recorder" | ||
authors = { workspace = true } | ||
description = "Pallet that stores last block's message commitment root" | ||
edition = "2021" | ||
license = "GPL-3.0-only" | ||
version = "0.1.0" | ||
|
||
[package.metadata.docs.rs] | ||
targets = [ "x86_64-unknown-linux-gnu" ] | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
frame-support = { workspace = true } | ||
frame-system = { workspace = true } | ||
parity-scale-codec = { workspace = true } | ||
scale-info = { workspace = true } | ||
sp-core = { workspace = true } | ||
sp-runtime = { workspace = true } | ||
|
||
|
||
[features] | ||
default = [ "std" ] | ||
std = [ | ||
"frame-support/std", | ||
"frame-system/std", | ||
"parity-scale-codec/std", | ||
"scale-info/std", | ||
"sp-core/std", | ||
"sp-runtime/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"sp-runtime/runtime-benchmarks", | ||
] | ||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
"frame-system/try-runtime", | ||
"sp-runtime/try-runtime", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (C) Moondance Labs Ltd. | ||
// This file is part of Tanssi. | ||
|
||
// Tanssi is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Tanssi is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Tanssi. If not, see <http://www.gnu.org/licenses/> | ||
|
||
//! Commitment recorder pallet. | ||
//! | ||
//! A pallet to record outbound message commitment. | ||
//! | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
pub use pallet::*; | ||
|
||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use {frame_support::pallet_prelude::*, sp_core::H256}; | ||
|
||
/// The current storage version. | ||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); | ||
|
||
/// Configure the pallet by specifying the parameters and types on which it depends. | ||
#[pallet::config] | ||
pub trait Config: frame_system::Config { | ||
/// Overarching event type. | ||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>; | ||
} | ||
|
||
#[pallet::pallet] | ||
#[pallet::storage_version(STORAGE_VERSION)] | ||
pub struct Pallet<T>(_); | ||
|
||
#[pallet::event] | ||
#[pallet::generate_deposit(pub(super) fn deposit_event)] | ||
pub enum Event<T: Config> { | ||
NewCommitmentRootRecorded { commitment: H256 }, | ||
CommitmentRootRead { commitment: H256 }, | ||
} | ||
|
||
/// Message commitment from last block. | ||
/// This will be set only when there are messages to relay. | ||
#[pallet::storage] | ||
pub type RecordedCommitment<T: Config> = StorageValue<_, H256, OptionQuery>; | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn take_commitment_root() -> Option<H256> { | ||
let maybe_commitment = RecordedCommitment::<T>::take(); | ||
if let Some(commitment) = maybe_commitment { | ||
Pallet::<T>::deposit_event(Event::<T>::CommitmentRootRead { commitment }); | ||
Some(commitment) | ||
} else { | ||
None | ||
} | ||
} | ||
|
||
pub fn record_commitment_root(commitment: H256) { | ||
RecordedCommitment::<T>::put(commitment); | ||
Pallet::<T>::deposit_event(Event::<T>::NewCommitmentRootRecorded { commitment }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"source": { | ||
"ethereum": { | ||
"endpoint": "" | ||
}, | ||
"polkadot": { | ||
"endpoint": "" | ||
}, | ||
"contracts": { | ||
"BeefyClient": null, | ||
"Gateway": null | ||
}, | ||
"channel-id": null | ||
}, | ||
"sink": { | ||
"ethereum": { | ||
"endpoint": "" | ||
}, | ||
"contracts": { | ||
"Gateway": null | ||
} | ||
}, | ||
"schedule": { | ||
"id": 0, | ||
"totalRelayerCount": 1, | ||
"sleepInterval": 10 | ||
} | ||
} |
Oops, something went wrong.