Skip to content

Commit 02552f2

Browse files
dantaikcyberhorseydavidtaikochadionysuzxBrechtpd
authored
feat(protocol): major protocol upgrade for alpha-3 testnet (taikoxyz#13640)
Co-authored-by: Jeffery Walsh <[email protected]> Co-authored-by: David <[email protected]> Co-authored-by: jeff <[email protected]> Co-authored-by: dave | d1onys1us <[email protected]> Co-authored-by: Brecht Devos <[email protected]> Co-authored-by: D <[email protected]> Co-authored-by: Keszey Dániel <[email protected]> Co-authored-by: adaki2004 <[email protected]> Co-authored-by: Daniel Wang <[email protected]> Co-authored-by: Francisco Ramos <[email protected]>
1 parent 864151f commit 02552f2

File tree

296 files changed

+129157
-18331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+129157
-18331
lines changed

.github/workflows/protocol.yml

+25-26
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,46 @@ jobs:
2020

2121
- name: Checkout repository
2222
uses: actions/checkout@v3
23+
with:
24+
submodules: recursive
25+
26+
- name: Install Foundry
27+
uses: foundry-rs/foundry-toolchain@v1
2328

2429
- name: Install pnpm dependencies
2530
uses: ./.github/actions/install-pnpm-dependencies
2631

2732
- name: protocol - Unit Tests
2833
working-directory: ./packages/protocol
29-
run: pnpm clean && pnpm test
30-
31-
- name: protocol - Integration Tests
32-
working-directory: ./packages/protocol
33-
run: pnpm test:integration
34-
35-
- name: protocol - Tokenomics Tests
36-
working-directory: ./packages/protocol
37-
run: pnpm test:tokenomics
38-
39-
- name: protocol - Bridge Tests
40-
working-directory: ./packages/protocol
41-
run: pnpm test:bridge
42-
43-
- name: protocol - Test Coverage
44-
working-directory: ./packages/protocol
45-
run: pnpm test:coverage
34+
run: pnpm clean && pnpm compile:hardhat && pnpm test
4635

4736
- name: protocol - Generate Genesis
4837
working-directory: ./packages/protocol
4938
run: pnpm test:genesis
5039

51-
- name: protocol - Export ABIs
40+
# TODO: CompilerError: Stack too deep
41+
# - name: protocol - Test Coverage
42+
# working-directory: ./packages/protocol
43+
# run: pnpm test:coverage
44+
45+
- name: protocol - Run snapshot (foundry)
5246
working-directory: ./packages/protocol
53-
run: pnpm export:abi
47+
run: pnpm snapshot
5448

5549
- name: protocol - Deploy L1 Contracts
5650
working-directory: ./packages/protocol
57-
run: pnpm deploy:hardhat
58-
59-
- name: protocol - Upload coverage to Codecov
60-
uses: codecov/codecov-action@v3
61-
with:
62-
directory: ./packages/protocol/coverage
63-
flags: protocol
51+
run: |
52+
anvil &
53+
while ! nc -z localhost 8545; do
54+
sleep 1
55+
done
56+
pnpm deploy:foundry
57+
58+
# - name: protocol - Upload coverage to Codecov
59+
# uses: codecov/codecov-action@v3
60+
# with:
61+
# directory: ./packages/protocol/coverage
62+
# flags: protocol
6463

6564
post-merge:
6665
if: github.event.pull_request.merged == true

.gitmodules

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[submodule "packages/protocol/lib/solmate"]
2+
path = packages/protocol/lib/solmate
3+
url = https://github.com/rari-capital/solmate
4+
branch = v1.5.0
5+
[submodule "packages/protocol/lib/openzeppelin-contracts-upgradeable"]
6+
path = packages/protocol/lib/openzeppelin-contracts-upgradeable
7+
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
8+
branch = v4.8.2
9+
[submodule "packages/protocol/lib/openzeppelin-contracts"]
10+
path = packages/protocol/lib/openzeppelin-contracts
11+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
12+
branch = v4.8.2
13+
[submodule "packages/protocol/lib/forge-std"]
14+
path = packages/protocol/lib/forge-std
15+
url = https://github.com/foundry-rs/forge-std
16+
branch = chore/v1.5.1

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
[![Twitter Follow](https://img.shields.io/twitter/follow/taikoxyz?style=social)](https://twitter.com/taikoxyz)
1818
[![Discord](https://img.shields.io/discord/984015101017346058?color=%235865F2&label=Discord&logo=discord&logoColor=%23fff)](https://discord.gg/taikoxyz)
1919
[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/taikoxyz/taiko-mono/badge)](https://www.gitpoap.io/gh/taikoxyz/taiko-mono)
20+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/taikoxyz/taiko-mono/protocol.yml?branch=main&label=Protocol&logo=github)](https://github.com/taikoxyz/taiko-mono/actions/workflows/protocol.yml)
21+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/taikoxyz/taiko-mono/relayer.yml?branch=main&label=Relayer&logo=github)](https://github.com/taikoxyz/taiko-mono/actions/workflows/relayer.yml)
22+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/taikoxyz/taiko-mono/bridge-ui.yml?branch=main&label=Bridge%20UI&logo=github)](https://github.com/taikoxyz/taiko-mono/actions/workflows/bridge-ui.yml)
23+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/taikoxyz/taiko-mono/website.yml?branch=main&label=Website&logo=github)](https://github.com/taikoxyz/taiko-mono/actions/workflows/website.yml)
2024
[![License](https://img.shields.io/github/license/taikoxyz/taiko-mono)](https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md)
2125

2226
</div>
@@ -41,7 +45,6 @@ taiko-mono/
4145
│ ├── <a href="./packages/relayer">relayer</a>: Bridge backend relayer in Go
4246
│ ├── <a href="./packages/starter-dapp">starter-dapp</a>: Template for Taiko dapps
4347
│ ├── <a href="./packages/status-page">status-page</a>: Taiko protocol status page
44-
│ ├── <a href="./packages/tokenomics">tokenomics</a>: Taiko tokenomics simulations
4548
│ ├── <a href="./packages/website">website</a>: Main documentation website at taiko.xyz (https://taiko.xyz/)
4649
│ └── <a href="./packages/whitepaper">whitepaper</a>: Whitepaper source files with automated publishing
4750
...

packages/bridge-ui/CHANGELOG.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,18 @@
5252

5353
## [0.3.0](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v0.2.0...bridge-ui-v0.3.0) (2023-03-15)
5454

55-
5655
### Features
5756

58-
* **bridge-ui:** custom recipient address ([#13309](https://github.com/taikoxyz/taiko-mono/issues/13309)) ([56d8848](https://github.com/taikoxyz/taiko-mono/commit/56d884812b3f12a52895bc666cb25e6edbe6eba0))
59-
* **bridge-ui:** fetch transactions from relayer api ([#13244](https://github.com/taikoxyz/taiko-mono/issues/13244)) ([9732cc0](https://github.com/taikoxyz/taiko-mono/commit/9732cc084ed99196a4cd2ccedf9187af4d289ed6))
60-
* **bridge-ui:** support both bull and horse tokens on the bridge UI ([#13249](https://github.com/taikoxyz/taiko-mono/issues/13249)) ([f9f38bb](https://github.com/taikoxyz/taiko-mono/commit/f9f38bb075c02c7976e0d04c84e4b8b5ac255644))
61-
* **bridge-ui:** support route param to directly open transactions tab ([#13281](https://github.com/taikoxyz/taiko-mono/issues/13281)) ([b4c31cd](https://github.com/taikoxyz/taiko-mono/commit/b4c31cd8566b834cbf83a434c705fb281d375d12))
62-
57+
- **bridge-ui:** custom recipient address ([#13309](https://github.com/taikoxyz/taiko-mono/issues/13309)) ([56d8848](https://github.com/taikoxyz/taiko-mono/commit/56d884812b3f12a52895bc666cb25e6edbe6eba0))
58+
- **bridge-ui:** fetch transactions from relayer api ([#13244](https://github.com/taikoxyz/taiko-mono/issues/13244)) ([9732cc0](https://github.com/taikoxyz/taiko-mono/commit/9732cc084ed99196a4cd2ccedf9187af4d289ed6))
59+
- **bridge-ui:** support both bull and horse tokens on the bridge UI ([#13249](https://github.com/taikoxyz/taiko-mono/issues/13249)) ([f9f38bb](https://github.com/taikoxyz/taiko-mono/commit/f9f38bb075c02c7976e0d04c84e4b8b5ac255644))
60+
- **bridge-ui:** support route param to directly open transactions tab ([#13281](https://github.com/taikoxyz/taiko-mono/issues/13281)) ([b4c31cd](https://github.com/taikoxyz/taiko-mono/commit/b4c31cd8566b834cbf83a434c705fb281d375d12))
6361

6462
### Bug Fixes
6563

66-
* **bridge-ui:** minor transactions list fix ([#13266](https://github.com/taikoxyz/taiko-mono/issues/13266)) ([4e78865](https://github.com/taikoxyz/taiko-mono/commit/4e788655ebd508eca3e1665ecb50f3010d2f51af))
67-
* **bridge-ui:** transaction and pendingTransaction refactor ([#13307](https://github.com/taikoxyz/taiko-mono/issues/13307)) ([9d215cf](https://github.com/taikoxyz/taiko-mono/commit/9d215cfe5ac6863405390444672a1e70e7501032))
68-
* **website,bridge-ui:** broken docs link + remove deprecated note in docs ([#13259](https://github.com/taikoxyz/taiko-mono/issues/13259)) ([912c155](https://github.com/taikoxyz/taiko-mono/commit/912c15595d7b0e3e2b4ec62fbcebeaf9dbc9db66))
64+
- **bridge-ui:** minor transactions list fix ([#13266](https://github.com/taikoxyz/taiko-mono/issues/13266)) ([4e78865](https://github.com/taikoxyz/taiko-mono/commit/4e788655ebd508eca3e1665ecb50f3010d2f51af))
65+
- **bridge-ui:** transaction and pendingTransaction refactor ([#13307](https://github.com/taikoxyz/taiko-mono/issues/13307)) ([9d215cf](https://github.com/taikoxyz/taiko-mono/commit/9d215cfe5ac6863405390444672a1e70e7501032))
66+
- **website,bridge-ui:** broken docs link + remove deprecated note in docs ([#13259](https://github.com/taikoxyz/taiko-mono/issues/13259)) ([912c155](https://github.com/taikoxyz/taiko-mono/commit/912c15595d7b0e3e2b4ec62fbcebeaf9dbc9db66))
6967

7068
## [0.2.0](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v0.1.2...bridge-ui-v0.2.0) (2023-03-01)
7169

packages/bridge-ui/src/bridge/ERC20Bridge.ts

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export class ERC20Bridge implements Bridge {
162162
messageStatus === MessageStatus.Done ||
163163
messageStatus === MessageStatus.Failed
164164
) {
165+
// TODO: should be throw a different error when status is Failed?
165166
throw Error('message already processed');
166167
}
167168

packages/bridge-ui/src/bridge/ETHBridge.ts

+6
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,18 @@ export class ETHBridge implements Bridge {
104104
throw Error('message already processed');
105105
}
106106

107+
if (messageStatus === MessageStatus.Failed) {
108+
throw Error('user can not process this, message has failed');
109+
}
110+
107111
const signerAddress = await opts.signer.getAddress();
108112

109113
if (opts.message.owner.toLowerCase() !== signerAddress.toLowerCase()) {
110114
throw Error('user can not process this, it is not their message');
111115
}
112116

117+
// TODO: up to here we share same logic as ERC20Bridge
118+
113119
if (messageStatus === MessageStatus.New) {
114120
const proofOpts = {
115121
srcChain: opts.message.srcChainId,

packages/bridge-ui/src/components/Transactions/Transaction.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
import { LottiePlayer } from '@lottiefiles/svelte-lottie-player';
1515
import { errorToast, successToast } from '../Toast.svelte';
16-
import HeaderSyncABI from '../../constants/abi/HeaderSync';
16+
import HeaderSyncABI from '../../constants/abi/ICrossChainSync';
1717
import BridgeABI from '../../constants/abi/Bridge';
1818
import ButtonWithTooltip from '../ButtonWithTooltip.svelte';
1919
import TokenVaultABI from '../../constants/abi/TokenVault';
@@ -180,7 +180,7 @@
180180
providers[chains[transaction.toChainId].id],
181181
);
182182
183-
const latestSyncedHeader = await contract.getLatestSyncedHeader();
183+
const latestSyncedHeader = await contract.getCrossChainBlockHash(0);
184184
const srcBlock = await providers[
185185
chains[transaction.fromChainId].id
186186
].getBlock(latestSyncedHeader);

packages/bridge-ui/src/constants/abi/HeaderSync.ts packages/bridge-ui/src/constants/abi/ICrossChainSync.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,28 @@ export default [
1111
{
1212
indexed: false,
1313
internalType: 'bytes32',
14-
name: 'srcHash',
14+
name: 'blockHash',
15+
type: 'bytes32',
16+
},
17+
{
18+
indexed: false,
19+
internalType: 'bytes32',
20+
name: 'signalRoot',
1521
type: 'bytes32',
1622
},
1723
],
18-
name: 'HeaderSynced',
24+
name: 'CrossChainSynced',
1925
type: 'event',
2026
},
2127
{
22-
inputs: [],
23-
name: 'getLatestSyncedHeader',
28+
inputs: [
29+
{
30+
internalType: 'uint256',
31+
name: 'number',
32+
type: 'uint256',
33+
},
34+
],
35+
name: 'getCrossChainBlockHash',
2436
outputs: [
2537
{
2638
internalType: 'bytes32',
@@ -39,7 +51,7 @@ export default [
3951
type: 'uint256',
4052
},
4153
],
42-
name: 'getSyncedHeader',
54+
name: 'getCrossChainSignalRoot',
4355
outputs: [
4456
{
4557
internalType: 'bytes32',

packages/bridge-ui/src/proof/ProofService.spec.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const mockProvider = {
77
};
88

99
const mockContract = {
10-
getLatestSyncedHeader: jest.fn(),
10+
getCrossChainBlockHash: jest.fn(),
1111
};
1212

1313
jest.mock('ethers', () => ({
@@ -105,11 +105,9 @@ const invalidStorageProof2: EthGetProofResponse = {
105105
};
106106

107107
const expectedProof =
108-
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000380a7881266ca0a344c43cb24175d9dbd243b58d45d6ae6ad71310a273a3d1d3afb1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec8c0dcf937b3f6136dd70a1ad11cc57b040fd410f3c49a5146f20c732895a3cc217273ade6b6ed865a9975ac281da23b90b141a8b607d874d2cd95e65e81336f8e74bb61e381e9238a08b169580f3cbf9b8b79d7d5ee708d3e286103eb291dfd0800000000000400000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000020000000000000000000000000000000000000000000000000100000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000300f5ba25df1e92e89a09e0b32063b81795f631100801158f5fa733f2ba26843bd0000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001265746865726d696e652d75732d7765737431000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022e1a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';
109-
108+
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000380a7881266ca0a344c43cb24175d9dbd243b58d45d6ae6ad71310a273a3d1d3afb1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec8c0dcf937b3f6136dd70a1ad11cc57b040fd410f3c49a5146f20c732895a3cc217273ade6b6ed865a9975ac281da23b90b141a8b607d874d2cd95e65e81336f8e74bb61e381e9238a08b169580f3cbf9b8b79d7d5ee708d3e286103eb291dfd0800000000000400000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000020000000000000000000000000000000000000000000000000100000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000300f5ba25df1e92e89a09e0b32063b81795f631100801158f5fa733f2ba26843bd0000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001265746865726d696e652d75732d776573743100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022e1a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';
110109
const expectedProofWithBaseFee =
111-
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000380a7881266ca0a344c43cb24175d9dbd243b58d45d6ae6ad71310a273a3d1d3afb1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec8c0dcf937b3f6136dd70a1ad11cc57b040fd410f3c49a5146f20c732895a3cc217273ade6b6ed865a9975ac281da23b90b141a8b607d874d2cd95e65e81336f8e74bb61e381e9238a08b169580f3cbf9b8b79d7d5ee708d3e286103eb291dfd0800000000000400000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000020000000000000000000000000000000000000000000000000100000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000300f5ba25df1e92e89a09e0b32063b81795f631100801158f5fa733f2ba26843bd0000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001265746865726d696e652d75732d7765737431000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022e1a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';
112-
110+
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000380a7881266ca0a344c43cb24175d9dbd243b58d45d6ae6ad71310a273a3d1d3afb1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347000000000000000000000000ea674fdde714fd979de3edf0f56aa9716b898ec8c0dcf937b3f6136dd70a1ad11cc57b040fd410f3c49a5146f20c732895a3cc217273ade6b6ed865a9975ac281da23b90b141a8b607d874d2cd95e65e81336f8e74bb61e381e9238a08b169580f3cbf9b8b79d7d5ee708d3e286103eb291dfd0800000000000400000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000020000000000000000000000000000000000000000000000000100000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000300f5ba25df1e92e89a09e0b32063b81795f631100801158f5fa733f2ba26843bd0000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001265746865726d696e652d75732d776573743100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022e1a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';
113111
const srcChain = 167001;
114112
const destChain = 31336;
115113

0 commit comments

Comments
 (0)