Skip to content

Commit

Permalink
Adding activation and rollback logic
Browse files Browse the repository at this point in the history
  • Loading branch information
asoto-iov committed Oct 14, 2024
1 parent 0f5e2ed commit dee9465
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ public enum ConsensusRule {
RSKIP417("rskip417"),
RSKIP428("rskip428"),
RSKIP434("rskip434"),
RSKIP438("rskip438")
RSKIP438("rskip438"),
RSKIP453("rskip453")

;

private String configKey;
Expand Down
12 changes: 12 additions & 0 deletions rskj-core/src/main/java/org/ethereum/vm/program/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,24 @@ private ProgramResult getProgramResult(RskAddress senderAddress, byte[] nonce, D
this,
"No gas to return just created contract",
storageCost));

if (activations.isActive(ConsensusRule.RSKIP453)) {
track.rollback();
stackPushZero();
return programResult;
}
} else if (codeLength > Constants.getMaxContractSize()) {
programResult.setException(
ExceptionHelper.tooLargeContractSize(
this,
Constants.getMaxContractSize(),
codeLength));

if (activations.isActive(ConsensusRule.RSKIP453)) {
track.rollback();
stackPushZero();
return programResult;
}
} else {
programResult.spendGas(storageCost);
track.saveCode(contractAddress, code);
Expand Down
1 change: 1 addition & 0 deletions rskj-core/src/main/resources/expected.conf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ blockchain = {
rskip428 = <hardforkName>
rskip434 = <hardforkName>
rskip438 = <hardforkName>
rskip453 = <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 @@ -82,6 +82,7 @@ blockchain = {
rskip428 = lovell700
rskip434 = arrowhead631
rskip438 = lovell700
rskip453 = lovell700
}
}
gc = {
Expand Down

0 comments on commit dee9465

Please sign in to comment.