Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some HUB debugging #1467

Merged
merged 43 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e633bf3
add HUB constraints
letypequividelespoubelles Oct 30, 2024
ac14db6
Merge branch 'arith-dev' into 1465-some-hub-debugging
letypequividelespoubelles Oct 30, 2024
a3afbba
fix: typo in the CREATE
OlivierBBB Oct 30, 2024
3cc19e2
ras: cosmetic
OlivierBBB Oct 30, 2024
5833618
ras: new tests + fix
OlivierBBB Oct 30, 2024
19311d2
ras: GASPRICE = 8 Wei/gas and VALUE = 1 Wei for base transactions
OlivierBBB Oct 30, 2024
0491017
spotless
OlivierBBB Oct 30, 2024
7407550
fix: make GAS_NEXT vanish in case of an exception
OlivierBBB Oct 30, 2024
ca2604a
fix: (2,0)-stack-pattern fixed 2nd stack item's height
OlivierBBB Oct 30, 2024
1cd5fe1
really nothing
letypequividelespoubelles Oct 30, 2024
5f2b2d7
Merge branch 'arith-dev' into 1465-some-hub-debugging
letypequividelespoubelles Oct 30, 2024
1cd9e01
ras
OlivierBBB Oct 30, 2024
21678a2
fix: the current context provides "outputData" which becomes the pare…
OlivierBBB Oct 30, 2024
1563918
fix: REVERT now provides the adequate return data to the caller
OlivierBBB Oct 30, 2024
7a29480
fix lookup hub into mmu and rlpAddr for create(2) + spotless
letypequividelespoubelles Oct 31, 2024
6ee97ef
clean up in signals
letypequividelespoubelles Oct 31, 2024
c28dced
use alpha / delta instead of added / remove to catch SUX/SOX
letypequividelespoubelles Oct 31, 2024
e7a5627
fix hasCode in accountFragment
letypequividelespoubelles Oct 31, 2024
776b8b9
tiny cleaning
letypequividelespoubelles Oct 31, 2024
97ff6e3
fix: some progress on gasCostToTrace()
OlivierBBB Oct 31, 2024
1e618fc
fix: traceLog() now takes the right "willRevert" into account
OlivierBBB Oct 31, 2024
a1d18d7
fix: opcodes.yml reflects spec change for TXN instruction family
OlivierBBB Oct 31, 2024
8479456
fix: opcodes.yml didn't include updated values for SLOAD/SSTORE
OlivierBBB Oct 31, 2024
bb2c8a2
fix: LOG1 had issue with its stack pattern
OlivierBBB Oct 31, 2024
3149332
fix: providing the correct value to context/CALL_DATA_CONTEXT_NUMBER
OlivierBBB Oct 31, 2024
5a816ce
spotless
OlivierBBB Oct 31, 2024
af73476
ras
OlivierBBB Oct 31, 2024
c3792f4
update consyraint to latest master wo HUB
letypequividelespoubelles Nov 1, 2024
caae34d
fix constraints
letypequividelespoubelles Nov 1, 2024
639e0e9
fix: removed old "Unconstrained FIRST/FINAL" columns from storage per…
OlivierBBB Nov 1, 2024
3e73fb7
ras
OlivierBBB Nov 1, 2024
7d4281a
fix: EXTCODECOPY stack pattern was off
OlivierBBB Nov 1, 2024
303e6f8
fix: RETURNDATACOPY fragment order
OlivierBBB Nov 1, 2024
b0391c2
fix: MSIZE requires its own TraceSection
OlivierBBB Nov 1, 2024
be9e128
fix: EXTCODECOPY doesn't have a static cost
OlivierBBB Nov 1, 2024
e88c9c3
ras: added names to the CREATE stack pattern function
OlivierBBB Nov 1, 2024
0b0599b
fix: make it compile + renaming to follow the constraints
OlivierBBB Nov 1, 2024
47f1407
fix: removed redundant method in CallStack
OlivierBBB Nov 2, 2024
92b4080
fix: returnDataTargetInCaller major update
OlivierBBB Nov 2, 2024
a7d6274
spotless
letypequividelespoubelles Nov 4, 2024
7ef113e
constrains
letypequividelespoubelles Nov 4, 2024
5f36617
fix(logSection): triggers log revert with the callframe.willrevert()
letypequividelespoubelles Nov 4, 2024
6ade93f
Merge branch 'arith-dev' into 1465-some-hub-debugging
letypequividelespoubelles Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static net.consensys.linea.zktracer.module.hub.HubProcessingPhase.TX_INIT;
import static net.consensys.linea.zktracer.module.hub.HubProcessingPhase.TX_SKIP;
import static net.consensys.linea.zktracer.module.hub.HubProcessingPhase.TX_WARM;
import static net.consensys.linea.zktracer.module.hub.Trace.MULTIPLIER___STACK_HEIGHT;
import static net.consensys.linea.zktracer.module.hub.Trace.MULTIPLIER___STACK_STAMP;
import static net.consensys.linea.zktracer.module.hub.signals.TracedException.*;
import static net.consensys.linea.zktracer.opcode.OpCode.RETURN;
import static net.consensys.linea.zktracer.opcode.OpCode.REVERT;
Expand All @@ -36,7 +36,6 @@
import java.util.Set;
import java.util.stream.Stream;

