Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
38181d6
Update substrate to v0.9.42
ukint-vs Jul 16, 2023
38f2380
Update runtimes
ukint-vs Jul 16, 2023
e7126e5
TypeInfo HandleKind
ukint-vs Jul 16, 2023
3a63a0a
Update node/service
ukint-vs Jul 16, 2023
9fe9452
Use verify instead of removed verify_weak
ukint-vs Jul 16, 2023
746d71f
gear-replay-cli update
ukint-vs Jul 16, 2023
d951683
gsdk update
ukint-vs Jul 16, 2023
72ba5f6
Update mocks
ukint-vs Jul 17, 2023
285edb8
misc update fuzzer, integration tests
ukint-vs Jul 18, 2023
0a1e799
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Aug 26, 2023
5c2483b
update mocks
ukint-vs Aug 26, 2023
1059913
update node test
ukint-vs Aug 26, 2023
b738016
skip missing weights
ukint-vs Aug 26, 2023
2b8e17f
fix resume_program_works: account ED
ukint-vs Aug 26, 2023
a1cea79
Nomination pools migration v5: rewardpool fix
ukint-vs Aug 26, 2023
9d1a05e
nom pools MigrateV3ToV5, offences MigrateToV1
ukint-vs Aug 26, 2023
f4224ab
update gsdk metadata
ukint-vs Aug 26, 2023
c9523f6
update gclient
ukint-vs Aug 26, 2023
cb15048
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Sep 1, 2023
ece5834
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Oct 21, 2023
bda819a
remove validator-set pallet
ukint-vs Oct 21, 2023
d1256b6
clean up runtime-interface
ukint-vs Oct 21, 2023
7f2bb4d
clean up common
ukint-vs Oct 23, 2023
e649eba
clean up lazy-pages
ukint-vs Oct 23, 2023
adae247
clean up utils
ukint-vs Oct 23, 2023
87eccb8
clean up node
ukint-vs Oct 23, 2023
7c94b27
others
ukint-vs Oct 23, 2023
20bbe52
update Cargo.lock
ukint-vs Oct 23, 2023
5edd18f
Merge branch 'master' into vs/remove-unused-deps
ukint-vs Oct 23, 2023
2aeea33
fiz fuzzer
ukint-vs Oct 23, 2023
b64f8ca
Merge branch 'vs/remove-unused-deps' into vs/substrate-v0.9.43-2
ukint-vs Oct 23, 2023
aafadf0
migrations
ukint-vs Oct 23, 2023
0ee2d4e
impl Credit Dust handler in pallet-staking-rewards
ukint-vs Oct 23, 2023
6e6f593
fix runtime-fuzzer
ukint-vs Oct 23, 2023
d4fae08
Update Cargo.lock
ukint-vs Oct 24, 2023
28983ce
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Oct 24, 2023
84cacdb
fix gcli test
ukint-vs Oct 24, 2023
4a0278c
revert gossip_duration
ukint-vs Oct 29, 2023
f14a064
fix typo
ukint-vs Oct 29, 2023
e2710f2
build our own executor
ukint-vs Oct 29, 2023
3fe4dc1
update substrate commit
ukint-vs Oct 29, 2023
d184e90
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Oct 29, 2023
5da12cf
fmt
ukint-vs Oct 29, 2023
6e59312
Update branch
ukint-vs Oct 24, 2023
b3af9d1
update substrate commit
ukint-vs Oct 29, 2023
73ae5fa
Fix gsdk wasm strategy
ukint-vs Oct 24, 2023
0141028
Update node/service
ukint-vs Oct 24, 2023
198cadb
Update runtime params
ukint-vs Oct 24, 2023
85ac6a1
Update gsdk
ukint-vs Oct 24, 2023
7410f3f
Update staking-rewards
ukint-vs Oct 24, 2023
a6c85dc
fix staking-rewards tests
ukint-vs Oct 29, 2023
84ffa05
clippy node
ukint-vs Oct 29, 2023
6aac336
update Cargo.lock
ukint-vs Oct 29, 2023
3510f31
fix migration
ukint-vs Oct 29, 2023
b1b92b1
update gsdk metadata
ukint-vs Oct 29, 2023
87bd13f
resolve comments
ukint-vs Oct 30, 2023
2682aec
Update weights
ukint-vs Oct 30, 2023
7cab152
disable hw benches for dev node
ukint-vs Oct 31, 2023
c4af7e3
ws-port -> rpc-port
ukint-vs Oct 31, 2023
19ce6b3
clippy
ukint-vs Oct 31, 2023
2f3ecab
set correct pallets storage version via migration
ukint-vs Nov 7, 2023
a0abfd4
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Nov 8, 2023
b48e2bd
Update Cargo.lock
ukint-vs Nov 8, 2023
dcbec86
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Nov 8, 2023
be06b0a
Merge branch 'master' into vs/substrate-v0.9.43-2
ukint-vs Dec 1, 2023
8a37b9a
use new logic flag
ukint-vs Dec 1, 2023
56142f5
fix cargo_metadata
ukint-vs Dec 1, 2023
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
2,157 changes: 1,280 additions & 877 deletions Cargo.lock

