Skip to content
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

Fee Alignment - Shibuya/local #1025

Merged
merged 24 commits into from
Oct 2, 2023
Merged

Conversation

Dinonard
Copy link
Member

@Dinonard Dinonard commented Sep 13, 2023

Pull Request Summary

This PR introduces rent fee reduction and fee alignment to local and Shibuya networks.

Pallet DynamicEvmBaseFee handles calculation and adjustment of base fee per gas parameter.
It's unlike EIP-1559, and instead uses a customized approach for Astar.
The core idea is to keep native fees & EVM fees aligned as much as possible.

For a detailed & expansive overview, please refer to Astar Forum post HERE.
Pallet rustdoc contains some more detailed description of the implementation approach.

Shibuya Integration

  • even though Tokenomics params weren't intended for Shibuya, they are exactly as they will be for Astar (fee-wise)
  • this is on purpose since it's a testnet
  • some numbers were rounded on very small decimals to make them more readable (but it can be easily modified to be exact as in the report - feel free to comment)

Local Integration

  • this runtime received a bit more modification to make it more aligned with parachain runtimes

Check list

  • added or updated unit tests
  • updated Astar official documentation
  • reduce rent fees
  • reduce WASM SC rent fees by 100x
  • burn portions update
  • fee alignment logic
  • run & update benchmark values
  • OnRuntimeUpgrade logic to modify DB adjustable params
  • apply necessary changes to local runtime

@Dinonard Dinonard added shibuya related to shibuya runtime This PR/Issue is related to the topic “runtime”. labels Sep 15, 2023
Copy link
Member

@ashutoshvarma ashutoshvarma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests!

I'm not very clear about how adjustment factor will be handled, as I understand it be updated every block based on block fullness. I couldn't find any TODOs for that, will there be a new pallet for it or it'll be part of this pallet itself?

pallets/dynamic-evm-base-fee/src/lib.rs Outdated Show resolved Hide resolved
pallets/dynamic-evm-base-fee/src/lib.rs Show resolved Hide resolved
pallets/dynamic-evm-base-fee/src/lib.rs Outdated Show resolved Hide resolved
pallets/dynamic-evm-base-fee/src/lib.rs Show resolved Hide resolved
pallets/dynamic-evm-base-fee/src/lib.rs Show resolved Hide resolved
pallets/dynamic-evm-base-fee/src/lib.rs Show resolved Hide resolved
@Dinonard
Copy link
Member Author

@ashutoshvarma

I'm not very clear about how adjustment factor will be handled, as I understand it be updated every block based on block fullness. I couldn't find any TODOs for that, will there be a new pallet for it or it'll be part of this pallet itself?

There's no TODO since this is already implemented & live on all of our networks.
It's part of the pallet-transaction-payment.

One of the remaining TODOs is related to this part though.
I have to check current values for the adjustment factor and see how it should be 'adjusted' so native fees don't change too much (since in Tokenomics v2 we are changing some of the constants).

@ashutoshvarma
Copy link
Member

@Dinonard

There's no TODO since this is already implemented & live on all of our networks.
It's part of the pallet-transaction-payment.

I missed that, I assumed this 'adjustment factor' is something specific to this pallet. Now it make sense.

shaunxw
shaunxw previously approved these changes Sep 27, 2023
Copy link
Member

@shaunxw shaunxw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Awesome docs and test coverage!

@shaunxw shaunxw marked this pull request as ready for review September 27, 2023 07:21
@Dinonard
Copy link
Member Author

/bench shibuya-dev pallet_dynamic_evm_base_fee

@github-actions
Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6327663494.
Please wait for a while.
Branch: feat/tokenomics-v2-fees-shibuya
SHA: a8900aa

@github-actions
Copy link

Benchmark job failed.
Please check https://github.com/AstarNetwork/Astar/actions/runs/6327663494.

@Dinonard
Copy link
Member Author

/bench shibuya-dev pallet_dynamic_evm_base_fee

@github-actions
Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6335948645.
Please wait for a while.
Branch: feat/tokenomics-v2-fees-shibuya
SHA: 32fa2b5

@github-actions
Copy link

Benchmarks have been finished.
You can download artifacts if exists https://github.com/AstarNetwork/Astar/actions/runs/6335948645.

@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
pallets/collator-selection/src 69% 0%
pallets/block-reward/src 85% 0%
pallets/dapps-staking/src 81% 0%
pallets/xc-asset-config/src 53% 0%
chain-extensions/types/assets/src 0% 0%
precompiles/utils/src 68% 0%
pallets/contracts-migration/src 0% 0%
precompiles/sr25519/src 79% 0%
chain-extensions/types/xvm/src 0% 0%
primitives/src 62% 0%
pallets/unified-accounts/src 80% 0%
chain-extensions/xvm/src 0% 0%
chain-extensions/types/dapps-staking/src 0% 0%
pallets/ethereum-checked/src 48% 0%
precompiles/assets-erc20/src 76% 0%
precompiles/dapps-staking/src 93% 0%
precompiles/xvm/src 75% 0%
pallets/pallet-xcm/src 53% 0%
pallets/dapps-staking/src/pallet 85% 0%
pallets/xvm/src 40% 0%
precompiles/substrate-ecdsa/src 78% 0%
pallets/dynamic-evm-base-fee/src 81% 0%
precompiles/utils/src/testing 62% 0%
precompiles/xcm/src 84% 0%
chain-extensions/dapps-staking/src 0% 0%
precompiles/utils/macro/src 0% 0%
primitives/src/xcm 66% 0%
chain-extensions/pallet-assets/src 0% 0%
precompiles/batch/src 80% 0%
Summary 58% (2652 / 4587) 0% (0 / 0)

Minimum allowed line rate is 50%

@Dinonard Dinonard merged commit 212fa81 into master Oct 2, 2023
11 checks passed
@Dinonard Dinonard deleted the feat/tokenomics-v2-fees-shibuya branch October 2, 2023 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runtime This PR/Issue is related to the topic “runtime”. shibuya related to shibuya
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants