-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: FeesTreasuryProportion is only applied to substrate based tx only (
#3043) * fix: FeesTreasuryProportion is only applied to substrate based tx only * refactor: split test into 2 files * test: test 0% FeesTreasuryProportion * add substrate based tests * test: test for different cases * test: add extra check * fix: test calculation * style: fix formatting * fix: fix calculation for moonriver and moonbeam * fix: fix calculation * test: add with tip case --------- Co-authored-by: Rodrigo Quelhas <[email protected]>
- Loading branch information
Showing
6 changed files
with
343 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
test/suites/dev/moonbase/test-parameters/test-parameters-randomness.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}); | ||
}, | ||
}); |
Oops, something went wrong.