Large diffs are not rendered by default.

237 changes: 119 additions & 118 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions common/src/pallet_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ macro_rules! impl_pallet_balances {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type HoldIdentifier = ();
type MaxHolds = ();
}
};
}
Expand Down
8 changes: 6 additions & 2 deletions gcli/src/keystore/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ impl Key {
}

/// Verify messages
pub fn verify<P>(sig: &[u8], message: &[u8], pubkey: &[u8]) -> Result<bool>
pub fn verify<'a, P>(sig: &'a [u8], message: &[u8], pubkey: &'a [u8]) -> Result<bool>
where
P: Pair,
<P as gsdk::ext::sp_core::Pair>::Signature: TryFrom<&'a [u8]>,
<P as gsdk::ext::sp_core::Pair>::Public: TryFrom<&'a [u8]>,
{
Ok(P::verify_weak(sig, message, pubkey))
let pubkey = P::Public::try_from(pubkey).map_err(|_| Error::InvalidPublic)?;
let sig = P::Signature::try_from(sig).map_err(|_| Error::InvalidSignature)?;
Ok(P::verify(&sig, message, &pubkey))
}
}
2 changes: 2 additions & 0 deletions gcli/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub enum Error {
InvalidPassword,
#[error("Invalid public key")]
InvalidPublic,
#[error("Invalid signature")]
InvalidSignature,
#[error("Invalid secret key")]
InvalidSecret,
#[error(transparent)]
Expand Down
8 changes: 6 additions & 2 deletions gcli/tests/cmd/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use crate::common::{
Args, Result,
};

// ExtraFlags is hardcoded
// const IS_NEW_LOGIC: u128 = 0x80000000_00000000_00000000_00000000u128;
const EXPECTED_BALANCE: &str = r#"
AccountInfo {
nonce: 0,
Expand All @@ -32,8 +34,10 @@ AccountInfo {
data: AccountData {
free: 1000000000000000000,
reserved: 0,
misc_frozen: 0,
fee_frozen: 0,
frozen: 0,
flags: ExtraFlags(
170141183460469231731687303715884105728,
),
},
}
"#;
Expand Down
57 changes: 26 additions & 31 deletions gclient/src/api/calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use gsdk::{
event::{CodeChangeKind, MessageEntry},
ActiveProgram,
},
pallet_balances::{pallet::Call as BalancesCall, AccountData},
pallet_balances::{pallet::Call as BalancesCall, types::AccountData},
pallet_gear::pallet::Call as GearCall,
pallet_gear_bank::pallet::BankAccount,
sp_weights::weight_v2::Weight,
Expand Down Expand Up @@ -289,8 +289,10 @@ impl GearApi {
Ok(AccountData {
free: 0u128,
reserved: 0,
misc_frozen: 0,
fee_frozen: 0,
frozen: 0,
flags: gsdk::metadata::runtime_types::pallet_balances::types::ExtraFlags(
170141183460469231731687303715884105728,
),
})
} else {
Err(e)
Expand All @@ -316,8 +318,10 @@ impl GearApi {
Ok(AccountData {
free: 0u128,
reserved: 0,
misc_frozen: 0,
fee_frozen: 0,
frozen: 0,
flags: gsdk::metadata::runtime_types::pallet_balances::types::ExtraFlags(
170141183460469231731687303715884105728,
),
})
} else {
Err(e)
Expand Down Expand Up @@ -378,19 +382,14 @@ impl GearApi {

// Apply data to the target program
dest_node_api
.set_balance(
.force_set_balance(
dest_program_id.into_account_id(),
src_program_account_data.free,
src_program_account_data.reserved,
)
.await?;

dest_node_api
.set_balance(
crate::bank_address(),
src_bank_account_data.free,
src_bank_account_data.reserved,
)
.force_set_balance(crate::bank_address(), src_bank_account_data.free)
.await?;

dest_node_api
Expand Down Expand Up @@ -421,9 +420,6 @@ impl GearApi {
.await?;

for account_with_reserved_funds in accounts_with_reserved_funds {
let src_account_data = self
.account_data_at(account_with_reserved_funds, src_block_hash)
.await?;
let src_account_bank_data = self
.bank_data_at(account_with_reserved_funds, src_block_hash)
.await
Expand All @@ -443,8 +439,11 @@ impl GearApi {
Ok(AccountData {
free: 0u128,
reserved: 0,
misc_frozen: 0,
fee_frozen: 0,
frozen: 0,
flags:
gsdk::metadata::runtime_types::pallet_balances::types::ExtraFlags(
170141183460469231731687303715884105728,
),
})
} else {
Err(e)
Expand All @@ -462,12 +461,9 @@ impl GearApi {
})?;

dest_node_api
.set_balance(
.force_set_balance(
account_with_reserved_funds.into_account_id(),
dest_account_data.free,
dest_account_data
.reserved
.saturating_add(src_account_data.reserved),
)
.await?;

Expand Down Expand Up @@ -569,8 +565,11 @@ impl GearApi {
Ok(AccountData {
free: 0u128,
reserved: 0,
misc_frozen: 0,
fee_frozen: 0,
frozen: 0,
flags:
gsdk::metadata::runtime_types::pallet_balances::types::ExtraFlags(
170141183460469231731687303715884105728,
),
})
} else {
Err(e)
Expand Down Expand Up @@ -601,10 +600,9 @@ impl GearApi {
.map(|(page_number, page_data)| (page_number.raw(), page_data.encode()))
.collect::<HashMap<_, _>>();

self.set_balance(
self.force_set_balance(
MultiAddress::Id(program_id.into_account_id()),
memory_dump.balance,
memory_dump.reserved_balance,
)
.await?;

Expand Down Expand Up @@ -1311,24 +1309,21 @@ impl GearApi {
self.set_code_without_checks(code).await
}

/// Set the free and reserved balance of the `to` account to `new_free` and
/// `new_reserved` respectively.
/// Set the free balance of the `to` account to `new_free`.
///
/// Sends the [`pallet_balances::set_balance`](https://crates.parity.io/pallet_balances/pallet/struct.Pallet.html#method.set_balance) extrinsic.
pub async fn set_balance(
pub async fn force_set_balance(
&self,
to: impl Into<MultiAddress<AccountId32, ()>>,
new_free: u128,
new_reserved: u128,
) -> Result<H256> {
let events = self
.0
.calls
.sudo_unchecked_weight(
RuntimeCall::Balances(BalancesCall::set_balance {
RuntimeCall::Balances(BalancesCall::force_set_balance {
who: to.into().convert(),
new_free,
new_reserved,
}),
Weight {
ref_time: 0,
Expand Down
2 changes: 1 addition & 1 deletion gclient/src/api/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use gsdk::{
ext::sp_core::{crypto::Ss58Codec, H256},
metadata::runtime_types::{
gear_common::storage::primitives::Interval, gear_core::message::user,
pallet_balances::AccountData, pallet_gear_bank::pallet::BankAccount,
pallet_balances::types::AccountData, pallet_gear_bank::pallet::BankAccount,
},
};

Expand Down
15 changes: 13 additions & 2 deletions gsdk/api-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,29 @@ fn main() -> Result<()> {
/// Get the metadata of vara runtime.
fn metadata() -> Vec<u8> {
use gear_runtime_interface as gear_ri;
use sc_executor::WasmExecutionMethod;
use sc_executor::{WasmExecutionMethod, WasmtimeInstantiationStrategy};
use sc_executor_common::runtime_blob::RuntimeBlob;

// 1. Get the wasm binary of `RUNTIME_WASM`.
let path = env::var(RUNTIME_WASM).expect("Missing RUNTIME_WASM env var.");
let code = fs::read(path).expect("Failed to read runtime wasm");

let heap_pages =
sc_executor_common::wasm_runtime::HeapAllocStrategy::Static { extra_pages: 1024 };

// 2. Create wasm executor.
let executor = sc_executor::WasmExecutor::<(
gear_ri::gear_ri::HostFunctions,
sp_io::SubstrateHostFunctions,
)>::new(WasmExecutionMethod::Interpreted, Some(1024), 8, None, 2);
)>::builder()
.with_execution_method(WasmExecutionMethod::Compiled {
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
})
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(8)
.with_runtime_cache_size(2)
.build();

// 3. Extract metadata.
executor
Expand Down
Loading