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 - Inbound Queue #6697

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
07808bd
inbound queue v2
claravanstaden Nov 20, 2024
6f238eb
adds sparse bitmap
claravanstaden Nov 21, 2024
b0115cd
use sparse bitmap
claravanstaden Nov 21, 2024
c27def2
use payfees
claravanstaden Nov 21, 2024
93b4516
Update bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs
claravanstaden Nov 25, 2024
3a13134
Update bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs
claravanstaden Nov 25, 2024
7e23462
rename NonceBitmap
claravanstaden Nov 25, 2024
68f5a8e
config T::XcmPrologueFee: Balance
claravanstaden Nov 25, 2024
02e8081
burn fees
claravanstaden Nov 25, 2024
ee0bc27
fix westend config
claravanstaden Nov 25, 2024
4309272
use sendcontroller
claravanstaden Nov 25, 2024
de00eb6
runtime config for sendcontroller
claravanstaden Nov 25, 2024
3653b7f
wip
claravanstaden Nov 25, 2024
990bf47
tests
claravanstaden Nov 26, 2024
9f7829c
xcm fee
claravanstaden Nov 26, 2024
11839dc
adds comments
claravanstaden Nov 26, 2024
8974696
revert sendcontroller
claravanstaden Nov 27, 2024
75d3c06
adds test for xcm register command
claravanstaden Nov 27, 2024
c666d23
update test
claravanstaden Nov 27, 2024
42d688a
runtime api
claravanstaden Nov 28, 2024
92e3419
adds comment
claravanstaden Nov 28, 2024
37ecd53
update test
claravanstaden Nov 28, 2024
69a660b
update tests
claravanstaden Nov 28, 2024
43f0d8d
Merge branch 'master' into inbound-queue-v2-clean
claravanstaden Nov 28, 2024
71929f6
prdoc
claravanstaden Nov 28, 2024
5735960
adds register token test
claravanstaden Nov 28, 2024
a935ff2
enable exchange asset on AH
claravanstaden Nov 28, 2024
373d63a
fix transact
claravanstaden Nov 29, 2024
a61ceef
Fix for register token
yrong Nov 29, 2024
fae2947
Merge pull request #6 from yrong/ron/inbound-queue-v2-clean
claravanstaden Nov 29, 2024
7e64403
add pool
claravanstaden Dec 2, 2024
d77a1ee
fix pool owner
claravanstaden Dec 2, 2024
f40cfd4
use weth for execution fees on AH
claravanstaden Dec 2, 2024
9b8117b
cleanup test
claravanstaden Dec 2, 2024
c2804dc
fix aliasorigin
claravanstaden Dec 3, 2024
02750d6
remove unnecessary alias origin
claravanstaden Dec 4, 2024
40e85ea
separate inbound pallet index IDs for v1 and v2
claravanstaden Dec 5, 2024
d70ac6c
fix reentrancy bug
claravanstaden Dec 5, 2024
bc45bbd
send all assets in a single instruction
claravanstaden Dec 5, 2024
9ffb3e1
use descend origin instead of alias origin
claravanstaden Dec 5, 2024
85d355e
use claimer for refund surplus, otherwise relayer
claravanstaden Dec 5, 2024
1168a16
Merge branch 'master' into inbound-queue-v2-clean
claravanstaden Dec 5, 2024
f1263e4
more tests
claravanstaden Dec 5, 2024
2d3a834
Merge remote-tracking branch 'origin/inbound-queue-v2-clean' into inb…
claravanstaden Dec 5, 2024
6af760b
allow invalid xcm
claravanstaden Dec 5, 2024
b368760
allow invalid claimer
claravanstaden Dec 6, 2024
9939927
move claimer before assets
claravanstaden Dec 6, 2024
028e0e8
Merge branch 'master' into inbound-queue-v2-clean
claravanstaden Dec 6, 2024
8f11a76
apply weight at most change
claravanstaden Dec 6, 2024
2484821
penpal test
claravanstaden Dec 9, 2024
373c878
pna progress
claravanstaden Dec 9, 2024
30d0cf4
finish integration tests
claravanstaden Dec 9, 2024
a35eee1
adds tests, changes message format
claravanstaden Dec 10, 2024
6208dfd
fmt
claravanstaden Dec 10, 2024
d0624e2
fmt
claravanstaden Dec 10, 2024
c66fcb1
change fee asset from weth to eth
claravanstaden Dec 10, 2024
ddece3c
adds abi decoding
claravanstaden Dec 10, 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
62 changes: 62 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ members = [
"bridges/snowbridge/pallets/ethereum-client/fixtures",
"bridges/snowbridge/pallets/inbound-queue",
"bridges/snowbridge/pallets/inbound-queue/fixtures",
"bridges/snowbridge/pallets/inbound-queue-v2",
"bridges/snowbridge/pallets/inbound-queue-v2/fixtures",
"bridges/snowbridge/pallets/inbound-queue-v2/runtime-api",
"bridges/snowbridge/pallets/outbound-queue",
"bridges/snowbridge/pallets/outbound-queue/merkle-tree",
"bridges/snowbridge/pallets/outbound-queue/runtime-api",
Expand Down Expand Up @@ -1228,6 +1231,9 @@ snowbridge-pallet-ethereum-client = { path = "bridges/snowbridge/pallets/ethereu
snowbridge-pallet-ethereum-client-fixtures = { path = "bridges/snowbridge/pallets/ethereum-client/fixtures", default-features = false }
snowbridge-pallet-inbound-queue = { path = "bridges/snowbridge/pallets/inbound-queue", default-features = false }
snowbridge-pallet-inbound-queue-fixtures = { path = "bridges/snowbridge/pallets/inbound-queue/fixtures", default-features = false }
snowbridge-pallet-inbound-queue-fixtures-v2 = { path = "bridges/snowbridge/pallets/inbound-queue-v2/fixtures", default-features = false }
snowbridge-pallet-inbound-queue-v2 = { path = "bridges/snowbridge/pallets/inbound-queue-v2", default-features = false }
snowbridge-inbound-queue-v2-runtime-api = { path = "bridges/snowbridge/pallets/inbound-queue-v2/runtime-api", default-features = false }
snowbridge-pallet-outbound-queue = { path = "bridges/snowbridge/pallets/outbound-queue", default-features = false }
snowbridge-pallet-system = { path = "bridges/snowbridge/pallets/system", default-features = false }
snowbridge-router-primitives = { path = "bridges/snowbridge/primitives/router", default-features = false }
Expand Down
96 changes: 96 additions & 0 deletions bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
[package]
name = "snowbridge-pallet-inbound-queue-v2"
description = "Snowbridge Inbound Queue Pallet V2"
version = "0.2.0"
authors = ["Snowfork <[email protected]>"]
edition.workspace = true
repository.workspace = true
license = "Apache-2.0"
categories = ["cryptography::cryptocurrencies"]

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
serde = { optional = true, workspace = true, default-features = true }
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
hex-literal = { optional = true, workspace = true, default-features = true }
log = { workspace = true }
alloy-primitives = { features = ["rlp"], workspace = true }
alloy-sol-types = { workspace = true }

frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-balances = { workspace = true }
sp-core = { workspace = true }
sp-std = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }

xcm = { workspace = true }
xcm-executor = { workspace = true }
xcm-builder = { workspace = true }

snowbridge-core = { workspace = true }
snowbridge-router-primitives = { workspace = true }
snowbridge-beacon-primitives = { workspace = true }
snowbridge-pallet-inbound-queue-fixtures-v2 = { optional = true, workspace = true }

[dev-dependencies]
frame-benchmarking = { workspace = true, default-features = true }
sp-keyring = { workspace = true, default-features = true }
snowbridge-pallet-ethereum-client = { workspace = true, default-features = true }
hex-literal = { workspace = true, default-features = true }
hex = { workspace = true, default-features = true }

[features]
default = ["std"]
std = [
"alloy-primitives/std",
"alloy-sol-types/std",
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-balances/std",
"scale-info/std",
"serde",
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-pallet-inbound-queue-fixtures-v2?/std",
"snowbridge-router-primitives/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"xcm-executor/std",
"xcm-builder/std",
"xcm/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"hex-literal",
"pallet-balances/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"snowbridge-pallet-inbound-queue-fixtures-v2/runtime-benchmarks",
"snowbridge-router-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"snowbridge-pallet-ethereum-client/try-runtime",
"sp-runtime/try-runtime",
]
3 changes: 3 additions & 0 deletions bridges/snowbridge/pallets/inbound-queue-v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ethereum Inbound Queue

Reads messages from Ethereum and sends it to intended destination on Polkadot, using XCM.
34 changes: 34 additions & 0 deletions bridges/snowbridge/pallets/inbound-queue-v2/fixtures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "snowbridge-pallet-inbound-queue-fixtures-v2"
description = "Snowbridge Inbound Queue Test Fixtures V2"
version = "0.10.0"
authors = ["Snowfork <[email protected]>"]
edition.workspace = true
repository.workspace = true
license = "Apache-2.0"
categories = ["cryptography::cryptocurrencies"]

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
hex-literal = { workspace = true, default-features = true }
sp-core = { workspace = true }
sp-std = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-beacon-primitives = { workspace = true }

[features]
default = ["std"]
std = [
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"sp-core/std",
"sp-std/std",
]
runtime-benchmarks = [
"snowbridge-core/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
#![cfg_attr(not(feature = "std"), no_std)]

pub mod register_token;
pub mod send_token;
pub mod send_token_to_penpal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
// Generated, do not edit!
// See ethereum client README.md for instructions to generate

use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_core::inbound::{InboundQueueFixture, Log, Message, Proof};
use sp_core::U256;
use sp_std::vec;

pub fn make_register_token_message() -> InboundQueueFixture {
InboundQueueFixture {
message: Message {
event_log: Log {
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(),
topics: vec![
hex!("7153f9357c8ea496bba60bf82e67143e27b64462b49041f8e689e1b05728f84f").into(),
hex!("c173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539").into(),
hex!("5f7060e971b0dc81e63f0aa41831091847d97c1a4693ac450cc128c7214e65e0").into(),
],
data: hex!("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002e00a736aa00000000000087d1f7fdfee7f651fabc8bfcb6e086c278b77a7d00e40b54020000000000000000000000000000000000000000000000000000000000").into(),
},
proof: Proof {
receipt_proof: (vec![
hex!("dccdfceea05036f7b61dcdabadc937945d31e68a8d3dfd4dc85684457988c284").to_vec(),
hex!("4a98e45a319168b0fc6005ce6b744ee9bf54338e2c0784b976a8578d241ced0f").to_vec(),
], vec![
hex!("f851a09c01dd6d2d8de951c45af23d3ad00829ce021c04d6c8acbe1612d456ee320d4980808080808080a04a98e45a319168b0fc6005ce6b744ee9bf54338e2c0784b976a8578d241ced0f8080808080808080").to_vec(),
hex!("f9028c30b9028802f90284018301d205b9010000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000080000000000000000000000000000004000000000080000000000000000000000000000000000010100000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000040004000000000000002000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000200000000000010f90179f85894eda338e4dc46038493b885327842fd3e301cab39e1a0f78bb28d4b1d7da699e5c0bc2be29c2b04b5aab6aacf6298fe5304f9db9c6d7ea000000000000000000000000087d1f7fdfee7f651fabc8bfcb6e086c278b77a7df9011c94eda338e4dc46038493b885327842fd3e301cab39f863a07153f9357c8ea496bba60bf82e67143e27b64462b49041f8e689e1b05728f84fa0c173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539a05f7060e971b0dc81e63f0aa41831091847d97c1a4693ac450cc128c7214e65e0b8a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002e00a736aa00000000000087d1f7fdfee7f651fabc8bfcb6e086c278b77a7d00e40b54020000000000000000000000000000000000000000000000000000000000").to_vec(),
]),
execution_proof: ExecutionProof {
header: BeaconHeader {
slot: 393,
proposer_index: 4,
parent_root: hex!("6545b47a614a1dd4cad042a0cdbbf5be347e8ffcdc02c6c64540d5153acebeef").into(),
state_root: hex!("b62ac34a8cb82497be9542fe2114410c9f6021855b766015406101a1f3d86434").into(),
body_root: hex!("04005fe231e11a5b7b1580cb73b177ae8b338bedd745497e6bb7122126a806db").into(),
},
ancestry_proof: Some(AncestryProof {
header_branch: vec![
hex!("6545b47a614a1dd4cad042a0cdbbf5be347e8ffcdc02c6c64540d5153acebeef").into(),
hex!("fa84cc88ca53a72181599ff4eb07d8b444bce023fe2347c3b4f51004c43439d3").into(),
hex!("cadc8ae211c6f2221c9138e829249adf902419c78eb4727a150baa4d9a02cc9d").into(),
hex!("33a89962df08a35c52bd7e1d887cd71fa7803e68787d05c714036f6edf75947c").into(),
hex!("2c9760fce5c2829ef3f25595a703c21eb22d0186ce223295556ed5da663a82cf").into(),
hex!("e1aa87654db79c8a0ecd6c89726bb662fcb1684badaef5cd5256f479e3c622e1").into(),
hex!("aa70d5f314e4a1fbb9c362f3db79b21bf68b328887248651fbd29fc501d0ca97").into(),
hex!("160b6c235b3a1ed4ef5f80b03ee1c76f7bf3f591c92fca9d8663e9221b9f9f0f").into(),
hex!("f68d7dcd6a07a18e9de7b5d2aa1980eb962e11d7dcb584c96e81a7635c8d2535").into(),
hex!("1d5f912dfd6697110dd1ecb5cb8e77952eef57d85deb373572572df62bb157fc").into(),
hex!("ffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b").into(),
hex!("6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220").into(),
hex!("b7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f").into(),
],
finalized_block_root: hex!("751414cd97c0624f922b3e80285e9f776b08fa22fd5f87391f2ed7ef571a8d46").into(),
}),
execution_header: VersionedExecutionPayloadHeader::Deneb(deneb::ExecutionPayloadHeader {
parent_hash: hex!("8092290aa21b7751576440f77edd02a94058429ce50e63a92d620951fb25eda2").into(),
fee_recipient: hex!("0000000000000000000000000000000000000000").into(),
state_root: hex!("96a83e9ddf745346fafcb0b03d57314623df669ed543c110662b21302a0fae8b").into(),
receipts_root: hex!("dccdfceea05036f7b61dcdabadc937945d31e68a8d3dfd4dc85684457988c284").into(),
logs_bloom: hex!("00000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000080000000400000000000000000000004000000000080000000000000000000000000000000000010100000000000000000000000000000000020000000000000000000000000000000000080000000000000000000000000000040004000000000000002002002000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000080000000000000000000000000000000000100000000000000000200000200000010").into(),
prev_randao: hex!("62e309d4f5119d1f5c783abc20fc1a549efbab546d8d0b25ff1cfd58be524e67").into(),
block_number: 393,
gas_limit: 54492273,
gas_used: 199644,
timestamp: 1710552813,
extra_data: hex!("d983010d0b846765746888676f312e32312e368664617277696e").into(),
base_fee_per_gas: U256::from(7u64),
block_hash: hex!("6a9810efb9581d30c1a5c9074f27c68ea779a8c1ae31c213241df16225f4e131").into(),
transactions_root: hex!("2cfa6ed7327e8807c7973516c5c32a68ef2459e586e8067e113d081c3bd8c07d").into(),
withdrawals_root: hex!("792930bbd5baac43bcc798ee49aa8185ef76bb3b44ba62b91d86ae569e4bb535").into(),
blob_gas_used: 0,
excess_blob_gas: 0,
}),
execution_branch: vec![
hex!("a6833fa629f3286b6916c6e50b8bf089fc9126bee6f64d0413b4e59c1265834d").into(),
hex!("b46f0c01805fe212e15907981b757e6c496b0cb06664224655613dcec82505bb").into(),
hex!("db56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71").into(),
hex!("d3af7c05c516726be7505239e0b9c7cb53d24abce6b91cdb3b3995f0164a75da").into(),
],
}
},
},
finalized_header: BeaconHeader {
slot: 864,
proposer_index: 4,
parent_root: hex!("614e7672f991ac268cd841055973f55e1e42228831a211adef207bb7329be614").into(),
state_root: hex!("5fa8dfca3d760e4242ab46d529144627aa85348a19173b6e081172c701197a4a").into(),
body_root: hex!("0f34c083b1803666bb1ac5e73fa71582731a2cf37d279ff0a3b0cad5a2ff371e").into(),
},
block_roots_root: hex!("b9aab9c388c4e4fcd899b71f62c498fc73406e38e8eb14aa440e9affa06f2a10").into(),
}
}
Loading