taikoxyz / taiko-mono

A based rollup. 🥁
https://taiko.xyz
MIT License
4.43k stars 2.08k forks source link

refactor(protocol): optimize core protocol and bridge implementation #14310

Closed adaki2004 closed 9 months ago

adaki2004 commented 10 months ago

Inspired by Brecht's feature request, this PR aims to separate the current prover (pool) contract from the core protocol, allowing various prover contract designs. Taiko will act as the "glue" between the core protocol and different prover contracts.

Core protocol Changes introduced in this PR:

Bridge changes introduced in this PR:

dantaik commented 10 months ago

checking the message.to equal to any of the deployed vaults.

The bridge should know nothing about the vaults. Vaults are application level smart contracts that use bridges as an underlaying infrastructure.

Vaults are applications of bridges; bridge is an application of signal service....

adaki2004 commented 10 months ago

checking the message.to equal to any of the deployed vaults.

The bridge should know nothing about the vaults. Vaults are application level smart contracts that use bridges as an underlaying infrastructure.

Vaults are applications of bridges; bridge is an application of signal service....

I put the feature back and in a try..catch, but since message does not have info on srcChain vaults, we need to somehow recover to 'which' contract call the releaseToken(), - please see _getVaultSrcChain() i could not really any 'quciker' idea - in any case you have an idea how to encode/recover this please let me know!

adaki2004 commented 10 months ago

@dantaik I think i addressed all, but please double check. (I'm also addressing what Jeff talked about here https://github.com/taikoxyz/taiko-mono/pull/14065#issuecomment-1661426376 like code exceeds max and failing test)

dantaik commented 10 months ago

@adaki2004 somehow there are 303 files changed by this PR. Not sure if the rebase with main went wrong or not... a bit scary. Maybe resolve the existing conflicts will solve the issue?

dantaik commented 9 months ago

@adaki2004 I convert this PR into a draft so we can merge https://github.com/taikoxyz/taiko-mono/pull/14383 into this one then merge this one into main later.

dantaik commented 9 months ago

pending this one: https://github.com/taikoxyz/taiko-mono/pull/14427

dantaik commented 9 months ago

@d1onys1us the files changed here may also require your attention for improving comments. Please feel free to fork off this branch.

codecov[bot] commented 9 months ago

Codecov Report

Merging #14310 (a160237) into main (a49c65c) will decrease coverage by 0.95%. Report is 26 commits behind head on main. The diff coverage is 19.62%.

:exclamation: Current head a160237 differs from pull request most recent head f6ec18d. Consider uploading reports for the commit f6ec18d to get more accurate results

@@            Coverage Diff             @@
##             main   #14310      +/-   ##
==========================================
- Coverage   65.25%   64.30%   -0.95%     
==========================================
  Files          89       89              
  Lines        3140     3205      +65     
  Branches      109      109              
==========================================
+ Hits         2049     2061      +12     
- Misses        965     1016      +51     
- Partials      126      128       +2     
Flag Coverage Δ *Carryforward flag
bridge-ui 93.91% <ø> (ø) Carriedforward from ab00d40
eventindexer 44.18% <ø> (ø) Carriedforward from ab00d40
relayer 57.47% <19.62%> (-1.60%) :arrow_down:

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

Files Changed Coverage Δ
packages/relayer/indexer/handle_event.go 40.54% <0.00%> (ø)
packages/relayer/message/process_message.go 33.58% <6.84%> (-6.78%) :arrow_down:
packages/relayer/indexer/service.go 68.69% <33.33%> (-5.57%) :arrow_down:
packages/relayer/cli/cli.go 60.37% <100.00%> (+0.59%) :arrow_up:
packages/relayer/message/is_profitable.go 100.00% <100.00%> (ø)
packages/relayer/message/processor.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **bridge-ui-v2** | ⬜️ Ignored ([Inspect](https://vercel.com/taikoxyz/bridge-ui-v2/7cUFc6ytygJ5sXxBh8xJU483mPes)) | [Visit Preview](https://bridge-ui-v2-git-onetxntokenandethrelease-taikoxyz.vercel.app) | | Aug 27, 2023 1:59pm |
dantaik commented 9 months ago

@Brechtpd @davidtaikocha @cyberhorsey please approve this PR again -- I just merge the core protocol optimization PR into this one.