substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Implements a variable deposit base calculation for EPM signed submissions

Open gpestana opened this issue 2 years ago • 9 comments

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.

polkadot companion: https://github.com/paritytech/polkadot/pull/7140

Closes https://github.com/paritytech/srlabs_findings/issues/189

gpestana avatar Apr 23 '23 21:04 gpestana

bot rebase

gpestana avatar May 04 '23 10:05 gpestana

Rebased

bot rebase

gpestana avatar May 17 '23 08:05 gpestana

Rebased

Moreover I think this is not the case in the code as it stands now yet:

It adds a new associated type to EPM's config type BaseDeposit that implements Convert<usize, Balance>, which is used to calculate the base deposit for signed submissions based on the size of the signed submissions queue.

kianenigma avatar Jun 08 '23 07:06 kianenigma

bot fmt

gpestana avatar Jun 09 '23 19:06 gpestana

@gpestana https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2965106 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 9-9b73b719-c72e-4e0a-a380-9251ec5eea62 to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] avatar Jun 09 '23 19:06 command-bot[bot]

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2965106 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2965106/artifacts/download.

command-bot[bot] avatar Jun 09 '23 19:06 command-bot[bot]

can be merged once conflict is resolved.

kianenigma avatar Jul 13 '23 09:07 kianenigma