Skip to content
Merged
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
38 changes: 30 additions & 8 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pretty_assertions = { version = "1.3.0" }
smallvec = "1.11.0"
numtoa = "0.2.4"
enumflags2 = "0.7.7"
docify = "0.2.8"
impl-trait-for-tuples = "0.2.2"
serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false }
serial_test = { version = "2.0.0", default-features = false }
Expand All @@ -74,7 +76,6 @@ pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "st
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion e2e/package-lock.json

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

151 changes: 70 additions & 81 deletions e2e/sudo/sudo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,87 +183,76 @@ describe('Sudo required', function () {
});
});

/*
* This test is skipped.
* BACKGROUND:
* Under the old Treasury proposal model, anyone could submit a proposal, which would
* require the proposer to have a certain amount of tokens locked as a bond.
*
* Once it is determined what the new model will be for Treasury proposals on Frequency, this section
* can be removed, or updated with new tests relevant to the way Treasury proposals will work.
*/
// describe.skip('Capacity should not be affected by a hold being slashed', function () {
// it('stake should fail when overlapping tokens are on hold', async function () {
// const accountBalance: bigint = 122n * DOLLARS;
// const stakeBalance: bigint = 100n * DOLLARS;
// const spendBalance: bigint = 20n * DOLLARS;
// const proposalBond: bigint = 100n * DOLLARS;

// // Setup some keys and a provider for capacity staking
// const stakeKeys: KeyringPair = createKeys('StakeKeys');
// const stakeProviderId: u64 = await createMsaAndProvider(
// fundingSource,
// stakeKeys,
// 'StakeProvider',
// accountBalance
// );

// // Create a treasury proposal which will result in a hold with minimum bond = 100 DOLLARS
// const proposalExt = ExtrinsicHelper.submitProposal(stakeKeys, spendBalance);
// const { target: proposalEvent } = await proposalExt.signAndSend();
// assert.notEqual(proposalEvent, undefined, 'should return a Proposal event');

// // Confirm that the tokens were reserved/hold in the stakeKeys account using the query API
// const stakedAcctInfo = await ExtrinsicHelper.getAccountInfo(stakeKeys);
// assert.equal(
// stakedAcctInfo.data.reserved,
// proposalBond,
// `expected ${proposalBond} reserved balance, got ${stakedAcctInfo.data.reserved}`
// );

// // Create a stake that will result in overlapping tokens being frozen
// // stake will allow only the balance not on hold to be staked
// await assert.rejects(stakeToProvider(fundingSource, stakeKeys, stakeProviderId, stakeBalance));

// // Slash the provider
// // TODO: skipping this test for now because of Treasury proposal changes
// // const slashExt = ExtrinsicHelper.rejectProposal(sudoKey, proposalEvent?.data.proposalIndex);
// // const { target: slashEvent } = await slashExt.sudoSignAndSend();
// // assert.notEqual(slashEvent, undefined, 'should return a Treasury event');

// // Confirm that the tokens were slashed from the stakeKeys account using the query API
// stakedAcctInfo = await ExtrinsicHelper.getAccountInfo(stakeKeys);
// assert.equal(
// stakedAcctInfo.data.reserved,
// 0n,
// `expected 0 reserved balance, got ${stakedAcctInfo.data.reserved}`
// );
// });

// it('proposal should fail when overlapping tokens are on hold', async function () {
// const accountBalance: bigint = 122n * DOLLARS;
// const stakeBalance: bigint = 100n * DOLLARS;
// const spendBalance: bigint = 20n * DOLLARS;

// // Setup some keys and a provider for capacity staking
// const stakeKeys: KeyringPair = createKeys('StakeKeys');
// const stakeProviderId: u64 = await createMsaAndProvider(
// fundingSource,
// stakeKeys,
// 'StakeProvider',
// accountBalance
// );

// // Create a stake that will result in overlapping tokens being frozen
// await assert.doesNotReject(stakeToProvider(fundingSource, stakeKeys, stakeProviderId, stakeBalance));

