Skip to content

Commit

Permalink
Add arrowhead631 config. Adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Jul 4, 2024
1 parent bab0a24 commit 7c4cfb6
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public enum NetworkUpgrade {
HOP401("hop401"),
FINGERROOT500("fingerroot500"),
ARROWHEAD600("arrowhead600"),
ARROWHEAD631("arrowhead631"),
LOVELL700("lovell700");

private String name;
Expand Down
4 changes: 1 addition & 3 deletions rskj-core/src/main/resources/config/main.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ blockchain.config {
hop401 = 4976300,
fingerroot500 = 5468000,
arrowhead600 = 6223700,
arrowhead631 = -1,
lovell700 = -1
},
consensusRules = {
rskip434 = -1
}
}

Expand Down
4 changes: 2 additions & 2 deletions rskj-core/src/main/resources/config/regtest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ blockchain.config {
hop401 = 0,
fingerroot500 = 0,
arrowhead600 = 0,
arrowhead631 = -1,
lovell700 = 0
},
consensusRules = {
rskip97 = -1 # disable orchid difficulty drop
rskipUMM = 1,
rskip434 = -1
rskipUMM = 1
}
}

Expand Down
4 changes: 2 additions & 2 deletions rskj-core/src/main/resources/config/testnet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ blockchain.config {
hop401 = 3362200,
fingerroot500 = 4015800,
arrowhead600 = 4927100,
arrowhead631 = -1,
lovell700 = -1
},
consensusRules = {
rskip97 = -1, # disable orchid difficulty drop
rskip132 = 43550, # enable recalculted receive headers cost
rskip284 = 2581800,
rskip290 = 2581800,
rskip434 = -1
rskip290 = 2581800
}
}

