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

Update substrate #1038

Merged
merged 18 commits into from
Jun 12, 2022
2,882 changes: 1,307 additions & 1,575 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "GPL-3.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
primitive-types = { version = "0.11.1", default-features = false, features = ["scale-info"] }
log = "0.4.17"
gear-common-codegen = { path = "./codegen" }
Expand Down
4 changes: 2 additions & 2 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use core::fmt;
use frame_support::{
dispatch::{DispatchError, DispatchResult},
traits::Imbalance,
weights::{IdentityFee, WeightToFeePolynomial},
weights::{IdentityFee, WeightToFee},
};
use gear_core::{
ids::{CodeId, MessageId, ProgramId},
Expand Down Expand Up @@ -134,7 +134,7 @@ pub trait GasPrice {
/// A price for the `gas` amount of gas.
/// In general case, this doesn't necessarily has to be constant.
fn gas_price(gas: u64) -> Self::Balance {
IdentityFee::<Self::Balance>::calc(&gas)
IdentityFee::<Self::Balance>::weight_to_fee(&gas)
}
}

Expand Down
6 changes: 3 additions & 3 deletions common/src/storage/complex/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub trait Mailbox {
fn remove(key1: Self::Key1, key2: Self::Key2) -> Result<Self::Value, Self::OutputError>;

/// Removes all values from all key's mailboxes.
fn remove_all();
fn clear();
}

/// Represents store of mailbox's action callbacks.
Expand Down Expand Up @@ -138,8 +138,8 @@ where
}
}

fn remove_all() {
T::remove_all()
fn clear() {
T::clear()
}
}

Expand Down
6 changes: 3 additions & 3 deletions common/src/storage/complex/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ pub trait Messenger {
Self::Sent::reset();
Self::Dequeued::reset();
Self::QueueProcessing::allow();
Self::Queue::remove_all();
Self::Mailbox::remove_all();
Self::Waitlist::remove_all();
Self::Queue::clear();
Self::Mailbox::clear();
Self::Waitlist::clear();
}
}
6 changes: 3 additions & 3 deletions common/src/storage/complex/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub trait Queue {
fn queue(value: Self::Value) -> Result<(), Self::OutputError>;

/// Removes all values from queue.
fn remove_all();
fn clear();

/// Inserts given value at the beginning of the queue.
///
Expand Down Expand Up @@ -87,8 +87,8 @@ where
T::push_back(key, value).map_err(Into::into)
}

fn remove_all() {
T::remove_all()
fn clear() {
T::clear()
}

fn requeue(value: Self::Value) -> Result<(), Self::OutputError> {
Expand Down
6 changes: 3 additions & 3 deletions common/src/storage/complex/waitlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub trait Waitlist {
) -> Result<(Self::Value, Self::BlockNumber), Self::OutputError>;

/// Removes all values from all key's waitlisted.
fn remove_all();
fn clear();
}

/// Represents store of waitlist's action callbacks.
Expand Down Expand Up @@ -156,8 +156,8 @@ where
}
}

fn remove_all() {
T::remove_all()
fn clear() {
T::clear()
}
}

Expand Down
12 changes: 6 additions & 6 deletions common/src/storage/complicated/dequeue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub trait Dequeue {
fn push_front(key: Self::Key, value: Self::Value) -> Result<(), Self::Error>;

/// Removes all values.
fn remove_all();
fn clear();
}

/// Represents store of dequeue's action callbacks.
Expand All @@ -77,8 +77,8 @@ pub trait DequeueCallbacks {
type OnPushBack: Callback<Self::Value>;
/// Callback on success `push_front`.
type OnPushFront: Callback<Self::Value>;
/// Callback on success `remove_all`.
type OnRemoveAll: EmptyCallback;
/// Callback on success `clear`.
type OnClear: EmptyCallback;
}

/// Represents dequeue error type.
Expand Down Expand Up @@ -308,11 +308,11 @@ where
}
}

