Skip to content

Commit

Permalink
Set rskip number
Browse files Browse the repository at this point in the history
  • Loading branch information
Vovchyk committed Sep 26, 2023
1 parent fd1878d commit 897d14d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public enum ConsensusRule {
RSKIP383("rskip383"),
RSKIP385("rskip385"),
RSKIP398("rskip398"),
RSKIPXXX("rskipXXX"), // From EIP-2028 calldata gas reduction
RSKIP400("rskip400"), // From EIP-2028 calldata gas cost reduction
;

private String configKey;
Expand Down
2 changes: 1 addition & 1 deletion rskj-core/src/main/java/org/ethereum/core/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public long transactionCost(Constants constants, ActivationConfig.ForBlock activ
}

private static long getTxNonZeroDataCost(ActivationConfig.ForBlock activations) {
return activations.isActive(ConsensusRule.RSKIPXXX) ? GasCost.TX_NO_ZERO_DATA_EIP2028 : GasCost.TX_NO_ZERO_DATA;
return activations.isActive(ConsensusRule.RSKIP400) ? GasCost.TX_NO_ZERO_DATA_EIP2028 : GasCost.TX_NO_ZERO_DATA;
}

public void verify(SignatureCache signatureCache) {
Expand Down
2 changes: 1 addition & 1 deletion rskj-core/src/main/resources/expected.conf
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ blockchain = {
rskip383 = <hardforkName>
rskip385 = <hardforkName>
rskip398 = <hardforkName>
rskipXXX = <hardforkName>
rskip400 = <hardforkName>
}
}
gc = {
Expand Down
2 changes: 1 addition & 1 deletion rskj-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ blockchain = {
rskip383 = fingerroot500
rskip385 = fingerroot500
rskip398 = tbd600
rskipXXX = tbd600
rskip400 = tbd600
}
}
gc = {
Expand Down
8 changes: 4 additions & 4 deletions rskj-core/src/test/java/co/rsk/core/TransactionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,25 +443,25 @@ void createEncodeAndDecodeTransactionWithChainId() {
}

@Test
void testTransactionCostWithRSKIPXXXDisabled() {
void testTransactionCostWithRSKIP400Disabled() {
byte[] bytes = new byte[]{-8, 96, -128, 8, -126, -61, 80, -108, -31, 126, -117, -65, -39, -94, 75, -27, 104, -101, 13, -118, 50, 8, 31, -83, -40, -94, 59, 107, 7, -127, -1, 102, -96, -63, -110, 91, -2, 42, -19, 18, 4, 67, -64, 48, -45, -85, -123, 41, 14, -48, -124, 118, 21, -63, -39, -45, 67, 116, -103, 93, 37, 4, 88, -61, 49, -96, 77, -30, -116, 59, -58, -82, -95, 76, 46, 124, 115, -32, -80, 125, 30, -42, -75, -111, -49, -41, 121, -73, -121, -68, -41, 72, -120, 94, 82, 42, 17, 61};
Transaction txInBlock = new ImmutableTransaction(bytes);

Constants constants = Mockito.mock(Constants.class);
ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class);
Mockito.doReturn(false).when(activations).isActive(Mockito.eq(ConsensusRule.RSKIPXXX));
Mockito.doReturn(false).when(activations).isActive(Mockito.eq(ConsensusRule.RSKIP400));

Assertions.assertEquals(21068L, txInBlock.transactionCost(constants, activations, new BlockTxSignatureCache(new ReceivedTxSignatureCache())));
}

@Test
void testTransactionCostWithRSKIPXXXEnabled() {
void testTransactionCostWithRSKIP400Enabled() {
byte[] bytes = new byte[]{-8, 96, -128, 8, -126, -61, 80, -108, -31, 126, -117, -65, -39, -94, 75, -27, 104, -101, 13, -118, 50, 8, 31, -83, -40, -94, 59, 107, 7, -127, -1, 102, -96, -63, -110, 91, -2, 42, -19, 18, 4, 67, -64, 48, -45, -85, -123, 41, 14, -48, -124, 118, 21, -63, -39, -45, 67, 116, -103, 93, 37, 4, 88, -61, 49, -96, 77, -30, -116, 59, -58, -82, -95, 76, 46, 124, 115, -32, -80, 125, 30, -42, -75, -111, -49, -41, 121, -73, -121, -68, -41, 72, -120, 94, 82, 42, 17, 61};
Transaction txInBlock = new ImmutableTransaction(bytes);

Constants constants = Mockito.mock(Constants.class);
ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class);
Mockito.doReturn(true).when(activations).isActive(Mockito.eq(ConsensusRule.RSKIPXXX));
Mockito.doReturn(true).when(activations).isActive(Mockito.eq(ConsensusRule.RSKIP400));

Assertions.assertEquals(21016L, txInBlock.transactionCost(constants, activations, new BlockTxSignatureCache(new ReceivedTxSignatureCache())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ActivationConfigTest {
" rskip383: fingerroot500",
" rskip385: fingerroot500",
" rskip398: tbd600",
" rskipXXX: tbd600",
" rskip400: tbd600",
"}"
));

Expand Down

0 comments on commit 897d14d

Please sign in to comment.