import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -55,25 +54,7 @@
import net.consensys.linea.zktracer.module.hub.defer.DeferRegistry;
import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment;
import net.consensys.linea.zktracer.module.hub.fragment.StackFragment;
import net.consensys.linea.zktracer.module.hub.section.AccountSection;
import net.consensys.linea.zktracer.module.hub.section.CallDataLoadSection;
import net.consensys.linea.zktracer.module.hub.section.ContextSection;
import net.consensys.linea.zktracer.module.hub.section.CreateSection;
import net.consensys.linea.zktracer.module.hub.section.EarlyExceptionSection;
import net.consensys.linea.zktracer.module.hub.section.ExpSection;
import net.consensys.linea.zktracer.module.hub.section.JumpSection;
import net.consensys.linea.zktracer.module.hub.section.KeccakSection;
import net.consensys.linea.zktracer.module.hub.section.LogSection;
import net.consensys.linea.zktracer.module.hub.section.SloadSection;
import net.consensys.linea.zktracer.module.hub.section.SstoreSection;
import net.consensys.linea.zktracer.module.hub.section.StackOnlySection;
import net.consensys.linea.zktracer.module.hub.section.StackRamSection;
import net.consensys.linea.zktracer.module.hub.section.TraceSection;
import net.consensys.linea.zktracer.module.hub.section.TransactionSection;
import net.consensys.linea.zktracer.module.hub.section.TxFinalizationSection;
import net.consensys.linea.zktracer.module.hub.section.TxInitializationSection;
import net.consensys.linea.zktracer.module.hub.section.TxPreWarmingMacroSection;
import net.consensys.linea.zktracer.module.hub.section.TxSkippedSection;
import net.consensys.linea.zktracer.module.hub.section.*;
import net.consensys.linea.zktracer.module.hub.section.call.CallSection;
import net.consensys.linea.zktracer.module.hub.section.copy.CallDataCopySection;
import net.consensys.linea.zktracer.module.hub.section.copy.CodeCopySection;
Expand Down Expand Up @@ -228,7 +209,7 @@ public int lineCount() {
private final RlpTxnRcpt rlpTxnRcpt = new RlpTxnRcpt();
private final LogInfo logInfo = new LogInfo(rlpTxnRcpt);
private final LogData logData = new LogData(rlpTxnRcpt);
private final RlpAddr rlpAddr = new RlpAddr(this, trm);
@Getter private final RlpAddr rlpAddr = new RlpAddr(this, trm);

// modules triggered by sub-fragments of the MISCELLANEOUS / IMC perspective
@Getter private final Mxp mxp = new Mxp();
Expand Down Expand Up @@ -405,7 +386,7 @@ public Hub(
final Address l2l1ContractAddress,
final Bytes l2l1Topic,
final BigInteger nonnegativeChainId) {
Preconditions.checkState(nonnegativeChainId.signum() >= 0);
checkState(nonnegativeChainId.signum() >= 0);
chainId = nonnegativeChainId;
l2Block = new L2Block(l2l1ContractAddress, LogTopic.of(l2l1Topic));
l2L1Logs = new L2L1Logs(l2Block);
Expand Down Expand Up @@ -624,6 +605,10 @@ public void traceContextEnter(MessageFrame frame) {
// internal transaction (CALL) or internal deployment (CREATE)
if (frame.getDepth() > 0) {
final OpCode currentOpCode = callStack.currentCallFrame().opCode();
checkState(currentOpCode.isCall() || currentOpCode.isCreate());
checkState(
currentTraceSection() instanceof CallSection
|| currentTraceSection() instanceof CreateSection);
final boolean isDeployment = frame.getType() == CONTRACT_CREATION;
final CallFrameType frameType =
frame.isStatic() ? CallFrameType.STATIC : CallFrameType.STANDARD;
Expand Down Expand Up @@ -651,6 +636,11 @@ public void traceContextEnter(MessageFrame frame) {
currentFrame().rememberGasNextBeforePausing();
currentFrame().pauseCurrentFrame();

MemorySpan returnDataTargetInCaller =
(currentTraceSection() instanceof CallSection)
? ((CallSection) currentTraceSection()).getCallProvidedReturnDataTargetSpan()
: MemorySpan.empty();

callStack.enter(
frameType,
newChildContextNumber(),
Expand All @@ -666,7 +656,8 @@ public void traceContextEnter(MessageFrame frame) {
frame.getInputData(),
callDataOffset,
callDataSize,
callDataContextNumber);
callDataContextNumber,
returnDataTargetInCaller);

this.currentFrame().initializeFrame(frame);

Expand Down Expand Up @@ -905,7 +896,7 @@ public final MessageFrame messageFrame() {
private void handleStack(MessageFrame frame) {
this.currentFrame()
.stack()
.processInstruction(this, frame, MULTIPLIER___STACK_HEIGHT * (stamp() + 1));
.processInstruction(this, frame, MULTIPLIER___STACK_STAMP * (stamp() + 1));
}

void triggerModules(MessageFrame frame) {
Expand All @@ -915,9 +906,6 @@ void triggerModules(MessageFrame frame) {
if (pch.signals().bin()) {
bin.tracePreOpcode(frame);
}
if (pch.signals().rlpAddr()) {
rlpAddr.tracePreOpcode(frame);
}
if (pch.signals().mul()) {
mul.tracePreOpcode(frame);
}
Expand Down Expand Up @@ -1024,17 +1012,13 @@ void traceOpcode(MessageFrame frame) {
failureConditionForCreates = false;

switch (this.opCodeData().instructionFamily()) {
case ADD,
MOD,
SHF,
BIN,
WCP,
EXT,
BATCH,
MACHINE_STATE,
PUSH_POP,
DUP,
SWAP -> new StackOnlySection(this);
case ADD, MOD, SHF, BIN, WCP, EXT, BATCH, PUSH_POP, DUP, SWAP -> new StackOnlySection(this);
case MACHINE_STATE -> {
switch (this.opCode()) {
case OpCode.MSIZE -> new MsizeSection(this);
default -> new StackOnlySection(this);
}
}
case MUL -> {
switch (this.opCode()) {
case OpCode.EXP -> new ExpSection(this);
Expand Down
Loading
Loading