fn remove_all() {
fn clear() {
HVS::kill();
TVS::kill();
MS::remove_all();
Callbacks::OnRemoveAll::call();
MS::clear();
Callbacks::OnClear::call();
}
}

Expand Down
6 changes: 3 additions & 3 deletions common/src/storage/primitives/double_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub trait DoubleMapStorage {
fn remove(key1: Self::Key1, key2: Self::Key2);

/// Removes all values.
fn remove_all();
fn clear();

/// Gets value stored under given keys, if present,
/// and removes it from storage.
Expand Down Expand Up @@ -127,8 +127,8 @@ macro_rules! wrap_storage_double_map {
$storage::<T>::remove(key1, key2)
}

fn remove_all() {
$storage::<T>::remove_all(None);
fn clear() {
let _ = $storage::<T>::clear(u32::MAX, None);
}

fn take(key1: Self::Key1, key2: Self::Key2) -> Option<Self::Value> {
Expand Down
16 changes: 5 additions & 11 deletions common/src/storage/primitives/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub trait MapStorage {
fn remove(key: Self::Key);

/// Removes all values.
fn remove_all();
fn clear();

/// Gets value stored under given key, if present,
/// and removes it from storage.
Expand All @@ -86,7 +86,7 @@ macro_rules! wrap_storage_map {
(storage: $storage: ident, name: $name: ident, key: $key: ty, value: $val: ty) => {
wrap_storage_map!(storage: $storage, name: $name, key: $key, value: $val, counted None);
};
(storage: $storage: ident, name: $name: ident, key: $key: ty, value: $val: ty, counted $($rm_arg:expr)?) => {
(storage: $storage: ident, name: $name: ident, key: $key: ty, value: $val: ty,) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should no be trailing comma after macro args

pub struct $name<T>(PhantomData<T>);

impl<T: crate::Config> MapStorage for $name<T> {
Expand Down Expand Up @@ -118,8 +118,8 @@ macro_rules! wrap_storage_map {
$storage::<T>::remove(key)
}

fn remove_all() {
$storage::<T>::remove_all($($rm_arg)?);
fn clear() {
let _ = $storage::<T>::clear(u32::MAX, None);
}

fn take(key: Self::Key) -> Option<Self::Value> {
Expand All @@ -137,13 +137,7 @@ macro_rules! wrap_storage_map {
#[macro_export]
macro_rules! wrap_counted_storage_map {
(storage: $storage: ident, name: $name: ident, key: $key: ty, value: $val: ty, length: $len: ty) => {
$crate::wrap_storage_map!(
storage: $storage,
name: $name,
key: $key,
value: $val,
counted
);
$crate::wrap_storage_map!(storage: $storage, name: $name, key: $key, value: $val,);

impl<T: crate::Config> Counted for $name<T> {
type Length = $len;
Expand Down
2 changes: 1 addition & 1 deletion core-errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
license = "GPL-3.0"

[dependencies]
scale-info = { version = "2.0.1", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"], optional = true }
derive_more = "0.99.17"

[dependencies.codec]
Expand Down
2 changes: 1 addition & 1 deletion core-processor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gear-core = { path = "../core" }
gear-core-errors = { path = "../core-errors" }
gear-backend-common = { path = "../core-backend/common" }

blake2-rfc = { version = "0.2.16", default-features = false }
blake2-rfc = { version = "0.2.18", default-features = false }
codec = { package = "parity-scale-codec", version = "3.1.2", features = ["derive"], default-features = false }
log = { version = "0.4.17", default-features = false }
anyhow = { version = "1.0.57", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ license = "GPL-3.0"

[dependencies]
gear-core-errors = { path = "../core-errors" }
blake2-rfc = { version = "0.2.16", default-features = false }
blake2-rfc = { version = "0.2.18", default-features = false }
codec = { package = "parity-scale-codec", version = "3.1.2", features = [
"derive",
], default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
derive_more = "0.99.17"
log = { version = "0.4.17", default-features = false }
parity-wasm = { version = "0.42.2", default-features = false }
Expand Down
Loading