Skip to content

Commit

Permalink
Merge branch 'master' into rq/remove-suicided-contracts-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
RomarQ authored Nov 15, 2024
2 parents 3acb3bd + 7a437ac commit 878c5fe
Show file tree
Hide file tree
Showing 9 changed files with 1,778 additions and 2,537 deletions.
3,837 changes: 1,398 additions & 2,439 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ where
mut fees_then_tips: impl Iterator<Item = Credit<R::AccountId, pallet_balances::Pallet<R>>>,
) {
if let Some(fees) = fees_then_tips.next() {
let treasury_perbill =
let treasury_proportion =
runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get();
let treasury_part = treasury_perbill.deconstruct();
let treasury_part = treasury_proportion.deconstruct();
let burn_part = Perbill::one().deconstruct() - treasury_part;
let (_, to_treasury) = fees.ration(burn_part, treasury_part);
// Balances pallet automatically burns dropped Credits by decreasing
Expand All @@ -378,7 +378,7 @@ where
// handle tip if there is one
if let Some(tip) = fees_then_tips.next() {
// for now we use the same burn/treasury strategy used for regular fees
let (_, to_treasury) = tip.ration(80, 20);
let (_, to_treasury) = tip.ration(burn_part, treasury_part);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(
to_treasury,
);
Expand All @@ -391,7 +391,11 @@ where
fn on_nonzero_unbalanced(amount: Credit<R::AccountId, pallet_balances::Pallet<R>>) {
// Balances pallet automatically burns dropped Credits by decreasing
// total_supply accordingly
let (_, to_treasury) = amount.ration(80, 20);
let treasury_proportion =
runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get();
let treasury_part = treasury_proportion.deconstruct();
let burn_part = Perbill::one().deconstruct() - treasury_part;
let (_, to_treasury) = amount.ration(burn_part, treasury_part);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(to_treasury);
}
}
Expand Down
12 changes: 8 additions & 4 deletions runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ where
mut fees_then_tips: impl Iterator<Item = Credit<R::AccountId, pallet_balances::Pallet<R>>>,
) {
if let Some(fees) = fees_then_tips.next() {
let treasury_perbill =
let treasury_proportion =
runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get();
let treasury_part = treasury_perbill.deconstruct();
let treasury_part = treasury_proportion.deconstruct();
let burn_part = Perbill::one().deconstruct() - treasury_part;
let (_, to_treasury) = fees.ration(burn_part, treasury_part);
// Balances pallet automatically burns dropped Credits by decreasing
Expand All @@ -366,7 +366,7 @@ where
// handle tip if there is one
if let Some(tip) = fees_then_tips.next() {
// for now we use the same burn/treasury strategy used for regular fees
let (_, to_treasury) = tip.ration(80, 20);
let (_, to_treasury) = tip.ration(burn_part, treasury_part);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(
to_treasury,
);
Expand All @@ -379,7 +379,11 @@ where
fn on_nonzero_unbalanced(amount: Credit<R::AccountId, pallet_balances::Pallet<R>>) {
// Balances pallet automatically burns dropped Credits by decreasing
// total_supply accordingly
let (_, to_treasury) = amount.ration(80, 20);
let treasury_proportion =
runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get();
let treasury_part = treasury_proportion.deconstruct();
let burn_part = Perbill::one().deconstruct() - treasury_part;
let (_, to_treasury) = amount.ration(burn_part, treasury_part);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(to_treasury);
}
}
Expand Down
12 changes: 8 additions & 4 deletions runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ where
mut fees_then_tips: impl Iterator<Item = Credit<R::AccountId, pallet_balances::Pallet<R>>>,
) {
if let Some(fees) = fees_then_tips.next() {
let treasury_perbill =
let treasury_proportion =
runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get();
let treasury_part = treasury_perbill.deconstruct();
let treasury_part = treasury_proportion.deconstruct();
let burn_part = Perbill::one().deconstruct() - treasury_part;
let (_, to_treasury) = fees.ration(burn_part, treasury_part);
// Balances pallet automatically burns dropped Credits by decreasing
Expand All @@ -368,7 +368,7 @@ where
// handle tip if there is one
if let Some(tip) = fees_then_tips.next() {
// for now we use the same burn/treasury strategy used for regular fees
let (_, to_treasury) = tip.ration(80, 20);
let (_, to_treasury) = tip.ration(burn_part, treasury_part);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(
to_treasury,
);
Expand All @@ -381,7 +381,11 @@ where
fn on_nonzero_unbalanced(amount: Credit<R::AccountId, pallet_balances::Pallet<R>>) {
// Balances pallet automatically burns dropped Credits by decreasing
// total_supply accordingly
let (_, to_treasury) = amount.ration(80, 20);
let treasury_proportion =
runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get();
let treasury_part = treasury_proportion.deconstruct();
let burn_part = Perbill::one().deconstruct() - treasury_part;
let (_, to_treasury) = amount.ration(burn_part, treasury_part);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(to_treasury);
}
}
Expand Down
4 changes: 3 additions & 1 deletion specs/moonbeam/parachain-embedded-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"/dns/apac-01.unitedbloc.com/tcp/37060/p2p/12D3KooWCnXymVyowL5YymVk6RNzRzFAWUvurX7eTTYAFcCbs4nj",
"/dns/sa-01.unitedbloc.com/tcp/37060/p2p/12D3KooWC3FoL2bFJ79C5CeLDjLmL2yRyozPxSjTQbm9RY95KNsV",
"/dns/na-01.unitedbloc.com/tcp/37060/p2p/12D3KooWLEZwHD8tWvWiEqKcD976wxdE5JRUnq1JG9a6VJxHUjiS",
"/dns4/moonbeam-1.boot.onfinality.io/tcp/28868/ws/p2p/12D3KooWEvop16VcctRftvTDdi5dSGWAA2FA9tXiZyZwzfBpH83L"
"/dns4/moonbeam-1.boot.onfinality.io/tcp/28868/ws/p2p/12D3KooWEvop16VcctRftvTDdi5dSGWAA2FA9tXiZyZwzfBpH83L",
"/dns/moonbeam-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWSKaKdqWFhNK8XTBhqNUZL2LUTZNCgFt1iXRN2HfvoLsh",
"/dns/moonbeam-boot-ng.dwellir.com/tcp/30364/p2p/12D3KooWSKaKdqWFhNK8XTBhqNUZL2LUTZNCgFt1iXRN2HfvoLsh"
],
"telemetryEndpoints": [
["/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", 0]
Expand Down
62 changes: 34 additions & 28 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "index.js",
"type": "module",
"scripts": {
"fmt": "prettier --check --ignore-path ../.prettierignore '**/*.(yml|js|ts|json)'",
"fmt:fix": "prettier --write --ignore-path ../.prettierignore '**/*.(yml|js|ts|json)'",
"fmt": "prettier --check --trailing-comma es5 --ignore-path ../.prettierignore '**/*.(yml|js|ts|json)'",
"fmt:fix": "prettier --write --trailing-comma es5 --ignore-path ../.prettierignore '**/*.(yml|js|ts|json)'",
"lint": "eslint './helpers/**/*.ts' './suites/**/*.ts'",
"lint:fix": "eslint './helpers/**/*.ts' './suites/**/*.ts' --fix",
"compile-solidity": "tsx scripts/compile-contracts.ts compile",
Expand All @@ -16,48 +16,48 @@
"author": "",
"license": "ISC",
"dependencies": {
"@acala-network/chopsticks": "1.0.1",
"@moonbeam-network/api-augment": "workspace:*",
"@acala-network/chopsticks": "0.16.1",
"@moonwall/cli": "5.3.3",
"@moonwall/util": "5.3.3",
"@moonwall/cli": "5.6.0",
"@moonwall/util": "5.6.0",
"@openzeppelin/contracts": "4.9.6",
"@polkadot-api/merkleize-metadata": "1.1.4",
"@polkadot/api": "14.0.1",
"@polkadot/api-augment": "14.0.1",
"@polkadot/api-derive": "14.0.1",
"@polkadot/apps-config": "0.143.2",
"@polkadot/keyring": "13.1.1",
"@polkadot/rpc-provider": "14.0.1",
"@polkadot/types": "14.0.1",
"@polkadot/types-codec": "14.0.1",
"@polkadot/util": "13.1.1",
"@polkadot/util-crypto": "13.1.1",
"@substrate/txwrapper-core": "7.5.1",
"@substrate/txwrapper-substrate": "7.5.1",
"@vitest/ui": "2.1.1",
"@polkadot-api/merkleize-metadata": "1.1.9",
"@polkadot/api": "14.3.1",
"@polkadot/api-augment": "14.3.1",
"@polkadot/api-derive": "14.3.1",
"@polkadot/apps-config": "0.146.1",
"@polkadot/keyring": "13.2.3",
"@polkadot/rpc-provider": "14.3.1",
"@polkadot/types": "14.3.1",
"@polkadot/types-codec": "14.3.1",
"@polkadot/util": "13.2.3",
"@polkadot/util-crypto": "13.2.3",
"@substrate/txwrapper-core": "7.5.2",
"@substrate/txwrapper-substrate": "7.5.2",
"@vitest/ui": "2.1.5",
"@zombienet/utils": "0.0.25",
"chalk": "5.3.0",
"eth-object": "github:aurora-is-near/eth-object#master",
"ethers": "6.13.2",
"ethers": "6.13.4",
"json-bigint": "1.0.0",
"json-stable-stringify": "1.1.1",
"merkle-patricia-tree": "4.2.4",
"node-fetch": "3.3.2",
"octokit": "^4.0.2",
"randomness": "1.6.14",
"randomness": "1.6.15",
"rlp": "3.0.0",
"semver": "7.6.3",
"solc": "0.8.25",
"tsx": "4.16.2",
"viem": "2.21.14",
"vitest": "2.1.1",
"web3": "4.13.0",
"yaml": "2.5.1"
"tsx": "4.19.2",
"viem": "2.21.45",
"vitest": "2.1.5",
"web3": "4.15.0",
"yaml": "2.6.0"
},
"devDependencies": {
"@types/debug": "4.1.12",
"@types/json-bigint": "^1.0.4",
"@types/node": "22.7.0",
"@types/node": "22.9.0",
"@types/semver": "7.5.8",
"@types/yargs": "17.0.33",
"@typescript-eslint/eslint-plugin": "7.5.0",
Expand All @@ -66,10 +66,16 @@
"debug": "4.3.7",
"eslint": "8.57.0",
"eslint-plugin-unused-imports": "3.1.0",
"inquirer": "9.2.16",
"prettier": "2.8.8",
"typescript": "5.6.2",
"typescript": "5.6.3",
"yargs": "17.7.2"
},
"pnpm": {
"overrides": {
"inquirer": "9.2.16"
}
},
"engines": {
"pnpm": ">=8.6",
"node": ">=20.10.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { describeSuite, expect } from "@moonwall/cli";
import { alith } from "@moonwall/util";
import { parameterType, UNIT } from "./test-parameters";

describeSuite({
id: "DTemp02",
title: "Parameters - Pallet Randomness",
foundationMethods: "dev",
testCases: ({ it, context, log }) => {
it({
id: `T01 - PalletRandomness - Deposit - CustomTests`,
title: "Deposit parameter should only be accepted in bounds",
test: async () => {
const MIN = 1n * UNIT;
const MAX = 1000n * UNIT;

// used as an acceptable value
const AVG = (MIN + MAX) / 2n;

const param1 = parameterType(context, "PalletRandomness", "Deposit", MIN - 1n);
try {
await context.createBlock(
context
.polkadotJs()
.tx.sudo.sudo(context.polkadotJs().tx.parameters.setParameter(param1.toU8a()))
.signAsync(alith),
{ allowFailures: false }
);
expect.fail("An extrinsic should not be created, since the parameter is invalid");
} catch (error) {
expect(error.toString().toLowerCase()).to.contain("value out of bounds");
}

const param2 = parameterType(context, "PalletRandomness", "Deposit", MAX + 1n);
try {
await context.createBlock(
context
.polkadotJs()
.tx.sudo.sudo(context.polkadotJs().tx.parameters.setParameter(param2.toU8a()))
.signAsync(alith),
{ allowFailures: false }
);
expect.fail("An extrinsic should not be created, since the parameter is invalid");
} catch (error) {
expect(error.toString().toLowerCase()).to.contain("value out of bounds");
}

const param3 = parameterType(context, "PalletRandomness", "Deposit", AVG);
const res3 = await context.createBlock(
context
.polkadotJs()
.tx.sudo.sudo(context.polkadotJs().tx.parameters.setParameter(param3.toU8a()))
.signAsync(alith),
{ allowFailures: false }
);
expect(
res3.result?.successful,
"An extrinsic should be created, since the parameter is valid"
).to.be.true;
},
});
},
});
Loading

0 comments on commit 878c5fe

Please sign in to comment.