Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d2d9cda
chore: support rust 1.76
StackOverflowExcept1on Dec 7, 2023
6605cfa
small fix
StackOverflowExcept1on Dec 8, 2023
aa1f8c8
update version
StackOverflowExcept1on Dec 9, 2023
ad341b8
fix clippy
StackOverflowExcept1on Dec 9, 2023
a571f9a
[skip-ci] fix new lints
StackOverflowExcept1on Dec 9, 2023
4f86ffd
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Dec 12, 2023
bf474e9
rm this file
StackOverflowExcept1on Dec 12, 2023
849dbb3
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Dec 30, 2023
e1a0498
try nightly-2024-01-25
StackOverflowExcept1on Jan 25, 2024
9f4742e
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Jan 25, 2024
bbc73fe
fix errors after merge
StackOverflowExcept1on Jan 25, 2024
00f0ac0
fix wasm builder
StackOverflowExcept1on Jan 25, 2024
93ab5a8
fix gstd tests
StackOverflowExcept1on Jan 25, 2024
7fc9671
fix fuzzer test
StackOverflowExcept1on Jan 25, 2024
bfe5ac2
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Jan 28, 2024
5317fc6
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Feb 1, 2024
26c1919
remove ptr::addr_of
StackOverflowExcept1on Feb 1, 2024
bf15a93
Merge remote-tracking branch 'origin/master' into av/rust-1.76-support
StackOverflowExcept1on Feb 2, 2024
e42c08e
remove gear_calls.rs after merge...
StackOverflowExcept1on Feb 2, 2024
9a9a157
some fixes
StackOverflowExcept1on Feb 2, 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
8 changes: 4 additions & 4 deletions common/numerated/src/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ mod tests {
#[test]
fn size() {
assert_eq!(Interval::<u8>::try_from(11..111).unwrap().size(), Some(100),);
assert_eq!(Interval::<u8>::try_from(..1).unwrap().size(), Some(1),);
assert_eq!(Interval::<u8>::from(..1).size(), Some(1),);
Comment thread
shamilsan marked this conversation as resolved.
assert_eq!(Interval::<u8>::from(..=1).size(), Some(2));
assert_eq!(Interval::<u8>::from(1..).size(), Some(255));
assert_eq!(Interval::<u8>::from(0..).size(), None);
Expand All @@ -452,15 +452,15 @@ mod tests {
Interval::<u8>::try_from(11..111).unwrap().raw_size(),
Some(100),
);
assert_eq!(Interval::<u8>::try_from(..1).unwrap().raw_size(), Some(1),);
assert_eq!(Interval::<u8>::from(..1).raw_size(), Some(1),);
assert_eq!(Interval::<u8>::from(..=1).raw_size(), Some(2));
assert_eq!(Interval::<u8>::from(1..).raw_size(), Some(255));
assert_eq!(Interval::<u8>::from(0..).raw_size(), None);
assert_eq!(Interval::<u8>::from(..).raw_size(), None);
assert_eq!(Interval::<u8>::try_from(1..1).unwrap().raw_size(), Some(0));

assert_eq!(Interval::<i8>::try_from(-1..99).unwrap().size(), Some(-28)); // corresponds to 100 numeration
assert_eq!(Interval::<i8>::try_from(..1).unwrap().size(), Some(1)); // corresponds to 129 numeration
assert_eq!(Interval::<i8>::from(..1).size(), Some(1)); // corresponds to 129 numeration
assert_eq!(Interval::<i8>::from(..=1).size(), Some(2)); // corresponds to 130 numeration
assert_eq!(Interval::<i8>::from(1..).size(), Some(-1)); // corresponds to 127 numeration
assert_eq!(Interval::<i8>::from(0..).size(), Some(0)); // corresponds to 128 numeration
Expand All @@ -471,7 +471,7 @@ mod tests {
Interval::<i8>::try_from(-1..99).unwrap().raw_size(),
Some(100)
);
assert_eq!(Interval::<i8>::try_from(..1).unwrap().raw_size(), Some(129));
assert_eq!(Interval::<i8>::from(..1).raw_size(), Some(129));
assert_eq!(Interval::<i8>::from(..=1).raw_size(), Some(130));
assert_eq!(Interval::<i8>::from(1..).raw_size(), Some(127));
assert_eq!(Interval::<i8>::from(0..).raw_size(), Some(128));
Expand Down
2 changes: 0 additions & 2 deletions examples/constructor/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ impl Calls {
self
}

// TODO #3452: remove this on next rust update
#[allow(clippy::useless_conversion)]
pub fn add_from_iter(mut self, calls: impl Iterator<Item = Call>) -> Self {
self.0.extend(calls.into_iter());
self
Expand Down
4 changes: 2 additions & 2 deletions examples/fungible-token/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ extern "C" fn state() {
decimals,
} = state;

let balances = balances.into_iter().map(|(k, v)| (k, v)).collect();
let balances = balances.into_iter().collect();
let allowances = allowances
.into_iter()
.map(|(id, allowance)| (id, allowance.into_iter().map(|(k, v)| (k, v)).collect()))
.map(|(id, allowance)| (id, allowance.into_iter().collect()))
.collect();
let payload = IoFungibleToken {
name,
Expand Down
4 changes: 2 additions & 2 deletions examples/node/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn process(request: Request) -> Reply {
transition.query_list = state().sub_nodes.iter().cloned().collect();
let first_sub_node = *transition
.query_list
.get(0)
.first()
.expect("Checked above that sub_nodes is not empty; qed");
transition.last_sent_message_id =
msg::send(first_sub_node, request, 0).unwrap();
Expand Down Expand Up @@ -176,7 +176,7 @@ fn process(request: Request) -> Reply {
if let TransitionState::Ready = transition.state {
let first_sub_node = *transition
.query_list
.get(0)
.first()
.expect("Checked above that sub_nodes is not empty; qed");

transition.query_index = 0;
Expand Down
8 changes: 1 addition & 7 deletions gcli/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Common utils for integration tests
pub use self::{
args::Args,
result::{Error, Result},
traits::{Convert, NodeExec},
};
pub use self::{args::Args, result::Result, traits::NodeExec};
use gear_core::ids::{CodeId, ProgramId};
use gsdk::{
ext::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32},
Expand All @@ -39,8 +35,6 @@ mod result;
pub mod traits;

mod prelude {
pub use scale_info::scale::Encode;

pub const ALICE_SS58_ADDRESS: &str = "kGkLEU3e3XXkJp2WK4eNpVmSab5xUNL9QtmLPh8QfCL2EgotW";
}

Expand Down
1 change: 0 additions & 1 deletion gclient/src/api/listener/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ mod subscription;

pub use gsdk::metadata::{gear::Event as GearEvent, Event};
pub use iterator::*;
pub use subscription::*;
Comment thread
breathx marked this conversation as resolved.

use crate::{Error, Result};
use async_trait::async_trait;
Expand Down
2 changes: 0 additions & 2 deletions gclient/src/api/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
pub(crate) mod account_id;
mod block;

pub use block::*;

use super::{GearApi, Result};
use crate::Error;
use account_id::IntoAccountId32;
Expand Down
2 changes: 1 addition & 1 deletion gclient/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ mod api;
mod utils;
mod ws;

pub use api::{calls::*, error::*, listener::*, GearApi};
Comment thread
breathx marked this conversation as resolved.
pub use api::{error::*, listener::*, GearApi};
pub use gsdk::metadata::errors;
pub use utils::*;
pub use ws::WSAddress;
3 changes: 1 addition & 2 deletions gsdk/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ impl Api {
],
);

let data: Option<(UserStoredMessage, Interval<u32>)> = self.fetch_storage(&addr).await.ok();
Ok(data.map(|(m, i)| (m, i)))
Ok(self.fetch_storage(&addr).await.ok())
}

/// Get all mailbox messages or for the provided `address`.
Expand Down
4 changes: 2 additions & 2 deletions gsdk/src/testing/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Node {
pub fn wait_for_log_record(&mut self, log: &str) -> Result<String> {
let stderr = self.process.stderr.as_mut();
let reader = BufReader::new(stderr.ok_or(Error::EmptyStderr)?);
for line in reader.lines().flatten() {
for line in reader.lines().map_while(|result| result.ok()) {
if line.contains(log) {
return Ok(line);
}
Expand All @@ -83,7 +83,7 @@ impl Node {
pub fn print_logs(&mut self) {
let stderr = self.process.stderr.as_mut();
let reader = BufReader::new(stderr.expect("Unable to get stderr"));
for line in reader.lines().flatten() {
for line in reader.lines().map_while(|result| result.ok()) {
println!("{line}");
}
}
Expand Down
2 changes: 1 addition & 1 deletion gstd/src/async_runtime/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl WakeSignals {
self.signals.contains_key(&reply_to)
}

pub fn poll(&mut self, reply_to: MessageId, cx: &Context<'_>) -> ReplyPoll {
pub fn poll(&mut self, reply_to: MessageId, cx: &mut Context<'_>) -> ReplyPoll {
match self.signals.remove(&reply_to) {
None => ReplyPoll::None,
Some(mut signal @ WakeSignal { payload: None, .. }) => {
Expand Down
2 changes: 1 addition & 1 deletion gstd/src/msg/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use core::{
use futures::future::FusedFuture;
use scale_info::scale::Decode;

fn poll<F, R>(waiting_reply_to: MessageId, cx: &Context<'_>, f: F) -> Poll<Result<R>>
fn poll<F, R>(waiting_reply_to: MessageId, cx: &mut Context<'_>, f: F) -> Poll<Result<R>>
where
F: Fn(Vec<u8>) -> Result<R>,
{
Expand Down
2 changes: 1 addition & 1 deletion pallets/gear-voucher/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ benchmarks! {

issue {
let issuer = benchmarking::account::<T::AccountId>("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&issuer,
100_000_000_000_000_u128.unique_saturated_into()
);
Expand Down
22 changes: 11 additions & 11 deletions pallets/gear/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,9 @@ benchmarks! {

claim_value {
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let program_id = benchmarking::account::<T::AccountId>("program", 0, 100);
CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let code = benchmarking::generate_wasm2(16.into()).unwrap();
benchmarking::set_program::<ProgramStorageOf::<T>, _>(ProgramId::from_origin(program_id.clone().into_origin()), code, 1.into());
let original_message_id = MessageId::from_origin(benchmarking::account::<T::AccountId>("message", 0, 100).into_origin());
Expand Down Expand Up @@ -497,7 +497,7 @@ benchmarks! {

pay_program_rent {
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let minimum_balance = CurrencyOf::<T>::minimum_balance();
let code = benchmarking::generate_wasm2(16.into()).unwrap();
let salt = vec![];
Expand All @@ -518,7 +518,7 @@ benchmarks! {

resume_session_init {
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let code = benchmarking::generate_wasm2(16.into()).unwrap();
let salt = vec![];
let program_id = ProgramId::generate_from_user(CodeId::generate(&code), &salt);
Expand All @@ -543,7 +543,7 @@ benchmarks! {
resume_session_push {
let c in 0 .. 16 * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u32;
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let code = benchmarking::generate_wasm2(16.into()).unwrap();
let salt = vec![];
let program_id = ProgramId::generate_from_user(CodeId::generate(&code), &salt);
Expand Down Expand Up @@ -579,7 +579,7 @@ benchmarks! {
resume_session_commit {
let c in 0 .. (MAX_PAGES - 1) * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u32;
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into());
let code = benchmarking::generate_wasm2(0.into()).unwrap();
let salt = vec![];
let program_id = ProgramId::generate_from_user(CodeId::generate(&code), &salt);
Expand Down Expand Up @@ -693,7 +693,7 @@ benchmarks! {
send_message {
let p in 0 .. MAX_PAYLOAD_LEN;
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let minimum_balance = CurrencyOf::<T>::minimum_balance();
let program_id = ProgramId::from_origin(benchmarking::account::<T::AccountId>("program", 0, 100).into_origin());
let code = benchmarking::generate_wasm2(16.into()).unwrap();
Expand All @@ -709,10 +709,10 @@ benchmarks! {
send_reply {
let p in 0 .. MAX_PAYLOAD_LEN;
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into());
let minimum_balance = CurrencyOf::<T>::minimum_balance();
let program_id = benchmarking::account::<T::AccountId>("program", 0, 100);
CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into());
let code = benchmarking::generate_wasm2(16.into()).unwrap();
benchmarking::set_program::<ProgramStorageOf::<T>, _>(ProgramId::from_origin(program_id.clone().into_origin()), code, 1.into());
let original_message_id = MessageId::from_origin(benchmarking::account::<T::AccountId>("message", 0, 100).into_origin());
Expand Down Expand Up @@ -743,7 +743,7 @@ benchmarks! {
let q in 1 .. MAX_PAGES;
let q = q as u16;
let caller: T::AccountId = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, (1u128 << 60).unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, (1u128 << 60).unique_saturated_into());
let code = benchmarking::generate_wasm(q.into()).unwrap();
let salt = vec![255u8; 32];
}: {
Expand All @@ -758,7 +758,7 @@ benchmarks! {
let q in 0 .. MAX_PAGES;
let q = q as u16;
let caller: T::AccountId = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, (1_u128 << 60).unique_saturated_into());
let _ = CurrencyOf::<T>::deposit_creating(&caller, (1_u128 << 60).unique_saturated_into());
let code = benchmarking::generate_wasm2(q.into()).unwrap();
let salt = vec![255u8; 32];
}: {
Expand Down
21 changes: 14 additions & 7 deletions pallets/gear/src/benchmarking/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ where
use demo_delayed_sender::WASM_BINARY;

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand All @@ -51,7 +52,8 @@ where
T::AccountId: Origin,
{
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -105,7 +107,8 @@ where
T::AccountId: Origin,
{
let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let code = benchmarking::generate_wasm2(16.into()).unwrap();
let salt = vec![];
let program_id = ProgramId::generate_from_user(CodeId::generate(&code), &salt);
Expand Down Expand Up @@ -144,7 +147,8 @@ where
use demo_reserve_gas::{InitAction, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -211,7 +215,8 @@ where
use demo_constructor::{Call, Calls, Scheme, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -267,7 +272,8 @@ where
use demo_waiter::{Command, WaitSubcommand, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down Expand Up @@ -317,7 +323,8 @@ where
use demo_waiter::{Command, WaitSubcommand, WASM_BINARY};

let caller = benchmarking::account("caller", 0, 0);
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());
let _ =
CurrencyOf::<T>::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into());

init_block::<T>(None);

Expand Down
14 changes: 7 additions & 7 deletions pallets/gear/src/benchmarking/tests/syscalls_integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where
utils::init_logger();

let origin = benchmarking::account::<T::AccountId>("origin", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&origin,
100_000_000_000_000_000_u128.unique_saturated_into(),
);
Expand Down Expand Up @@ -204,7 +204,7 @@ where
{
run_tester::<T, _, _, T::AccountId>(|tester_pid, _| {
let default_account = utils::default_account();
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&default_account,
100_000_000_000_000_u128.unique_saturated_into(),
);
Expand Down Expand Up @@ -394,7 +394,7 @@ where
let wasm_module = alloc_free_test_wasm::<T>();

let default_account = utils::default_account();
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&default_account,
100_000_000_000_000_u128.unique_saturated_into(),
);
Expand Down Expand Up @@ -486,7 +486,7 @@ where
{
run_tester::<T, _, _, T::AccountId>(|_, _| {
let message_sender = benchmarking::account::<T::AccountId>("some_user", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&message_sender,
50_000_000_000_000_u128.unique_saturated_into(),
);
Expand Down Expand Up @@ -1011,7 +1011,7 @@ where

// Deploy program with valid code hash
let child_deployer = benchmarking::account::<T::AccountId>("child_deployer", 0, 0);
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&child_deployer,
100_000_000_000_000_u128.unique_saturated_into(),
);
Expand All @@ -1028,7 +1028,7 @@ where

// Set default code-hash for create program calls
let default_account = utils::default_account();
CurrencyOf::<T>::deposit_creating(
let _ = CurrencyOf::<T>::deposit_creating(
&default_account,
100_000_000_000_000_u128.unique_saturated_into(),
);
Expand Down Expand Up @@ -1089,7 +1089,7 @@ where

// Manually reset the storage
Gear::<T>::reset();
CurrencyOf::<T>::slash(
let _ = CurrencyOf::<T>::slash(
&Id::from_origin(tester_pid.into_origin()),
CurrencyOf::<T>::free_balance(&Id::from_origin(tester_pid.into_origin())),
);
Expand Down
Loading