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

feat(runtime): Add pallet-gear-bridges #3650

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
113 changes: 108 additions & 5 deletions Cargo.lock

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

95 changes: 54 additions & 41 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ members = [
"examples/async-signal-entry",
"examples/async-tester",
"examples/autoreply",
"examples/bridge-messaging",
"examples/calc-hash",
"examples/custom",
"examples/delayed-reservation-sender",
Expand Down Expand Up @@ -90,7 +91,7 @@ members = [
"pallets/*",
"runtime/*",
"utils/*",
"utils/runtime-fuzzer/fuzz"
"utils/runtime-fuzzer/fuzz",
]

[workspace.dependencies]
Expand Down Expand Up @@ -120,6 +121,7 @@ futures-util = "0.3.29"
hashbrown = "0.14.3"
hex = { version = "0.4.3", default-features = false }
hex-literal = "0.4.1"
impl-trait-for-tuples = "0.2.2"
jsonrpsee = { version = "^0.16" }
lazy_static = "1.4.0"
libc = { version = "0.2", default-features = false }
Expand All @@ -141,7 +143,7 @@ regex = "^1.9"
region = "3.0.0"
reqwest = { version = "0.11.22", default-features = false }
scale-info = { version = "2.5.0", default-features = false }
serde = "^1"
serde = { version = "^1", default-features = false }
serde_json = "^1"
serde_yaml = "0.8.26"
sha-1 = "0.10.1"
Expand Down Expand Up @@ -179,12 +181,13 @@ authorship = { package = "gear-authorship", path = "node/authorship" }
common = { package = "gear-common", path = "common", default-features = false }
core-processor = { package = "gear-core-processor", path = "core-processor", default-features = false }
galloc = { path = "galloc" }
gbuiltin = { path = "gbuiltin" }
gcore = { path = "gcore" }
gcli = { path = "gcli" }
gclient = { path = "gclient" }
gsdk = { path = "gsdk" }
gsdk-codegen = { path = "gsdk/codegen" }
gstd = { path = "gstd", features = [ "nightly" ] }
gstd = { path = "gstd", features = ["nightly"] }
gstd-codegen = { path = "gstd/codegen" }
gsys = { path = "gsys" }
gtest = { path = "gtest" }
Expand Down Expand Up @@ -231,6 +234,10 @@ pallet-gear-staking-rewards-rpc = { path = "pallets/staking-rewards/rpc" }
pallet-gear-staking-rewards-rpc-runtime-api = { path = "pallets/staking-rewards/rpc/runtime-api", default-features = false }
pallet-gear-voucher = { path = "pallets/gear-voucher", default-features = false }
pallet-gear-bank = { path = "pallets/gear-bank", default-features = false }
pallet-gear-builtin-actor = { path = "pallets/gear-builtin-actor", default-features = false }
pallet-gear-builtin-actor-rpc = { path = "pallets/gear-builtin-actor/rpc" }
pallet-gear-builtin-actor-rpc-runtime-api = { path = "pallets/gear-builtin-actor/rpc/runtime-api", default-features = false }
pallet-gear-bridges = { path = "pallets/gear-bridges", default-features = false }
runtime-common = { package = "gear-runtime-common", path = "runtime/common", default-features = false }
runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", default-features = false }
service = { package = "gear-service", path = "node/service", default-features = false }
Expand All @@ -239,7 +246,9 @@ vara-runtime = { path = "runtime/vara", default-features = false }
wasm-smith = { version = "0.12.21", git = "https://github.com/gear-tech/wasm-tools.git", branch = "gear-stable" }

# Common executors between `sandbox-host` and `calc-stack-height`
sandbox-wasmer = { package = "wasmer", version = "2.2", features = ["singlepass"] }
sandbox-wasmer = { package = "wasmer", version = "2.2", features = [
"singlepass",
] }
sandbox-wasmer-types = { package = "wasmer-types", version = "2.2" }

# Substrate deps
Expand Down Expand Up @@ -301,7 +310,9 @@ sp-debug-derive = { version = "8.0.0", git = "https://github.com/gear-tech/subst
sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-cli = { version = "0.10.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-client-db = { version = "0.10.0-dev", features = ["rocksdb"], git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-client-db = { version = "0.10.0-dev", features = [
"rocksdb",
], git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-executor = { version = "0.10.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-executor-common = { version = "0.10.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
sc-consensus-grandpa = { version = "0.10.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v1.0.0-canary" }
Expand Down Expand Up @@ -372,6 +383,7 @@ demo-async-init = { path = "examples/async-init" }
demo-async-recursion = { path = "examples/async-recursion" }
demo-async-signal-entry = { path = "examples/async-signal-entry" }
demo-async-tester = { path = "examples/async-tester" }
demo-bridge-messaging = { path = "examples/bridge-messaging" }
demo-calc-hash = { path = "examples/calc-hash" }
demo-calc-hash-in-one-block = { path = "examples/calc-hash/in-one-block" }
demo-calc-hash-over-blocks = { path = "examples/calc-hash/over-blocks" }
Expand All @@ -381,7 +393,9 @@ demo-compose = { path = "examples/compose" }
demo-constructor = { path = "examples/constructor", default-features = false }
demo-delayed-sender = { path = "examples/delayed-sender" }
demo-distributor = { path = "examples/distributor" }
demo-futures-unordered = { path = "examples/futures-unordered", features = ["debug"] }
demo-futures-unordered = { path = "examples/futures-unordered", features = [
"debug",
] }
demo-gas-burned = { path = "examples/gas-burned" }
demo-fungible-token = { path = "examples/fungible-token" }
demo-incomplete-async-payloads = { path = "examples/incomplete-async-payloads" }
Expand Down Expand Up @@ -421,41 +435,40 @@ demo-wat = { path = "examples/wat" }
# Dependencies that only used in one package
#
# TODO: remove these dependencies (from this file?) or add more docs.
cfg-if = "1.0.0" # gear-lazy-pages
errno = "0.3" # gear-lazy-pages
nix = "0.26.4" # gear-lazy-pages
impl-trait-for-tuples = "0.2.2" # pallets/staking-rewards
indexmap = "2.1.0" # utils/weight-diff
indicatif = "*" # utils/wasm-gen
keyring = "1.2.1" # gcli
libp2p = "=0.50.1" # gcli (same version as sc-consensus)
mimalloc = { version = "0.1.39", default-features = false } # node/cli
nacl = "0.5.3" # gcli
nonempty = "0.8.1" # utils/utils
libfuzzer-sys = "0.4" # utils/runtime-fuzzer/fuzz
page_size = { version = "0.6", default-features = false } # pallets/gear
pathdiff = { version = "0.2.1", default-features = false } # utils/wasm-builder
rand_pcg = "0.3.1" # pallets/gear
schnorrkel = "0.9.1" # gcli
scopeguard = { version = "1.2.0", default-features = false } # pallets/gear
tabled = "0.10.0" # utils/regression-analysis
thousands = "0.2.0" # utils/regression-analysis
toml = "0.7.8" # utils/wasm-builder
tracing = "0.1.40" # utils/node-loder
tracing-appender = "0.2" # utils/node-loder
tracing-subscriber = "0.3.18" # utils/node-loder
trybuild = "1" # gstd/codegen
wasm-opt = "0.112.0" # utils/wasm-builder
wasmprinter = "0.2" # utils/wasm-gen
whoami = "1.4.0" # gcli
fail = "0.5" # gear-common
scale-value = "^0.12" # gsdk
heck = "0.4.1" # gsdk-api-gen
etc = "0.1.16" # gcli
toml_edit = "0.21.0" # crates-io
scale-decode = "0.9.0" # gsdk
directories = "5.0.1" # utils/key-finder
num-traits = { version = "0.2", default-features = false } # gear-core
cfg-if = "1.0.0" # gear-lazy-pages
errno = "0.3" # gear-lazy-pages
nix = "0.26.4" # gear-lazy-pages
indexmap = "2.1.0" # utils/weight-diff
indicatif = "*" # utils/wasm-gen
keyring = "1.2.1" # gcli
libp2p = "=0.50.1" # gcli (same version as sc-consensus)
mimalloc = { version = "0.1.39", default-features = false } # node/cli
nacl = "0.5.3" # gcli
nonempty = "0.8.1" # utils/utils
libfuzzer-sys = "0.4" # utils/runtime-fuzzer/fuzz
page_size = { version = "0.6", default-features = false } # pallets/gear
pathdiff = { version = "0.2.1", default-features = false } # utils/wasm-builder
rand_pcg = "0.3.1" # pallets/gear
schnorrkel = "0.9.1" # gcli
scopeguard = { version = "1.2.0", default-features = false } # pallets/gear
tabled = "0.10.0" # utils/regression-analysis
thousands = "0.2.0" # utils/regression-analysis
toml = "0.7.8" # utils/wasm-builder
tracing = "0.1.40" # utils/node-loder
tracing-appender = "0.2" # utils/node-loder
tracing-subscriber = "0.3.18" # utils/node-loder
trybuild = "1" # gstd/codegen
wasm-opt = "0.112.0" # utils/wasm-builder
wasmprinter = "0.2" # utils/wasm-gen
whoami = "1.4.0" # gcli
fail = "0.5" # gear-common
scale-value = "^0.12" # gsdk
heck = "0.4.1" # gsdk-api-gen
etc = "0.1.16" # gcli
toml_edit = "0.21.0" # crates-io
scale-decode = "0.9.0" # gsdk
directories = "5.0.1" # utils/key-finder
num-traits = { version = "0.2", default-features = false } # gear-core

# TODO: remove after wasmer bug is fixed:
# `misaligned pointer dereference: address must be a multiple of 0x8 but is...`
Expand Down
3 changes: 3 additions & 0 deletions core-processor/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ impl ProcessExecutionContext {
}
}

/// System reservation context.
#[derive(Debug, Default)]
pub struct SystemReservationContext {
/// Reservation created in current execution.
Expand All @@ -168,6 +169,7 @@ pub struct SystemReservationContext {
}

impl SystemReservationContext {
/// Extracts reservation context from dispatch.
pub fn from_dispatch(dispatch: &IncomingDispatch) -> Self {
Self {
current_reservation: None,
Expand All @@ -178,6 +180,7 @@ impl SystemReservationContext {
}
}

/// Checks if there are any reservations.
pub fn has_any(&self) -> bool {
self.current_reservation.is_some() || self.previous_reservation.is_some()
}
Expand Down
Loading
Loading