use of org.aion.zero.impl.vm.avm.schedule.AvmVersionSchedule in project aion by aionnetwork.
the class AvmTransactionExecutorTest method setupClass.
@BeforeClass
public static void setupClass() {
AvmVersionSchedule schedule = AvmVersionSchedule.newScheduleForBothVersions(VERSION_1_FORK, VERSION_2_FORK, TOLERANCE);
AvmConfigurations.initializeConfigurationsAsReadAndWriteable(schedule, AvmPathManager.getPathOfProjectRootDirectory());
projectRootDir = AvmPathManager.getPathOfProjectRootDirectory();
}
use of org.aion.zero.impl.vm.avm.schedule.AvmVersionSchedule in project aion by aionnetwork.
the class AvmVersionScheduleTest method testProhibitionWithZeroToleranceUsingSingleAvmSupport.
@Test
public void testProhibitionWithZeroToleranceUsingSingleAvmSupport() {
AvmVersionSchedule schedule = AvmVersionSchedule.newScheduleForOnlySingleVersionSupport(0, 0);
// Version 1 is permitted over blocks 0 onwards.
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 0));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 1));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, Long.MAX_VALUE));
// Ensure that version 2 is always prohibited.
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 0));
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 1));
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, Long.MAX_VALUE));
}
use of org.aion.zero.impl.vm.avm.schedule.AvmVersionSchedule in project aion by aionnetwork.
the class AvmVersionScheduleTest method testWhichVersionToRun1.
@Test
public void testWhichVersionToRun1() {
AvmVersionSchedule schedule = AvmVersionSchedule.newScheduleForBothVersions(0, 10, 3);
Assert.assertEquals(AvmVersion.VERSION_1, schedule.whichVersionToRunWith(0));
Assert.assertEquals(AvmVersion.VERSION_1, schedule.whichVersionToRunWith(9));
Assert.assertEquals(AvmVersion.VERSION_2, schedule.whichVersionToRunWith(10));
Assert.assertEquals(AvmVersion.VERSION_2, schedule.whichVersionToRunWith(Long.MAX_VALUE));
}
use of org.aion.zero.impl.vm.avm.schedule.AvmVersionSchedule in project aion by aionnetwork.
the class AvmVersionScheduleTest method testProhibitionWhenForksAreBlockNeighboursWithLargeTolerance.
@Test
public void testProhibitionWhenForksAreBlockNeighboursWithLargeTolerance() {
AvmVersionSchedule schedule = AvmVersionSchedule.newScheduleForBothVersions(11, 12, 8);
// Version 1 is permitted over blocks [3, 19]
// Version 2 is permitted over blocks 4 onwards.
// Verify when version 1 is prohibited.
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 0));
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 2));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 3));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 10));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 11));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 12));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 13));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 19));
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, 20));
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_1, Long.MAX_VALUE));
// Verify when version 2 is prohibited.
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 0));
Assert.assertTrue(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 3));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 4));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 10));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 11));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 12));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, 13));
Assert.assertFalse(schedule.isVersionProhibitedAtBlockNumber(AvmVersion.VERSION_2, Long.MAX_VALUE));
}
use of org.aion.zero.impl.vm.avm.schedule.AvmVersionSchedule in project aion by aionnetwork.
the class AvmVersionScheduleTest method testWhichVersionToRun3.
@Test
public void testWhichVersionToRun3() {
AvmVersionSchedule schedule = AvmVersionSchedule.newScheduleForBothVersions(61, 62, 30);
Assert.assertNull(schedule.whichVersionToRunWith(0));
Assert.assertNull(schedule.whichVersionToRunWith(60));
Assert.assertEquals(AvmVersion.VERSION_1, schedule.whichVersionToRunWith(61));
Assert.assertEquals(AvmVersion.VERSION_2, schedule.whichVersionToRunWith(62));
Assert.assertEquals(AvmVersion.VERSION_2, schedule.whichVersionToRunWith(Long.MAX_VALUE));
}
Aggregations