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): Based Contestable Rollup with multi-proofs and multi-hop bridging #14705

Merged
merged 111 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
74783f3
feat(protocol): Contestable zkRollup [DRAFT] (#14703)
dantaik Sep 18, 2023
3e7e6c3
Merge branch 'main' into contestable-zkrollup
dantaik Sep 18, 2023
fb5ca45
Update LibProposing.sol
dong77 Sep 18, 2023
022745f
more
dong77 Sep 18, 2023
5fc177d
Update LibProposing.sol
dong77 Sep 18, 2023
42e57bb
Update TaikoData.sol
dong77 Sep 18, 2023
1f55b21
rename
dong77 Sep 18, 2023
c6ee6e3
Merge branch 'main' into contestable-zkrollup
davidtaikocha Sep 19, 2023
8a64422
Merge branch 'main' into contestable-zkrollup
adaki2004 Sep 19, 2023
795d6f1
Merge branch 'main' into contestable-zkrollup
adaki2004 Sep 19, 2023
72b2de6
Fix tran.timestamp for first proveBlock() txn
adaki2004 Sep 19, 2023
3948721
Merge branch 'main' into contestable-zkrollup
dantaik Sep 19, 2023
917d26d
refactor(protocol): further improve EIP1559 on L2 (#14724)
dantaik Sep 19, 2023
cfe5966
feat(protocol): Contestable zkRollup v2 (observations) [DRAFT] (#14721)
adaki2004 Sep 19, 2023
ea51ba3
Emit an event (#14731)
dantaik Sep 19, 2023
f3c6a36
Merge branch 'main' into contestable-zkrollup
dantaik Sep 20, 2023
0e7258f
Update LibProving.sol
dong77 Sep 20, 2023
25043b6
fix(protocol): fixed a minor issue with getting EIP1559 base fee func…
dantaik Sep 20, 2023
830334f
Merge branch 'main' into contestable-zkrollup
adaki2004 Sep 21, 2023
381abaa
fix(protocol): Hybrid rollup tests and small fixes (#14766)
adaki2004 Sep 21, 2023
0be3527
fix(protocol): allow prover assignment with different proving fees (#…
dantaik Sep 22, 2023
e86320f
feat(protocol): extract tier configs into a provider contract for dec…
dantaik Sep 22, 2023
edc9ccb
refactor(protocol): cleanup solidity imports (#14772)
dantaik Sep 22, 2023
a7edd7b
Update TaikoL2.sol
dong77 Sep 23, 2023
7f8a1bc
fix(protocol): Fix tests (#14783)
adaki2004 Sep 23, 2023
a7133cf
Merge branch 'main' into contestable-zkrollup
dantaik Sep 23, 2023
6c17b0a
more
dong77 Sep 24, 2023
a58c2a0
Merge branch 'main' into contestable-zkrollup
davidtaikocha Sep 25, 2023
248b5da
address build warning
adaki2004 Sep 25, 2023
a353265
remove debug prints
adaki2004 Sep 25, 2023
f47cc85
Optimize gas (#14803)
dantaik Sep 25, 2023
1a6744f
Merge branch 'main' into contestable-zkrollup
dantaik Sep 25, 2023
00f0be1
Merge branch 'main' into contestable-zkrollup
dantaik Sep 26, 2023
4528e7b
fix test command
adaki2004 Sep 26, 2023
77d26e3
fix unit test command
adaki2004 Sep 26, 2023
6de9c60
Fuzz seed workaround
adaki2004 Sep 26, 2023
36b1ece
remove unused eip1559config
adaki2004 Sep 26, 2023
0e340a0
Merge branch 'main' into contestable-zkrollup
davidtaikocha Sep 26, 2023
d07eea1
update comment
adaki2004 Sep 26, 2023
0b4ba34
feat(protocol): emit events in LibTaikoToken (#14821)
dantaik Sep 26, 2023
535ca31
refactor(protocol): rename variables (#14820)
dantaik Sep 26, 2023
7274072
Update packages/protocol/contracts/L1/libs/LibProposing.sol
dantaik Sep 26, 2023
90612d2
feat(protocol): rename config providers and add ZKRollupConfigProvide…
dantaik Sep 27, 2023
bf7262c
fix(protocol): fixes based on David's review (#14828)
dantaik Sep 27, 2023
8770d6c
feat(protocol): Guardian can return unprovable bonds (#14830)
adaki2004 Sep 27, 2023
67f4edf
Update GuardianVerifier.sol
dong77 Sep 27, 2023
7f34319
Merge branch 'main' into contestable-zkrollup
dantaik Sep 27, 2023
5a2aa13
feat(protocol): update `DeployOnL1` script based on Contestable zkRol…
davidtaikocha Sep 27, 2023
29bfd96
feat(protocol): add extraData to proposed block (#14846)
dantaik Sep 28, 2023
be0fe1c
feat(protocol): add `minTier` to `BlockProposed` event (#14859)
davidtaikocha Sep 30, 2023
ea737d3
feat(protocol): add a missing slot value in pre-deployed `TaikoL2` ge…
davidtaikocha Oct 1, 2023
61268f5
Merge branch 'main' into contestable-zkrollup
davidtaikocha Oct 1, 2023
781464f
refactor(protocol): reimplement curve(amm)-based 1559 for L2a (#14885)
dantaik Oct 3, 2023
6a6cc8b
chore(protocol): Contestable rollup additions (design docs, documenta…
adaki2004 Oct 3, 2023
d072fc5
feat(eventindexer): Contestable zkrollup eventindexer (#14892)
cyberhorsey Oct 4, 2023
14d5ffd
fix genesis test
adaki2004 Oct 4, 2023
324be43
remove parentTimestamp from taikoL2.ts
adaki2004 Oct 4, 2023
a74f44f
Merge branch 'alpha-6' into contestable-zkrollup
dantaik Oct 4, 2023
4c78ddb
feat(protocol): implemented partial and more fair block proposal rew…
adaki2004 Oct 6, 2023
49efd75
feat(protocol): lower top tier proof cost (#14922)
dantaik Oct 9, 2023
2bcf2bf
feat(protocol): allow checking config after initialization (#14924)
dantaik Oct 10, 2023
b3a77cc
feat(protocol): reward proposer using gas used on L2 (#14929)
dantaik Oct 13, 2023
6f88830
Update TaikoErrors.sol
dong77 Oct 13, 2023
3d3e1ab
Merge branch 'alpha-6' into contestable-zkrollup
dantaik Oct 13, 2023
cd76f60
refactor(protocol): update TaikoL2.sol (#14947)
mvidovic-tuple Oct 14, 2023
2511b58
Update TaikoL2.sol
dong77 Oct 14, 2023
1f3fd0f
Update TaikoL2.sol
dong77 Oct 14, 2023
d9e3617
pnpm update --latest
dong77 Oct 15, 2023
7d947b2
pnpm update --latest
dong77 Oct 15, 2023
6772f94
refactor(protocol): address manager cannot be changed, only upgradabl…
dantaik Oct 16, 2023
22c4a5a
fix(protocol): Revert long imports (hardhat seems issues parsing rema…
adaki2004 Oct 16, 2023
6945598
feat(protocol): support multi-hop bridging & add SGX prover (#14954)
dantaik Oct 17, 2023
56efc69
merge
dong77 Oct 17, 2023
7a58e95
Add refund in onMessageRecalled
adaki2004 Oct 18, 2023
b8e699c
fix typo
adaki2004 Oct 18, 2023
372b8e5
Added sgxAndZk verifier to deployment
adaki2004 Oct 18, 2023
ee4f93e
Test for proof and hop proof
adaki2004 Oct 18, 2023
362ee57
getInstance -> calcInstance
dong77 Oct 19, 2023
ee6f34d
remove errors
dong77 Oct 19, 2023
cb21e4e
Update SgxVerifier.sol
dong77 Oct 19, 2023
00e20be
fix(protocol): Fix LibAddress (#14989)
adaki2004 Oct 19, 2023
4d740b5
add warning acc. to Brecht
adaki2004 Oct 19, 2023
74d2649
function order change
adaki2004 Oct 19, 2023
d63982e
function order change2
adaki2004 Oct 19, 2023
56c0198
chore(protocol): deploy `ProxiedGuardianProver` in `DeployOnL1` scrip…
davidtaikocha Oct 20, 2023
409f368
feat(protocol): remove block reward (#14992)
dantaik Oct 20, 2023
5b7fc25
feat(protocol): Simulate and plot l2 basefee (#14997)
adaki2004 Oct 21, 2023
394ff17
refactor(protocol): improve TaikoToken and allow pausing Bridge/Vault…
dantaik Oct 21, 2023
2cc9863
Merge branch 'contestable-zkrollup-consolidated' into contestable-zkr…
dantaik Oct 21, 2023
8ba512b
feat(protocol): set taiko token supply to 1 billion (#15007)
dantaik Oct 23, 2023
8e6c047
feat(relayer): Relayer multihop (#15000)
cyberhorsey Oct 23, 2023
9ca78ae
Add description
adaki2004 Oct 24, 2023
136ee0e
feat(protocol): Enable designated address to propose 1st block post-g…
dantaik Oct 25, 2023
edf9452
feat(repo): add a contract to handle token granting and unlocking (#1…
dantaik Oct 25, 2023
cb43010
fix(protocol): check l1BlockHash & l1SignalRoot in anchortx (#15035)
dantaik Oct 25, 2023
c334af7
merge
dong77 Oct 25, 2023
2a908be
merge
dong77 Oct 26, 2023
004e02a
test(protocol): fix workflow errors (#15043)
davidtaikocha Oct 26, 2023
7363b64
feat(protocol): update A6 configurations (#15025)
davidtaikocha Oct 27, 2023
ff5d3da
bindings
cyberhorsey Oct 27, 2023
ac3856a
not every block is synced
cyberhorsey Oct 27, 2023
ca29a72
test
cyberhorsey Oct 27, 2023
c704bae
fix(protocol): Change sgx instanceId to 4bytes (#15092)
adaki2004 Oct 31, 2023
a31854d
feat(protocol): allow using both blob & calldata for DA (#15011)
dantaik Nov 2, 2023
077b343
merge with main
dong77 Nov 2, 2023
0a2ab0c
Merge branch 'contestable-zkrollup' of https://github.com/taikoxyz/ta…
dong77 Nov 2, 2023
19e7ec1
feat(protocol): Return value to sgx addition (#15111)
adaki2004 Nov 3, 2023
9b0728a
Merge branch 'main' into contestable-zkrollup
dantaik Nov 9, 2023
1c273b0
fix(protocol): get around forge bug (#15192)
dantaik Nov 12, 2023
3069a52
refactor(protocol): refactor bridge/vault/signal for multi-chain depl…
dantaik Nov 15, 2023
1adf901
merge upstream
dong77 Nov 15, 2023
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
24 changes: 0 additions & 24 deletions packages/protocol/contracts/L1/IProofVerifier.sol

This file was deleted.

4 changes: 2 additions & 2 deletions packages/protocol/contracts/L1/IProver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ interface IProver {
/// @param blockId The ID of the proposed block. Note that the ID is only
/// known when the block is proposed, therefore, it should not be used for
/// verifying prover authorization.
/// @param input The block's BlockMetadataInput data.
/// @param txListHash The block's txList hash
/// @param assignment The assignment to evaluate
function onBlockAssigned(
uint64 blockId,
TaikoData.BlockMetadataInput calldata input,
bytes32 txListHash,
TaikoData.ProverAssignment calldata assignment
)
external
Expand Down
75 changes: 0 additions & 75 deletions packages/protocol/contracts/L1/ProofVerifier.sol

This file was deleted.

82 changes: 34 additions & 48 deletions packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,17 @@ library TaikoData {
uint32 blockFeeBaseGas;
// The maximum allowed bytes for the proposed transaction list calldata.
uint24 blockMaxTxListBytes;
// The expiration time for the block transaction list.
uint256 blockTxListExpiry;
// Amount of token to reward to the first block propsoed in each L1
// block.
uint256 proposerRewardPerSecond;
uint256 proposerRewardMax;
// ---------------------------------------------------------------------
// Group 3: Proof related configs
// ---------------------------------------------------------------------
// The cooldown period for regular proofs (in minutes).
uint256 proofRegularCooldown;
// The cooldown period for oracle proofs (in minutes).
uint256 proofOracleCooldown;
// The maximum time window allowed for a proof submission (in minutes).
uint16 proofWindow;
// The amount of Taiko token as a bond
uint96 proofBond;
// The amount of Taiko token as a zk proof bond
uint96 assignmentBond;
// True to skip proof verification
bool skipProverAssignmentVerificaiton;
bool skipAssignmentVerificaiton;
// ---------------------------------------------------------------------
// Group 4: ETH deposit related configs
// ---------------------------------------------------------------------
Expand All @@ -73,23 +65,22 @@ library TaikoData {
uint256 ethDepositMaxFee;
}

struct TierConfig {
bytes32 verifierName;
uint96 proofBond;
uint96 contestBond;
uint24 cooldownWindow;
uint16 provingWindow;
}

/// @dev Struct holding state variables.
struct StateVariables {
uint64 genesisHeight;
uint64 genesisTimestamp;
uint64 numBlocks;
uint64 lastVerifiedBlockId;
uint64 nextEthDepositToProcess;
uint64 numEthDeposits;
}

/// @dev Struct representing input data for block metadata.
struct BlockMetadataInput {
bytes32 txListHash;
address proposer;
uint24 txListByteStart; // byte-wise start index (inclusive)
uint24 txListByteEnd; // byte-wise end index (exclusive)
bool cacheTxListInfo;
uint64 numBlocks;
uint64 lastVerifiedBlockId;
}

/// @dev Struct representing prover assignment
Expand All @@ -100,19 +91,13 @@ library TaikoData {
}

/// @dev Struct containing data only required for proving a block
/// Warning: changing this struct requires changing {LibUtils.hashMetadata}
/// accordingly.
struct BlockMetadata {
uint64 id;
uint64 timestamp;
uint64 l1Height;
bytes32 l1Hash;
bytes32 mixHash;
bytes32 txListHash;
uint24 txListByteStart;
uint24 txListByteEnd;
uint64 timestamp;
uint64 l1Height;
uint32 gasLimit;
address proposer;
davidtaikocha marked this conversation as resolved.
Show resolved Hide resolved
TaikoData.EthDeposit[] depositsProcessed;
}

Expand All @@ -123,31 +108,36 @@ library TaikoData {
bytes32 blockHash;
bytes32 signalRoot;
bytes32 graffiti;
address prover;
bytes proofs;
uint16 tier;
bytes proof;
}

/// @dev Struct representing state transition data.
/// 10 slots reserved for upgradability, 4 slots used.
/// 10 slots reserved for upgradability, 6 slots used.
struct Transition {
bytes32 key; //only written/read for the 1st state transition.
bytes32 blockHash;
bytes32 signalRoot;
address prover;
uint64 provenAt;
bytes32[6] __reserved;
bytes32 key; // slot 1, only written/read for the 1st state transition.
bytes32 blockHash; // slot 2
bytes32 signalRoot; // slot 3
address prover; // slot 4
uint96 proofBond;
address contester; // slot 5
uint96 contestBond;
uint64 timestamp; // slot 6 (82 bits)
uint16 tier;
bytes32[4] __reserved;
}

/// @dev Struct containing data required for verifying a block.
/// 10 slots reserved for upgradability, 3 slots used.
struct Block {
bytes32 metaHash; // slot 1
address prover; // slot 2
uint96 proofBond;
address assignedProver; // slot 2
uint96 assignmentBond;
uint64 blockId; // slot 3
uint64 proposedAt;
uint32 nextTransitionId;
uint32 verifiedTransitionId;
uint16 minTier;
bytes32[7] __reserved;
}

Expand Down Expand Up @@ -198,15 +188,11 @@ library TaikoData {
uint64 blockId_mod_blockRingBufferSize
=> mapping(uint32 transitionId => Transition)
) transitions;
// txList cached info
mapping(bytes32 txListHash => TxListInfo) txListInfo;
// Ring buffer for Ether deposits
mapping(uint256 depositId_mod_ethDepositRingBufferSize => uint256)
ethDeposits;
// In-protocol Taiko token balances
mapping(address account => uint256 balance) taikoTokenBalances;
SlotA slotA; // slot 7
SlotB slotB; // slot 8
uint256[142] __gap;
SlotA slotA; // slot 5
SlotB slotB; // slot 6
uint256[144] __gap;
}
}
25 changes: 14 additions & 11 deletions packages/protocol/contracts/L1/TaikoErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,32 @@ pragma solidity ^0.8.20;
abstract contract TaikoErrors {
// NOTE: The following custom errors must match the definitions in
// `L1/libs/*.sol`.
error L1_ALREADY_PROVEN();
error L1_BLOCK_ID_MISMATCH();
error L1_EVIDENCE_MISMATCH();
error L1_INSUFFICIENT_TOKEN();
error L1_ALREADY_CONTESTED();
error L1_ALREADY_PROVED();
error L1_ASSIGNED_PROVER_NOT_ALLOWED();
error L1_BLOCK_MISMATCH();
error L1_INVALID_ASSIGNMENT();
error L1_INVALID_BLOCK_ID();
error L1_INVALID_CONFIG();
error L1_INVALID_ETH_DEPOSIT();
error L1_INVALID_EVIDENCE();
error L1_INVALID_METADATA();
error L1_INVALID_ORACLE_PROVER();
error L1_INVALID_PARAM();
error L1_INVALID_PROOF();
error L1_INVALID_PROPOSER();
error L1_INVALID_PROVER();
error L1_INVALID_PROVER_SIG();
error L1_NOT_PROVEABLE();
error L1_SAME_PROOF();
error L1_INVALID_TIER();
error L1_NOT_ASSIGNED_PROVER();
error L1_TIER_NOT_FOUND();
error L1_TOO_MANY_BLOCKS();
error L1_TRANSITION_ID_ZERO();
error L1_TRANSITION_NOT_FOUND();
error L1_TX_LIST_NOT_EXIST();
error L1_TX_LIST_HASH();
error L1_TX_LIST_RANGE();
error L1_TX_LIST();
error L1_TXLIST_INVALID_RANGE();
error L1_TXLIST_MISMATCH();
error L1_TXLIST_NOT_FOUND();
error L1_TXLIST_TOO_LARGE();
error L1_UNAUTHORIZED();
error L1_UNEXPECTED_TRANSITION_ID();
error L1_UNEXPECTED_TRANSITION_TIER();
}
56 changes: 31 additions & 25 deletions packages/protocol/contracts/L1/TaikoEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,56 @@ import { TaikoData } from "./TaikoData.sol";
abstract contract TaikoEvents {
/// @dev Emitted when a block is proposed.
/// @param blockId The ID of the proposed block.
/// @param prover The address of the assigned prover for the block.
/// @param assignedProver The block's assigned prover
/// @param reward The proposer's block reward in Taiko token.
/// @param meta The block metadata containing information about the proposed
/// block.
event BlockProposed(
uint256 indexed blockId,
address indexed prover,
address indexed assignedProver,
uint96 assignmentBond,
uint256 reward,
TaikoData.BlockMetadata meta
);

/// @dev Emitted when a block is proven.
/// @param blockId The ID of the proven block.
/// @param parentHash The hash of the parent block.
/// @param blockHash The hash of the proven block.
/// @param signalRoot The signal root of the proven block.
/// @param prover The address of the prover who submitted the proof.
event BlockProven(
/// @dev Emitted when a block is verified.
/// @param blockId The ID of the verified block.
/// @param assignedProver The block's assigned prover
/// @param prover The prover whose transition is used for verifing the
/// block.
/// @param blockHash The hash of the verified block.
event BlockVerified(
uint256 indexed blockId,
address indexed assignedProver,
address indexed prover,
bytes32 blockHash,
bytes32 signalRoot
);

/// @dev Emitted when a block transition is proved or re-proved.
event TransitionProved(
uint256 indexed blockId,
bytes32 parentHash,
bytes32 blockHash,
bytes32 signalRoot,
address prover
address prover,
uint96 proofBond,
uint16 tier
);

/// @dev Emitted when a block is verified.
/// @param blockId The ID of the verified block.
/// @param prover The address of the prover that proved the block which is
/// verified.
/// @param blockHash The hash of the verified block.
event BlockVerified(
uint256 indexed blockId, address indexed prover, bytes32 blockHash
/// @dev Emitted when a block transition is contested.
event TransitionContested(
uint256 indexed blockId,
bytes32 parentHash,
bytes32 blockHash,
bytes32 signalRoot,
address contester,
uint96 contestBond,
uint16 tier
);

/// @dev Emitted when an Ethereum deposit is made.
/// @param deposit The Ethereum deposit information including recipient,
/// amount, and ID.
event EthDeposited(TaikoData.EthDeposit deposit);

/// @dev The following events are emitted when bonds are received, returned,
/// or rewarded. Note that no event is emitted when a bond is kept/burnt as
/// for a single block, multiple bonds may get burned or retained by the
/// protocol, emitting events will consume more gas.
event BondReceived(address indexed from, uint64 blockId, uint256 bond);
event BondReturned(address indexed to, uint64 blockId, uint256 bond);
event BondRewarded(address indexed to, uint64 blockId, uint256 bond);
}
Loading