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

fix(protocol): fix config.slotSmoothingFactor and getTimeAdjustedFee bug #13293

Merged
merged 11 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions packages/protocol/contracts/libs/LibSharedConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,13 @@ pragma solidity ^0.8.18;

import {TaikoData} from "../L1/TaikoData.sol";

/*
> cd taiko-mono/packages/protocol/utils/generate_config
> python3 main.py
Expected block time (seconds): 20
Expected proof time (minutes): 10
Slot availability multiplier: 20
Number of ZKPs required per block before verificaiton: 1
Extra slots (e.g, 50 means 50% more slots): 100
---------
min num slots: 30
---------
maxNumBlocks: 61
slotSmoothingFactor: 16789
*/

library LibSharedConfig {
/// Returns shared configs for both TaikoL1 and TaikoL2 for production.
function getConfig() internal pure returns (TaikoData.Config memory) {
return
TaikoData.Config({
chainId: 167,
maxNumBlocks: 2048, // owner:daniel
maxNumBlocks: 2049, // owner:daniel
blockHashHistory: 40, // owner:daniel
maxVerificationsPerTx: 10, //owner:david. Each time one more block is verified, there will be ~20k more gas cost.
commitConfirmations: 0, // owner:daniel
Expand All @@ -38,7 +23,7 @@ library LibSharedConfig {
maxBytesPerTxList: 120000, // owner:david. Set it to 120KB, since 128KB is the upper size limit of a geth transaction, so using 120KB for the proposed transactions list calldata, 8K for the remaining tx fields.
minTxGasLimit: 21000, // owner:david
anchorTxGasLimit: 250000, // owner:david
slotSmoothingFactor: 16789, // owner:daniel
slotSmoothingFactor: 946649, // owner:daniel
rewardBurnBips: 100, // owner:daniel. 100 basis points or 1%
proposerDepositPctg: 25, // owner:daniel - 25%
// Moving average factors
Expand Down
10 changes: 5 additions & 5 deletions packages/protocol/utils/generate_config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
print("Expected proof time (minutes)", end=": ")
proof_time = int(input()) * 60

print("Slot availability multiplier", end=": ")
slot_availability_multiplier = int(input())
if slot_availability_multiplier <= 5:
print("error: Slot availability multiplier must be greater than 5")
print("Max baseFee upside (5 = 5x)", end=": ")
max_basefee_upside = int(input())
if max_basefee_upside < 5:
print("error: Max baseFee upside < 5")
exit(1)

min_num_slots = math.ceil(1.0 * proof_time / block_time)
Expand All @@ -24,7 +24,7 @@
print("min num slots:", min_num_slots)
max_num_slots = min_num_slots + math.ceil(min_num_slots * extra_slots / 100) + 1

k = slot_availability_multiplier
k = max_basefee_upside
n = max_num_slots

# https://www.wolframalpha.com/input?i=solve++%28n%2Bx%29%28n%2Bx-1%29%3Dk*%281%2Bx%29x+for+x
Expand Down