From f64eba070c1313123abeffd072d0ce57f2a36c9e Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Wed, 15 May 2024 11:35:26 -0500 Subject: [PATCH] allow VP with no fee --- ethereum/contracts/Rollup.sol | 4 +++- ethereum/contracts/core/Bench.sol | 3 +-- ethereum/test/ValidationPools.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ethereum/contracts/Rollup.sol b/ethereum/contracts/Rollup.sol index f94c566..70323ee 100644 --- a/ethereum/contracts/Rollup.sol +++ b/ethereum/contracts/Rollup.sol @@ -121,6 +121,7 @@ contract Rollup is Availability { /// If the batch worker fails to submit the batch, a new batch worker may be selected function resetBatchWorker() public { + // TODO: Grace period after the current batch is due and before the worker can be replaced require( block.timestamp - batchStart > batchInterval, "Current batch interval has not yet elapsed" @@ -131,7 +132,8 @@ contract Rollup is Availability { block.timestamp - lastWorkerReset >= minResetInterval, "Mininum reset interval has not elapsed since last batch worker reset" ); - // TODO: Should the current batch worker's availability stakes be forfeit? + // TODO: Submit a validation pool targeting a null post, and send the worker's availability stake + // This gives the DAO an opportunity to police the failed work // Select a new batch worker batchWorkerStakeIndex = assignWork(); batchWorker = stakes[batchWorkerStakeIndex].worker; diff --git a/ethereum/contracts/core/Bench.sol b/ethereum/contracts/core/Bench.sol index e5d3e3e..99fa8be 100644 --- a/ethereum/contracts/core/Bench.sol +++ b/ethereum/contracts/core/Bench.sol @@ -97,7 +97,6 @@ contract Bench { msg.sender == address(dao), "Only DAO contract may call initiateValidationPool" ); - require(msg.value > 0, "Fee is required to initiate validation pool"); require(duration >= minDuration, "Duration is too short"); require(duration <= maxDuration, "Duration is too long"); require( @@ -124,7 +123,7 @@ contract Bench { // We use our privilege as the DAO contract to mint reputation in proportion with the fee. // Here we assume a minting ratio of 1 // TODO: Make minting ratio an adjustable parameter - dao.mint(address(dao), msg.value); + dao.mint(address(dao), pool.props.fee); pool.props.minted = msg.value; dao.emitValidationPoolInitiated(poolIndex); } diff --git a/ethereum/test/ValidationPools.js b/ethereum/test/ValidationPools.js index 45dec0f..3179069 100644 --- a/ethereum/test/ValidationPools.js +++ b/ethereum/test/ValidationPools.js @@ -52,9 +52,9 @@ describe('Validation Pools', () => { }); describe('Initiate', () => { - it('should not be able to initiate a validation pool without a fee', async () => { + it('should be able to initiate a validation pool without a fee', async () => { const init = () => initiateValidationPool({ fee: 0 }); - await expect(init()).to.be.revertedWith('Fee is required to initiate validation pool'); + await expect(init()).to.emit(dao, 'ValidationPoolInitiated'); }); it('should not be able to initiate a validation pool with a quorum below the minimum', async () => {