Skip to content

Commit

Permalink
Fixing some sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fmacleal committed Nov 5, 2024
1 parent 551df42 commit 612a66a
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 111 deletions.
9 changes: 4 additions & 5 deletions rskj-core/src/main/java/org/ethereum/vm/OpCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
* Created by Sergio on 07/07/2016.
*/
public class OpCodes {

private OpCodes() {

}

/**
* Halts execution (0x00)
*/
Expand Down Expand Up @@ -672,4 +667,8 @@ private OpCodes() {
* later deletion
*/
static final byte OP_SUICIDE =(byte)0xff;

private OpCodes() {

}
}
167 changes: 85 additions & 82 deletions rskj-core/src/main/java/org/ethereum/vm/VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -1860,14 +1860,15 @@ protected void executeOpcode() {
break;
case OpCodes.OP_CALLDATACOPY: doCALLDATACOPY();
break;
case OpCodes.OP_CODESIZE:
case OpCodes.OP_EXTCODESIZE: doCODESIZE();
case OpCodes.OP_CODESIZE,
OpCodes.OP_EXTCODESIZE:
doCODESIZE();
break;
case OpCodes.OP_CODECOPY:
case OpCodes.OP_EXTCODECOPY: doCODECOPY();
case OpCodes.OP_CODECOPY,
OpCodes.OP_EXTCODECOPY:
doCODECOPY();
break;


case OpCodes.OP_EXTCODEHASH:
if (!activations.isActive(RSKIP140)) {
throw Program.ExceptionHelper.invalidOpCode(program);
Expand Down Expand Up @@ -1925,39 +1926,41 @@ protected void executeOpcode() {

case OpCodes.OP_POP: doPOP();
break;
case OpCodes.OP_DUP_1:
case OpCodes.OP_DUP_2:
case OpCodes.OP_DUP_3:
case OpCodes.OP_DUP_4:
case OpCodes.OP_DUP_5:
case OpCodes.OP_DUP_6:
case OpCodes.OP_DUP_7:
case OpCodes.OP_DUP_8:
case OpCodes.OP_DUP_9:
case OpCodes.OP_DUP_10:
case OpCodes.OP_DUP_11:
case OpCodes.OP_DUP_12:
case OpCodes.OP_DUP_13:
case OpCodes.OP_DUP_14:
case OpCodes.OP_DUP_15:
case OpCodes.OP_DUP_16: doDUP();
break;
case OpCodes.OP_SWAP_1:
case OpCodes.OP_SWAP_2:
case OpCodes.OP_SWAP_3:
case OpCodes.OP_SWAP_4:
case OpCodes.OP_SWAP_5:
case OpCodes.OP_SWAP_6:
case OpCodes.OP_SWAP_7:
case OpCodes.OP_SWAP_8:
case OpCodes.OP_SWAP_9:
case OpCodes.OP_SWAP_10:
case OpCodes.OP_SWAP_11:
case OpCodes.OP_SWAP_12:
case OpCodes.OP_SWAP_13:
case OpCodes.OP_SWAP_14:
case OpCodes.OP_SWAP_15:
case OpCodes.OP_SWAP_16: doSWAP();
case OpCodes.OP_DUP_1 ,
OpCodes.OP_DUP_2 ,
OpCodes.OP_DUP_3 ,
OpCodes.OP_DUP_4 ,
OpCodes.OP_DUP_5 ,
OpCodes.OP_DUP_6 ,
OpCodes.OP_DUP_7 ,
OpCodes.OP_DUP_8 ,
OpCodes.OP_DUP_9 ,
OpCodes.OP_DUP_10 ,
OpCodes.OP_DUP_11 ,
OpCodes.OP_DUP_12 ,
OpCodes.OP_DUP_13 ,
OpCodes.OP_DUP_14 ,
OpCodes.OP_DUP_15 ,
OpCodes.OP_DUP_16:
doDUP();
break;
case OpCodes.OP_SWAP_1,
OpCodes.OP_SWAP_2,
OpCodes.OP_SWAP_3,
OpCodes.OP_SWAP_4,
OpCodes.OP_SWAP_5,
OpCodes.OP_SWAP_6,
OpCodes.OP_SWAP_7,
OpCodes.OP_SWAP_8,
OpCodes.OP_SWAP_9,
OpCodes.OP_SWAP_10,
OpCodes.OP_SWAP_11,
OpCodes.OP_SWAP_12,
OpCodes.OP_SWAP_13,
OpCodes.OP_SWAP_14,
OpCodes.OP_SWAP_15,
OpCodes.OP_SWAP_16:
doSWAP();
break;
case OpCodes.OP_SWAPN:
if (activations.isActive(RSKIP191)) {
Expand All @@ -1968,11 +1971,12 @@ protected void executeOpcode() {

break;

case OpCodes.OP_LOG_0:
case OpCodes.OP_LOG_1:
case OpCodes.OP_LOG_2:
case OpCodes.OP_LOG_3:
case OpCodes.OP_LOG_4: doLOG();
case OpCodes.OP_LOG_0,
OpCodes.OP_LOG_1,
OpCodes.OP_LOG_2,
OpCodes.OP_LOG_3,
OpCodes.OP_LOG_4:
doLOG();
break;
case OpCodes.OP_MLOAD: doMLOAD();
break;
Expand Down Expand Up @@ -2014,38 +2018,39 @@ protected void executeOpcode() {
doPUSH0();
break;

case OpCodes.OP_PUSH_1:
case OpCodes.OP_PUSH_2:
case OpCodes.OP_PUSH_3:
case OpCodes.OP_PUSH_4:
case OpCodes.OP_PUSH_5:
case OpCodes.OP_PUSH_6:
case OpCodes.OP_PUSH_7:
case OpCodes.OP_PUSH_8:
case OpCodes.OP_PUSH_9:
case OpCodes.OP_PUSH_10:
case OpCodes.OP_PUSH_11:
case OpCodes.OP_PUSH_12:
case OpCodes.OP_PUSH_13:
case OpCodes.OP_PUSH_14:
case OpCodes.OP_PUSH_15:
case OpCodes.OP_PUSH_16:
case OpCodes.OP_PUSH_17:
case OpCodes.OP_PUSH_18:
case OpCodes.OP_PUSH_19:
case OpCodes.OP_PUSH_20:
case OpCodes.OP_PUSH_21:
case OpCodes.OP_PUSH_22:
case OpCodes.OP_PUSH_23:
case OpCodes.OP_PUSH_24:
case OpCodes.OP_PUSH_25:
case OpCodes.OP_PUSH_26:
case OpCodes.OP_PUSH_27:
case OpCodes.OP_PUSH_28:
case OpCodes.OP_PUSH_29:
case OpCodes.OP_PUSH_30:
case OpCodes.OP_PUSH_31:
case OpCodes.OP_PUSH_32: doPUSH();
case OpCodes.OP_PUSH_1,
OpCodes.OP_PUSH_2,
OpCodes.OP_PUSH_3,
OpCodes.OP_PUSH_4,
OpCodes.OP_PUSH_5,
OpCodes.OP_PUSH_6,
OpCodes.OP_PUSH_7,
OpCodes.OP_PUSH_8,
OpCodes.OP_PUSH_9,
OpCodes.OP_PUSH_10,
OpCodes.OP_PUSH_11,
OpCodes.OP_PUSH_12,
OpCodes.OP_PUSH_13,
OpCodes.OP_PUSH_14,
OpCodes.OP_PUSH_15,
OpCodes.OP_PUSH_16,
OpCodes.OP_PUSH_17,
OpCodes.OP_PUSH_18,
OpCodes.OP_PUSH_19,
OpCodes.OP_PUSH_20,
OpCodes.OP_PUSH_21,
OpCodes.OP_PUSH_22,
OpCodes.OP_PUSH_23,
OpCodes.OP_PUSH_24,
OpCodes.OP_PUSH_25,
OpCodes.OP_PUSH_26,
OpCodes.OP_PUSH_27,
OpCodes.OP_PUSH_28,
OpCodes.OP_PUSH_29,
OpCodes.OP_PUSH_30,
OpCodes.OP_PUSH_31,
OpCodes.OP_PUSH_32:
doPUSH();
break;
case OpCodes.OP_JUMPDEST: doJUMPDEST();
break;
Expand All @@ -2057,10 +2062,10 @@ protected void executeOpcode() {
}
doCREATE2();
break;
case OpCodes.OP_CALL:
case OpCodes.OP_CALLCODE:
case OpCodes.OP_DELEGATECALL:
doCALL();
case OpCodes.OP_CALL,
OpCodes.OP_CALLCODE,
OpCodes.OP_DELEGATECALL:
doCALL();
break;
case OpCodes.OP_STATICCALL:
if (!activations.isActive(RSKIP91)) {
Expand Down Expand Up @@ -2227,9 +2232,7 @@ private void dumpLine(OpCode op, long gasBefore, long gasCost, long memWords, Pr
RskAddress ownerAddress = new RskAddress(program.getOwnerAddress());
if ("standard+".equals(vmConfig.dumpStyle())) {
switch (op) {
case STOP:
case RETURN:
case SUICIDE:
case STOP, RETURN, SUICIDE:
Iterator<DataWord> keysIterator = storage.getStorageKeys(ownerAddress);
while (keysIterator.hasNext()) {
DataWord key = keysIterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class TransientStorageDslTest {
class TransientStorageDslTest {

@Test
void testTransientStorageOpcodesExecutionsWithRSKIPActivated() throws FileNotFoundException, DslProcessorException {
Expand Down
23 changes: 0 additions & 23 deletions rskj-core/src/test/java/co/rsk/vm/opcode/TransientStorageTest.java

This file was deleted.

0 comments on commit 612a66a

Please sign in to comment.