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(tokenomics): charge more fees for blocks that are harder to prove #351

Merged
merged 32 commits into from
Nov 30, 2022

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Nov 27, 2022

Previously, when blocks are proven after 1.25*avgProofTime, we mint extra tokens to incentivize the provers, but the blocks' proposers get away without paying extra fees. This may open a door for DOS attack -- the proposers may simply create certain transactions that are harder to prove.

This PR enable the protocol to charge up to 25% additional fees -- 125% of the original proposer fees are burnt initially (100% is the fee, and 25% is called the deposit), then based on the tRef value in the whitepaper, we mint back [0-100%] of the deposit back to the proposer. If tRef == 0, we mint back all deposit, if tRef == 10000, we mint back no deposit to the proposer.

@dantaik dantaik changed the title Revert "remove deposit for now" feat(tokenomics): request proposer to deposit extra token Nov 27, 2022
@codecov
Copy link

codecov bot commented Nov 27, 2022

Codecov Report

Merging #351 (895aeee) into implement-tokenomics-v1_pr (597b72c) will decrease coverage by 2.16%.
The diff coverage is 0.00%.

@@                      Coverage Diff                       @@
##           implement-tokenomics-v1_pr     #351      +/-   ##
==============================================================
- Coverage                       63.68%   61.51%   -2.17%     
==============================================================
  Files                              88       88              
  Lines                            2489     2580      +91     
  Branches                          283      296      +13     
==============================================================
+ Hits                             1585     1587       +2     
- Misses                            831      920      +89     
  Partials                           73       73              
Flag Coverage Δ *Carryforward flag
protocol 55.48% <0.00%> (-3.38%) ⬇️
relayer 68.80% <ø> (-0.13%) ⬇️ Carriedforward from 36033be
ui 100.00% <ø> (ø) Carriedforward from 36033be

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

Impacted Files Coverage Δ
packages/protocol/contracts/L1/LibData.sol 21.42% <ø> (ø)
packages/protocol/contracts/L1/TaikoL1.sol 20.00% <0.00%> (-2.23%) ⬇️
packages/protocol/contracts/L1/v1/V1Proposing.sol 0.00% <0.00%> (ø)
packages/protocol/contracts/L1/v1/V1Utils.sol 0.00% <0.00%> (ø)
packages/protocol/contracts/L1/v1/V1Verifying.sol 13.69% <0.00%> (ø)
packages/relayer/http/server.go 93.15% <0.00%> (-2.74%) ⬇️
packages/protocol/contracts/L1/TkoToken.sol 84.21% <0.00%> (ø)
packages/protocol/contracts/L2/V1TaikoL2.sol 56.81% <0.00%> (ø)
... and 17 more

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

Base automatically changed from extra_fee_for_refund to improve_readability November 27, 2022 10:56
Base automatically changed from improve_readability to implement-tokenomics-v1_pr November 27, 2022 10:58
@dantaik dantaik closed this Nov 28, 2022
@dantaik dantaik reopened this Nov 28, 2022
@dantaik dantaik changed the title feat(tokenomics): request proposer to deposit extra token feat(tokenomics): charge more fees for blocks that are proven late Nov 29, 2022
@dantaik dantaik marked this pull request as ready for review November 29, 2022 05:47
@dantaik dantaik changed the title feat(tokenomics): charge more fees for blocks that are proven late feat(tokenomics): charge more fees for blocks that are harder to prove Nov 29, 2022
@dantaik dantaik merged commit 9a4130a into implement-tokenomics-v1_pr Nov 30, 2022
@dantaik dantaik deleted the extra_fee_for_refund_2 branch November 30, 2022 07:58
@Brechtpd
Copy link
Contributor

Previously, when blocks are proven after 1.25*avgProofTime, we mint extra tokens to incentivize the provers, but the blocks' proposers get away without paying extra fees. This may open a door for DOS attack -- the proposers may simply create certain transactions that are harder to prove.

If the average price increases after the protocol notices the prover fee it charges proposers is too low, and the amount of blocks that can be submitted before this happens is limited, is there a way for proposers to abuse the system? For the proposers the only thing that would matter is the gas cost. They could submit a lot of transactions that are more expensive to prove when the prover fee is "low", which will increase the prover fee eventually. They could then submit transactions that are cheap to prove to get the prover fee down again. I don't think there is anything wrong with that, it's just that the transactions fees for the second part will be higher than necessary (but the transaction fees will be lower than the transaction fees in the first part). Transaction fees will be fluctuating a lot anyway so I don't really see a real problem with that. For now I can't really see a way the system could be abused but I could be missing something.

This PR enable the protocol to charge up to 25% additional fees -- 125% of the original proposer fees are burnt initially (100% is the fee, and 25% is called the deposit), then based on the tRef value in the whitepaper, we mint back [0-100%] of the deposit back to the proposer. If tRef == 0, we mint back all deposit, if tRef == 10000, we mint back no deposit to the proposer.

I do want to stress that this is a big change to how the fee market will work, and will put potentially a lot of complexity on the proposers to create profitable blocks. It could introduce a DOS vector on proposers or increase transaction fees for users if having to calculate the costs by having to actually execute the transactions is a hard problem to solve well. Keeping prover fees linked to gas cost will allow us to use any existing fee market/MEV code pretty much out of the box, if we change that we will be forced to support modified versions that are specifically made for Taiko.

@Brechtpd Brechtpd mentioned this pull request Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants