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

feat(protocol): improve precision for slot-availability multipliers #13108

Merged
merged 4 commits into from
Feb 8, 2023

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Feb 7, 2023

Assuming the first slot's baseFee is bMin, the last slot's baseFee is bMax, the ration of bMin/bMax is the slot availability multiplier. Usually we want to set this multiplier to a certain value, for example, 20, then we calculate the internal parameter slotSmoothingFactor reversely to ensure bMin/bMax == 20.

Before this PR, the actual bMin/bMax value is way off 20 because the number of slots are not a large value. We need to make sure slotSmoothingFactor has higher precision, that's why we multiply 1000 in the calculate of fees so we can give slotSmoothingFactor a bigger value -- if it's supposed to have a value of 12.1234, now it will have a value of 12123 instead of 12.

@dantaik dantaik marked this pull request as ready for review February 7, 2023 10:12
@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Merging #13108 (4717917) into main (543f242) will not change coverage.
The diff coverage is 25.00%.

@@           Coverage Diff           @@
##             main   #13108   +/-   ##
=======================================
  Coverage   62.77%   62.77%           
=======================================
  Files         113      113           
  Lines        3213     3213           
  Branches      437      437           
=======================================
  Hits         2017     2017           
  Misses       1120     1120           
  Partials       76       76           
Flag Coverage Δ *Carryforward flag
bridge-ui 92.61% <ø> (ø) Carriedforward from 543f242
protocol 53.22% <25.00%> (ø)
relayer 69.15% <ø> (ø) Carriedforward from 543f242
ui 100.00% <ø> (ø) Carriedforward from 543f242

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
packages/protocol/contracts/L1/libs/LibUtils.sol 31.57% <0.00%> (ø)
...ckages/protocol/contracts/libs/LibSharedConfig.sol 0.00% <ø> (ø)
.../contracts/test/L1/TestTaikoL1EnableTokenomics.sol 0.00% <0.00%> (ø)
...ackages/protocol/contracts/test/L1/TestTaikoL2.sol 0.00% <0.00%> (ø)
...ackages/protocol/contracts/test/L1/TestTaikoL1.sol 87.87% <100.00%> (ø)
...cts/test/L1/TestTaikoL2EnablePublicInputsCheck.sol 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dantaik dantaik enabled auto-merge (squash) February 7, 2023 14:44
Copy link
Contributor

@davidtaikocha davidtaikocha left a comment

Choose a reason for hiding this comment

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

All calculation changes LGTM.

@dantaik dantaik merged commit 3ed5138 into main Feb 8, 2023
@dantaik dantaik deleted the generate_config_util branch February 8, 2023 06:29
@github-actions github-actions bot mentioned this pull request Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants