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): major protocol upgrade #13389

Merged
merged 53 commits into from
Apr 23, 2023

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Mar 22, 2023

This is a PR rebased on top of PR #13254. If any comments are not resolved there, we will continue to discuss there but new changes will be applied to this PR.

Major Changes:

  • move as much logic from contracts to circuits as possible. Write an internal doc regarding what needs to be proven by a ZKP.
  • remove commit-and-propose scheme
  • enable EIP-1559 on L2
  • invalid blocks are proven by using zkp as well, just like valid blocks. (invalidatedBlock function is deleted from TaikoL2.sol)
  • the anchor transaction validation is deleted from L1 and shall be done by a new circuit on top of the existing ZKP.
  • synchronize not only the block header hashes across chains, but also the SignalServcie Storage Roots (signalRoot) -- Currently to prove signal's validity on the destination chain, we need to provide a full merkle proof which has two parts, the account proof and the storage proof. After this change, the account proof will be done only once in circuits. Users only need to provide the storage merkle proof, which will be less expensive.
  • use uint64 instead of uint256 for feeBase
  • do NOT refund the proposer if the block is invalid
  • require proposers to deposit TKO token first then burn from its balance before a block can be proposed.
  • call plonk verifiers directly from LibProving by removing IProofVerifier contracts
  • use string.concat and bytes.concat instead of abi.encodePacked/abi.encode
  • delete a few unused libraries
  • disable a lot of protocol tests based on Dave's comment (probably need rewrite)
  • support foundry tests and add a few foundry tests
  • rename config.rewardMultiplierPctg to config.feeMultiplierPctg to be consistent with other config vars.
  • fix math in getTimeAdjustedFee
  • validate configs in TaikoL1.init()
  • baseFee is now a uint64 represent Twei, not Szabo.
  • a few optimization using unchecked -- Need your careful review and feedback
  • allow prover/proposer to have independent configs for dynamic fees
  • optimized gas cost for L2's anchor transaction

Co-authored-by: Jeffery Walsh <cyberhorsey@gmail.com>
Co-authored-by: David <david@taiko.xyz>
Co-authored-by: jeff <113397187+cyberhorsey@users.noreply.github.com>
Co-authored-by: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com>
Co-authored-by: Brecht Devos <Brechtp.Devos@gmail.com>
Co-authored-by: D <51912515+adaki2004@users.noreply.github.com>
Co-authored-by: Keszey Dániel <keszeyd@MacBook-Pro.local>
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #13389 (7f84e77) into major_protocol_upgrade_alpha3 (4812950) will increase coverage by 5.44%.
The diff coverage is 100.00%.

@@                        Coverage Diff                        @@
##           major_protocol_upgrade_alpha3   #13389      +/-   ##
=================================================================
+ Coverage                          39.47%   44.91%   +5.44%     
=================================================================
  Files                                135      133       -2     
  Lines                               4043     3553     -490     
  Branches                             506      363     -143     
=================================================================
  Hits                                1596     1596              
+ Misses                              2343     1853     -490     
  Partials                             104      104              
Flag Coverage Δ *Carryforward flag
bridge-ui 95.81% <100.00%> (ø)
eventindexer 81.09% <ø> (ø) Carriedforward from 4812950
protocol 0.00% <ø> (ø) Carriedforward from 4812950
relayer 62.53% <ø> (ø) Carriedforward from 4812950
ui 100.00% <ø> (ø) Carriedforward from 4812950

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

Impacted Files Coverage Δ
packages/protocol/contracts/L1/TaikoL1.sol 0.00% <ø> (ø)
packages/protocol/contracts/L1/TaikoToken.sol 0.00% <ø> (ø)
...ckages/protocol/contracts/L1/libs/LibProposing.sol 0.00% <ø> (ø)
packages/protocol/contracts/L1/libs/LibProving.sol 0.00% <ø> (ø)
packages/protocol/contracts/L1/libs/LibUtils.sol 0.00% <ø> (ø)
...ckages/protocol/contracts/L1/libs/LibVerifying.sol 0.00% <ø> (ø)
packages/protocol/contracts/L2/TaikoL2.sol 0.00% <ø> (ø)
packages/protocol/contracts/bridge/Bridge.sol 0.00% <ø> (ø)
packages/protocol/contracts/bridge/TokenVault.sol 0.00% <ø> (ø)
...s/protocol/contracts/bridge/libs/LibBridgeData.sol 0.00% <ø> (ø)
... and 21 more

... and 2 files with indirect coverage changes

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

packages/protocol/contracts/L1/TaikoData.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/L1/TaikoData.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/L1/libs/LibProving.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/L1/libs/LibVerifying.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/L1/TaikoData.sol Outdated Show resolved Hide resolved
packages/protocol/contracts/L2/TaikoL2.sol Outdated Show resolved Hide resolved
Co-authored-by: Brecht Devos <Brechtp.Devos@gmail.com>
Co-authored-by: adaki2004 <keszeydani@gmail.com>
if (ethVault != address(0)) {
ethVault.sendEther(message.callValue);
}
ethVault.sendEther(message.callValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not burn the message.callValue now, because ethVault can be 0 address?

…#13489)

Co-authored-by: Daniel Wang <dan@taiko.xyz>
Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com>
…t [1] (#13617)

Co-authored-by: adaki2004 <keszeydani@gmail.com>
Co-authored-by: Dani <51912515+adaki2004@users.noreply.github.com>
cyberhorsey and others added 2 commits April 22, 2023 22:28
Co-authored-by: adaki2004 <keszeydani@gmail.com>
Co-authored-by: David <david@taiko.xyz>
Co-authored-by: Dani <51912515+adaki2004@users.noreply.github.com>
Co-authored-by: adaki2004 <keszeydani@gmail.com>
Co-authored-by: David <david@taiko.xyz>
Co-authored-by: Dani <51912515+adaki2004@users.noreply.github.com>
cyberhorsey and others added 2 commits April 23, 2023 21:34
Co-authored-by: Daniel Wang <dan@taiko.xyz>
Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com>
@dantaik dantaik changed the title feat(protocol): major protocol upgrade(#13254) feat(protocol): major protocol upgrade Apr 23, 2023
@dantaik dantaik marked this pull request as draft April 23, 2023 13:44
auto-merge was automatically disabled April 23, 2023 13:44

Pull request was converted to draft

@dantaik dantaik marked this pull request as ready for review April 23, 2023 13:47
@dantaik dantaik enabled auto-merge April 23, 2023 13:48
@dantaik dantaik changed the base branch from main to major_protocol_upgrade_alpha3 April 23, 2023 13:50
@dantaik dantaik disabled auto-merge April 23, 2023 13:50
@dantaik dantaik merged commit 0b2c9ae into major_protocol_upgrade_alpha3 Apr 23, 2023
@dantaik dantaik deleted the major_protocol_upgrade_rebase branch April 23, 2023 13:50
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.

7 participants