Skip to content

Commit 651bb76

Browse files
authored
chore: 7.5 minute Epoch and Europa Testnet Contracts Released (#1011)
* chore: 7.5 min epoch * chore: fix test constants for 90s state and 7.5min epoch * chore: fix test * chore: update package version
1 parent 258cf2d commit 651bb76

File tree

7 files changed

+32
-18
lines changed

7 files changed

+32
-18
lines changed

contracts/Core/storage/Constants.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ contract Constants {
2929

3030
uint8 public constant NUM_STATES = 5;
3131

32-
uint16 public constant EPOCH_LENGTH = 300;
32+
uint16 public constant EPOCH_LENGTH = 450;
3333

3434
// slither-disable-next-line too-many-digits
3535
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

deployed/europaTestnet/addresses.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"Governance": "0x40c9339735D8A323240C775BAa2aA3DFf4a9068a",
3+
"BlockManager": "0x2c44089cf0b69bB99937E18d3F68E410CDbd72D5",
4+
"CollectionManager": "0x6565F307ADfb1c7105ECa401f600C4c352F4B65f",
5+
"StakeManager": "0x3CD0B9650642D9D47614754f1f25b2D78821a998",
6+
"RewardManager": "0x87da99bEB8F781f7FCC606812BA6E8c5eB46CcD5",
7+
"VoteManager": "0x4B7d5280490BB97D78a9a733678d669c782EaFCA",
8+
"Delegator": "0x36294b24E27AA5a1B82c9f4127CEB082fdB13a99",
9+
"RAZOR": "0x56ea26865DF007dD16b642ecAA3E0B21DeE7Ec64",
10+
"StakedTokenFactory": "0xEd8d85d4fDB870f07A7D92e6400AD46C2e983Bd7",
11+
"RandomNoManager": "0x728038fb03d28866e5028da4fD3b5004fB4C36CE"
12+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@razor-network/contracts",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "These are the contracts for Razor network v2 mainnet",
55
"author": "Razor Network",
66
"private": false,

test/AssignCollectionsRandomly.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('AssignCollectionsRandomly', function () {
5555

5656
describe('razor', async () => {
5757
it('Assign Collections Randomly End to End Flow', async () => {
58-
await network.provider.send('evm_setNextBlockTimestamp', [2625097600]);
58+
await network.provider.send('evm_setNextBlockTimestamp', [2625095600]);
5959

6060
/* ///////////////////////////////////////////////////////////////
6161
SETUP
@@ -201,27 +201,28 @@ describe('AssignCollectionsRandomly', function () {
201201
await assertRevert(blockManager.connect(signers[19]).finalizeDispute(epoch, 0, collectionIndexInBlock), 'Block proposed with same medians');
202202

203203
// Give Sorted and FinaliseDispute on non-revealed asset
204-
await blockManager.giveSorted(epoch, 3, [400]);
204+
await blockManager.giveSorted(epoch, 0, [100]);
205205
collectionIndexInBlock = await getCollectionIdPositionInBlock(epoch, await blockManager.sortedProposedBlockIds(epoch, 0),
206206
signers[0], blockManager, collectionManager);
207207
await assertRevert(blockManager.finalizeDispute(epoch, 0, collectionIndexInBlock), 'Invalid dispute');
208208

209209
// disputeForProposedCollectionIds
210210
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 2), 'Dispute: ID present only');
211211
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 3), 'Dispute: ID present only');
212-
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 5), 'Dispute: ID present only');
213-
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 6), 'Dispute: ID present only');
212+
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 4), 'Dispute: ID present only');
213+
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 5), 'Dispute: ID should be absent');
214+
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 6), 'Dispute: ID should be absent');
214215
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 7), 'Dispute: ID present only');
215-
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 1), 'Dispute: ID present only');
216-
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 4), 'Dispute: ID should be absent');
216+
await assertRevert(blockManager.disputeCollectionIdShouldBePresent(epoch, 0, 1), 'Dispute: ID should be absent');
217217

218218
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 2, 0), 'Dispute: ID should be present');
219219
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 3, 0), 'Dispute: ID should be present');
220-
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 5, 0), 'Dispute: ID should be present');
221-
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 6, 0), 'Dispute: ID should be present');
220+
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 4, 0), 'Dispute: ID should be present');
221+
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 5, 0), 'Dispute: ID absent only');
222+
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 6, 0), 'Dispute: ID absent only');
222223
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 7, 0), 'Dispute: ID should be present');
223-
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 1, 0), 'Dispute: ID should be present');
224-
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 4, 0), 'Dispute: ID absent only');
224+
await assertRevert(blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 1, 0), 'Dispute: ID absent only');
225+
225226
// the id itself doesnt exist
226227
await assertRevert(blockManager.disputeOnOrderOfIds(epoch, 0, 1, 0), 'index1 not greater than index0 0');
227228
await assertRevert(blockManager.disputeOnOrderOfIds(epoch, 0, 0, 1), 'ID at i0 not gt than of i1');
@@ -295,11 +296,10 @@ describe('AssignCollectionsRandomly', function () {
295296
await restoreSnapshot(snapshotId);
296297
snapshotId = await takeSnapshot();
297298
// additional 2
298-
await adhocPropose(signers[1], [1, 2, 4, 5, 6, 7], [100, 200, 400, 500, 600, 700], stakeManager, blockManager, voteManager);
299+
await adhocPropose(signers[1], [1, 2, 8, 5, 6, 7], [100, 200, 800, 500, 600, 700], stakeManager, blockManager, voteManager);
299300
await mineToNextState();
300301
const epoch = await getEpoch();
301-
302-
await blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 4, 2);
302+
await blockManager.disputeCollectionIdShouldBeAbsent(epoch, 0, 8, 2);
303303
const blockIndexToBeConfirmed = await blockManager.blockIndexToBeConfirmed();
304304
const block = await blockManager.getProposedBlock(epoch, 0);
305305
expect(blockIndexToBeConfirmed).to.eq(-1);

test/helpers/InternalEngine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const proposeWithDeviation = async (signer, deviation, stakeManager, blockManage
224224
}
225225
}
226226
}
227-
// console.log('propose', idsRevealedThisEpoch, mediansValues);
227+
228228
await blockManager.connect(signer).propose(epoch,
229229
idsRevealedThisEpoch,
230230
mediansValues,

test/helpers/constants.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const { BigNumber } = ethers;
33
const DEFAULT_ADMIN_ROLE_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000';
44
const ONE_ETHER = BigNumber.from(10).pow(BigNumber.from(18));
55

6-
const EPOCH_LENGTH = BigNumber.from(300);
6+
const EPOCH_LENGTH = BigNumber.from(450);
77
const BASE_DENOMINATOR = BigNumber.from(10000000);
88
const NUM_BLOCKS = 10;
99
const NUM_STATES = BigNumber.from(5);
10-
const STATE_LENGTH = BigNumber.from(60);
10+
const STATE_LENGTH = BigNumber.from(90);
1111
const GRACE_PERIOD = 0;
1212
const UNSTAKE_LOCK_PERIOD = 1;
1313
const WITHDRAW_LOCK_PERIOD = 1;

test/helpers/utils.js

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const calculateDisputesData = async (collectionId, voteManager, stakeManager, ep
4747
median = sortedValues[i];
4848
}
4949
}
50+
5051
return {
5152
median, totalInfluenceRevealed, sortedValues,
5253
};
@@ -295,6 +296,7 @@ const adhocPropose = async (signer, ids, medians, stakeManager, blockManager, vo
295296
const staker = await stakeManager.getStaker(stakerID);
296297
const { biggestStake, biggestStakerId } = await getBiggestStakeAndId(stakeManager, voteManager); (stakeManager);
297298
const iteration = await getIteration(voteManager, stakeManager, staker, biggestStake);
299+
298300
await blockManager.connect(signer).propose(getEpoch(),
299301
ids,
300302
medians,

0 commit comments

Comments
 (0)