-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements a variable deposit base calculation for EPM signed submissions #1547
Merged
Conversation
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
gpestana
added
T1-FRAME
This PR/Issue is related to core FRAME, the framework.
T8-polkadot
This PR/Issue is related to/affects the Polkadot network.
labels
Sep 13, 2023
kianenigma
approved these changes
Sep 15, 2023
Ank4n
approved these changes
Sep 16, 2023
bot merge |
@gpestana |
1 task
svyatonik
added a commit
to svyatonik/runtimes
that referenced
this pull request
Nov 3, 2023
bkchr
added a commit
to polkadot-fellows/runtimes
that referenced
this pull request
Nov 20, 2023
In the PR we bump versions for all dependacy crates from `polkadot-sdk` and apply all required changes Changes: - `parachains_runtime_api_impl` `v5` -> `v7`, - from paritytech/polkadot-sdk#1543; - `Consideration` setup for preimage pallet instances, - from paritytech/polkadot-sdk#1363; - `experimental` feature removed for `pallet-society`, `pallet-xcm`, `runtime-common` crates, - from paritytech/polkadot-sdk#1503; - `pallet_election_provider_multi_phase::Config::SignedDepositBase` set to `GeometricDepositBase`, - from paritytech/polkadot-sdk#1547; - support `open_outbound_hrmp_channel_for_benchmarks_or_tests` func rename, - from paritytech/polkadot-sdk#1422; - missing weight functions added for `runtime_parachains_hrmp` and `pallet_preimage`; TODO: - [x] Deleted the Copy&paste para scheduler migration from #26 in b666613. This should be applied in the next runtime upgrade, but i did not properly check yet. --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: joe petrowski <[email protected]>
bgallois
pushed a commit
to duniter/duniter-polkadot-sdk
that referenced
this pull request
Mar 25, 2024
…ions (paritytech#1547) **Note**: This is a lift-and-shift PR from the old substrate and polkadot repos, both PRs have been reviewed and audited (paritytech/substrate#13983, paritytech/polkadot#7140) --- This PR implements a generic `BaseDeposit` calculation for signed submissions, based on the size of the submission queue. It adds a new associated type to EPM's config, `type SignedDepositBase`, that implements `Convert<usize, BalanceOf<T>>`, which is used to calculate the base deposit for signed submissions based on the size of the signed submissions queue. `struct GeometricDepositBase<Balance, Fixed, Inc>` implements the convert trait so that the deposit value increases as a geometric progression. The deposit base is calculated by `deposit_base = fixed_deposit_base * (1 + increase_factor)^n`, where `n` is the term of the progression (i.e. the number of signed submissions in the queue). `Fixed` and `Inc` generic params are getters for `Balance` and `IncreaseFactor` to compute the geometric progression. If `IncreaseFactor = 0`, then the signed deposit is constant and equal to `Fixed` regardless of the size of the queue. ### Runtime configs In Kusama, the progression with 10% increase without changing the current signed fixed deposit is: (term == size of the queue) Term 1: `1,333,333,332,000` Term 2: `1,333,333,332,000 * 1.10 = 1,466,666,665,200` Term 3: `1,333,333,332,000 * 1.10^2 = 1,613,333,331,200` Term 4: `1,333,333,332,000 * 1.10^3 = 1,774,666,664,320` Term 5: `1,333,333,332,000 * 1.10^4 = 1,952,133,330,752` Term 6: `1,333,333,332,000 * 1.10^5 = 2,147,346,663,827.20` Term 7: `1,333,333,332,000 * 1.10^6 = 2,362,081,330,210.92` Term 8: `1,333,333,332,000 * 1.10^7 = 2,598,289,463,231.01` Term 9: `1,333,333,332,000 * 1.10^8 = 2,858,118,409,554.11` Term 10: `1,333,333,332,000 * 1.10^9 = 3,143,930,250,509.52` Westend: Term 1: `2,000,000,000,000` Term 2: `2,000,000,000,000 * 1.10 = 2,200,000,000,000` Term 3: `2,000,000,000,000 * 1.10^2 = 2,420,000,000,000` Term 4: `2,000,000,000,000 * 1.10^3 = 2,662,000,000,000` Term 5: `2,000,000,000,000 * 1.10^4 = 2,928,200,000,000` Term 6: `2,000,000,000,000 * 1.10^5 = 3,221,020,000,000` Term 7: `2,000,000,000,000 * 1.10^6 = 3,543,122,000,000` Term 8: `2,000,000,000,000 * 1.10^7 = 3,897,434,200,000` Term 9: `2,000,000,000,000 * 1.10^8 = 4,287,177,620,000` Term 10: `2,000,000,000,000 * 1.10^9 = 4,715,895,382,000` and in Polkadot, the deposit increase is disabled in the current state of the PR, as the increase factor is 0% -- so nothing changes from the current behaviour. Closes paritytech-secops/srlabs_findings#189
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 10, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
serban300
added a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 10, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
bkchr
pushed a commit
that referenced
this pull request
Apr 10, 2024
Signed-off-by: Serban Iorga <[email protected]> Signed-off-by: Serban Iorga <[email protected]>
This was referenced Jun 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
T1-FRAME
This PR/Issue is related to core FRAME, the framework.
T8-polkadot
This PR/Issue is related to/affects the Polkadot network.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: This is a lift-and-shift PR from the old substrate and polkadot repos, both PRs have been reviewed and audited (paritytech/substrate#13983, paritytech/polkadot#7140)
This PR implements a generic
BaseDeposit
calculation for signed submissions, based on the size of the submission queue.It adds a new associated type to EPM's config,
type SignedDepositBase
, that implementsConvert<usize, BalanceOf<T>>
, which is used to calculate the base deposit for signed submissions based on the size of the signed submissions queue.struct GeometricDepositBase<Balance, Fixed, Inc>
implements the convert trait so that the deposit value increases as a geometric progression. The deposit base is calculated bydeposit_base = fixed_deposit_base * (1 + increase_factor)^n
, wheren
is the term of the progression (i.e. the number of signed submissions in the queue).Fixed
andInc
generic params are getters forBalance
andIncreaseFactor
to compute the geometric progression. IfIncreaseFactor = 0
, then the signed deposit is constant and equal toFixed
regardless of the size of the queue.Runtime configs
In Kusama, the progression with 10% increase without changing the current signed fixed deposit is: (term == size of the queue)
Term 1:
1,333,333,332,000
Term 2:
1,333,333,332,000 * 1.10 = 1,466,666,665,200
Term 3:
1,333,333,332,000 * 1.10^2 = 1,613,333,331,200
Term 4:
1,333,333,332,000 * 1.10^3 = 1,774,666,664,320
Term 5:
1,333,333,332,000 * 1.10^4 = 1,952,133,330,752
Term 6:
1,333,333,332,000 * 1.10^5 = 2,147,346,663,827.20
Term 7:
1,333,333,332,000 * 1.10^6 = 2,362,081,330,210.92
Term 8:
1,333,333,332,000 * 1.10^7 = 2,598,289,463,231.01
Term 9:
1,333,333,332,000 * 1.10^8 = 2,858,118,409,554.11
Term 10:
1,333,333,332,000 * 1.10^9 = 3,143,930,250,509.52
Westend:
Term 1:
2,000,000,000,000
Term 2:
2,000,000,000,000 * 1.10 = 2,200,000,000,000
Term 3:
2,000,000,000,000 * 1.10^2 = 2,420,000,000,000
Term 4:
2,000,000,000,000 * 1.10^3 = 2,662,000,000,000
Term 5:
2,000,000,000,000 * 1.10^4 = 2,928,200,000,000
Term 6:
2,000,000,000,000 * 1.10^5 = 3,221,020,000,000
Term 7:
2,000,000,000,000 * 1.10^6 = 3,543,122,000,000
Term 8:
2,000,000,000,000 * 1.10^7 = 3,897,434,200,000
Term 9:
2,000,000,000,000 * 1.10^8 = 4,287,177,620,000
Term 10:
2,000,000,000,000 * 1.10^9 = 4,715,895,382,000
and in Polkadot, the deposit increase is disabled in the current state of the PR, as the increase factor is 0% -- so nothing changes from the current behaviour.
Closes https://github.com/paritytech-secops/srlabs_findings/issues/189