Skip to content

Commit

Permalink
1427 remove refunds for selfdestruct (#1442)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzogentile404 authored Oct 23, 2024
1 parent 2978c7f commit d2052c7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
package net.consensys.linea.zktracer.module.constants;

import java.math.BigInteger;
import java.nio.MappedByteBuffer;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;

import net.consensys.linea.zktracer.ColumnHeader;

/**
* WARNING: This code is generated automatically.
Expand Down Expand Up @@ -320,8 +326,7 @@ public class GlobalConstants {
public static final int PHASE_RIPEMD_RESULT = 0x4;
public static final int PHASE_SHA2_DATA = 0x1;
public static final int PHASE_SHA2_RESULT = 0x2;
public static final int REFUND_CONST_R_SCLEAR = 0x3a98;
public static final int REFUND_CONST_R_SELFDESTRUCT = 0x5dc0;
public static final int REFUND_CONST_R_SCLEAR = 0x12c0;
public static final int RLP_ADDR_RECIPE_1 = 0x1;
public static final int RLP_ADDR_RECIPE_2 = 0x2;
public static final int RLP_PREFIX_INT_LONG = 0xb7;
Expand Down Expand Up @@ -356,4 +361,42 @@ public class GlobalConstants {
public static final int WCP_INST_LEQ = 0xf;
public static final int WORD_SIZE = 0x20;
public static final int WORD_SIZE_MO = 0x1f;

private final BitSet filled = new BitSet();
private int currentLine = 0;

static List<ColumnHeader> headers(int length) {
List<ColumnHeader> headers = new ArrayList<>();
return headers;
}

public GlobalConstants(List<MappedByteBuffer> buffers) {}

public int size() {
if (!filled.isEmpty()) {
throw new RuntimeException("Cannot measure a trace with a non-validated row.");
}

return this.currentLine;
}

public GlobalConstants validateRow() {
filled.clear();
this.currentLine++;

return this;
}

public GlobalConstants fillAndValidateRow() {
filled.clear();
this.currentLine++;

return this;
}

public void build() {
if (!filled.isEmpty()) {
throw new IllegalStateException("Cannot build trace with a non-validated row.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public enum GasConstants {
G_S_SET(GlobalConstants.GAS_CONST_G_SSET),
G_S_RESET(GlobalConstants.GAS_CONST_G_SRESET),
R_S_CLEAR(GlobalConstants.REFUND_CONST_R_SCLEAR),
R_SELF_DESTRUCT(GlobalConstants.REFUND_CONST_R_SELFDESTRUCT),
G_SELF_DESTRUCT(GlobalConstants.GAS_CONST_G_SELFDESTRUCT),
G_CREATE(GlobalConstants.GAS_CONST_G_CREATE),
G_CODE_DEPOSIT(GlobalConstants.GAS_CONST_G_CODE_DEPOSIT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,4 @@ public long accountCreation() {
return 0L;
}
}

@Override
public long refund() {
return GlobalConstants.REFUND_CONST_R_SELFDESTRUCT;
}
}

0 comments on commit d2052c7

Please sign in to comment.