From a8e6c5482f012e292f6741d7279e0937943f9a20 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Wed, 18 Sep 2024 11:09:08 +0800 Subject: [PATCH 1/8] =?UTF-8?q?Reward=20actual=20prover=20=C2=BD=20livenes?= =?UTF-8?q?s=20bond?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../protocol/contracts/layer1/based/LibProving.sol | 4 +++- .../test/layer1/based/TaikoL1TestGroup1.t.sol | 12 +++++------- .../test/layer1/based/TaikoL1TestGroup3.t.sol | 8 ++++---- .../test/layer1/based/TaikoL1TestGroup4.t.sol | 2 +- .../test/layer1/based/TaikoL1TestGroup5.t.sol | 4 ++-- .../test/layer1/based/TaikoL1TestGroup9.t.sol | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/protocol/contracts/layer1/based/LibProving.sol b/packages/protocol/contracts/layer1/based/LibProving.sol index 753fa6f097b..88f173f80f4 100644 --- a/packages/protocol/contracts/layer1/based/LibProving.sol +++ b/packages/protocol/contracts/layer1/based/LibProving.sol @@ -575,7 +575,7 @@ library LibProving { private { // Higher tier proof overwriting lower tier proof - uint256 reward; // reward to the new (current) prover + uint256 reward; // reward to the new (current) prover - msg.sender if (_ts.contester != address(0)) { if (_local.sameTransition) { @@ -611,6 +611,8 @@ library LibProving { } else { LibBonds.creditBond(_state, _local.assignedProver, _local.livenessBond); } + } else if (!_local.isTopTier) { + reward += _local.livenessBond/2; } } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol index 7192f3b8e6c..4fd10ac8eaf 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol @@ -116,7 +116,6 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { printBlockAndTrans(0); giveEthAndTko(Alice, 10_000 ether, 1000 ether); - giveEthAndTko(Taylor, 10_000 ether, 1000 ether); ITierProvider.Tier memory tierOp = TestTierProvider(cp).getTier(LibTiers.TIER_OPTIMISTIC); @@ -171,7 +170,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { provenAt = ts.timestamp; - assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.validityBond + livenessBond/2); } console2.log("====== Verify block"); @@ -196,7 +195,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(ts.timestamp, provenAt); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether); + assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + livenessBond/2); } } @@ -351,17 +350,16 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - L1.getConfig().livenessBond); } } + // Test summary: // 1. Alice proposes a block, // 2. Alice proves the block outside the proving window, using the correct parent hash. // 3. Alice's proof is used to verify the block. - function test_taikoL1_group_1_case_6() external { vm.warp(1_000_000); printBlockAndTrans(0); giveEthAndTko(Alice, 10_000 ether, 1000 ether); - giveEthAndTko(Taylor, 10_000 ether, 1000 ether); ITierProvider.Tier memory tierOp = TestTierProvider(cp).getTier(LibTiers.TIER_OPTIMISTIC); @@ -417,7 +415,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { provenAt = ts.timestamp; assertEq( - totalTkoBalance(tko, L1, Alice), 10_000 ether - tierOp.validityBond - livenessBond + totalTkoBalance(tko, L1, Alice), 10_000 ether - tierOp.validityBond - livenessBond /2 ); } @@ -442,7 +440,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(ts.validityBond, tierOp.validityBond); assertEq(ts.timestamp, provenAt); - assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); + assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond /2); } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol index b27ffda2c9e..b0f7af2b87d 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol @@ -59,7 +59,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.contestBond); } @@ -169,7 +169,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.contestBond); } @@ -195,7 +195,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); uint256 quarterReward = tierOp.validityBond * 7 / 8 / 4; assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + quarterReward * 3); @@ -227,7 +227,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); uint256 quarterReward = tierOp.validityBond * 7 / 8 / 4; - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + quarterReward * 3); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether + quarterReward); } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol index c5850ebf3bc..d9220396bb5 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol @@ -135,7 +135,7 @@ contract TaikoL1TestGroup4 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond); + assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq( tko.balanceOf(Taylor), 10_000 ether - tierSgx.validityBond + tierOp.validityBond * 7 / 8 diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol index d6d1a294b2f..16f7b5aca71 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol @@ -274,7 +274,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond); + assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } @@ -297,7 +297,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.prover, address(gp)); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond); + assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol index e1aa9e67bf8..dec188a46ed 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol @@ -301,7 +301,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Carol), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, Carol), 10_000 ether - tierOp.validityBond + livenessBond/2); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } @@ -325,7 +325,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.prover, address(gp)); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Carol), 10_000 ether - tierOp.validityBond); + assertEq(totalTkoBalance(tko, L1, Carol), 10_000 ether - tierOp.validityBond+ livenessBond/2); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } } From d88c3588643c35642b814516605adac391f5d918 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Wed, 18 Sep 2024 11:15:39 +0800 Subject: [PATCH 2/8] more --- .../contracts/layer1/based/LibProving.sol | 14 +++++++++---- .../test/layer1/based/TaikoL1TestGroup1.t.sol | 12 +++++++---- .../test/layer1/based/TaikoL1TestGroup3.t.sol | 20 +++++++++++++++---- .../test/layer1/based/TaikoL1TestGroup4.t.sol | 2 +- .../test/layer1/based/TaikoL1TestGroup5.t.sol | 4 ++-- .../test/layer1/based/TaikoL1TestGroup9.t.sol | 10 ++++++++-- 6 files changed, 45 insertions(+), 17 deletions(-) diff --git a/packages/protocol/contracts/layer1/based/LibProving.sol b/packages/protocol/contracts/layer1/based/LibProving.sol index 88f173f80f4..7bcf875cf50 100644 --- a/packages/protocol/contracts/layer1/based/LibProving.sol +++ b/packages/protocol/contracts/layer1/based/LibProving.sol @@ -588,8 +588,9 @@ library LibProving { // The contested transition is proven to be invalid, contester wins the game. // Contester gets 3/4 of reward, the new prover gets 1/4. reward = _rewardAfterFriction(_ts.validityBond) >> 2; - - LibBonds.creditBond(_state, _ts.contester, _ts.contestBond + reward * 3); + unchecked { + LibBonds.creditBond(_state, _ts.contester, _ts.contestBond + reward * 3); + } } } else { if (_local.sameTransition) revert L1_ALREADY_PROVED(); @@ -607,12 +608,17 @@ library LibProving { if (_returnLivenessBond(_local, _proof.data)) { if (_local.assignedProver == msg.sender) { - reward += _local.livenessBond; + unchecked { + reward += _local.livenessBond; + } } else { LibBonds.creditBond(_state, _local.assignedProver, _local.livenessBond); } } else if (!_local.isTopTier) { - reward += _local.livenessBond/2; + // Reward 50% of liveness bond to the actual prover, the other 50% burnt. + unchecked { + reward += _local.livenessBond >> 1; + } } } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol index 4fd10ac8eaf..2b95f7542be 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol @@ -170,7 +170,10 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { provenAt = ts.timestamp; - assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, Taylor), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); } console2.log("====== Verify block"); @@ -195,7 +198,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(ts.timestamp, provenAt); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + livenessBond/2); + assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + livenessBond / 2); } } @@ -415,7 +418,8 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { provenAt = ts.timestamp; assertEq( - totalTkoBalance(tko, L1, Alice), 10_000 ether - tierOp.validityBond - livenessBond /2 + totalTkoBalance(tko, L1, Alice), + 10_000 ether - tierOp.validityBond - livenessBond / 2 ); } @@ -440,7 +444,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(ts.validityBond, tierOp.validityBond); assertEq(ts.timestamp, provenAt); - assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond /2); + assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond / 2); } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol index b0f7af2b87d..2aa9793cbfc 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol @@ -59,7 +59,10 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, James), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.contestBond); } @@ -169,7 +172,10 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, James), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.contestBond); } @@ -195,7 +201,10 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, James), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); uint256 quarterReward = tierOp.validityBond * 7 / 8 / 4; assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + quarterReward * 3); @@ -227,7 +236,10 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); uint256 quarterReward = tierOp.validityBond * 7 / 8 / 4; - assertEq(totalTkoBalance(tko, L1, James), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, James), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + quarterReward * 3); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether + quarterReward); } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol index d9220396bb5..1a38a74728e 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol @@ -135,7 +135,7 @@ contract TaikoL1TestGroup4 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond / 2); assertEq( tko.balanceOf(Taylor), 10_000 ether - tierSgx.validityBond + tierOp.validityBond * 7 / 8 diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol index 16f7b5aca71..f1adc0ea702 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol @@ -274,7 +274,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond / 2); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } @@ -297,7 +297,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.prover, address(gp)); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond / 2); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol index dec188a46ed..64ce8a84f00 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol @@ -301,7 +301,10 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Carol), 10_000 ether - tierOp.validityBond + livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, Carol), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } @@ -325,7 +328,10 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.prover, address(gp)); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Carol), 10_000 ether - tierOp.validityBond+ livenessBond/2); + assertEq( + totalTkoBalance(tko, L1, Carol), + 10_000 ether - tierOp.validityBond + livenessBond / 2 + ); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } } From 85e0f5248673e3401633ea76b03ac87e8e1c2b63 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Wed, 18 Sep 2024 11:16:35 +0800 Subject: [PATCH 3/8] Update LibProving.sol --- packages/protocol/contracts/layer1/based/LibProving.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/layer1/based/LibProving.sol b/packages/protocol/contracts/layer1/based/LibProving.sol index 7bcf875cf50..eb3ebb77e14 100644 --- a/packages/protocol/contracts/layer1/based/LibProving.sol +++ b/packages/protocol/contracts/layer1/based/LibProving.sol @@ -575,7 +575,7 @@ library LibProving { private { // Higher tier proof overwriting lower tier proof - uint256 reward; // reward to the new (current) prover - msg.sender + uint256 reward; // reward to the new (current) prover if (_ts.contester != address(0)) { if (_local.sameTransition) { From 016c216e1ebc99642ce3278b8a07e80039f356e8 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Wed, 18 Sep 2024 11:23:18 +0800 Subject: [PATCH 4/8] revert using arc-runner-set --- .github/workflows/bridge-ui--ci.yml | 2 +- .github/workflows/eventindexer.yml | 6 +++--- .github/workflows/nfts.yml | 2 +- .github/workflows/protocol.yml | 2 +- .github/workflows/relayer.yml | 6 +++--- .github/workflows/snaefell-ui--ci.yml | 2 +- .github/workflows/supplementary-contracts.yml | 2 +- .github/workflows/taikoon-ui--ci.yml | 2 +- .github/workflows/ui-lib--ci.yml | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/bridge-ui--ci.yml b/.github/workflows/bridge-ui--ci.yml index 8e4e784d61d..d270c524ece 100644 --- a/.github/workflows/bridge-ui--ci.yml +++ b/.github/workflows/bridge-ui--ci.yml @@ -4,7 +4,7 @@ on: workflow_call jobs: build: - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/.github/workflows/eventindexer.yml b/.github/workflows/eventindexer.yml index c4baed7afa5..4699550398a 100644 --- a/.github/workflows/eventindexer.yml +++ b/.github/workflows/eventindexer.yml @@ -18,7 +18,7 @@ jobs: lint-eventindexer: name: lint-eventindexer if: github.event_name == 'pull_request' - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - uses: actions/setup-go@v5 with: @@ -35,7 +35,7 @@ jobs: args: --config=.golangci.yml --timeout=4m test-eventindexer: - runs-on: [arc-runner-set] + runs-on: [taiko-runner] if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} needs: lint-eventindexer steps: @@ -63,7 +63,7 @@ jobs: # Skip dependabot PRs if: ${{ github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/dependabot/') }} name: Build and push docker image - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Checkout diff --git a/.github/workflows/nfts.yml b/.github/workflows/nfts.yml index f347dcd1ea2..93a41de5616 100644 --- a/.github/workflows/nfts.yml +++ b/.github/workflows/nfts.yml @@ -9,7 +9,7 @@ on: jobs: build-nfts-contracts: if: github.event.pull_request.draft == false - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/.github/workflows/protocol.yml b/.github/workflows/protocol.yml index ffad733461d..5952fb968ee 100644 --- a/.github/workflows/protocol.yml +++ b/.github/workflows/protocol.yml @@ -9,7 +9,7 @@ on: jobs: build-protocol: if: github.event.pull_request.draft == false - runs-on: [arc-runner-set] + runs-on: [taiko-runner] permissions: # Give the necessary permissions for stefanzweifel/git-auto-commit-action. contents: write diff --git a/.github/workflows/relayer.yml b/.github/workflows/relayer.yml index 0308e8e5eb9..e42cd859b4b 100644 --- a/.github/workflows/relayer.yml +++ b/.github/workflows/relayer.yml @@ -18,7 +18,7 @@ jobs: lint-relayer: name: lint-relayer if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - uses: actions/setup-go@v5 with: @@ -36,7 +36,7 @@ jobs: test-relayer: if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} - runs-on: [arc-runner-set] + runs-on: [taiko-runner] needs: lint-relayer steps: - name: Cancel Previous Runs @@ -66,7 +66,7 @@ jobs: # Skip dependabot PRs if: ${{ github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/dependabot/') }} name: Build and push docker image - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Checkout diff --git a/.github/workflows/snaefell-ui--ci.yml b/.github/workflows/snaefell-ui--ci.yml index a0cbbff937c..59eb8b0481a 100644 --- a/.github/workflows/snaefell-ui--ci.yml +++ b/.github/workflows/snaefell-ui--ci.yml @@ -4,7 +4,7 @@ on: workflow_call jobs: build: - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/.github/workflows/supplementary-contracts.yml b/.github/workflows/supplementary-contracts.yml index de59293013e..76025fb93ef 100644 --- a/.github/workflows/supplementary-contracts.yml +++ b/.github/workflows/supplementary-contracts.yml @@ -9,7 +9,7 @@ on: jobs: build-supplementary-contracts: if: github.event.pull_request.draft == false - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/.github/workflows/taikoon-ui--ci.yml b/.github/workflows/taikoon-ui--ci.yml index e2acf9f1fad..8aecc97c8bd 100644 --- a/.github/workflows/taikoon-ui--ci.yml +++ b/.github/workflows/taikoon-ui--ci.yml @@ -4,7 +4,7 @@ on: workflow_call jobs: build: - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/.github/workflows/ui-lib--ci.yml b/.github/workflows/ui-lib--ci.yml index f6f15417794..46160239765 100644 --- a/.github/workflows/ui-lib--ci.yml +++ b/.github/workflows/ui-lib--ci.yml @@ -4,7 +4,7 @@ on: workflow_call jobs: build: - runs-on: [arc-runner-set] + runs-on: [taiko-runner] steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 From e07a8b448b9be9e06e44745650dcc79ce54c3c7b Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Wed, 18 Sep 2024 13:00:29 +0800 Subject: [PATCH 5/8] fix --- packages/protocol/contracts/layer1/based/LibProving.sol | 2 +- .../protocol/test/layer1/based/TaikoL1TestGroup1.t.sol | 8 ++++---- .../protocol/test/layer1/based/TaikoL1TestGroup3.t.sol | 8 ++++---- .../protocol/test/layer1/based/TaikoL1TestGroup4.t.sol | 4 +++- .../protocol/test/layer1/based/TaikoL1TestGroup5.t.sol | 8 ++++++-- .../protocol/test/layer1/based/TaikoL1TestGroup9.t.sol | 4 ++-- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/protocol/contracts/layer1/based/LibProving.sol b/packages/protocol/contracts/layer1/based/LibProving.sol index eb3ebb77e14..67c07bfca71 100644 --- a/packages/protocol/contracts/layer1/based/LibProving.sol +++ b/packages/protocol/contracts/layer1/based/LibProving.sol @@ -617,7 +617,7 @@ library LibProving { } else if (!_local.isTopTier) { // Reward 50% of liveness bond to the actual prover, the other 50% burnt. unchecked { - reward += _local.livenessBond >> 1; + reward += _rewardAfterFriction(_local.livenessBond); } } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol index 2b95f7542be..764ab18aa59 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol @@ -172,7 +172,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq( totalTkoBalance(tko, L1, Taylor), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); } @@ -198,7 +198,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(ts.timestamp, provenAt); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + livenessBond / 2); + assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + livenessBond * 7 / 8); } } @@ -419,7 +419,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq( totalTkoBalance(tko, L1, Alice), - 10_000 ether - tierOp.validityBond - livenessBond / 2 + 10_000 ether - tierOp.validityBond - livenessBond / 8 ); } @@ -444,7 +444,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq(ts.validityBond, tierOp.validityBond); assertEq(ts.timestamp, provenAt); - assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond / 2); + assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond / 8); } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol index 2aa9793cbfc..000fefb99ea 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup3.t.sol @@ -61,7 +61,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); assertEq( totalTkoBalance(tko, L1, James), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.contestBond); } @@ -174,7 +174,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); assertEq( totalTkoBalance(tko, L1, James), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether - tierOp.contestBond); } @@ -203,7 +203,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); assertEq( totalTkoBalance(tko, L1, James), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); uint256 quarterReward = tierOp.validityBond * 7 / 8 / 4; @@ -238,7 +238,7 @@ contract TaikoL1TestGroup3 is TaikoL1TestGroupBase { uint256 quarterReward = tierOp.validityBond * 7 / 8 / 4; assertEq( totalTkoBalance(tko, L1, James), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); assertEq(totalTkoBalance(tko, L1, Taylor), 10_000 ether + quarterReward * 3); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether + quarterReward); diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol index 1a38a74728e..01b503f5cd6 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup4.t.sol @@ -135,7 +135,9 @@ contract TaikoL1TestGroup4 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond / 2); + assertEq( + tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 + ); assertEq( tko.balanceOf(Taylor), 10_000 ether - tierSgx.validityBond + tierOp.validityBond * 7 / 8 diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol index f1adc0ea702..ac7d7fc0efe 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup5.t.sol @@ -274,7 +274,9 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.timestamp, block.timestamp); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond / 2); + assertEq( + tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 + ); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } @@ -297,7 +299,9 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(ts.prover, address(gp)); assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); - assertEq(tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond / 2); + assertEq( + tko.balanceOf(David), 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 + ); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } } diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol index 64ce8a84f00..563512ef66b 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup9.t.sol @@ -303,7 +303,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); assertEq( totalTkoBalance(tko, L1, Carol), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } @@ -330,7 +330,7 @@ contract TaikoL1TestGroup5 is TaikoL1TestGroupBase { assertEq(totalTkoBalance(tko, L1, Alice), 10_000 ether - livenessBond); assertEq( totalTkoBalance(tko, L1, Carol), - 10_000 ether - tierOp.validityBond + livenessBond / 2 + 10_000 ether - tierOp.validityBond + livenessBond * 7 / 8 ); assertEq(totalTkoBalance(tko, L1, William), 10_000 ether); } From 33fd8ef1c401894897e8fb50afcd25d7e2c97025 Mon Sep 17 00:00:00 2001 From: dantaik Date: Wed, 18 Sep 2024 05:05:04 +0000 Subject: [PATCH 6/8] forge fmt & update contract layout tables --- packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol index 764ab18aa59..93aff49bbe5 100644 --- a/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol +++ b/packages/protocol/test/layer1/based/TaikoL1TestGroup1.t.sol @@ -419,7 +419,7 @@ contract TaikoL1TestGroup1 is TaikoL1TestGroupBase { assertEq( totalTkoBalance(tko, L1, Alice), - 10_000 ether - tierOp.validityBond - livenessBond / 8 + 10_000 ether - tierOp.validityBond - livenessBond / 8 ); } From 4c3f84bcd765767d40617843167af69a35a688fd Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:28:28 +0800 Subject: [PATCH 7/8] Update packages/protocol/contracts/layer1/based/LibProving.sol --- packages/protocol/contracts/layer1/based/LibProving.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/layer1/based/LibProving.sol b/packages/protocol/contracts/layer1/based/LibProving.sol index 67c07bfca71..01029818863 100644 --- a/packages/protocol/contracts/layer1/based/LibProving.sol +++ b/packages/protocol/contracts/layer1/based/LibProving.sol @@ -614,7 +614,7 @@ library LibProving { } else { LibBonds.creditBond(_state, _local.assignedProver, _local.livenessBond); } - } else if (!_local.isTopTier) { + } else { // Reward 50% of liveness bond to the actual prover, the other 50% burnt. unchecked { reward += _rewardAfterFriction(_local.livenessBond); From 463012bce0cb94ed71a16be391565535dba06a7e Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Wed, 18 Sep 2024 23:22:05 +0800 Subject: [PATCH 8/8] Update LibProving.sol --- packages/protocol/contracts/layer1/based/LibProving.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/layer1/based/LibProving.sol b/packages/protocol/contracts/layer1/based/LibProving.sol index 01029818863..0c96335ec8d 100644 --- a/packages/protocol/contracts/layer1/based/LibProving.sol +++ b/packages/protocol/contracts/layer1/based/LibProving.sol @@ -615,7 +615,7 @@ library LibProving { LibBonds.creditBond(_state, _local.assignedProver, _local.livenessBond); } } else { - // Reward 50% of liveness bond to the actual prover, the other 50% burnt. + // Reward a majority of liveness bond to the actual prover unchecked { reward += _rewardAfterFriction(_local.livenessBond); }