-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Constrained the minimum unity fork number to 2
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
modAionImpl/test/org/aion/zero/impl/blockchain/AionBlockchainImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.aion.zero.impl.blockchain; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.Properties; | ||
import org.aion.zero.impl.config.CfgAion; | ||
import org.junit.After; | ||
import org.junit.Test; | ||
|
||
public class AionBlockchainImplTest { | ||
|
||
private StandaloneBlockchain blockchain; | ||
|
||
@After | ||
public void tearDown() { | ||
|
||
CfgAion cfg = CfgAion.inst(); | ||
Properties p = new Properties(); | ||
p.put("fork0.5.0", String.valueOf(Long.MAX_VALUE)); | ||
cfg.getFork().setProperties(p); | ||
this.blockchain = null; | ||
} | ||
|
||
@Test | ||
public void testUnityMininmumNumber() { | ||
CfgAion cfg = CfgAion.inst(); | ||
Properties p = new Properties(); | ||
p.put("fork0.5.0", "1"); | ||
cfg.getFork().setProperties(p); | ||
|
||
StandaloneBlockchain.Bundle bundle = | ||
new StandaloneBlockchain.Builder() | ||
.withDefaultAccounts() | ||
.withValidatorConfiguration("simple") | ||
.build(); | ||
this.blockchain = bundle.bc; | ||
|
||
assertNotNull(blockchain); | ||
//AKI-419 the minimum fork point is 2, therefore, the unity protocol will start from 3 | ||
assertFalse(blockchain.forkUtility.isUnityForkActive(2)); | ||
assertTrue(blockchain.forkUtility.isUnityForkActive(3)); | ||
} | ||
|
||
@Test | ||
public void testUnityMininmumNumber2() { | ||
CfgAion cfg = CfgAion.inst(); | ||
Properties p = new Properties(); | ||
p.put("fork0.5.0", "2"); | ||
cfg.getFork().setProperties(p); | ||
|
||
StandaloneBlockchain.Bundle bundle = | ||
new StandaloneBlockchain.Builder() | ||
.withDefaultAccounts() | ||
.withValidatorConfiguration("simple") | ||
.build(); | ||
this.blockchain = bundle.bc; | ||
|
||
assertNotNull(blockchain); | ||
assertFalse(blockchain.forkUtility.isUnityForkActive(2)); | ||
assertTrue(blockchain.forkUtility.isUnityForkActive(3)); | ||
} | ||
} |