Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snowbridge V2 - Unified Rewards #1

Open
wants to merge 40 commits into
base: outbound-queue-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
738a2de
Inbound queue v2
yrong Oct 18, 2024
f6b9968
Respect V2 contract
yrong Oct 20, 2024
2e827e8
More cleanup
yrong Oct 20, 2024
ca8e226
Comments
yrong Oct 20, 2024
23cf919
Merge branch 'inbound-queue-v2' into clara/unified-rewards
claravanstaden Oct 23, 2024
a4bf3be
new pallet
claravanstaden Oct 17, 2024
4ebf7e8
cleanup
claravanstaden Oct 18, 2024
d85bac5
move rewards interface
claravanstaden Oct 18, 2024
48d285e
lock file
claravanstaden Oct 23, 2024
21e4bf8
progress
claravanstaden Oct 18, 2024
655a45b
progress
claravanstaden Oct 18, 2024
61fa771
more tests
claravanstaden Oct 18, 2024
6346718
more tests
claravanstaden Oct 18, 2024
4b9be93
adds pallet integration
claravanstaden Oct 23, 2024
9d6d13d
adds deposit reward
claravanstaden Oct 23, 2024
2139274
tests
claravanstaden Oct 23, 2024
a6ec370
rewards progress
claravanstaden Oct 23, 2024
ffffb6b
test progress
claravanstaden Oct 23, 2024
1bbf90d
fix test
claravanstaden Oct 24, 2024
dd5ad4a
use BalanceOf
claravanstaden Oct 24, 2024
496d89e
burn fees
claravanstaden Oct 24, 2024
8d049b7
todo
claravanstaden Oct 24, 2024
6487068
cleanup
claravanstaden Oct 24, 2024
0e9cca0
Rebase inbound queue
yrong Oct 24, 2024
93959ef
tests
claravanstaden Oct 25, 2024
55c6989
Merge branch 'outbound-queue-v2' into clara/unified-rewards
claravanstaden Oct 25, 2024
1d5957b
merge damage
claravanstaden Oct 25, 2024
bb01477
Merge branch 'inbound-queue-v2' into clara/unified-rewards
claravanstaden Oct 25, 2024
a66a0ca
test test compilation
claravanstaden Oct 25, 2024
45a582b
fix unit tests
claravanstaden Oct 25, 2024
93e46f9
move rewards work to relayer pallet
claravanstaden Oct 30, 2024
a97785f
tests
claravanstaden Oct 30, 2024
f6efbd4
refactoring
claravanstaden Oct 30, 2024
6e78187
fix inbound queue
claravanstaden Oct 30, 2024
c79b9b8
fixes
claravanstaden Oct 30, 2024
5d4e495
configure inbound id
claravanstaden Oct 30, 2024
1295cad
fix integration tests
claravanstaden Oct 31, 2024
44cd54e
fmt
claravanstaden Oct 31, 2024
2afc09f
use configured inbound queue pallet index
claravanstaden Oct 31, 2024
8dadc2d
update tests
claravanstaden Oct 31, 2024
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
28 changes: 28 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ members = [
"bridges/snowbridge/pallets/outbound-queue-v2",
"bridges/snowbridge/pallets/outbound-queue-v2/runtime-api",
"bridges/snowbridge/pallets/outbound-queue/runtime-api",
"bridges/snowbridge/pallets/rewards",
"bridges/snowbridge/pallets/system",
"bridges/snowbridge/pallets/system/runtime-api",
"bridges/snowbridge/primitives/beacon",
Expand Down Expand Up @@ -1217,6 +1218,7 @@ snowbridge-pallet-inbound-queue-v2 = { path = "bridges/snowbridge/pallets/inboun
snowbridge-pallet-outbound-queue = { path = "bridges/snowbridge/pallets/outbound-queue", default-features = false }
snowbridge-pallet-outbound-queue-v2 = { path = "bridges/snowbridge/pallets/outbound-queue-v2", default-features = false }
snowbridge-pallet-system = { path = "bridges/snowbridge/pallets/system", default-features = false }
snowbridge-pallet-rewards = { path = "bridges/snowbridge/pallets/rewards", default-features = false }
snowbridge-router-primitives = { path = "bridges/snowbridge/primitives/router", default-features = false }
snowbridge-runtime-common = { path = "bridges/snowbridge/runtime/runtime-common", default-features = false }
snowbridge-runtime-test-common = { path = "bridges/snowbridge/runtime/test-common", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ snowbridge-pallet-inbound-queue-fixtures-v2 = { optional = true, workspace = tru
frame-benchmarking = { workspace = true, default-features = true }
sp-keyring = { workspace = true, default-features = true }
snowbridge-pallet-ethereum-client = { workspace = true, default-features = true }
snowbridge-pallet-rewards = { workspace = true, default-features = true }
hex-literal = { workspace = true, default-features = true }

[features]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,6 @@ mod benchmarks {
create_message.block_roots_root,
);

let sovereign_account = sibling_sovereign_account::<T>(1000u32.into());

let minimum_balance = T::Token::minimum_balance();

// So that the receiving account exists
assert_ok!(T::Token::mint_into(&caller, minimum_balance));
// Fund the sovereign account (parachain sovereign account) so it can transfer a reward
// fee to the caller account
assert_ok!(T::Token::mint_into(
&sovereign_account,
3_000_000_000_000u128
.try_into()
.unwrap_or_else(|_| panic!("unable to cast sovereign account balance")),
));

#[block]
{
assert_ok!(InboundQueue::<T>::submit(
Expand Down
15 changes: 6 additions & 9 deletions bridges/snowbridge/pallets/inbound-queue-v2/src/envelope.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
use snowbridge_core::{inbound::Log, ChannelId};
use snowbridge_core::inbound::Log;

use sp_core::{RuntimeDebug, H160, H256};
use sp_core::{RuntimeDebug, H160};
use sp_std::prelude::*;

use alloy_primitives::B256;
use alloy_sol_types::{sol, SolEvent};

sol! {
event OutboundMessageAccepted(bytes32 indexed channel_id, uint64 nonce, bytes32 indexed message_id, bytes payload);
event OutboundMessageAccepted(uint64 indexed nonce, uint128 fee, bytes payload);
}

/// An inbound message that has had its outer envelope decoded.
#[derive(Clone, RuntimeDebug)]
pub struct Envelope {
/// The address of the outbound queue on Ethereum that emitted this message as an event log
pub gateway: H160,
/// The message Channel
pub channel_id: ChannelId,
/// A nonce for enforcing replay protection and ordering.
pub nonce: u64,
/// An id for tracing the message on its route (has no role in bridge consensus)
pub message_id: H256,
/// Total fee paid in Ether on Ethereum, should cover all the cost
pub fee: u128,
/// The inner payload generated from the source application.
pub payload: Vec<u8>,
}
Expand All @@ -41,9 +39,8 @@ impl TryFrom<&Log> for Envelope {

Ok(Self {
gateway: log.address,
channel_id: ChannelId::from(event.channel_id.as_ref()),
nonce: event.nonce,
message_id: H256::from(event.message_id.as_ref()),
fee: event.fee,
payload: event.payload,
})
}
Expand Down
Loading
Loading