Consensys / linea-tracer

Part of the Linea stack responsible for extracting data from the execution of an EVM client in order to construct large matrices called execution traces.
https://linea.build
Other
35 stars 22 forks source link

`FullExceptions` vs `TracedException` #1118

Closed OlivierBBB closed 1 month ago

OlivierBBB commented 1 month ago

We need two Exceptions objects:

The TracedException will be used in the tracing of the stack-rows. We must have the property that

Also the Gas.java should be using the TracedException to determine the outOfGasException flag.


Example of what we would like to achieve for the CallSection, for instance:

    // STATICX cases
    if (Exceptions.staticFault(exceptions)) {
      this.commonValues.tracedException == Exceptions.STATIC_FAULT;
      return;
    }

    // ...

    // MXPX case
    if (Exceptions.memoryExpansionException(exceptions)) {
      this.commonValues.tracedException == Exceptions.MEMORY_EXPANSION_EXCEPTION;
      return;
    }

    // ...

    // OOGX case
    if (Exceptions.outOfGasException(exceptions)) {
      this.commonValues.tracedException == Exceptions.OUT_OF_GAS_EXCEPTION;
      this.oogXCall(hub);
      return;
    }

The end goal is to replace exceptions below with tracedExceptions in the tracing of StackFragmet.java

        // Exception flag // this is WRONG
        .pStackOpcx(Exceptions.invalidCodePrefix(exceptions))
        .pStackSux(Exceptions.stackUnderflow(exceptions))
        .pStackSox(Exceptions.stackOverflow(exceptions))
        .pStackMxpx(Exceptions.memoryExpansionException(exceptions))
        .pStackOogx(Exceptions.outOfGasException(exceptions))
        .pStackRdcx(Exceptions.returnDataCopyFault(exceptions))
        .pStackJumpx(Exceptions.jumpFault(exceptions))
        .pStackStaticx(Exceptions.staticFault(exceptions))
        .pStackSstorex(Exceptions.outOfSStore(exceptions))
        .pStackIcpx(contextExceptions.invalidCodePrefix())
        .pStackMaxcsx(contextExceptions.codeSizeOverflow())
letypequividelespoubelles commented 1 month ago

duplicate of #922

OlivierBBB commented 1 month ago

TracedException could alternatively be an enum, which would be cleaner.