Expand Down
2 changes: 2 additions & 0 deletions rskj-core/src/main/resources/expected.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ blockchain = {
hop401 = <height>
fingerroot500 = <height>
arrowhead600 = <height>
arrowhead631 = <height>
lovell700 = <height>
}
consensusRules = {
Expand Down Expand Up @@ -94,6 +95,7 @@ blockchain = {
rskip415 = <hardforkName>
rskip417 = <hardforkName>
rskip428 = <hardforkName>
rskip434 = <hardforkName>
}
}
gc = {
Expand Down
1 change: 1 addition & 0 deletions rskj-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ blockchain = {
rskip415 = arrowhead600
rskip417 = arrowhead600
rskip428 = lovell700
rskip434 = arrowhead631
}
}
gc = {
Expand Down
18 changes: 7 additions & 11 deletions rskj-core/src/test/java/co/rsk/peg/BridgeSupportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6232,6 +6232,8 @@ void receiveHeader_block_exist_in_storage() throws IOException, BlockStoreExcept
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Tag("test chain work before and after rskip 434")
class ChainWorkTests {
ActivationConfig.ForBlock activationsPreRSKIP434 = ActivationConfigsForTest.arrowhead631(Collections.singletonList(ConsensusRule.RSKIP434)).forBlock(0);
ActivationConfig.ForBlock activationsPostRSKIP434 = ActivationConfigsForTest.arrowhead631().forBlock(0);
Repository repository;
BtcBlockStoreWithCache.Factory btcBlockStoreFactory;
BtcBlockStoreWithCache btcBlockStoreWithCachePreRSKIP434;
Expand All @@ -6251,9 +6253,6 @@ class ChainWorkTests {
@BeforeEach
void setUp() {
BridgeConstants bridgeMainnetConstants = BridgeMainNetConstants.getInstance();
ActivationConfig.ForBlock activationsPreRSKIP434 = ActivationConfigsForTest.allBut(ConsensusRule.RSKIP434).forBlock(0);
ActivationConfig.ForBlock activationsPostRSKIP434 = ActivationConfigsForTest.all().forBlock(0);

repository = createRepository();
btcBlockStoreFactory = new RepositoryBtcBlockStoreWithCache.Factory(bridgeMainnetConstants.getBtcParams(), 100, 100);

Expand Down Expand Up @@ -6470,18 +6469,15 @@ void receiveHeaders_networkNotMainnet_savesAllBlocks(ActivationConfig.ForBlock a
}

private Stream<Arguments> notMainnetAndActivationsArgs() {
ActivationConfig.ForBlock activationsPreRSKIP434 = ActivationConfigsForTest.allBut(ConsensusRule.RSKIP434).forBlock(0);
ActivationConfig.ForBlock activationsPostRSKIP434 = ActivationConfigsForTest.all().forBlock(0);

BridgeConstants testnet = BridgeTestNetConstants.getInstance();
BridgeConstants regtest = BridgeRegTestConstants.getInstance();

return Stream.of(
Arguments.of(activationsPreRSKIP434, testnet),
Arguments.of(activationsPostRSKIP434, testnet),
Arguments.of(activationsPreRSKIP434, regtest),
Arguments.of(activationsPostRSKIP434, regtest)
);
Arguments.of(activationsPreRSKIP434, testnet),
Arguments.of(activationsPostRSKIP434, testnet),
Arguments.of(activationsPreRSKIP434, regtest),
Arguments.of(activationsPostRSKIP434, regtest)
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ActivationConfigTest {
" hop401: 0",
" fingerroot500: 0",
" arrowhead600: 0",
" arrowhead631: 0",
" lovell700: 0",
"},",
"consensusRules: {",
Expand Down Expand Up @@ -120,6 +121,7 @@ class ActivationConfigTest {
" rskip412: arrowhead600",
" rskip415: arrowhead600",
" rskip417: arrowhead600",
" rskip434: arrowhead631",
" rskip428: lovell700",
"}"
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ private static List<ConsensusRule> getArrowhead600Rskips() {
return rskips;
}

private static List<ConsensusRule> getArrowhead631Rskips() {
List<ConsensusRule> rskips = new ArrayList<>();
rskips.addAll(Collections.singletonList(
ConsensusRule.RSKIP434
));

return rskips;
}

private static List<ConsensusRule> getLovell700Rskips() {
List<ConsensusRule> rskips = new ArrayList<>();
rskips.addAll(Arrays.asList(
Expand Down Expand Up @@ -341,6 +350,29 @@ public static ActivationConfig arrowhead600(List<ConsensusRule> except) {
return enableTheseDisableThose(rskips, except);
}

public static ActivationConfig arrowhead631() {
return arrowhead631(Collections.emptyList());
}

public static ActivationConfig arrowhead631(List<ConsensusRule> except) {
List<ConsensusRule> rskips = new ArrayList<>();
rskips.addAll(getPaidBridgeTxsRskip());
rskips.addAll(getOrchidRskips());
rskips.addAll(getOrchid060Rskips());
rskips.addAll(getWasabi100Rskips());
rskips.addAll(getBahamasRskips());
rskips.addAll(getTwoToThreeRskips());
rskips.addAll(getPapyrus200Rskips());
rskips.addAll(getIris300Rskips());
rskips.addAll(getHop400Rskips());
rskips.addAll(getHop401Rskips());
rskips.addAll(getFingerroot500Rskips());
rskips.addAll(getArrowhead600Rskips());
rskips.addAll(getArrowhead631Rskips());

return enableTheseDisableThose(rskips, except);
}

public static ActivationConfig lovell700(List<ConsensusRule> except) {
List<ConsensusRule> rskips = new ArrayList<>();
rskips.addAll(getPaidBridgeTxsRskip());
Expand All @@ -355,6 +387,7 @@ public static ActivationConfig lovell700(List<ConsensusRule> except) {
rskips.addAll(getHop401Rskips());
rskips.addAll(getFingerroot500Rskips());
rskips.addAll(getArrowhead600Rskips());
rskips.addAll(getArrowhead631Rskips());
rskips.addAll(getLovell700Rskips());

return enableTheseDisableThose(rskips, except);
Expand Down

0 comments on commit 7c4cfb6

Please sign in to comment.