// // TODO: skipping this test for now because of Treasury proposal changes
// // Create a treasury proposal which will result in a hold with minimum bond = 100 DOLLARS
// // The proposal should fail because the stakeKeys account has overlapping tokens frozen
// const proposalExt = ExtrinsicHelper.submitProposal(stakeKeys, spendBalance);
// await assert.rejects(proposalExt.signAndSend());
// });
// });
describe('Capacity should not be affected by a hold being slashed', function () {
it('stake should fail when overlapping tokens are on hold', async function () {
const accountBalance: bigint = 122n * DOLLARS;
const stakeBalance: bigint = 100n * DOLLARS;
const spendBalance: bigint = 20n * DOLLARS;
const proposalBond: bigint = 100n * DOLLARS;

// Setup some keys and a provider for capacity staking
const stakeKeys: KeyringPair = createKeys('StakeKeys');
const stakeProviderId: u64 = await createMsaAndProvider(
fundingSource,
stakeKeys,
'StakeProvider',
accountBalance
);

// Create a treasury proposal which will result in a hold with minimum bond = 100 DOLLARS
const proposalExt = ExtrinsicHelper.submitProposal(stakeKeys, spendBalance);
const { target: proposalEvent } = await proposalExt.signAndSend();
assert.notEqual(proposalEvent, undefined, 'should return a Proposal event');

// Confirm that the tokens were reserved/hold in the stakeKeys account using the query API
let stakedAcctInfo = await ExtrinsicHelper.getAccountInfo(stakeKeys);
assert.equal(
stakedAcctInfo.data.reserved,
proposalBond,
`expected ${proposalBond} reserved balance, got ${stakedAcctInfo.data.reserved}`
);

// Create a stake that will result in overlapping tokens being frozen
// stake will allow only the balance not on hold to be staked
await assert.rejects(stakeToProvider(fundingSource, stakeKeys, stakeProviderId, stakeBalance));

// Slash the provider
const slashExt = ExtrinsicHelper.rejectProposal(sudoKey, proposalEvent?.data.proposalIndex);
const { target: slashEvent } = await slashExt.sudoSignAndSend();
assert.notEqual(slashEvent, undefined, 'should return a Treasury event');

// Confirm that the tokens were slashed from the stakeKeys account using the query API
stakedAcctInfo = await ExtrinsicHelper.getAccountInfo(stakeKeys);
assert.equal(
stakedAcctInfo.data.reserved,
0n,
`expected 0 reserved balance, got ${stakedAcctInfo.data.reserved}`
);
});

it('proposal should fail when overlapping tokens are on hold', async function () {
const accountBalance: bigint = 122n * DOLLARS;
const stakeBalance: bigint = 100n * DOLLARS;
const spendBalance: bigint = 20n * DOLLARS;

// Setup some keys and a provider for capacity staking
const stakeKeys: KeyringPair = createKeys('StakeKeys');
const stakeProviderId: u64 = await createMsaAndProvider(
fundingSource,
stakeKeys,
'StakeProvider',
accountBalance
);

// Create a stake that will result in overlapping tokens being frozen
await assert.doesNotReject(stakeToProvider(fundingSource, stakeKeys, stakeProviderId, stakeBalance));

// Create a treasury proposal which will result in a hold with minimum bond = 100 DOLLARS
// The proposal should fail because the stakeKeys account has overlapping tokens frozen
const proposalExt = ExtrinsicHelper.submitProposal(stakeKeys, spendBalance);
await assert.rejects(proposalExt.signAndSend());
});
});
});
});
});
3 changes: 3 additions & 0 deletions pallets/frequency-tx-payment/src/tests/pallet_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use pallet_frequency_tx_payment::Call as FrequencyTxPaymentCall;
use pallet_msa::Call as MsaCall;

#[test]
#[allow(deprecated)]
fn transaction_payment_validate_is_succesful() {
let balance_factor = 10;

Expand All @@ -39,6 +40,7 @@ fn transaction_payment_validate_is_succesful() {
}

#[test]
#[allow(deprecated)]
fn transaction_payment_validate_errors_when_balance_is_cannot_pay_for_fee() {
let balance_factor = 1;

Expand Down Expand Up @@ -67,6 +69,7 @@ fn transaction_payment_validate_errors_when_balance_is_cannot_pay_for_fee() {
}

#[test]
#[allow(deprecated)]
fn transaction_payment_with_token_and_no_overcharge_post_dispatch_refund_is_succesful() {
let balance_factor = 10;

Expand Down
2 changes: 2 additions & 0 deletions pallets/handles/src/tests/signed_extension_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fn signed_extension_retire_handle_success() {

/// Assert that retiring a handle w/o existing one fails the signed extension HandlesSignedExtension
#[test]
#[allow(deprecated)]
fn signed_extension_retire_handle_failure() {
new_test_ext().execute_with(|| {
let alice = sr25519::Pair::from_seed(&[0; 32]);
Expand All @@ -62,6 +63,7 @@ fn signed_extension_retire_handle_failure() {
}

#[test]
#[allow(deprecated)]
fn test_early_retirement_should_fail() {
new_test_ext().execute_with(|| {
let base_handle_str = "test1";
Expand Down
6 changes: 1 addition & 5 deletions pallets/stateful-storage/src/tests/delete_page_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ use crate::{
types::*,
Config, Error, Event as StatefulEvent,
};
use common_primitives::{
msa::{MessageSourceId, SchemaId},
stateful_storage::{PageHash, PageId},
utils::wrap_binary_data,
};
use common_primitives::{stateful_storage::PageHash, utils::wrap_binary_data};
use frame_support::{assert_err, assert_ok, assert_storage_noop};
use parity_scale_codec::Encode;
#[allow(unused_imports)]
Expand Down
Loading