diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index 961167fa7d..468ff99130 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -15,6 +15,11 @@ package net.consensys.linea.zktracer.module.hub; +import java.util.*; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; + import static com.google.common.base.Preconditions.*; import static net.consensys.linea.zktracer.module.hub.HubProcessingPhase.TX_EXEC; import static net.consensys.linea.zktracer.module.hub.HubProcessingPhase.TX_FINL; @@ -145,6 +150,9 @@ public class Hub implements Module { /** provides phase-related volatile information */ @Getter Transients transients = new Transients(this); + /** Block and conflation-level metadata for computing columns relevant to the state manager.* */ + @Getter static StateManagerMetadata stateManagerMetadata = new StateManagerMetadata(); + /** * Long-lived states, not used in tracing per se but keeping track of data of the associated * lifetime @@ -432,6 +440,7 @@ public Hub( blockdata /* WARN: must be called AFTER txnData */), precompileLimitModules().stream()) .toList(); + stateManagerMetadata.setHub(this); } @Override @@ -473,6 +482,10 @@ public void traceEndConflation(final WorldView world) { for (Module m : modules) { m.traceEndConflation(world); } + + // update the conflation level map for the state manager + updateConflationMapAccount(); + updateConflationMapStorage(); } @Override @@ -490,6 +503,8 @@ public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBo for (Module m : modules) { m.traceEndBlock(blockHeader, blockBody); } + // update the block level map for the state manager + updateBlockMap(); } public void traceStartTransaction(final WorldView world, final Transaction tx) { @@ -1164,4 +1179,266 @@ public final boolean returnFromMessageCall(MessageFrame frame) { public final boolean returnFromDeployment(MessageFrame frame) { return opCode() == RETURN && frame.getType() == CONTRACT_CREATION; } + + + public void updateBlockMapAccount() { + Map< + StateManagerMetadata.AddrBlockPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + blockMapAccount = Hub.stateManagerMetadata().getAccountFirstLastBlockMap(); + + List txn = txStack.getTransactions(); + + for (TransactionProcessingMetadata metadata : txn) { + if (metadata.getRelativeBlockNumber() == transients.block().blockNumber()) { + int blockNumber = transients.block().blockNumber(); + Map> + localMapAccount = metadata.getAccountFirstAndLastMap(); + + // Update the block map for the account + for (Address addr : localMapAccount.keySet()) { + StateManagerMetadata.AddrBlockPair pairAddrBlock = + new StateManagerMetadata.AddrBlockPair(addr, blockNumber); + + // localValue exists for sure because addr belongs to the keySet of the local map + TransactionProcessingMetadata.FragmentFirstAndLast localValueAccount = + localMapAccount.get(addr); + if (!blockMapAccount.containsKey(pairAddrBlock)) { + // the pair is not present in the map + blockMapAccount.put(pairAddrBlock, localValueAccount); + } else { + TransactionProcessingMetadata.FragmentFirstAndLast fetchedValue = + blockMapAccount.get(pairAddrBlock); + // we make a copy that will be modified to not change the values already present in the + // transaction maps + TransactionProcessingMetadata.FragmentFirstAndLast blockValue = + fetchedValue.copy(); + // update the first part of the blockValue + // Todo: Refactor and remove code duplication + if (TransactionProcessingMetadata.FragmentFirstAndLast.strictlySmallerStamps( + localValueAccount.getFirstDom(), + localValueAccount.getFirstSub(), + blockValue.getFirstDom(), + blockValue.getFirstSub())) { + // chronologically checks that localValue.First is before blockValue.First + // localValue comes chronologically before, and should be the first value of the map. + blockValue.setFirst(localValueAccount.getFirst()); + blockValue.setFirstDom(localValueAccount.getFirstDom()); + blockValue.setFirstSub(localValueAccount.getFirstSub()); + } + + // update the last part of the blockValue + if (TransactionProcessingMetadata.FragmentFirstAndLast.strictlySmallerStamps( + blockValue.getLastDom(), + blockValue.getLastSub(), + localValueAccount.getLastDom(), + localValueAccount.getLastSub())) { + // chronologically checks that blockValue.Last is before localValue.Last + // localValue comes chronologically after, and should be the final value of the map. + blockValue.setLast(localValueAccount.getLast()); + blockValue.setLastDom(localValueAccount.getLastDom()); + blockValue.setLastSub(localValueAccount.getLastSub()); + } + blockMapAccount.put(pairAddrBlock, blockValue); + + } + + } + } + } + } + + public void updateBlockMapStorage() { + Map< + StateManagerMetadata.AddrStorageKeyBlockNumTuple, + TransactionProcessingMetadata.FragmentFirstAndLast> + blockMapStorage = Hub.stateManagerMetadata().getStorageFirstLastBlockMap(); + + List txn = txStack.getTransactions(); + + for (TransactionProcessingMetadata metadata : txn) { + if (metadata.getRelativeBlockNumber() == transients.block().blockNumber()) { + int blockNumber = transients.block().blockNumber(); + Map< + TransactionProcessingMetadata.AddrStorageKeyPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + localMapStorage = metadata.getStorageFirstAndLastMap(); + // Update the block map for storage + for (TransactionProcessingMetadata.AddrStorageKeyPair addrStorageKeyPair : + localMapStorage.keySet()) { + + StateManagerMetadata.AddrStorageKeyBlockNumTuple addrStorageBlockTuple = + new StateManagerMetadata.AddrStorageKeyBlockNumTuple(addrStorageKeyPair, blockNumber); + + // localValue exists for sure because addr belongs to the keySet of the local map + TransactionProcessingMetadata.FragmentFirstAndLast localValueStorage = + localMapStorage.get(addrStorageKeyPair); + + if (!blockMapStorage.containsKey(addrStorageBlockTuple)) { + // the pair is not present in the map + blockMapStorage.put(addrStorageBlockTuple, localValueStorage); + } else { + TransactionProcessingMetadata.FragmentFirstAndLast fetched = + blockMapStorage.get(addrStorageBlockTuple); + // we make a copy that will be modified to not change the values already present in the + // transaction maps + TransactionProcessingMetadata.FragmentFirstAndLast blockValueStorage = + fetched.copy(); + // update the first part of the blockValue + if (TransactionProcessingMetadata.FragmentFirstAndLast.strictlySmallerStamps( + localValueStorage.getFirstDom(), + localValueStorage.getFirstSub(), + blockValueStorage.getFirstDom(), + blockValueStorage.getFirstSub())) { + // chronologically checks that localValue.First is before blockValue.First + // localValue comes chronologically before, and should be the first value of the map. + blockValueStorage.setFirst(localValueStorage.getFirst()); + blockValueStorage.setFirstDom(localValueStorage.getFirstDom()); + blockValueStorage.setFirstSub(localValueStorage.getFirstSub()); + } + // update the last part of the blockValue + if (TransactionProcessingMetadata.FragmentFirstAndLast.strictlySmallerStamps( + blockValueStorage.getLastDom(), + blockValueStorage.getLastSub(), + localValueStorage.getLastDom(), + localValueStorage.getLastSub())) { + // chronologically checks that blockValue.Last is before localValue.Last + // localValue comes chronologically after, and should be the final value of the map. + blockValueStorage.setLast(localValueStorage.getLast()); + blockValueStorage.setLastDom(localValueStorage.getLastDom()); + blockValueStorage.setLastSub(localValueStorage.getLastSub()); + } + + blockMapStorage.put(addrStorageBlockTuple, blockValueStorage); + + } + } + } + } + } + + public void updateBlockMap() { + updateBlockMapAccount(); + updateBlockMapStorage(); + } + + // Update the conflation level map for the state manager + public void updateConflationMapAccount() { + Map> + conflationMapAccount = Hub.stateManagerMetadata().getAccountFirstLastConflationMap(); + + List txn = txStack.getTransactions(); + HashSet
allAccounts = new HashSet
(); + + Map< + StateManagerMetadata.AddrBlockPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + blockMapAccount = Hub.stateManagerMetadata().getAccountFirstLastBlockMap(); + + for (TransactionProcessingMetadata metadata : txn) { + + Map> + txnMapAccount = metadata.getAccountFirstAndLastMap(); + + allAccounts.addAll(txnMapAccount.keySet()); + } + + for (Address addr : allAccounts) { + TransactionProcessingMetadata.FragmentFirstAndLast firstValue = null; + // Update the first value of the conflation map for Account + // We update the value of the conflation map with the earliest value of the block map + for (int i = 1; i <= transients.block().blockNumber(); i++) { + StateManagerMetadata.AddrBlockPair pairAddrBlock = + new StateManagerMetadata.AddrBlockPair(addr, i); + if (blockMapAccount.containsKey(pairAddrBlock)) { + firstValue = blockMapAccount.get(pairAddrBlock); + conflationMapAccount.put(addr, firstValue); + break; + } + } + // Update the last value of the conflation map + // We update the last value for the conflation map with the latest blockMap's last values, + // if some address is not present in the last block, we ignore the corresponding account + for (int i = transients.block().blockNumber(); i >= 1; i--) { + StateManagerMetadata.AddrBlockPair pairAddrBlock = + new StateManagerMetadata.AddrBlockPair(addr, i); + if (blockMapAccount.containsKey(pairAddrBlock)) { + TransactionProcessingMetadata.FragmentFirstAndLast blockValue = + blockMapAccount.get(pairAddrBlock); + + TransactionProcessingMetadata.FragmentFirstAndLast updatedValue = + new TransactionProcessingMetadata.FragmentFirstAndLast( + firstValue.getFirst(), + blockValue.getLast(), + firstValue.getFirstDom(), + firstValue.getFirstSub(), + blockValue.getLastDom(), + blockValue.getLastSub()); + conflationMapAccount.put(addr, updatedValue); + break; + } + } + } + } + + public void updateConflationMapStorage() { + Map< + TransactionProcessingMetadata.AddrStorageKeyPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + conflationMapStorage = Hub.stateManagerMetadata().getStorageFirstLastConflationMap(); + + List txn = txStack.getTransactions(); + HashSet allStorage = + new HashSet(); + Map< + StateManagerMetadata.AddrStorageKeyBlockNumTuple, + TransactionProcessingMetadata.FragmentFirstAndLast> + blockMapStorage = Hub.stateManagerMetadata().getStorageFirstLastBlockMap(); + for (TransactionProcessingMetadata metadata : txn) { + + Map< + TransactionProcessingMetadata.AddrStorageKeyPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + txnMapStorage = metadata.getStorageFirstAndLastMap(); + + allStorage.addAll(txnMapStorage.keySet()); + } + + for (TransactionProcessingMetadata.AddrStorageKeyPair addrStorageKeyPair : allStorage) { + TransactionProcessingMetadata.FragmentFirstAndLast firstValue = null; + // Update the first value of the conflation map for Storage + // We update the value of the conflation map with the earliest value of the block map + for (int i = 1; i <= transients.block().blockNumber(); i++) { + StateManagerMetadata.AddrStorageKeyBlockNumTuple addrStorageBlockTuple = + new StateManagerMetadata.AddrStorageKeyBlockNumTuple(addrStorageKeyPair, i); + if (blockMapStorage.containsKey(addrStorageBlockTuple)) { + firstValue = blockMapStorage.get(addrStorageBlockTuple); + conflationMapStorage.put(addrStorageKeyPair, firstValue); + break; + } + } + // Update the last value of the conflation map + // We update the last value for the conflation map with the latest blockMap's last values, + // if some address is not present in the last block, we ignore the corresponding account + for (int i = transients.block().blockNumber(); i >= 1; i--) { + StateManagerMetadata.AddrStorageKeyBlockNumTuple addrStorageBlockTuple = + new StateManagerMetadata.AddrStorageKeyBlockNumTuple(addrStorageKeyPair, i); + if (blockMapStorage.containsKey(addrStorageBlockTuple)) { + TransactionProcessingMetadata.FragmentFirstAndLast blockValue = + blockMapStorage.get(addrStorageBlockTuple); + + TransactionProcessingMetadata.FragmentFirstAndLast updatedValue = + new TransactionProcessingMetadata.FragmentFirstAndLast( + firstValue.getFirst(), + blockValue.getLast(), + firstValue.getFirstDom(), + firstValue.getFirstSub(), + blockValue.getLastDom(), + blockValue.getLastSub()); + conflationMapStorage.put(addrStorageKeyPair, updatedValue); + break; + } + } + } + } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java index 83e6037fb0..567a58e81c 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.hub; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -34,43 +35,33 @@ public class Trace { public static final int DOM_SUB_STAMP_OFFSET___REVERT = 0x6; public static final int DOM_SUB_STAMP_OFFSET___SELFDESTRUCT = 0x7; public static final int MULTIPLIER___DOM_SUB_STAMPS = 0x8; + public static final int MULTIPLIER___STACK_HEIGHT = 0x8; public static final int MULTIPLIER___STACK_STAMP = 0x8; private final BitSet filled = new BitSet(); private int currentLine = 0; private final MappedByteBuffer absoluteTransactionNumber; - private final MappedByteBuffer - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize; - private final MappedByteBuffer - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo; - private final MappedByteBuffer - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd; - private final MappedByteBuffer - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment; - private final MappedByteBuffer - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2; + private final MappedByteBuffer addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize; + private final MappedByteBuffer addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo; + private final MappedByteBuffer againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd; + private final MappedByteBuffer againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment; + private final MappedByteBuffer againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2; private final MappedByteBuffer alpha; - private final MappedByteBuffer - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance; - private final MappedByteBuffer - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo; + private final MappedByteBuffer balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance; + private final MappedByteBuffer balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo; private final MappedByteBuffer callDataOffsetXorMmuSize; private final MappedByteBuffer callDataSizeXorMmuSrcId; private final MappedByteBuffer callStackDepthXorStackItemHeight1; private final MappedByteBuffer callerContextNumber; private final MappedByteBuffer codeFragmentIndex; - private final MappedByteBuffer - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi; + private final MappedByteBuffer codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi; private final MappedByteBuffer codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue; - private final MappedByteBuffer - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo; + private final MappedByteBuffer codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo; private final MappedByteBuffer codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo; private final MappedByteBuffer codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi; - private final MappedByteBuffer - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize; - private final MappedByteBuffer - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi; + private final MappedByteBuffer codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize; + private final MappedByteBuffer codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi; private final MappedByteBuffer contextGetsReverted; private final MappedByteBuffer contextMayChange; private final MappedByteBuffer contextNumber; @@ -84,55 +75,39 @@ public class Trace { private final MappedByteBuffer delta; private final MappedByteBuffer deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock; private final MappedByteBuffer deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock; - private final MappedByteBuffer - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao; - private final MappedByteBuffer - deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas; - private final MappedByteBuffer - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi; - private final MappedByteBuffer - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode; - private final MappedByteBuffer - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn; - private final MappedByteBuffer - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution; + private final MappedByteBuffer deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao; + private final MappedByteBuffer deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas; + private final MappedByteBuffer deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi; + private final MappedByteBuffer deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode; + private final MappedByteBuffer deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn; + private final MappedByteBuffer deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution; private final MappedByteBuffer domStamp; private final MappedByteBuffer exceptionAhoy; - private final MappedByteBuffer - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf; - private final MappedByteBuffer - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk; - private final MappedByteBuffer - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn; - private final MappedByteBuffer - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges; - private final MappedByteBuffer - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig; - private final MappedByteBuffer - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero; - private final MappedByteBuffer firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr; - private final MappedByteBuffer - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig; + private final MappedByteBuffer existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf; + private final MappedByteBuffer existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk; + private final MappedByteBuffer finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn; + private final MappedByteBuffer finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorUnconstrainedFinal; + private final MappedByteBuffer finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorUnconstrainedFirst; + private final MappedByteBuffer firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges; + private final MappedByteBuffer firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig; + private final MappedByteBuffer firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero; private final MappedByteBuffer gasActual; private final MappedByteBuffer gasCost; private final MappedByteBuffer gasExpected; private final MappedByteBuffer gasLimit; private final MappedByteBuffer gasNext; private final MappedByteBuffer gasPrice; - private final MappedByteBuffer hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero; - private final MappedByteBuffer - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero; + private final MappedByteBuffer hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueNextIsOrig; + private final MappedByteBuffer hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsCurr; private final MappedByteBuffer height; private final MappedByteBuffer heightNew; private final MappedByteBuffer hubStamp; private final MappedByteBuffer hubStampTransactionEnd; private final MappedByteBuffer instruction; - private final MappedByteBuffer isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth; + private final MappedByteBuffer isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorValueNextIsZero; private final MappedByteBuffer logInfoStamp; - private final MappedByteBuffer - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx; - private final MappedByteBuffer - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew; + private final MappedByteBuffer markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpxXorWarmth; + private final MappedByteBuffer markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorValueOrigIsZero; private final MappedByteBuffer mmuStamp; private final MappedByteBuffer mxpOffset2Hi; private final MappedByteBuffer mxpOffset2Lo; @@ -142,6 +117,8 @@ public class Trace { private final MappedByteBuffer mxpSize2Lo; private final MappedByteBuffer mxpStamp; private final MappedByteBuffer mxpWords; + private final MappedByteBuffer nbAdded; + private final MappedByteBuffer nbRemoved; private final MappedByteBuffer nonStackRows; private final MappedByteBuffer nonce; private final MappedByteBuffer nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable; @@ -194,10 +171,8 @@ public class Trace { private final MappedByteBuffer returnFromMessageCallWillTouchRamXorStackItemPop3; private final MappedByteBuffer returnFromMessageCallWontTouchRamXorStackItemPop4; private final MappedByteBuffer rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize; - private final MappedByteBuffer - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi; - private final MappedByteBuffer - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired; + private final MappedByteBuffer rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi; + private final MappedByteBuffer rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequiredXorWarmthNew; private final MappedByteBuffer rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo; private final MappedByteBuffer rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2; private final MappedByteBuffer rlpaddrRecipe; @@ -236,401 +211,200 @@ public class Trace { private final MappedByteBuffer wcpFlag; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("hub.ABSOLUTE_TRANSACTION_NUMBER", 2, length)); - headers.add( - new ColumnHeader( - "hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CALLEE_GAS_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2", - 1, - length)); - headers.add(new ColumnHeader("hub.ALPHA", 1, length)); - headers.add( - new ColumnHeader( - "hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO", - 16, - length)); - headers.add(new ColumnHeader("hub.CALL_DATA_OFFSET_xor_MMU_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID", 4, length)); - headers.add(new ColumnHeader("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1", 2, length)); - headers.add(new ColumnHeader("hub.CALLER_CONTEXT_NUMBER", 4, length)); - headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX", 4, length)); - headers.add( - new ColumnHeader( - "hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CALLER_GAS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_CDS_xor_INIT_CODE_SIZE", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_CDO_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI", - 4, - length)); - headers.add(new ColumnHeader("hub.CONTEXT_GETS_REVERTED", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_MAY_CHANGE", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_REVERT_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_SELF_REVERTS", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_WILL_REVERT", 1, length)); - headers.add(new ColumnHeader("hub.COUNTER_NSR", 1, length)); - headers.add(new ColumnHeader("hub.COUNTER_TLI", 1, length)); - headers.add(new ColumnHeader("hub.DELTA", 1, length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK", - 2, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK", - 2, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE_xor_PRC_RAO", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET_xor_PRC_RETURN_GAS", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_PRC_RAC_xor_TO_ADDRESS_HI", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION", - 1, - length)); - headers.add(new ColumnHeader("hub.DOM_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.EXCEPTION_AHOY", 1, length)); - headers.add( - new ColumnHeader( - "hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG", - 1, - length)); - headers.add(new ColumnHeader("hub.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("hub.GAS_COST", 8, length)); - headers.add(new ColumnHeader("hub.GAS_EXPECTED", 8, length)); - headers.add(new ColumnHeader("hub.GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("hub.GAS_NEXT", 8, length)); - headers.add(new ColumnHeader("hub.GAS_PRICE", 8, length)); - headers.add( - new ColumnHeader( - "hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO", - 1, - length)); - headers.add(new ColumnHeader("hub.HEIGHT", 2, length)); - headers.add(new ColumnHeader("hub.HEIGHT_NEW", 2, length)); - headers.add(new ColumnHeader("hub.HUB_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.HUB_STAMP_TRANSACTION_END", 4, length)); - headers.add(new ColumnHeader("hub.INSTRUCTION", 32, length)); - headers.add( - new ColumnHeader( - "hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH", - 1, - length)); - headers.add(new ColumnHeader("hub.LOG_INFO_STAMP", 4, length)); - headers.add( - new ColumnHeader( - "hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW", - 1, - length)); - headers.add(new ColumnHeader("hub.MMU_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MXP_OFFSET_2_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_OFFSET_2_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_1_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_1_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_2_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_2_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MXP_WORDS", 16, length)); - headers.add(new ColumnHeader("hub.NON_STACK_ROWS", 1, length)); - headers.add(new ColumnHeader("hub.NONCE", 8, length)); - headers.add( - new ColumnHeader( - "hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_GAS_INITIALLY_AVAILABLE", 8, length)); - headers.add(new ColumnHeader("hub.NONCE_xor_STP_GAS_MXP_xor_BASEFEE", 8, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_1", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_2", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_3", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_4", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_5", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_6", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_7", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_8", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_9", 16, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_ACCOUNT", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_CONTEXT", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_MISCELLANEOUS", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_SCENARIO", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_STACK", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_STORAGE", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_TRANSACTION", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECMUL_xor_MACHINE_STATE_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECPAIRING_xor_MAXCSX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECRECOVER_xor_MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_RAM_xor_MXPX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_IDENTITY_xor_MXP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_MODEXP_xor_OOGX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_RIPEMD-160_xor_OPCX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SHA2-256_xor_PUSHPOP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRIORITY_FEE_PER_GAS", 8, length)); - headers.add(new ColumnHeader("hub.PROGRAM_COUNTER", 4, length)); - headers.add(new ColumnHeader("hub.PROGRAM_COUNTER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER_INFINITY", 8, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_EFFECTIVE", 8, length)); - headers.add(new ColumnHeader("hub.RELATIVE_BLOCK_NUMBER", 2, length)); - headers.add(new ColumnHeader("hub.RETURN_AT_CAPACITY_xor_MXP_INST", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_AT_OFFSET_xor_OOB_INST", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_EXCEPTION_xor_SOX", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4", 1, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE", 4, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2", 16, length)); - headers.add(new ColumnHeader("hub.RLPADDR_RECIPE", 1, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3", 16, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4", 16, length)); - headers.add( - new ColumnHeader( - "hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG", - 1, - length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_EXCEPTION_xor_STATICX", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG", 1, length)); - headers.add( - new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX", 1, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_2", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_3", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_4", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_1", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_2", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_3", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_4", 5, length)); - headers.add(new ColumnHeader("hub.STP_GAS_HI", 16, length)); - headers.add(new ColumnHeader("hub.STP_GAS_LO", 16, length)); - headers.add(new ColumnHeader("hub.STP_GAS_UPFRONT_GAS_COST_xor_GAS_LEFTOVER", 8, length)); - headers.add(new ColumnHeader("hub.STP_VALUE_HI", 16, length)); - headers.add(new ColumnHeader("hub.STP_VALUE_LO", 16, length)); - headers.add(new ColumnHeader("hub.SUB_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.SWAP_FLAG", 1, length)); - headers.add( - new ColumnHeader( - "hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG", - 1, - length)); - headers.add(new ColumnHeader("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO", 16, length)); - headers.add(new ColumnHeader("hub.TWO_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("hub.TX_EXEC", 1, length)); - headers.add(new ColumnHeader("hub.TX_FINL", 1, length)); - headers.add(new ColumnHeader("hub.TX_INIT", 1, length)); - headers.add(new ColumnHeader("hub.TX_SKIP", 1, length)); - headers.add(new ColumnHeader("hub.TX_WARM", 1, length)); - headers.add(new ColumnHeader("hub.TXN_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WCP_FLAG", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("hub.ABSOLUTE_TRANSACTION_NUMBER", 2, length)); + headers.add(new ColumnHeader("hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CALLEE_GAS_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD", 1, length)); + headers.add(new ColumnHeader("hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT", 1, length)); + headers.add(new ColumnHeader("hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2", 1, length)); + headers.add(new ColumnHeader("hub.ALPHA", 1, length)); + headers.add(new ColumnHeader("hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE", 16, length)); + headers.add(new ColumnHeader("hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("hub.CALL_DATA_OFFSET_xor_MMU_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID", 4, length)); + headers.add(new ColumnHeader("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1", 2, length)); + headers.add(new ColumnHeader("hub.CALLER_CONTEXT_NUMBER", 4, length)); + headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX", 4, length)); + headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CALLER_GAS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE", 16, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO", 16, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI", 16, length)); + headers.add(new ColumnHeader("hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_CDS_xor_INIT_CODE_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_CDO_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_GETS_REVERTED", 1, length)); + headers.add(new ColumnHeader("hub.CONTEXT_MAY_CHANGE", 1, length)); + headers.add(new ColumnHeader("hub.CONTEXT_NUMBER", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_NEW", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_REVERT_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_SELF_REVERTS", 1, length)); + headers.add(new ColumnHeader("hub.CONTEXT_WILL_REVERT", 1, length)); + headers.add(new ColumnHeader("hub.COUNTER_NSR", 1, length)); + headers.add(new ColumnHeader("hub.COUNTER_TLI", 1, length)); + headers.add(new ColumnHeader("hub.DELTA", 1, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK", 2, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK", 2, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE_xor_PRC_RAO", 4, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET_xor_PRC_RETURN_GAS", 4, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_PRC_RAC_xor_TO_ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE", 1, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN", 1, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION", 1, length)); + headers.add(new ColumnHeader("hub.DOM_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.EXCEPTION_AHOY", 1, length)); + headers.add(new ColumnHeader("hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF", 1, length)); + headers.add(new ColumnHeader("hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK", 1, length)); + headers.add(new ColumnHeader("hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN", 1, length)); + headers.add(new ColumnHeader("hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_UNCONSTRAINED_FINAL", 1, length)); + headers.add(new ColumnHeader("hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_UNCONSTRAINED_FIRST", 1, length)); + headers.add(new ColumnHeader("hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_CHANGES", 1, length)); + headers.add(new ColumnHeader("hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_CURR_IS_ORIG", 1, length)); + headers.add(new ColumnHeader("hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_CURR_IS_ZERO", 1, length)); + headers.add(new ColumnHeader("hub.GAS_ACTUAL", 8, length)); + headers.add(new ColumnHeader("hub.GAS_COST", 8, length)); + headers.add(new ColumnHeader("hub.GAS_EXPECTED", 8, length)); + headers.add(new ColumnHeader("hub.GAS_LIMIT", 8, length)); + headers.add(new ColumnHeader("hub.GAS_NEXT", 8, length)); + headers.add(new ColumnHeader("hub.GAS_PRICE", 8, length)); + headers.add(new ColumnHeader("hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_NEXT_IS_ORIG", 1, length)); + headers.add(new ColumnHeader("hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_CURR", 1, length)); + headers.add(new ColumnHeader("hub.HEIGHT", 2, length)); + headers.add(new ColumnHeader("hub.HEIGHT_NEW", 2, length)); + headers.add(new ColumnHeader("hub.HUB_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.HUB_STAMP_TRANSACTION_END", 4, length)); + headers.add(new ColumnHeader("hub.INSTRUCTION", 32, length)); + headers.add(new ColumnHeader("hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_VALUE_NEXT_IS_ZERO", 1, length)); + headers.add(new ColumnHeader("hub.LOG_INFO_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX_xor_WARMTH", 1, length)); + headers.add(new ColumnHeader("hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_VALUE_ORIG_IS_ZERO", 1, length)); + headers.add(new ColumnHeader("hub.MMU_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.MXP_OFFSET_2_HI", 16, length)); + headers.add(new ColumnHeader("hub.MXP_OFFSET_2_LO", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_1_HI", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_1_LO", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_2_HI", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_2_LO", 16, length)); + headers.add(new ColumnHeader("hub.MXP_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.MXP_WORDS", 16, length)); + headers.add(new ColumnHeader("hub.NB_ADDED", 1, length)); + headers.add(new ColumnHeader("hub.NB_REMOVED", 1, length)); + headers.add(new ColumnHeader("hub.NON_STACK_ROWS", 1, length)); + headers.add(new ColumnHeader("hub.NONCE", 8, length)); + headers.add(new ColumnHeader("hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_GAS_INITIALLY_AVAILABLE", 8, length)); + headers.add(new ColumnHeader("hub.NONCE_xor_STP_GAS_MXP_xor_BASEFEE", 8, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_1", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_2", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_3", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_4", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_5", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_6", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_7", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_8", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_9", 16, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_ACCOUNT", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_CONTEXT", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_MISCELLANEOUS", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_SCENARIO", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_STACK", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_STORAGE", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_TRANSACTION", 1, length)); + headers.add(new ColumnHeader("hub.PRC_ECMUL_xor_MACHINE_STATE_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_ECPAIRING_xor_MAXCSX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_ECRECOVER_xor_MOD_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_RAM_xor_MXPX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_IDENTITY_xor_MXP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_MODEXP_xor_OOGX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_RIPEMD-160_xor_OPCX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_SHA2-256_xor_PUSHPOP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRIORITY_FEE_PER_GAS", 8, length)); + headers.add(new ColumnHeader("hub.PROGRAM_COUNTER", 4, length)); + headers.add(new ColumnHeader("hub.PROGRAM_COUNTER_NEW", 4, length)); + headers.add(new ColumnHeader("hub.REFUND_COUNTER", 4, length)); + headers.add(new ColumnHeader("hub.REFUND_COUNTER_INFINITY", 8, length)); + headers.add(new ColumnHeader("hub.REFUND_COUNTER_NEW", 4, length)); + headers.add(new ColumnHeader("hub.REFUND_EFFECTIVE", 8, length)); + headers.add(new ColumnHeader("hub.RELATIVE_BLOCK_NUMBER", 2, length)); + headers.add(new ColumnHeader("hub.RETURN_AT_CAPACITY_xor_MXP_INST", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_AT_OFFSET_xor_OOB_INST", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_DATA_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_EXCEPTION_xor_SOX", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4", 1, length)); + headers.add(new ColumnHeader("hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED_xor_WARMTH_NEW", 1, length)); + headers.add(new ColumnHeader("hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_RECIPE", 1, length)); + headers.add(new ColumnHeader("hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4", 16, length)); + headers.add(new ColumnHeader("hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_EXCEPTION_xor_STATICX", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX", 1, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_2", 2, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_3", 2, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_4", 2, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_1", 5, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_2", 5, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_3", 5, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_4", 5, length)); + headers.add(new ColumnHeader("hub.STP_GAS_HI", 16, length)); + headers.add(new ColumnHeader("hub.STP_GAS_LO", 16, length)); + headers.add(new ColumnHeader("hub.STP_GAS_UPFRONT_GAS_COST_xor_GAS_LEFTOVER", 8, length)); + headers.add(new ColumnHeader("hub.STP_VALUE_HI", 16, length)); + headers.add(new ColumnHeader("hub.STP_VALUE_LO", 16, length)); + headers.add(new ColumnHeader("hub.SUB_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.SWAP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO", 16, length)); + headers.add(new ColumnHeader("hub.TWO_LINE_INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("hub.TX_EXEC", 1, length)); + headers.add(new ColumnHeader("hub.TX_FINL", 1, length)); + headers.add(new ColumnHeader("hub.TX_INIT", 1, length)); + headers.add(new ColumnHeader("hub.TX_SKIP", 1, length)); + headers.add(new ColumnHeader("hub.TX_WARM", 1, length)); + headers.add(new ColumnHeader("hub.TXN_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.WCP_FLAG", 1, length)); + return headers; + } + + public Trace (List buffers) { this.absoluteTransactionNumber = buffers.get(0); - this - .addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize = - buffers.get(1); - this - .addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo = - buffers.get(2); - this.againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd = - buffers.get(3); - this - .againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment = - buffers.get(4); - this - .againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 = - buffers.get(5); + this.addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize = buffers.get(1); + this.addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo = buffers.get(2); + this.againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd = buffers.get(3); + this.againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment = buffers.get(4); + this.againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 = buffers.get(5); this.alpha = buffers.get(6); - this.balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance = - buffers.get(7); - this.balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo = - buffers.get(8); + this.balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance = buffers.get(7); + this.balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo = buffers.get(8); this.callDataOffsetXorMmuSize = buffers.get(9); this.callDataSizeXorMmuSrcId = buffers.get(10); this.callStackDepthXorStackItemHeight1 = buffers.get(11); this.callerContextNumber = buffers.get(12); this.codeFragmentIndex = buffers.get(13); - this - .codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi = - buffers.get(14); + this.codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi = buffers.get(14); this.codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue = buffers.get(15); - this.codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo = - buffers.get(16); + this.codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo = buffers.get(16); this.codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo = buffers.get(17); this.codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi = buffers.get(18); - this.codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize = - buffers.get(19); - this.codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi = - buffers.get(20); + this.codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize = buffers.get(19); + this.codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi = buffers.get(20); this.contextGetsReverted = buffers.get(21); this.contextMayChange = buffers.get(22); this.contextNumber = buffers.get(23); @@ -646,53 +420,37 @@ public Trace(List buffers) { this.deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock = buffers.get(33); this.deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao = buffers.get(34); this.deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas = buffers.get(35); - this.deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi = - buffers.get(36); - this.deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode = - buffers.get(37); + this.deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi = buffers.get(36); + this.deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode = buffers.get(37); this.deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn = buffers.get(38); - this - .deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution = - buffers.get(39); + this.deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution = buffers.get(39); this.domStamp = buffers.get(40); this.exceptionAhoy = buffers.get(41); - this.existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf = - buffers.get(42); - this.existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk = - buffers.get(43); - this - .finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn = - buffers.get(44); - this - .finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges = - buffers.get(45); - this.finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig = - buffers.get(46); - this.firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero = - buffers.get(47); - this.firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr = buffers.get(48); - this.firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig = - buffers.get(49); + this.existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf = buffers.get(42); + this.existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk = buffers.get(43); + this.finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn = buffers.get(44); + this.finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorUnconstrainedFinal = buffers.get(45); + this.finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorUnconstrainedFirst = buffers.get(46); + this.firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges = buffers.get(47); + this.firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig = buffers.get(48); + this.firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero = buffers.get(49); this.gasActual = buffers.get(50); this.gasCost = buffers.get(51); this.gasExpected = buffers.get(52); this.gasLimit = buffers.get(53); this.gasNext = buffers.get(54); this.gasPrice = buffers.get(55); - this.hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero = buffers.get(56); - this.hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero = - buffers.get(57); + this.hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueNextIsOrig = buffers.get(56); + this.hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsCurr = buffers.get(57); this.height = buffers.get(58); this.heightNew = buffers.get(59); this.hubStamp = buffers.get(60); this.hubStampTransactionEnd = buffers.get(61); this.instruction = buffers.get(62); - this.isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth = buffers.get(63); + this.isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorValueNextIsZero = buffers.get(63); this.logInfoStamp = buffers.get(64); - this.markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx = - buffers.get(65); - this.markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew = - buffers.get(66); + this.markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpxXorWarmth = buffers.get(65); + this.markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorValueOrigIsZero = buffers.get(66); this.mmuStamp = buffers.get(67); this.mxpOffset2Hi = buffers.get(68); this.mxpOffset2Lo = buffers.get(69); @@ -702,97 +460,98 @@ public Trace(List buffers) { this.mxpSize2Lo = buffers.get(73); this.mxpStamp = buffers.get(74); this.mxpWords = buffers.get(75); - this.nonStackRows = buffers.get(76); - this.nonce = buffers.get(77); - this.nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable = buffers.get(78); - this.nonceXorStpGasMxpXorBasefee = buffers.get(79); - this.oobData1 = buffers.get(80); - this.oobData2 = buffers.get(81); - this.oobData3 = buffers.get(82); - this.oobData4 = buffers.get(83); - this.oobData5 = buffers.get(84); - this.oobData6 = buffers.get(85); - this.oobData7 = buffers.get(86); - this.oobData8 = buffers.get(87); - this.oobData9 = buffers.get(88); - this.peekAtAccount = buffers.get(89); - this.peekAtContext = buffers.get(90); - this.peekAtMiscellaneous = buffers.get(91); - this.peekAtScenario = buffers.get(92); - this.peekAtStack = buffers.get(93); - this.peekAtStorage = buffers.get(94); - this.peekAtTransaction = buffers.get(95); - this.prcEcmulXorMachineStateFlag = buffers.get(96); - this.prcEcpairingXorMaxcsx = buffers.get(97); - this.prcEcrecoverXorModFlag = buffers.get(98); - this.prcFailureKnownToHubXorMulFlag = buffers.get(99); - this.prcFailureKnownToRamXorMxpx = buffers.get(100); - this.prcIdentityXorMxpFlag = buffers.get(101); - this.prcModexpXorOogx = buffers.get(102); - this.prcRipemd160XorOpcx = buffers.get(103); - this.prcSha2256XorPushpopFlag = buffers.get(104); - this.prcSuccessCallerWillRevertXorRdcx = buffers.get(105); - this.prcSuccessCallerWontRevertXorShfFlag = buffers.get(106); - this.priorityFeePerGas = buffers.get(107); - this.programCounter = buffers.get(108); - this.programCounterNew = buffers.get(109); - this.refundCounter = buffers.get(110); - this.refundCounterInfinity = buffers.get(111); - this.refundCounterNew = buffers.get(112); - this.refundEffective = buffers.get(113); - this.relativeBlockNumber = buffers.get(114); - this.returnAtCapacityXorMxpInst = buffers.get(115); - this.returnAtOffsetXorOobInst = buffers.get(116); - this.returnDataContextNumberXorStpGasStipend = buffers.get(117); - this.returnDataOffsetXorStpInstruction = buffers.get(118); - this.returnDataSize = buffers.get(119); - this.returnExceptionXorSox = buffers.get(120); - this.returnFromDeploymentEmptyCodeWillRevertXorSstorex = buffers.get(121); - this.returnFromDeploymentEmptyCodeWontRevertXorStackramFlag = buffers.get(122); - this.returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1 = buffers.get(123); - this.returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2 = buffers.get(124); - this.returnFromMessageCallWillTouchRamXorStackItemPop3 = buffers.get(125); - this.returnFromMessageCallWontTouchRamXorStackItemPop4 = buffers.get(126); - this.rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize = buffers.get(127); - this.rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi = buffers.get(128); - this.rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired = - buffers.get(129); - this.rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo = buffers.get(130); - this.rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2 = buffers.get(131); - this.rlpaddrRecipe = buffers.get(132); - this.rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3 = buffers.get(133); - this.rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4 = buffers.get(134); - this.romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag = buffers.get(135); - this.selfdestructExceptionXorStaticx = buffers.get(136); - this.selfdestructWillRevertXorStaticFlag = buffers.get(137); - this.selfdestructWontRevertAlreadyMarkedXorStoFlag = buffers.get(138); - this.selfdestructWontRevertNotYetMarkedXorSux = buffers.get(139); - this.stackItemHeight2 = buffers.get(140); - this.stackItemHeight3 = buffers.get(141); - this.stackItemHeight4 = buffers.get(142); - this.stackItemStamp1 = buffers.get(143); - this.stackItemStamp2 = buffers.get(144); - this.stackItemStamp3 = buffers.get(145); - this.stackItemStamp4 = buffers.get(146); - this.stpGasHi = buffers.get(147); - this.stpGasLo = buffers.get(148); - this.stpGasUpfrontGasCostXorGasLeftover = buffers.get(149); - this.stpValueHi = buffers.get(150); - this.stpValueLo = buffers.get(151); - this.subStamp = buffers.get(152); - this.swapFlag = buffers.get(153); - this.trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag = buffers.get(154); - this.trmRawAddressHiXorMxpOffset1Lo = buffers.get(155); - this.twoLineInstruction = buffers.get(156); - this.txExec = buffers.get(157); - this.txFinl = buffers.get(158); - this.txInit = buffers.get(159); - this.txSkip = buffers.get(160); - this.txWarm = buffers.get(161); - this.txnFlag = buffers.get(162); - this.warmthNewXorPrcEcaddXorLogInfoFlag = buffers.get(163); - this.warmthXorPrcBlake2FXorLogFlag = buffers.get(164); - this.wcpFlag = buffers.get(165); + this.nbAdded = buffers.get(76); + this.nbRemoved = buffers.get(77); + this.nonStackRows = buffers.get(78); + this.nonce = buffers.get(79); + this.nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable = buffers.get(80); + this.nonceXorStpGasMxpXorBasefee = buffers.get(81); + this.oobData1 = buffers.get(82); + this.oobData2 = buffers.get(83); + this.oobData3 = buffers.get(84); + this.oobData4 = buffers.get(85); + this.oobData5 = buffers.get(86); + this.oobData6 = buffers.get(87); + this.oobData7 = buffers.get(88); + this.oobData8 = buffers.get(89); + this.oobData9 = buffers.get(90); + this.peekAtAccount = buffers.get(91); + this.peekAtContext = buffers.get(92); + this.peekAtMiscellaneous = buffers.get(93); + this.peekAtScenario = buffers.get(94); + this.peekAtStack = buffers.get(95); + this.peekAtStorage = buffers.get(96); + this.peekAtTransaction = buffers.get(97); + this.prcEcmulXorMachineStateFlag = buffers.get(98); + this.prcEcpairingXorMaxcsx = buffers.get(99); + this.prcEcrecoverXorModFlag = buffers.get(100); + this.prcFailureKnownToHubXorMulFlag = buffers.get(101); + this.prcFailureKnownToRamXorMxpx = buffers.get(102); + this.prcIdentityXorMxpFlag = buffers.get(103); + this.prcModexpXorOogx = buffers.get(104); + this.prcRipemd160XorOpcx = buffers.get(105); + this.prcSha2256XorPushpopFlag = buffers.get(106); + this.prcSuccessCallerWillRevertXorRdcx = buffers.get(107); + this.prcSuccessCallerWontRevertXorShfFlag = buffers.get(108); + this.priorityFeePerGas = buffers.get(109); + this.programCounter = buffers.get(110); + this.programCounterNew = buffers.get(111); + this.refundCounter = buffers.get(112); + this.refundCounterInfinity = buffers.get(113); + this.refundCounterNew = buffers.get(114); + this.refundEffective = buffers.get(115); + this.relativeBlockNumber = buffers.get(116); + this.returnAtCapacityXorMxpInst = buffers.get(117); + this.returnAtOffsetXorOobInst = buffers.get(118); + this.returnDataContextNumberXorStpGasStipend = buffers.get(119); + this.returnDataOffsetXorStpInstruction = buffers.get(120); + this.returnDataSize = buffers.get(121); + this.returnExceptionXorSox = buffers.get(122); + this.returnFromDeploymentEmptyCodeWillRevertXorSstorex = buffers.get(123); + this.returnFromDeploymentEmptyCodeWontRevertXorStackramFlag = buffers.get(124); + this.returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1 = buffers.get(125); + this.returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2 = buffers.get(126); + this.returnFromMessageCallWillTouchRamXorStackItemPop3 = buffers.get(127); + this.returnFromMessageCallWontTouchRamXorStackItemPop4 = buffers.get(128); + this.rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize = buffers.get(129); + this.rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi = buffers.get(130); + this.rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequiredXorWarmthNew = buffers.get(131); + this.rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo = buffers.get(132); + this.rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2 = buffers.get(133); + this.rlpaddrRecipe = buffers.get(134); + this.rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3 = buffers.get(135); + this.rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4 = buffers.get(136); + this.romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag = buffers.get(137); + this.selfdestructExceptionXorStaticx = buffers.get(138); + this.selfdestructWillRevertXorStaticFlag = buffers.get(139); + this.selfdestructWontRevertAlreadyMarkedXorStoFlag = buffers.get(140); + this.selfdestructWontRevertNotYetMarkedXorSux = buffers.get(141); + this.stackItemHeight2 = buffers.get(142); + this.stackItemHeight3 = buffers.get(143); + this.stackItemHeight4 = buffers.get(144); + this.stackItemStamp1 = buffers.get(145); + this.stackItemStamp2 = buffers.get(146); + this.stackItemStamp3 = buffers.get(147); + this.stackItemStamp4 = buffers.get(148); + this.stpGasHi = buffers.get(149); + this.stpGasLo = buffers.get(150); + this.stpGasUpfrontGasCostXorGasLeftover = buffers.get(151); + this.stpValueHi = buffers.get(152); + this.stpValueLo = buffers.get(153); + this.subStamp = buffers.get(154); + this.swapFlag = buffers.get(155); + this.trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag = buffers.get(156); + this.trmRawAddressHiXorMxpOffset1Lo = buffers.get(157); + this.twoLineInstruction = buffers.get(158); + this.txExec = buffers.get(159); + this.txFinl = buffers.get(160); + this.txInit = buffers.get(161); + this.txSkip = buffers.get(162); + this.txWarm = buffers.get(163); + this.txnFlag = buffers.get(164); + this.warmthNewXorPrcEcaddXorLogInfoFlag = buffers.get(165); + this.warmthXorPrcBlake2FXorLogFlag = buffers.get(166); + this.wcpFlag = buffers.get(167); } public int size() { @@ -810,13 +569,11 @@ public Trace absoluteTransactionNumber(final long b) { filled.set(0); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.ABSOLUTE_TRANSACTION_NUMBER has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.ABSOLUTE_TRANSACTION_NUMBER has invalid value (" + b + ")"); } absoluteTransactionNumber.put((byte) (b >> 8)); absoluteTransactionNumber.put((byte) b); + return this; } @@ -827,14 +584,13 @@ public Trace callerContextNumber(final long b) { filled.set(1); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CALLER_CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CALLER_CONTEXT_NUMBER has invalid value (" + b + ")"); } callerContextNumber.put((byte) (b >> 24)); callerContextNumber.put((byte) (b >> 16)); callerContextNumber.put((byte) (b >> 8)); callerContextNumber.put((byte) b); + return this; } @@ -845,14 +601,13 @@ public Trace codeFragmentIndex(final long b) { filled.set(2); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } codeFragmentIndex.put((byte) (b >> 24)); codeFragmentIndex.put((byte) (b >> 16)); codeFragmentIndex.put((byte) (b >> 8)); codeFragmentIndex.put((byte) b); + return this; } @@ -887,14 +642,13 @@ public Trace contextNumber(final long b) { filled.set(5); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_NUMBER has invalid value (" + b + ")"); } contextNumber.put((byte) (b >> 24)); contextNumber.put((byte) (b >> 16)); contextNumber.put((byte) (b >> 8)); contextNumber.put((byte) b); + return this; } @@ -905,14 +659,13 @@ public Trace contextNumberNew(final long b) { filled.set(6); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CONTEXT_NUMBER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_NUMBER_NEW has invalid value (" + b + ")"); } contextNumberNew.put((byte) (b >> 24)); contextNumberNew.put((byte) (b >> 16)); contextNumberNew.put((byte) (b >> 8)); contextNumberNew.put((byte) b); + return this; } @@ -923,14 +676,13 @@ public Trace contextRevertStamp(final long b) { filled.set(7); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CONTEXT_REVERT_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_REVERT_STAMP has invalid value (" + b + ")"); } contextRevertStamp.put((byte) (b >> 24)); contextRevertStamp.put((byte) (b >> 16)); contextRevertStamp.put((byte) (b >> 8)); contextRevertStamp.put((byte) b); + return this; } @@ -965,11 +717,10 @@ public Trace counterNsr(final long b) { filled.set(10); } - if (b >= 256L) { - throw new IllegalArgumentException("hub.COUNTER_NSR has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("hub.COUNTER_NSR has invalid value (" + b + ")"); } counterNsr.put((byte) b); + return this; } @@ -992,14 +743,13 @@ public Trace domStamp(final long b) { filled.set(12); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.DOM_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.DOM_STAMP has invalid value (" + b + ")"); } domStamp.put((byte) (b >> 24)); domStamp.put((byte) (b >> 16)); domStamp.put((byte) (b >> 8)); domStamp.put((byte) b); + return this; } @@ -1025,18 +775,11 @@ public Trace gasActual(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasActual.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasActual.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasCost.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasCost.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasCost.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.GAS_EXPECTED has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_EXPECTED has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasExpected.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasExpected.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasExpected.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.GAS_NEXT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_NEXT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasNext.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasNext.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasNext.put(bs.get(j)); - } + for(int j=0; j= 2048L) { - throw new IllegalArgumentException("hub.HEIGHT has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.HEIGHT has invalid value (" + b + ")"); } height.put((byte) (b >> 8)); height.put((byte) b); + return this; } @@ -1142,12 +863,11 @@ public Trace heightNew(final long b) { filled.set(19); } - if (b >= 2048L) { - throw new IllegalArgumentException("hub.HEIGHT_NEW has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.HEIGHT_NEW has invalid value (" + b + ")"); } heightNew.put((byte) (b >> 8)); heightNew.put((byte) b); + return this; } @@ -1158,14 +878,13 @@ public Trace hubStamp(final long b) { filled.set(20); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.HUB_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.HUB_STAMP has invalid value (" + b + ")"); } hubStamp.put((byte) (b >> 24)); hubStamp.put((byte) (b >> 16)); hubStamp.put((byte) (b >> 8)); hubStamp.put((byte) b); + return this; } @@ -1176,15 +895,13 @@ public Trace hubStampTransactionEnd(final long b) { filled.set(21); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.HUB_STAMP_TRANSACTION_END has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.HUB_STAMP_TRANSACTION_END has invalid value (" + b + ")"); } hubStampTransactionEnd.put((byte) (b >> 24)); hubStampTransactionEnd.put((byte) (b >> 16)); hubStampTransactionEnd.put((byte) (b >> 8)); hubStampTransactionEnd.put((byte) b); + return this; } @@ -1195,14 +912,13 @@ public Trace logInfoStamp(final long b) { filled.set(22); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.LOG_INFO_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.LOG_INFO_STAMP has invalid value (" + b + ")"); } logInfoStamp.put((byte) (b >> 24)); logInfoStamp.put((byte) (b >> 16)); logInfoStamp.put((byte) (b >> 8)); logInfoStamp.put((byte) b); + return this; } @@ -1213,14 +929,13 @@ public Trace mmuStamp(final long b) { filled.set(23); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.MMU_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.MMU_STAMP has invalid value (" + b + ")"); } mmuStamp.put((byte) (b >> 24)); mmuStamp.put((byte) (b >> 16)); mmuStamp.put((byte) (b >> 8)); mmuStamp.put((byte) b); + return this; } @@ -1231,14 +946,13 @@ public Trace mxpStamp(final long b) { filled.set(24); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.MXP_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.MXP_STAMP has invalid value (" + b + ")"); } mxpStamp.put((byte) (b >> 24)); mxpStamp.put((byte) (b >> 16)); mxpStamp.put((byte) (b >> 8)); mxpStamp.put((byte) b); + return this; } @@ -1249,60 +963,45 @@ public Trace nonStackRows(final long b) { filled.set(25); } - if (b >= 256L) { - throw new IllegalArgumentException("hub.NON_STACK_ROWS has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("hub.NON_STACK_ROWS has invalid value (" + b + ")"); } nonStackRows.put((byte) b); + return this; } public Trace pAccountAddressHi(final long b) { - if (filled.get(103)) { + if (filled.get(105)) { throw new IllegalStateException("hub.account/ADDRESS_HI already set"); } else { - filled.set(103); + filled.set(105); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.account/ADDRESS_HI has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/ADDRESS_HI has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pAccountAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(134)) { throw new IllegalStateException("hub.account/ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/BALANCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/BALANCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/BALANCE_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/BALANCE_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pAccountCodeHashHi(final Bytes b) { - if (filled.get(135)) { + if (filled.get(137)) { throw new IllegalStateException("hub.account/CODE_HASH_HI already set"); } else { - filled.set(135); + filled.set(137); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_HI_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_HI_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_LO_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_LO_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.account/CODE_SIZE has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_SIZE has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pAccountCodeSizeNew(final long b) { - if (filled.get(106)) { + if (filled.get(108)) { throw new IllegalStateException("hub.account/CODE_SIZE_NEW already set"); } else { - filled.set(106); + filled.set(108); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.account/CODE_SIZE_NEW has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_SIZE_NEW has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) b); + return this; } public Trace pAccountDeploymentNumber(final long b) { - if (filled.get(107)) { + if (filled.get(109)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER already set"); } else { - filled.set(107); + filled.set(109); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 24)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 16)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) b); + return this; } public Trace pAccountDeploymentNumberFinalInBlock(final long b) { - if (filled.get(101)) { + if (filled.get(103)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK already set"); } else { - filled.set(101); + filled.set(103); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) (b >> 8)); deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) b); + return this; } public Trace pAccountDeploymentNumberFirstInBlock(final long b) { - if (filled.get(102)) { + if (filled.get(104)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK already set"); } else { - filled.set(102); + filled.set(104); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) (b >> 8)); deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) b); + return this; } public Trace pAccountDeploymentNumberInfty(final long b) { - if (filled.get(108)) { + if (filled.get(110)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_INFTY already set"); } else { - filled.set(108); + filled.set(110); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) b); + return this; } public Trace pAccountDeploymentNumberNew(final long b) { - if (filled.get(109)) { + if (filled.get(111)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_NEW already set"); } else { - filled.set(109); + filled.set(111); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_NEW has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) b); + return this; } @@ -1673,8 +1295,7 @@ public Trace pAccountDeploymentStatus(final Boolean b) { filled.set(48); } - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .put((byte) (b ? 1 : 0)); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); return this; } @@ -1686,8 +1307,7 @@ public Trace pAccountDeploymentStatusInfty(final Boolean b) { filled.set(49); } - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put( - (byte) (b ? 1 : 0)); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); return this; } @@ -1711,8 +1331,7 @@ public Trace pAccountExists(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -1724,8 +1343,7 @@ public Trace pAccountExistsNew(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } @@ -1737,8 +1355,7 @@ public Trace pAccountFinalInBlk(final Boolean b) { filled.set(53); } - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put( - (byte) (b ? 1 : 0)); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); return this; } @@ -1750,8 +1367,7 @@ public Trace pAccountFinalInCnf(final Boolean b) { filled.set(54); } - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .put((byte) (b ? 1 : 0)); + finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorUnconstrainedFinal.put((byte) (b ? 1 : 0)); return this; } @@ -1763,8 +1379,7 @@ public Trace pAccountFinalInTxn(final Boolean b) { filled.set(55); } - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.put( - (byte) (b ? 1 : 0)); + finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorUnconstrainedFirst.put((byte) (b ? 1 : 0)); return this; } @@ -1776,8 +1391,7 @@ public Trace pAccountFirstInBlk(final Boolean b) { filled.set(56); } - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put( - (byte) (b ? 1 : 0)); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges.put((byte) (b ? 1 : 0)); return this; } @@ -1789,7 +1403,7 @@ public Trace pAccountFirstInCnf(final Boolean b) { filled.set(57); } - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); + firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig.put((byte) (b ? 1 : 0)); return this; } @@ -1801,8 +1415,7 @@ public Trace pAccountFirstInTxn(final Boolean b) { filled.set(58); } - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put( - (byte) (b ? 1 : 0)); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -1814,8 +1427,7 @@ public Trace pAccountHasCode(final Boolean b) { filled.set(59); } - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.put( - (byte) (b ? 1 : 0)); + hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); return this; } @@ -1827,7 +1439,7 @@ public Trace pAccountHasCodeNew(final Boolean b) { filled.set(60); } - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.put((byte) (b ? 1 : 0)); + hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueNextIsOrig.put((byte) (b ? 1 : 0)); return this; } @@ -1839,7 +1451,7 @@ public Trace pAccountIsPrecompile(final Boolean b) { filled.set(61); } - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.put((byte) (b ? 1 : 0)); + isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorValueNextIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -1851,8 +1463,7 @@ public Trace pAccountMarkedForSelfdestruct(final Boolean b) { filled.set(62); } - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.put( - (byte) (b ? 1 : 0)); + markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorValueOrigIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -1864,105 +1475,81 @@ public Trace pAccountMarkedForSelfdestructNew(final Boolean b) { filled.set(63); } - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.put( - (byte) (b ? 1 : 0)); + markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpxXorWarmth.put((byte) (b ? 1 : 0)); return this; } public Trace pAccountNonce(final Bytes b) { - if (filled.get(123)) { + if (filled.get(125)) { throw new IllegalStateException("hub.account/NONCE already set"); } else { - filled.set(123); + filled.set(125); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.account/NONCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.account/NONCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorBasefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.account/NONCE_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.account/NONCE_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_DEP_ADDR_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/RLPADDR_DEP_ADDR_HI has invalid value (" + b + ")"); } rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); + return this; } public Trace pAccountRlpaddrDepAddrLo(final Bytes b) { - if (filled.get(139)) { + if (filled.get(141)) { throw new IllegalStateException("hub.account/RLPADDR_DEP_ADDR_LO already set"); } else { - filled.set(139); + filled.set(141); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_KEC_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_KEC_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_KEC_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_KEC_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_RECIPE has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("hub.account/RLPADDR_RECIPE has invalid value (" + b + ")"); } rlpaddrRecipe.put((byte) b); + return this; } public Trace pAccountRlpaddrSaltHi(final Bytes b) { - if (filled.get(142)) { + if (filled.get(144)) { throw new IllegalStateException("hub.account/RLPADDR_SALT_HI already set"); } else { - filled.set(142); + filled.set(144); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_SALT_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_SALT_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_SALT_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_SALT_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/TRM_RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/TRM_RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trmRawAddressHiXorMxpOffset1Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/ACCOUNT_ADDRESS_HI has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/ACCOUNT_ADDRESS_HI has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pContextAccountAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(134)) { throw new IllegalStateException("hub.context/ACCOUNT_ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/ACCOUNT_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/ACCOUNT_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/ACCOUNT_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/ACCOUNT_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pContextByteCodeAddressHi(final long b) { - if (filled.get(105)) { + if (filled.get(107)) { throw new IllegalStateException("hub.context/BYTE_CODE_ADDRESS_HI already set"); } else { - filled.set(105); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_ADDRESS_HI has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_ADDRESS_HI has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pContextByteCodeAddressLo(final Bytes b) { - if (filled.get(133)) { + if (filled.get(135)) { throw new IllegalStateException("hub.context/BYTE_CODE_ADDRESS_LO already set"); } else { - filled.set(133); + filled.set(135); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/BYTE_CODE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) b); + return this; } public Trace pContextByteCodeDeploymentNumber(final long b) { - if (filled.get(107)) { + if (filled.get(109)) { throw new IllegalStateException("hub.context/BYTE_CODE_DEPLOYMENT_NUMBER already set"); } else { - filled.set(107); + filled.set(109); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 24)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 16)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) b); + return this; } public Trace pContextByteCodeDeploymentStatus(final long b) { - if (filled.get(108)) { + if (filled.get(110)) { throw new IllegalStateException("hub.context/BYTE_CODE_DEPLOYMENT_STATUS already set"); } else { - filled.set(108); + filled.set(110); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_DEPLOYMENT_STATUS has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_DEPLOYMENT_STATUS has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) b); + return this; } public Trace pContextCallDataContextNumber(final long b) { - if (filled.get(110)) { + if (filled.get(112)) { throw new IllegalStateException("hub.context/CALL_DATA_CONTEXT_NUMBER already set"); } else { - filled.set(110); + filled.set(112); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALL_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); } rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); + return this; } public Trace pContextCallDataOffset(final long b) { - if (filled.get(111)) { + if (filled.get(113)) { throw new IllegalStateException("hub.context/CALL_DATA_OFFSET already set"); } else { - filled.set(111); + filled.set(113); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALL_DATA_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_OFFSET has invalid value (" + b + ")"); } callDataOffsetXorMmuSize.put((byte) (b >> 24)); callDataOffsetXorMmuSize.put((byte) (b >> 16)); callDataOffsetXorMmuSize.put((byte) (b >> 8)); callDataOffsetXorMmuSize.put((byte) b); + return this; } public Trace pContextCallDataSize(final long b) { - if (filled.get(112)) { + if (filled.get(114)) { throw new IllegalStateException("hub.context/CALL_DATA_SIZE already set"); } else { - filled.set(112); + filled.set(114); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALL_DATA_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_SIZE has invalid value (" + b + ")"); } callDataSizeXorMmuSrcId.put((byte) (b >> 24)); callDataSizeXorMmuSrcId.put((byte) (b >> 16)); callDataSizeXorMmuSrcId.put((byte) (b >> 8)); callDataSizeXorMmuSrcId.put((byte) b); + return this; } public Trace pContextCallStackDepth(final long b) { - if (filled.get(97)) { + if (filled.get(99)) { throw new IllegalStateException("hub.context/CALL_STACK_DEPTH already set"); } else { - filled.set(97); + filled.set(99); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.context/CALL_STACK_DEPTH has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.context/CALL_STACK_DEPTH has invalid value (" + b + ")"); } callStackDepthXorStackItemHeight1.put((byte) (b >> 8)); callStackDepthXorStackItemHeight1.put((byte) b); + return this; } public Trace pContextCallValue(final Bytes b) { - if (filled.get(135)) { + if (filled.get(137)) { throw new IllegalStateException("hub.context/CALL_VALUE already set"); } else { - filled.set(135); + filled.set(137); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/CALL_VALUE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/CALL_VALUE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALLER_ADDRESS_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALLER_ADDRESS_HI has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) b); + return this; } public Trace pContextCallerAddressLo(final Bytes b) { - if (filled.get(134)) { + if (filled.get(136)) { throw new IllegalStateException("hub.context/CALLER_ADDRESS_LO already set"); } else { - filled.set(134); + filled.set(136); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/CALLER_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/CALLER_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CONTEXT_NUMBER has invalid value (" + b + ")"); } contextNumberXorMmuTgtId.put((byte) (b >> 24)); contextNumberXorMmuTgtId.put((byte) (b >> 16)); contextNumberXorMmuTgtId.put((byte) (b >> 8)); contextNumberXorMmuTgtId.put((byte) b); + return this; } @@ -2535,8 +2008,7 @@ public Trace pContextIsRoot(final Boolean b) { filled.set(45); } - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put( - (byte) (b ? 1 : 0)); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); return this; } @@ -2548,104 +2020,93 @@ public Trace pContextIsStatic(final Boolean b) { filled.set(46); } - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put( - (byte) (b ? 1 : 0)); + againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put((byte) (b ? 1 : 0)); return this; } public Trace pContextReturnAtCapacity(final long b) { - if (filled.get(114)) { + if (filled.get(116)) { throw new IllegalStateException("hub.context/RETURN_AT_CAPACITY already set"); } else { - filled.set(114); + filled.set(116); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_AT_CAPACITY has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_AT_CAPACITY has invalid value (" + b + ")"); } returnAtCapacityXorMxpInst.put((byte) (b >> 24)); returnAtCapacityXorMxpInst.put((byte) (b >> 16)); returnAtCapacityXorMxpInst.put((byte) (b >> 8)); returnAtCapacityXorMxpInst.put((byte) b); + return this; } public Trace pContextReturnAtOffset(final long b) { - if (filled.get(115)) { + if (filled.get(117)) { throw new IllegalStateException("hub.context/RETURN_AT_OFFSET already set"); } else { - filled.set(115); + filled.set(117); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_AT_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_AT_OFFSET has invalid value (" + b + ")"); } returnAtOffsetXorOobInst.put((byte) (b >> 24)); returnAtOffsetXorOobInst.put((byte) (b >> 16)); returnAtOffsetXorOobInst.put((byte) (b >> 8)); returnAtOffsetXorOobInst.put((byte) b); + return this; } public Trace pContextReturnDataContextNumber(final long b) { - if (filled.get(116)) { + if (filled.get(118)) { throw new IllegalStateException("hub.context/RETURN_DATA_CONTEXT_NUMBER already set"); } else { - filled.set(116); + filled.set(118); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); } returnDataContextNumberXorStpGasStipend.put((byte) (b >> 24)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 16)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 8)); returnDataContextNumberXorStpGasStipend.put((byte) b); + return this; } public Trace pContextReturnDataOffset(final long b) { - if (filled.get(117)) { + if (filled.get(119)) { throw new IllegalStateException("hub.context/RETURN_DATA_OFFSET already set"); } else { - filled.set(117); + filled.set(119); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_DATA_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_OFFSET has invalid value (" + b + ")"); } returnDataOffsetXorStpInstruction.put((byte) (b >> 24)); returnDataOffsetXorStpInstruction.put((byte) (b >> 16)); returnDataOffsetXorStpInstruction.put((byte) (b >> 8)); returnDataOffsetXorStpInstruction.put((byte) b); + return this; } public Trace pContextReturnDataSize(final long b) { - if (filled.get(118)) { + if (filled.get(120)) { throw new IllegalStateException("hub.context/RETURN_DATA_SIZE already set"); } else { - filled.set(118); + filled.set(120); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_DATA_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_SIZE has invalid value (" + b + ")"); } returnDataSize.put((byte) (b >> 24)); returnDataSize.put((byte) (b >> 16)); returnDataSize.put((byte) (b >> 8)); returnDataSize.put((byte) b); + return this; } @@ -2656,30 +2117,24 @@ public Trace pContextUpdate(final Boolean b) { filled.set(47); } - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .put((byte) (b ? 1 : 0)); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscCcrsStamp(final long b) { - if (filled.get(103)) { + if (filled.get(105)) { throw new IllegalStateException("hub.misc/CCRS_STAMP already set"); } else { - filled.set(103); + filled.set(105); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/CCRS_STAMP has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/CCRS_STAMP has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } @@ -2691,144 +2146,102 @@ public Trace pMiscCcsrFlag(final Boolean b) { filled.set(45); } - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put( - (byte) (b ? 1 : 0)); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscExpData1(final Bytes b) { - if (filled.get(132)) { + if (filled.get(134)) { throw new IllegalStateException("hub.misc/EXP_DATA_1 already set"); } else { - filled.set(132); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/EXP_INST has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/EXP_INST has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pMiscMmuAuxId(final long b) { - if (filled.get(105)) { + if (filled.get(107)) { throw new IllegalStateException("hub.misc/MMU_AUX_ID already set"); } else { - filled.set(105); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_AUX_ID has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_AUX_ID has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pMiscMmuExoSum(final long b) { - if (filled.get(106)) { + if (filled.get(108)) { throw new IllegalStateException("hub.misc/MMU_EXO_SUM already set"); } else { - filled.set(106); + filled.set(108); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_EXO_SUM has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_EXO_SUM has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) b); + return this; } @@ -2918,223 +2316,185 @@ public Trace pMiscMmuFlag(final Boolean b) { filled.set(47); } - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .put((byte) (b ? 1 : 0)); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscMmuInst(final long b) { - if (filled.get(107)) { + if (filled.get(109)) { throw new IllegalStateException("hub.misc/MMU_INST already set"); } else { - filled.set(107); + filled.set(109); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_INST has invalid value (" + b + ")"); - } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_INST has invalid value (" + b + ")"); } + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 24)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 16)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) b); + return this; } public Trace pMiscMmuLimb1(final Bytes b) { - if (filled.get(137)) { + if (filled.get(139)) { throw new IllegalStateException("hub.misc/MMU_LIMB_1 already set"); } else { - filled.set(137); + filled.set(139); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_PHASE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_PHASE has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) b); + return this; } public Trace pMiscMmuRefOffset(final long b) { - if (filled.get(109)) { + if (filled.get(111)) { throw new IllegalStateException("hub.misc/MMU_REF_OFFSET already set"); } else { - filled.set(109); + filled.set(111); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_REF_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_REF_OFFSET has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) b); + return this; } public Trace pMiscMmuRefSize(final long b) { - if (filled.get(110)) { + if (filled.get(112)) { throw new IllegalStateException("hub.misc/MMU_REF_SIZE already set"); } else { - filled.set(110); + filled.set(112); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_REF_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_REF_SIZE has invalid value (" + b + ")"); } rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); + return this; } public Trace pMiscMmuSize(final long b) { - if (filled.get(111)) { + if (filled.get(113)) { throw new IllegalStateException("hub.misc/MMU_SIZE already set"); } else { - filled.set(111); + filled.set(113); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_SIZE has invalid value (" + b + ")"); } callDataOffsetXorMmuSize.put((byte) (b >> 24)); callDataOffsetXorMmuSize.put((byte) (b >> 16)); callDataOffsetXorMmuSize.put((byte) (b >> 8)); callDataOffsetXorMmuSize.put((byte) b); + return this; } public Trace pMiscMmuSrcId(final long b) { - if (filled.get(112)) { + if (filled.get(114)) { throw new IllegalStateException("hub.misc/MMU_SRC_ID already set"); } else { - filled.set(112); + filled.set(114); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_SRC_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_SRC_ID has invalid value (" + b + ")"); } callDataSizeXorMmuSrcId.put((byte) (b >> 24)); callDataSizeXorMmuSrcId.put((byte) (b >> 16)); callDataSizeXorMmuSrcId.put((byte) (b >> 8)); callDataSizeXorMmuSrcId.put((byte) b); + return this; } public Trace pMiscMmuSrcOffsetHi(final Bytes b) { - if (filled.get(139)) { + if (filled.get(141)) { throw new IllegalStateException("hub.misc/MMU_SRC_OFFSET_HI already set"); } else { - filled.set(139); + filled.set(141); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_TGT_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_TGT_ID has invalid value (" + b + ")"); } contextNumberXorMmuTgtId.put((byte) (b >> 24)); contextNumberXorMmuTgtId.put((byte) (b >> 16)); contextNumberXorMmuTgtId.put((byte) (b >> 8)); contextNumberXorMmuTgtId.put((byte) b); + return this; } public Trace pMiscMmuTgtOffsetLo(final Bytes b) { - if (filled.get(141)) { + if (filled.get(143)) { throw new IllegalStateException("hub.misc/MMU_TGT_OFFSET_LO already set"); } else { - filled.set(141); + filled.set(143); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MXP_INST has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MXP_INST has invalid value (" + b + ")"); } returnAtCapacityXorMxpInst.put((byte) (b >> 24)); returnAtCapacityXorMxpInst.put((byte) (b >> 16)); returnAtCapacityXorMxpInst.put((byte) (b >> 8)); returnAtCapacityXorMxpInst.put((byte) b); + return this; } @@ -3272,8 +2614,7 @@ public Trace pMiscMxpMtntop(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -3285,164 +2626,121 @@ public Trace pMiscMxpMxpx(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscMxpOffset1Hi(final Bytes b) { - if (filled.get(143)) { + if (filled.get(145)) { throw new IllegalStateException("hub.misc/MXP_OFFSET_1_HI already set"); } else { - filled.set(143); + filled.set(145); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trmRawAddressHiXorMxpOffset1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpOffset2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpOffset2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpOffset2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpOffset2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpOffset2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpOffset2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_WORDS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_WORDS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpWords.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpWords.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpWords.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData5.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData6.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData6.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_7 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_7 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData7.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData7.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData7.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_8 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_8 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData8.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData8.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData8.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_9 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_9 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData9.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData9.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData9.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/OOB_INST has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/OOB_INST has invalid value (" + b + ")"); } returnAtOffsetXorOobInst.put((byte) (b >> 24)); returnAtOffsetXorOobInst.put((byte) (b >> 16)); returnAtOffsetXorOobInst.put((byte) (b >> 8)); returnAtOffsetXorOobInst.put((byte) b); + return this; } @@ -3823,8 +3033,7 @@ public Trace pMiscStpExists(final Boolean b) { filled.set(56); } - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put( - (byte) (b ? 1 : 0)); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges.put((byte) (b ? 1 : 0)); return this; } @@ -3836,174 +3045,137 @@ public Trace pMiscStpFlag(final Boolean b) { filled.set(57); } - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); + firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscStpGasHi(final Bytes b) { - if (filled.get(161)) { + if (filled.get(163)) { throw new IllegalStateException("hub.misc/STP_GAS_HI already set"); } else { - filled.set(161); + filled.set(163); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_GAS_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpGasHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpGasHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_GAS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpGasLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpGasLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorBasefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_PAID_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_PAID_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/STP_GAS_STIPEND has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/STP_GAS_STIPEND has invalid value (" + b + ")"); } returnDataContextNumberXorStpGasStipend.put((byte) (b >> 24)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 16)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 8)); returnDataContextNumberXorStpGasStipend.put((byte) b); + return this; } public Trace pMiscStpGasUpfrontGasCost(final Bytes b) { - if (filled.get(125)) { + if (filled.get(127)) { throw new IllegalStateException("hub.misc/STP_GAS_UPFRONT_GAS_COST already set"); } else { - filled.set(125); + filled.set(127); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_UPFRONT_GAS_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_UPFRONT_GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - stpGasUpfrontGasCostXorGasLeftover.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorGasLeftover.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasUpfrontGasCostXorGasLeftover.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/STP_INSTRUCTION has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/STP_INSTRUCTION has invalid value (" + b + ")"); } returnDataOffsetXorStpInstruction.put((byte) (b >> 24)); returnDataOffsetXorStpInstruction.put((byte) (b >> 16)); returnDataOffsetXorStpInstruction.put((byte) (b >> 8)); returnDataOffsetXorStpInstruction.put((byte) b); + return this; } @@ -4014,60 +3186,45 @@ public Trace pMiscStpOogx(final Boolean b) { filled.set(58); } - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put( - (byte) (b ? 1 : 0)); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscStpValueHi(final Bytes b) { - if (filled.get(163)) { + if (filled.get(165)) { throw new IllegalStateException("hub.misc/STP_VALUE_HI already set"); } else { - filled.set(163); + filled.set(165); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/STP_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpValueHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpValueHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpValueHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/STP_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpValueLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpValueLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpValueLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.scenario/PRC_CALLEE_GAS has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CALLEE_GAS has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pScenarioPrcCallerGas(final long b) { - if (filled.get(104)) { + if (filled.get(106)) { throw new IllegalStateException("hub.scenario/PRC_CALLER_GAS already set"); } else { - filled.set(104); + filled.set(106); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.scenario/PRC_CALLER_GAS has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CALLER_GAS has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pScenarioPrcCdo(final long b) { - if (filled.get(105)) { + if (filled.get(107)) { throw new IllegalStateException("hub.scenario/PRC_CDO already set"); } else { - filled.set(105); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_CDO has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CDO has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pScenarioPrcCds(final long b) { - if (filled.get(106)) { + if (filled.get(108)) { throw new IllegalStateException("hub.scenario/PRC_CDS already set"); } else { - filled.set(106); + filled.set(108); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_CDS has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CDS has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) b); + return this; } @@ -4579,60 +3682,53 @@ public Trace pScenarioPrcModexp(final Boolean b) { } public Trace pScenarioPrcRac(final long b) { - if (filled.get(107)) { + if (filled.get(109)) { throw new IllegalStateException("hub.scenario/PRC_RAC already set"); } else { - filled.set(107); + filled.set(109); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_RAC has invalid value (" + b + ")"); - } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RAC has invalid value (" + b + ")"); } + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 24)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 16)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) b); + return this; } public Trace pScenarioPrcRao(final long b) { - if (filled.get(108)) { + if (filled.get(110)) { throw new IllegalStateException("hub.scenario/PRC_RAO already set"); } else { - filled.set(108); + filled.set(110); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_RAO has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RAO has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.put((byte) b); + return this; } public Trace pScenarioPrcReturnGas(final long b) { - if (filled.get(109)) { + if (filled.get(111)) { throw new IllegalStateException("hub.scenario/PRC_RETURN_GAS already set"); } else { - filled.set(109); + filled.set(111); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.scenario/PRC_RETURN_GAS has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RETURN_GAS has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.put((byte) b); + return this; } @@ -4698,8 +3794,7 @@ public Trace pScenarioReturnException(final Boolean b) { public Trace pScenarioReturnFromDeploymentEmptyCodeWillRevert(final Boolean b) { if (filled.get(81)) { - throw new IllegalStateException( - "hub.scenario/RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT already set"); + throw new IllegalStateException("hub.scenario/RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT already set"); } else { filled.set(81); } @@ -4711,8 +3806,7 @@ public Trace pScenarioReturnFromDeploymentEmptyCodeWillRevert(final Boolean b) { public Trace pScenarioReturnFromDeploymentEmptyCodeWontRevert(final Boolean b) { if (filled.get(82)) { - throw new IllegalStateException( - "hub.scenario/RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT already set"); + throw new IllegalStateException("hub.scenario/RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT already set"); } else { filled.set(82); } @@ -4724,8 +3818,7 @@ public Trace pScenarioReturnFromDeploymentEmptyCodeWontRevert(final Boolean b) { public Trace pScenarioReturnFromDeploymentNonemptyCodeWillRevert(final Boolean b) { if (filled.get(83)) { - throw new IllegalStateException( - "hub.scenario/RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT already set"); + throw new IllegalStateException("hub.scenario/RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT already set"); } else { filled.set(83); } @@ -4737,8 +3830,7 @@ public Trace pScenarioReturnFromDeploymentNonemptyCodeWillRevert(final Boolean b public Trace pScenarioReturnFromDeploymentNonemptyCodeWontRevert(final Boolean b) { if (filled.get(84)) { - throw new IllegalStateException( - "hub.scenario/RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT already set"); + throw new IllegalStateException("hub.scenario/RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT already set"); } else { filled.set(84); } @@ -4750,8 +3842,7 @@ public Trace pScenarioReturnFromDeploymentNonemptyCodeWontRevert(final Boolean b public Trace pScenarioReturnFromMessageCallWillTouchRam(final Boolean b) { if (filled.get(85)) { - throw new IllegalStateException( - "hub.scenario/RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM already set"); + throw new IllegalStateException("hub.scenario/RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM already set"); } else { filled.set(85); } @@ -4763,8 +3854,7 @@ public Trace pScenarioReturnFromMessageCallWillTouchRam(final Boolean b) { public Trace pScenarioReturnFromMessageCallWontTouchRam(final Boolean b) { if (filled.get(86)) { - throw new IllegalStateException( - "hub.scenario/RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM already set"); + throw new IllegalStateException("hub.scenario/RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM already set"); } else { filled.set(86); } @@ -4800,8 +3890,7 @@ public Trace pScenarioSelfdestructWillRevert(final Boolean b) { public Trace pScenarioSelfdestructWontRevertAlreadyMarked(final Boolean b) { if (filled.get(89)) { - throw new IllegalStateException( - "hub.scenario/SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED already set"); + throw new IllegalStateException("hub.scenario/SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED already set"); } else { filled.set(89); } @@ -4813,8 +3902,7 @@ public Trace pScenarioSelfdestructWontRevertAlreadyMarked(final Boolean b) { public Trace pScenarioSelfdestructWontRevertNotYetMarked(final Boolean b) { if (filled.get(90)) { - throw new IllegalStateException( - "hub.scenario/SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED already set"); + throw new IllegalStateException("hub.scenario/SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED already set"); } else { filled.set(90); } @@ -4831,8 +3919,7 @@ public Trace pStackAccFlag(final Boolean b) { filled.set(45); } - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put( - (byte) (b ? 1 : 0)); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); return this; } @@ -4844,8 +3931,7 @@ public Trace pStackAddFlag(final Boolean b) { filled.set(46); } - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put( - (byte) (b ? 1 : 0)); + againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put((byte) (b ? 1 : 0)); return this; } @@ -4869,8 +3955,7 @@ public Trace pStackBinFlag(final Boolean b) { filled.set(47); } - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .put((byte) (b ? 1 : 0)); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); return this; } @@ -4882,8 +3967,7 @@ public Trace pStackBtcFlag(final Boolean b) { filled.set(48); } - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .put((byte) (b ? 1 : 0)); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); return this; } @@ -4895,8 +3979,7 @@ public Trace pStackCallFlag(final Boolean b) { filled.set(49); } - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put( - (byte) (b ? 1 : 0)); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); return this; } @@ -4920,8 +4003,7 @@ public Trace pStackCopyFlag(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -4933,8 +4015,7 @@ public Trace pStackCreateFlag(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } @@ -4946,8 +4027,7 @@ public Trace pStackDecFlag1(final Boolean b) { filled.set(53); } - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put( - (byte) (b ? 1 : 0)); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); return this; } @@ -4959,8 +4039,7 @@ public Trace pStackDecFlag2(final Boolean b) { filled.set(54); } - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .put((byte) (b ? 1 : 0)); + finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorUnconstrainedFinal.put((byte) (b ? 1 : 0)); return this; } @@ -4972,8 +4051,7 @@ public Trace pStackDecFlag3(final Boolean b) { filled.set(55); } - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.put( - (byte) (b ? 1 : 0)); + finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorUnconstrainedFirst.put((byte) (b ? 1 : 0)); return this; } @@ -4985,8 +4063,7 @@ public Trace pStackDecFlag4(final Boolean b) { filled.set(56); } - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put( - (byte) (b ? 1 : 0)); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges.put((byte) (b ? 1 : 0)); return this; } @@ -5010,7 +4087,7 @@ public Trace pStackDupFlag(final Boolean b) { filled.set(57); } - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); + firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig.put((byte) (b ? 1 : 0)); return this; } @@ -5022,8 +4099,7 @@ public Trace pStackExtFlag(final Boolean b) { filled.set(58); } - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put( - (byte) (b ? 1 : 0)); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -5035,8 +4111,7 @@ public Trace pStackHaltFlag(final Boolean b) { filled.set(59); } - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.put( - (byte) (b ? 1 : 0)); + hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); return this; } @@ -5048,63 +4123,45 @@ public Trace pStackHashInfoFlag(final Boolean b) { filled.set(60); } - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.put((byte) (b ? 1 : 0)); + hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueNextIsOrig.put((byte) (b ? 1 : 0)); return this; } public Trace pStackHashInfoKeccakHi(final Bytes b) { - if (filled.get(132)) { + if (filled.get(134)) { throw new IllegalStateException("hub.stack/HASH_INFO_KECCAK_HI already set"); } else { - filled.set(132); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.stack/HASH_INFO_KECCAK_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/HASH_INFO_KECCAK_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/HASH_INFO_KECCAK_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/HASH_INFO_KECCAK_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "hub.stack/INSTRUCTION has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("hub.stack/INSTRUCTION has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - instruction.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { instruction.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - instruction.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_1 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_1 has invalid value (" + b + ")"); } callStackDepthXorStackItemHeight1.put((byte) (b >> 8)); callStackDepthXorStackItemHeight1.put((byte) b); + return this; } public Trace pStackStackItemHeight2(final long b) { - if (filled.get(98)) { + if (filled.get(100)) { throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_2 already set"); } else { - filled.set(98); + filled.set(100); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_2 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_2 has invalid value (" + b + ")"); } stackItemHeight2.put((byte) (b >> 8)); stackItemHeight2.put((byte) b); + return this; } public Trace pStackStackItemHeight3(final long b) { - if (filled.get(99)) { + if (filled.get(101)) { throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_3 already set"); } else { - filled.set(99); + filled.set(101); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_3 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_3 has invalid value (" + b + ")"); } stackItemHeight3.put((byte) (b >> 8)); stackItemHeight3.put((byte) b); + return this; } public Trace pStackStackItemHeight4(final long b) { - if (filled.get(100)) { + if (filled.get(102)) { throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_4 already set"); } else { - filled.set(100); + filled.set(102); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_4 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_4 has invalid value (" + b + ")"); } stackItemHeight4.put((byte) (b >> 8)); stackItemHeight4.put((byte) b); + return this; } @@ -5561,289 +4608,225 @@ public Trace pStackStackItemPop4(final Boolean b) { } public Trace pStackStackItemStamp1(final long b) { - if (filled.get(119)) { + if (filled.get(121)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_1 already set"); } else { - filled.set(119); + filled.set(121); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_1 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_1 has invalid value (" + b + ")"); } stackItemStamp1.put((byte) (b >> 32)); stackItemStamp1.put((byte) (b >> 24)); stackItemStamp1.put((byte) (b >> 16)); stackItemStamp1.put((byte) (b >> 8)); stackItemStamp1.put((byte) b); + return this; } public Trace pStackStackItemStamp2(final long b) { - if (filled.get(120)) { + if (filled.get(122)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_2 already set"); } else { - filled.set(120); + filled.set(122); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_2 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_2 has invalid value (" + b + ")"); } stackItemStamp2.put((byte) (b >> 32)); stackItemStamp2.put((byte) (b >> 24)); stackItemStamp2.put((byte) (b >> 16)); stackItemStamp2.put((byte) (b >> 8)); stackItemStamp2.put((byte) b); + return this; } public Trace pStackStackItemStamp3(final long b) { - if (filled.get(121)) { + if (filled.get(123)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_3 already set"); } else { - filled.set(121); + filled.set(123); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_3 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_3 has invalid value (" + b + ")"); } stackItemStamp3.put((byte) (b >> 32)); stackItemStamp3.put((byte) (b >> 24)); stackItemStamp3.put((byte) (b >> 16)); stackItemStamp3.put((byte) (b >> 8)); stackItemStamp3.put((byte) b); + return this; } public Trace pStackStackItemStamp4(final long b) { - if (filled.get(122)) { + if (filled.get(124)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_4 already set"); } else { - filled.set(122); + filled.set(124); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_4 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_4 has invalid value (" + b + ")"); } stackItemStamp4.put((byte) (b >> 32)); stackItemStamp4.put((byte) (b >> 24)); stackItemStamp4.put((byte) (b >> 16)); stackItemStamp4.put((byte) (b >> 8)); stackItemStamp4.put((byte) b); + return this; } public Trace pStackStackItemValueHi1(final Bytes b) { - if (filled.get(136)) { + if (filled.get(138)) { throw new IllegalStateException("hub.stack/STACK_ITEM_VALUE_HI_1 already set"); } else { - filled.set(136); + filled.set(138); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.stack/STATIC_GAS has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.stack/STATIC_GAS has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } @@ -5967,51 +4945,37 @@ public Trace pStackWcpFlag(final Boolean b) { } public Trace pStorageAddressHi(final long b) { - if (filled.get(103)) { + if (filled.get(105)) { throw new IllegalStateException("hub.storage/ADDRESS_HI already set"); } else { - filled.set(103); + filled.set(105); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.storage/ADDRESS_HI has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/ADDRESS_HI has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pStorageAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(134)) { throw new IllegalStateException("hub.storage/ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.storage/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pStorageDeploymentNumberFinalInBlock(final long b) { - if (filled.get(101)) { + if (filled.get(103)) { throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK already set"); } else { - filled.set(101); + filled.set(103); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) (b >> 8)); deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) b); + return this; } public Trace pStorageDeploymentNumberFirstInBlock(final long b) { - if (filled.get(102)) { + if (filled.get(104)) { throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK already set"); } else { - filled.set(102); + filled.set(104); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) (b >> 8)); deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) b); + return this; } public Trace pStorageDeploymentNumberInfty(final long b) { - if (filled.get(105)) { + if (filled.get(107)) { throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_INFTY already set"); } else { - filled.set(105); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } @@ -6142,8 +5087,7 @@ public Trace pStorageFinalInBlk(final Boolean b) { filled.set(48); } - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .put((byte) (b ? 1 : 0)); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); return this; } @@ -6155,8 +5099,7 @@ public Trace pStorageFinalInCnf(final Boolean b) { filled.set(49); } - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put( - (byte) (b ? 1 : 0)); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); return this; } @@ -6180,8 +5123,7 @@ public Trace pStorageFirstInBlk(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -6193,8 +5135,7 @@ public Trace pStorageFirstInCnf(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } @@ -6206,434 +5147,363 @@ public Trace pStorageFirstInTxn(final Boolean b) { filled.set(53); } - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put( - (byte) (b ? 1 : 0)); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); return this; } public Trace pStorageStorageKeyHi(final Bytes b) { - if (filled.get(133)) { + if (filled.get(135)) { throw new IllegalStateException("hub.storage/STORAGE_KEY_HI already set"); } else { - filled.set(133); + filled.set(135); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.storage/STORAGE_KEY_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/STORAGE_KEY_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/STORAGE_KEY_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/STORAGE_KEY_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_CURR_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_CURR_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_CURR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_CURR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_NEXT_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_NEXT_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_NEXT_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_NEXT_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_ORIG_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_ORIG_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_ORIG_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_ORIG_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/BASEFEE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorBasefee.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/CALL_DATA_SIZE has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/CALL_DATA_SIZE has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pTransactionCoinbaseAddressHi(final long b) { - if (filled.get(104)) { + if (filled.get(106)) { throw new IllegalStateException("hub.transaction/COINBASE_ADDRESS_HI already set"); } else { - filled.set(104); + filled.set(106); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/COINBASE_ADDRESS_HI has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/COINBASE_ADDRESS_HI has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pTransactionCoinbaseAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(134)) { throw new IllegalStateException("hub.transaction/COINBASE_ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/COINBASE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/COINBASE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/FROM_ADDRESS_HI has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/FROM_ADDRESS_HI has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pTransactionFromAddressLo(final Bytes b) { - if (filled.get(133)) { + if (filled.get(135)) { throw new IllegalStateException("hub.transaction/FROM_ADDRESS_LO already set"); } else { - filled.set(133); + filled.set(135); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/FROM_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/FROM_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - stpGasUpfrontGasCostXorGasLeftover.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorGasLeftover.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasUpfrontGasCostXorGasLeftover.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasLimit.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasLimit.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasLimit.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasPrice.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasPrice.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasPrice.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/INIT_CODE_SIZE has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/INIT_CODE_SIZE has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.put((byte) b); + return this; } public Trace pTransactionInitialBalance(final Bytes b) { - if (filled.get(134)) { + if (filled.get(136)) { throw new IllegalStateException("hub.transaction/INITIAL_BALANCE already set"); } else { - filled.set(134); + filled.set(136); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/NONCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/NONCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonce.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonce.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - priorityFeePerGas.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { priorityFeePerGas.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - priorityFeePerGas.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/REFUND_COUNTER_INFINITY has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/REFUND_COUNTER_INFINITY has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refundCounterInfinity.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refundCounterInfinity.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refundCounterInfinity.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refundEffective.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refundEffective.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refundEffective.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/TO_ADDRESS_HI has invalid value (" + b + ")"); - } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/TO_ADDRESS_HI has invalid value (" + b + ")"); } + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 24)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 16)); + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.put((byte) b); + return this; } public Trace pTransactionToAddressLo(final Bytes b) { - if (filled.get(135)) { + if (filled.get(137)) { throw new IllegalStateException("hub.transaction/TO_ADDRESS_LO already set"); } else { - filled.set(135); + filled.set(137); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/TO_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/TO_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.transaction/VALUE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/VALUE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.PROGRAM_COUNTER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.PROGRAM_COUNTER has invalid value (" + b + ")"); } programCounter.put((byte) (b >> 24)); programCounter.put((byte) (b >> 16)); programCounter.put((byte) (b >> 8)); programCounter.put((byte) b); + return this; } @@ -7195,14 +5955,13 @@ public Trace programCounterNew(final long b) { filled.set(34); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.PROGRAM_COUNTER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.PROGRAM_COUNTER_NEW has invalid value (" + b + ")"); } programCounterNew.put((byte) (b >> 24)); programCounterNew.put((byte) (b >> 16)); programCounterNew.put((byte) (b >> 8)); programCounterNew.put((byte) b); + return this; } @@ -7213,14 +5972,13 @@ public Trace refundCounter(final long b) { filled.set(35); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.REFUND_COUNTER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.REFUND_COUNTER has invalid value (" + b + ")"); } refundCounter.put((byte) (b >> 24)); refundCounter.put((byte) (b >> 16)); refundCounter.put((byte) (b >> 8)); refundCounter.put((byte) b); + return this; } @@ -7231,14 +5989,13 @@ public Trace refundCounterNew(final long b) { filled.set(36); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.REFUND_COUNTER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.REFUND_COUNTER_NEW has invalid value (" + b + ")"); } refundCounterNew.put((byte) (b >> 24)); refundCounterNew.put((byte) (b >> 16)); refundCounterNew.put((byte) (b >> 8)); refundCounterNew.put((byte) b); + return this; } @@ -7249,12 +6006,11 @@ public Trace relativeBlockNumber(final long b) { filled.set(37); } - if (b >= 65536L) { - throw new IllegalArgumentException("hub.RELATIVE_BLOCK_NUMBER has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.RELATIVE_BLOCK_NUMBER has invalid value (" + b + ")"); } relativeBlockNumber.put((byte) (b >> 8)); relativeBlockNumber.put((byte) b); + return this; } @@ -7265,14 +6021,13 @@ public Trace subStamp(final long b) { filled.set(38); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.SUB_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.SUB_STAMP has invalid value (" + b + ")"); } subStamp.put((byte) (b >> 24)); subStamp.put((byte) (b >> 16)); subStamp.put((byte) (b >> 8)); subStamp.put((byte) b); + return this; } @@ -7353,56 +6108,48 @@ public Trace validateRow() { throw new IllegalStateException("hub.ABSOLUTE_TRANSACTION_NUMBER has not been filled"); } - if (!filled.get(103)) { - throw new IllegalStateException( - "hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CALLEE_GAS_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE has not been filled"); + if (!filled.get(105)) { + throw new IllegalStateException("hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CALLEE_GAS_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE has not been filled"); } - if (!filled.get(132)) { - throw new IllegalStateException( - "hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO has not been filled"); + if (!filled.get(134)) { + throw new IllegalStateException("hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO has not been filled"); } if (!filled.get(45)) { - throw new IllegalStateException( - "hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD has not been filled"); + throw new IllegalStateException("hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD has not been filled"); } if (!filled.get(46)) { - throw new IllegalStateException( - "hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT has not been filled"); + throw new IllegalStateException("hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT has not been filled"); } if (!filled.get(47)) { - throw new IllegalStateException( - "hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2 has not been filled"); + throw new IllegalStateException("hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2 has not been filled"); } if (!filled.get(94)) { throw new IllegalStateException("hub.ALPHA has not been filled"); } - if (!filled.get(134)) { - throw new IllegalStateException( - "hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE has not been filled"); + if (!filled.get(136)) { + throw new IllegalStateException("hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE has not been filled"); } - if (!filled.get(133)) { - throw new IllegalStateException( - "hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO has not been filled"); + if (!filled.get(135)) { + throw new IllegalStateException("hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO has not been filled"); } - if (!filled.get(111)) { + if (!filled.get(113)) { throw new IllegalStateException("hub.CALL_DATA_OFFSET_xor_MMU_SIZE has not been filled"); } - if (!filled.get(112)) { + if (!filled.get(114)) { throw new IllegalStateException("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID has not been filled"); } - if (!filled.get(97)) { - throw new IllegalStateException( - "hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1 has not been filled"); + if (!filled.get(99)) { + throw new IllegalStateException("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1 has not been filled"); } if (!filled.get(1)) { @@ -7413,39 +6160,32 @@ public Trace validateRow() { throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX has not been filled"); } - if (!filled.get(104)) { - throw new IllegalStateException( - "hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CALLER_GAS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI has not been filled"); + if (!filled.get(106)) { + throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CALLER_GAS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI has not been filled"); } - if (!filled.get(136)) { - throw new IllegalStateException( - "hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE has not been filled"); + if (!filled.get(138)) { + throw new IllegalStateException("hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE has not been filled"); } - if (!filled.get(135)) { - throw new IllegalStateException( - "hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO has not been filled"); + if (!filled.get(137)) { + throw new IllegalStateException("hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO has not been filled"); } - if (!filled.get(138)) { - throw new IllegalStateException( - "hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO has not been filled"); + if (!filled.get(140)) { + throw new IllegalStateException("hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO has not been filled"); } - if (!filled.get(137)) { - throw new IllegalStateException( - "hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI has not been filled"); + if (!filled.get(139)) { + throw new IllegalStateException("hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI has not been filled"); } - if (!filled.get(106)) { - throw new IllegalStateException( - "hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_CDS_xor_INIT_CODE_SIZE has not been filled"); + if (!filled.get(108)) { + throw new IllegalStateException("hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_CDS_xor_INIT_CODE_SIZE has not been filled"); } - if (!filled.get(105)) { - throw new IllegalStateException( - "hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_CDO_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI has not been filled"); + if (!filled.get(107)) { + throw new IllegalStateException("hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_CDO_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI has not been filled"); } if (!filled.get(3)) { @@ -7464,7 +6204,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.CONTEXT_NUMBER_NEW has not been filled"); } - if (!filled.get(113)) { + if (!filled.get(115)) { throw new IllegalStateException("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID has not been filled"); } @@ -7492,44 +6232,36 @@ public Trace validateRow() { throw new IllegalStateException("hub.DELTA has not been filled"); } - if (!filled.get(101)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has not been filled"); + if (!filled.get(103)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has not been filled"); } - if (!filled.get(102)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has not been filled"); + if (!filled.get(104)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has not been filled"); } - if (!filled.get(108)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE_xor_PRC_RAO has not been filled"); + if (!filled.get(110)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE_xor_PRC_RAO has not been filled"); } - if (!filled.get(109)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET_xor_PRC_RETURN_GAS has not been filled"); + if (!filled.get(111)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET_xor_PRC_RETURN_GAS has not been filled"); } - if (!filled.get(107)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_PRC_RAC_xor_TO_ADDRESS_HI has not been filled"); + if (!filled.get(109)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_PRC_RAC_xor_TO_ADDRESS_HI has not been filled"); } if (!filled.get(49)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE has not been filled"); } if (!filled.get(50)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN has not been filled"); } if (!filled.get(48)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION has not been filled"); } if (!filled.get(12)) { @@ -7541,43 +6273,35 @@ public Trace validateRow() { } if (!filled.get(52)) { - throw new IllegalStateException( - "hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF has not been filled"); + throw new IllegalStateException("hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF has not been filled"); } if (!filled.get(51)) { - throw new IllegalStateException( - "hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK has not been filled"); + throw new IllegalStateException("hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK has not been filled"); } if (!filled.get(53)) { - throw new IllegalStateException( - "hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN has not been filled"); + throw new IllegalStateException("hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN has not been filled"); } if (!filled.get(54)) { - throw new IllegalStateException( - "hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES has not been filled"); + throw new IllegalStateException("hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_UNCONSTRAINED_FINAL has not been filled"); } if (!filled.get(55)) { - throw new IllegalStateException( - "hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG has not been filled"); + throw new IllegalStateException("hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_UNCONSTRAINED_FIRST has not been filled"); } if (!filled.get(56)) { - throw new IllegalStateException( - "hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO has not been filled"); + throw new IllegalStateException("hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_CHANGES has not been filled"); } if (!filled.get(57)) { - throw new IllegalStateException( - "hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR has not been filled"); + throw new IllegalStateException("hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_CURR_IS_ORIG has not been filled"); } if (!filled.get(58)) { - throw new IllegalStateException( - "hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG has not been filled"); + throw new IllegalStateException("hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_CURR_IS_ZERO has not been filled"); } if (!filled.get(14)) { @@ -7592,7 +6316,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.GAS_EXPECTED has not been filled"); } - if (!filled.get(126)) { + if (!filled.get(128)) { throw new IllegalStateException("hub.GAS_LIMIT has not been filled"); } @@ -7600,18 +6324,16 @@ public Trace validateRow() { throw new IllegalStateException("hub.GAS_NEXT has not been filled"); } - if (!filled.get(127)) { + if (!filled.get(129)) { throw new IllegalStateException("hub.GAS_PRICE has not been filled"); } if (!filled.get(60)) { - throw new IllegalStateException( - "hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO has not been filled"); + throw new IllegalStateException("hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_NEXT_IS_ORIG has not been filled"); } if (!filled.get(59)) { - throw new IllegalStateException( - "hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO has not been filled"); + throw new IllegalStateException("hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_CURR has not been filled"); } if (!filled.get(18)) { @@ -7630,13 +6352,12 @@ public Trace validateRow() { throw new IllegalStateException("hub.HUB_STAMP_TRANSACTION_END has not been filled"); } - if (!filled.get(165)) { + if (!filled.get(167)) { throw new IllegalStateException("hub.INSTRUCTION has not been filled"); } if (!filled.get(61)) { - throw new IllegalStateException( - "hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH has not been filled"); + throw new IllegalStateException("hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_VALUE_NEXT_IS_ZERO has not been filled"); } if (!filled.get(22)) { @@ -7644,40 +6365,38 @@ public Trace validateRow() { } if (!filled.get(63)) { - throw new IllegalStateException( - "hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX has not been filled"); + throw new IllegalStateException("hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX_xor_WARMTH has not been filled"); } if (!filled.get(62)) { - throw new IllegalStateException( - "hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW has not been filled"); + throw new IllegalStateException("hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_VALUE_ORIG_IS_ZERO has not been filled"); } if (!filled.get(23)) { throw new IllegalStateException("hub.MMU_STAMP has not been filled"); } - if (!filled.get(145)) { + if (!filled.get(147)) { throw new IllegalStateException("hub.MXP_OFFSET_2_HI has not been filled"); } - if (!filled.get(146)) { + if (!filled.get(148)) { throw new IllegalStateException("hub.MXP_OFFSET_2_LO has not been filled"); } - if (!filled.get(147)) { + if (!filled.get(149)) { throw new IllegalStateException("hub.MXP_SIZE_1_HI has not been filled"); } - if (!filled.get(148)) { + if (!filled.get(150)) { throw new IllegalStateException("hub.MXP_SIZE_1_LO has not been filled"); } - if (!filled.get(149)) { + if (!filled.get(151)) { throw new IllegalStateException("hub.MXP_SIZE_2_HI has not been filled"); } - if (!filled.get(150)) { + if (!filled.get(152)) { throw new IllegalStateException("hub.MXP_SIZE_2_LO has not been filled"); } @@ -7685,60 +6404,67 @@ public Trace validateRow() { throw new IllegalStateException("hub.MXP_STAMP has not been filled"); } - if (!filled.get(151)) { + if (!filled.get(153)) { throw new IllegalStateException("hub.MXP_WORDS has not been filled"); } + if (!filled.get(96)) { + throw new IllegalStateException("hub.NB_ADDED has not been filled"); + } + + if (!filled.get(97)) { + throw new IllegalStateException("hub.NB_REMOVED has not been filled"); + } + if (!filled.get(25)) { throw new IllegalStateException("hub.NON_STACK_ROWS has not been filled"); } - if (!filled.get(128)) { + if (!filled.get(130)) { throw new IllegalStateException("hub.NONCE has not been filled"); } - if (!filled.get(124)) { - throw new IllegalStateException( - "hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_GAS_INITIALLY_AVAILABLE has not been filled"); + if (!filled.get(126)) { + throw new IllegalStateException("hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_GAS_INITIALLY_AVAILABLE has not been filled"); } - if (!filled.get(123)) { + if (!filled.get(125)) { throw new IllegalStateException("hub.NONCE_xor_STP_GAS_MXP_xor_BASEFEE has not been filled"); } - if (!filled.get(152)) { + if (!filled.get(154)) { throw new IllegalStateException("hub.OOB_DATA_1 has not been filled"); } - if (!filled.get(153)) { + if (!filled.get(155)) { throw new IllegalStateException("hub.OOB_DATA_2 has not been filled"); } - if (!filled.get(154)) { + if (!filled.get(156)) { throw new IllegalStateException("hub.OOB_DATA_3 has not been filled"); } - if (!filled.get(155)) { + if (!filled.get(157)) { throw new IllegalStateException("hub.OOB_DATA_4 has not been filled"); } - if (!filled.get(156)) { + if (!filled.get(158)) { throw new IllegalStateException("hub.OOB_DATA_5 has not been filled"); } - if (!filled.get(157)) { + if (!filled.get(159)) { throw new IllegalStateException("hub.OOB_DATA_6 has not been filled"); } - if (!filled.get(158)) { + if (!filled.get(160)) { throw new IllegalStateException("hub.OOB_DATA_7 has not been filled"); } - if (!filled.get(159)) { + if (!filled.get(161)) { throw new IllegalStateException("hub.OOB_DATA_8 has not been filled"); } - if (!filled.get(160)) { + if (!filled.get(162)) { throw new IllegalStateException("hub.OOB_DATA_9 has not been filled"); } @@ -7783,8 +6509,7 @@ public Trace validateRow() { } if (!filled.get(72)) { - throw new IllegalStateException( - "hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG has not been filled"); + throw new IllegalStateException("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG has not been filled"); } if (!filled.get(73)) { @@ -7808,16 +6533,14 @@ public Trace validateRow() { } if (!filled.get(78)) { - throw new IllegalStateException( - "hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX has not been filled"); + throw new IllegalStateException("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX has not been filled"); } if (!filled.get(79)) { - throw new IllegalStateException( - "hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG has not been filled"); + throw new IllegalStateException("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG has not been filled"); } - if (!filled.get(129)) { + if (!filled.get(131)) { throw new IllegalStateException("hub.PRIORITY_FEE_PER_GAS has not been filled"); } @@ -7833,7 +6556,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.REFUND_COUNTER has not been filled"); } - if (!filled.get(130)) { + if (!filled.get(132)) { throw new IllegalStateException("hub.REFUND_COUNTER_INFINITY has not been filled"); } @@ -7841,7 +6564,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.REFUND_COUNTER_NEW has not been filled"); } - if (!filled.get(131)) { + if (!filled.get(133)) { throw new IllegalStateException("hub.REFUND_EFFECTIVE has not been filled"); } @@ -7849,25 +6572,23 @@ public Trace validateRow() { throw new IllegalStateException("hub.RELATIVE_BLOCK_NUMBER has not been filled"); } - if (!filled.get(114)) { + if (!filled.get(116)) { throw new IllegalStateException("hub.RETURN_AT_CAPACITY_xor_MXP_INST has not been filled"); } - if (!filled.get(115)) { + if (!filled.get(117)) { throw new IllegalStateException("hub.RETURN_AT_OFFSET_xor_OOB_INST has not been filled"); } - if (!filled.get(116)) { - throw new IllegalStateException( - "hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND has not been filled"); + if (!filled.get(118)) { + throw new IllegalStateException("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND has not been filled"); } - if (!filled.get(117)) { - throw new IllegalStateException( - "hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION has not been filled"); + if (!filled.get(119)) { + throw new IllegalStateException("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION has not been filled"); } - if (!filled.get(118)) { + if (!filled.get(120)) { throw new IllegalStateException("hub.RETURN_DATA_SIZE has not been filled"); } @@ -7876,77 +6597,63 @@ public Trace validateRow() { } if (!filled.get(81)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX has not been filled"); } if (!filled.get(82)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG has not been filled"); } if (!filled.get(83)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1 has not been filled"); } if (!filled.get(84)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2 has not been filled"); } if (!filled.get(85)) { - throw new IllegalStateException( - "hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3 has not been filled"); } if (!filled.get(86)) { - throw new IllegalStateException( - "hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4 has not been filled"); } - if (!filled.get(110)) { - throw new IllegalStateException( - "hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE has not been filled"); + if (!filled.get(112)) { + throw new IllegalStateException("hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE has not been filled"); } - if (!filled.get(139)) { - throw new IllegalStateException( - "hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI has not been filled"); + if (!filled.get(141)) { + throw new IllegalStateException("hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI has not been filled"); } if (!filled.get(64)) { - throw new IllegalStateException( - "hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED has not been filled"); + throw new IllegalStateException("hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED_xor_WARMTH_NEW has not been filled"); } - if (!filled.get(140)) { - throw new IllegalStateException( - "hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO has not been filled"); + if (!filled.get(142)) { + throw new IllegalStateException("hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO has not been filled"); } - if (!filled.get(141)) { - throw new IllegalStateException( - "hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2 has not been filled"); + if (!filled.get(143)) { + throw new IllegalStateException("hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2 has not been filled"); } - if (!filled.get(96)) { + if (!filled.get(98)) { throw new IllegalStateException("hub.RLPADDR_RECIPE has not been filled"); } - if (!filled.get(142)) { - throw new IllegalStateException( - "hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3 has not been filled"); + if (!filled.get(144)) { + throw new IllegalStateException("hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3 has not been filled"); } - if (!filled.get(143)) { - throw new IllegalStateException( - "hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4 has not been filled"); + if (!filled.get(145)) { + throw new IllegalStateException("hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4 has not been filled"); } if (!filled.get(65)) { - throw new IllegalStateException( - "hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG has not been filled"); + throw new IllegalStateException("hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG has not been filled"); } if (!filled.get(87)) { @@ -7954,66 +6661,62 @@ public Trace validateRow() { } if (!filled.get(88)) { - throw new IllegalStateException( - "hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG has not been filled"); + throw new IllegalStateException("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG has not been filled"); } if (!filled.get(89)) { - throw new IllegalStateException( - "hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG has not been filled"); + throw new IllegalStateException("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG has not been filled"); } if (!filled.get(90)) { - throw new IllegalStateException( - "hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX has not been filled"); + throw new IllegalStateException("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX has not been filled"); } - if (!filled.get(98)) { + if (!filled.get(100)) { throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_2 has not been filled"); } - if (!filled.get(99)) { + if (!filled.get(101)) { throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_3 has not been filled"); } - if (!filled.get(100)) { + if (!filled.get(102)) { throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_4 has not been filled"); } - if (!filled.get(119)) { + if (!filled.get(121)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_1 has not been filled"); } - if (!filled.get(120)) { + if (!filled.get(122)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_2 has not been filled"); } - if (!filled.get(121)) { + if (!filled.get(123)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_3 has not been filled"); } - if (!filled.get(122)) { + if (!filled.get(124)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_4 has not been filled"); } - if (!filled.get(161)) { + if (!filled.get(163)) { throw new IllegalStateException("hub.STP_GAS_HI has not been filled"); } - if (!filled.get(162)) { + if (!filled.get(164)) { throw new IllegalStateException("hub.STP_GAS_LO has not been filled"); } - if (!filled.get(125)) { - throw new IllegalStateException( - "hub.STP_GAS_UPFRONT_GAS_COST_xor_GAS_LEFTOVER has not been filled"); + if (!filled.get(127)) { + throw new IllegalStateException("hub.STP_GAS_UPFRONT_GAS_COST_xor_GAS_LEFTOVER has not been filled"); } - if (!filled.get(163)) { + if (!filled.get(165)) { throw new IllegalStateException("hub.STP_VALUE_HI has not been filled"); } - if (!filled.get(164)) { + if (!filled.get(166)) { throw new IllegalStateException("hub.STP_VALUE_LO has not been filled"); } @@ -8026,13 +6729,11 @@ public Trace validateRow() { } if (!filled.get(66)) { - throw new IllegalStateException( - "hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG has not been filled"); + throw new IllegalStateException("hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG has not been filled"); } - if (!filled.get(144)) { - throw new IllegalStateException( - "hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO has not been filled"); + if (!filled.get(146)) { + throw new IllegalStateException("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO has not been filled"); } if (!filled.get(39)) { @@ -8064,13 +6765,11 @@ public Trace validateRow() { } if (!filled.get(68)) { - throw new IllegalStateException( - "hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG has not been filled"); + throw new IllegalStateException("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG has not been filled"); } if (!filled.get(67)) { - throw new IllegalStateException( - "hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG has not been filled"); + throw new IllegalStateException("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG has not been filled"); } if (!filled.get(93)) { @@ -8088,75 +6787,47 @@ public Trace fillAndValidateRow() { absoluteTransactionNumber.position(absoluteTransactionNumber.position() + 2); } - if (!filled.get(103)) { - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .position( - addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize - .position() - + 4); + if (!filled.get(105)) { + addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.position(addressHiXorAccountAddressHiXorCcrsStampXorPrcCalleeGasXorStaticGasXorAddressHiXorCallDataSize.position() + 4); } - if (!filled.get(132)) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .position( - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .position() - + 16); + if (!filled.get(134)) { + addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.position(addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.position() + 16); } if (!filled.get(45)) { - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd - .position( - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd - .position() - + 1); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.position(againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.position() + 1); } if (!filled.get(46)) { - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment - .position( - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment - .position() - + 1); + againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.position(againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.position() + 1); } if (!filled.get(47)) { - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .position( - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .position() - + 1); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.position(againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.position() + 1); } if (!filled.get(94)) { alpha.position(alpha.position() + 1); } - if (!filled.get(134)) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance - .position( - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance - .position() - + 16); + if (!filled.get(136)) { + balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.position(balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.position() + 16); } - if (!filled.get(133)) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo - .position( - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo - .position() - + 16); + if (!filled.get(135)) { + balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.position(balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.position() + 16); } - if (!filled.get(111)) { + if (!filled.get(113)) { callDataOffsetXorMmuSize.position(callDataOffsetXorMmuSize.position() + 4); } - if (!filled.get(112)) { + if (!filled.get(114)) { callDataSizeXorMmuSrcId.position(callDataSizeXorMmuSrcId.position() + 4); } - if (!filled.get(97)) { + if (!filled.get(99)) { callStackDepthXorStackItemHeight1.position(callStackDepthXorStackItemHeight1.position() + 2); } @@ -8168,47 +6839,32 @@ public Trace fillAndValidateRow() { codeFragmentIndex.position(codeFragmentIndex.position() + 4); } - if (!filled.get(104)) { - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .position( - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi - .position() - + 4); + if (!filled.get(106)) { + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.position(codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCallerGasXorDeploymentNumberXorCoinbaseAddressHi.position() + 4); } - if (!filled.get(136)) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position( - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position() + 16); + if (!filled.get(138)) { + codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position(codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position() + 16); } - if (!filled.get(135)) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position( - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position() - + 16); + if (!filled.get(137)) { + codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position(codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position() + 16); } - if (!filled.get(138)) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position( - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position() + 16); + if (!filled.get(140)) { + codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position(codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position() + 16); } - if (!filled.get(137)) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position( - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position() + 16); + if (!filled.get(139)) { + codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position(codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position() + 16); } - if (!filled.get(106)) { - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.position( - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.position() - + 4); + if (!filled.get(108)) { + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.position(codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcCdsXorInitCodeSize.position() + 4); } - if (!filled.get(105)) { - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi - .position( - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi - .position() - + 4); + if (!filled.get(107)) { + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.position(codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcCdoXorDeploymentNumberInftyXorFromAddressHi.position() + 4); } if (!filled.get(3)) { @@ -8227,7 +6883,7 @@ public Trace fillAndValidateRow() { contextNumberNew.position(contextNumberNew.position() + 4); } - if (!filled.get(113)) { + if (!filled.get(115)) { contextNumberXorMmuTgtId.position(contextNumberXorMmuTgtId.position() + 4); } @@ -8255,51 +6911,36 @@ public Trace fillAndValidateRow() { delta.position(delta.position() + 1); } - if (!filled.get(101)) { - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position( - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position() + 2); + if (!filled.get(103)) { + deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position(deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position() + 2); } - if (!filled.get(102)) { - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position( - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position() + 2); + if (!filled.get(104)) { + deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position(deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position() + 2); } - if (!filled.get(108)) { - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.position( - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.position() + 4); + if (!filled.get(110)) { + deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.position(deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhaseXorPrcRao.position() + 4); } - if (!filled.get(109)) { - deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.position( - deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.position() + 4); + if (!filled.get(111)) { + deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.position(deploymentNumberNewXorCallerAddressHiXorMmuRefOffsetXorPrcReturnGas.position() + 4); } - if (!filled.get(107)) { - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.position( - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.position() - + 4); + if (!filled.get(109)) { + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.position(deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorPrcRacXorToAddressHi.position() + 4); } if (!filled.get(49)) { - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode - .position( - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode - .position() - + 1); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.position(deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.position() + 1); } if (!filled.get(50)) { - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position( - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position() + 1); + deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position(deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position() + 1); } if (!filled.get(48)) { - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .position( - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .position() - + 1); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.position(deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.position() + 1); } if (!filled.get(12)) { @@ -8311,57 +6952,35 @@ public Trace fillAndValidateRow() { } if (!filled.get(52)) { - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position( - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position() - + 1); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position(existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position() + 1); } if (!filled.get(51)) { - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position( - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position() - + 1); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position(existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position() + 1); } if (!filled.get(53)) { - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn - .position( - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn - .position() - + 1); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.position(finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.position() + 1); } if (!filled.get(54)) { - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .position( - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .position() - + 1); + finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorUnconstrainedFinal.position(finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorUnconstrainedFinal.position() + 1); } if (!filled.get(55)) { - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.position( - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig - .position() - + 1); + finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorUnconstrainedFirst.position(finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorUnconstrainedFirst.position() + 1); } if (!filled.get(56)) { - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.position( - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero - .position() - + 1); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges.position(firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrChanges.position() + 1); } if (!filled.get(57)) { - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position( - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position() + 1); + firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig.position(firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueCurrIsOrig.position() + 1); } if (!filled.get(58)) { - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.position( - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig - .position() - + 1); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero.position(firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueCurrIsZero.position() + 1); } if (!filled.get(14)) { @@ -8376,7 +6995,7 @@ public Trace fillAndValidateRow() { gasExpected.position(gasExpected.position() + 8); } - if (!filled.get(126)) { + if (!filled.get(128)) { gasLimit.position(gasLimit.position() + 8); } @@ -8384,20 +7003,16 @@ public Trace fillAndValidateRow() { gasNext.position(gasNext.position() + 8); } - if (!filled.get(127)) { + if (!filled.get(129)) { gasPrice.position(gasPrice.position() + 8); } if (!filled.get(60)) { - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position( - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position() + 1); + hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueNextIsOrig.position(hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueNextIsOrig.position() + 1); } if (!filled.get(59)) { - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.position( - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero - .position() - + 1); + hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsCurr.position(hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsCurr.position() + 1); } if (!filled.get(18)) { @@ -8416,13 +7031,12 @@ public Trace fillAndValidateRow() { hubStampTransactionEnd.position(hubStampTransactionEnd.position() + 4); } - if (!filled.get(165)) { + if (!filled.get(167)) { instruction.position(instruction.position() + 32); } if (!filled.get(61)) { - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position( - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position() + 1); + isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorValueNextIsZero.position(isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorValueNextIsZero.position() + 1); } if (!filled.get(22)) { @@ -8430,43 +7044,38 @@ public Trace fillAndValidateRow() { } if (!filled.get(63)) { - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position( - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position() - + 1); + markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpxXorWarmth.position(markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpxXorWarmth.position() + 1); } if (!filled.get(62)) { - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.position( - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew - .position() - + 1); + markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorValueOrigIsZero.position(markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorValueOrigIsZero.position() + 1); } if (!filled.get(23)) { mmuStamp.position(mmuStamp.position() + 4); } - if (!filled.get(145)) { + if (!filled.get(147)) { mxpOffset2Hi.position(mxpOffset2Hi.position() + 16); } - if (!filled.get(146)) { + if (!filled.get(148)) { mxpOffset2Lo.position(mxpOffset2Lo.position() + 16); } - if (!filled.get(147)) { + if (!filled.get(149)) { mxpSize1Hi.position(mxpSize1Hi.position() + 16); } - if (!filled.get(148)) { + if (!filled.get(150)) { mxpSize1Lo.position(mxpSize1Lo.position() + 16); } - if (!filled.get(149)) { + if (!filled.get(151)) { mxpSize2Hi.position(mxpSize2Hi.position() + 16); } - if (!filled.get(150)) { + if (!filled.get(152)) { mxpSize2Lo.position(mxpSize2Lo.position() + 16); } @@ -8474,60 +7083,67 @@ public Trace fillAndValidateRow() { mxpStamp.position(mxpStamp.position() + 4); } - if (!filled.get(151)) { + if (!filled.get(153)) { mxpWords.position(mxpWords.position() + 16); } + if (!filled.get(96)) { + nbAdded.position(nbAdded.position() + 1); + } + + if (!filled.get(97)) { + nbRemoved.position(nbRemoved.position() + 1); + } + if (!filled.get(25)) { nonStackRows.position(nonStackRows.position() + 1); } - if (!filled.get(128)) { + if (!filled.get(130)) { nonce.position(nonce.position() + 8); } - if (!filled.get(124)) { - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.position( - nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.position() + 8); + if (!filled.get(126)) { + nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.position(nonceNewXorStpGasPaidOutOfPocketXorGasInitiallyAvailable.position() + 8); } - if (!filled.get(123)) { + if (!filled.get(125)) { nonceXorStpGasMxpXorBasefee.position(nonceXorStpGasMxpXorBasefee.position() + 8); } - if (!filled.get(152)) { + if (!filled.get(154)) { oobData1.position(oobData1.position() + 16); } - if (!filled.get(153)) { + if (!filled.get(155)) { oobData2.position(oobData2.position() + 16); } - if (!filled.get(154)) { + if (!filled.get(156)) { oobData3.position(oobData3.position() + 16); } - if (!filled.get(155)) { + if (!filled.get(157)) { oobData4.position(oobData4.position() + 16); } - if (!filled.get(156)) { + if (!filled.get(158)) { oobData5.position(oobData5.position() + 16); } - if (!filled.get(157)) { + if (!filled.get(159)) { oobData6.position(oobData6.position() + 16); } - if (!filled.get(158)) { + if (!filled.get(160)) { oobData7.position(oobData7.position() + 16); } - if (!filled.get(159)) { + if (!filled.get(161)) { oobData8.position(oobData8.position() + 16); } - if (!filled.get(160)) { + if (!filled.get(162)) { oobData9.position(oobData9.position() + 16); } @@ -8600,11 +7216,10 @@ public Trace fillAndValidateRow() { } if (!filled.get(79)) { - prcSuccessCallerWontRevertXorShfFlag.position( - prcSuccessCallerWontRevertXorShfFlag.position() + 1); + prcSuccessCallerWontRevertXorShfFlag.position(prcSuccessCallerWontRevertXorShfFlag.position() + 1); } - if (!filled.get(129)) { + if (!filled.get(131)) { priorityFeePerGas.position(priorityFeePerGas.position() + 8); } @@ -8620,7 +7235,7 @@ public Trace fillAndValidateRow() { refundCounter.position(refundCounter.position() + 4); } - if (!filled.get(130)) { + if (!filled.get(132)) { refundCounterInfinity.position(refundCounterInfinity.position() + 8); } @@ -8628,7 +7243,7 @@ public Trace fillAndValidateRow() { refundCounterNew.position(refundCounterNew.position() + 4); } - if (!filled.get(131)) { + if (!filled.get(133)) { refundEffective.position(refundEffective.position() + 8); } @@ -8636,24 +7251,23 @@ public Trace fillAndValidateRow() { relativeBlockNumber.position(relativeBlockNumber.position() + 2); } - if (!filled.get(114)) { + if (!filled.get(116)) { returnAtCapacityXorMxpInst.position(returnAtCapacityXorMxpInst.position() + 4); } - if (!filled.get(115)) { + if (!filled.get(117)) { returnAtOffsetXorOobInst.position(returnAtOffsetXorOobInst.position() + 4); } - if (!filled.get(116)) { - returnDataContextNumberXorStpGasStipend.position( - returnDataContextNumberXorStpGasStipend.position() + 4); + if (!filled.get(118)) { + returnDataContextNumberXorStpGasStipend.position(returnDataContextNumberXorStpGasStipend.position() + 4); } - if (!filled.get(117)) { + if (!filled.get(119)) { returnDataOffsetXorStpInstruction.position(returnDataOffsetXorStpInstruction.position() + 4); } - if (!filled.get(118)) { + if (!filled.get(120)) { returnDataSize.position(returnDataSize.position() + 4); } @@ -8662,80 +7276,63 @@ public Trace fillAndValidateRow() { } if (!filled.get(81)) { - returnFromDeploymentEmptyCodeWillRevertXorSstorex.position( - returnFromDeploymentEmptyCodeWillRevertXorSstorex.position() + 1); + returnFromDeploymentEmptyCodeWillRevertXorSstorex.position(returnFromDeploymentEmptyCodeWillRevertXorSstorex.position() + 1); } if (!filled.get(82)) { - returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position( - returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position() + 1); + returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position(returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position() + 1); } if (!filled.get(83)) { - returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position( - returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position() + 1); + returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position(returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position() + 1); } if (!filled.get(84)) { - returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position( - returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position() + 1); + returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position(returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position() + 1); } if (!filled.get(85)) { - returnFromMessageCallWillTouchRamXorStackItemPop3.position( - returnFromMessageCallWillTouchRamXorStackItemPop3.position() + 1); + returnFromMessageCallWillTouchRamXorStackItemPop3.position(returnFromMessageCallWillTouchRamXorStackItemPop3.position() + 1); } if (!filled.get(86)) { - returnFromMessageCallWontTouchRamXorStackItemPop4.position( - returnFromMessageCallWontTouchRamXorStackItemPop4.position() + 1); + returnFromMessageCallWontTouchRamXorStackItemPop4.position(returnFromMessageCallWontTouchRamXorStackItemPop4.position() + 1); } - if (!filled.get(110)) { - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position( - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position() + 4); + if (!filled.get(112)) { + rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position(rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position() + 4); } - if (!filled.get(139)) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position( - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position() + 16); + if (!filled.get(141)) { + rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position(rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position() + 16); } if (!filled.get(64)) { - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired - .position( - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired - .position() - + 1); + rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequiredXorWarmthNew.position(rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequiredXorWarmthNew.position() + 1); } - if (!filled.get(140)) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position( - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position() + 16); + if (!filled.get(142)) { + rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position(rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position() + 16); } - if (!filled.get(141)) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position( - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position() + 16); + if (!filled.get(143)) { + rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position(rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position() + 16); } - if (!filled.get(96)) { + if (!filled.get(98)) { rlpaddrRecipe.position(rlpaddrRecipe.position() + 1); } - if (!filled.get(142)) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position( - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position() + 16); + if (!filled.get(144)) { + rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position(rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position() + 16); } - if (!filled.get(143)) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position( - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position() + 16); + if (!filled.get(145)) { + rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position(rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position() + 16); } if (!filled.get(65)) { - romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position( - romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position() + 1); + romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position(romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position() + 1); } if (!filled.get(87)) { @@ -8743,66 +7340,62 @@ public Trace fillAndValidateRow() { } if (!filled.get(88)) { - selfdestructWillRevertXorStaticFlag.position( - selfdestructWillRevertXorStaticFlag.position() + 1); + selfdestructWillRevertXorStaticFlag.position(selfdestructWillRevertXorStaticFlag.position() + 1); } if (!filled.get(89)) { - selfdestructWontRevertAlreadyMarkedXorStoFlag.position( - selfdestructWontRevertAlreadyMarkedXorStoFlag.position() + 1); + selfdestructWontRevertAlreadyMarkedXorStoFlag.position(selfdestructWontRevertAlreadyMarkedXorStoFlag.position() + 1); } if (!filled.get(90)) { - selfdestructWontRevertNotYetMarkedXorSux.position( - selfdestructWontRevertNotYetMarkedXorSux.position() + 1); + selfdestructWontRevertNotYetMarkedXorSux.position(selfdestructWontRevertNotYetMarkedXorSux.position() + 1); } - if (!filled.get(98)) { + if (!filled.get(100)) { stackItemHeight2.position(stackItemHeight2.position() + 2); } - if (!filled.get(99)) { + if (!filled.get(101)) { stackItemHeight3.position(stackItemHeight3.position() + 2); } - if (!filled.get(100)) { + if (!filled.get(102)) { stackItemHeight4.position(stackItemHeight4.position() + 2); } - if (!filled.get(119)) { + if (!filled.get(121)) { stackItemStamp1.position(stackItemStamp1.position() + 5); } - if (!filled.get(120)) { + if (!filled.get(122)) { stackItemStamp2.position(stackItemStamp2.position() + 5); } - if (!filled.get(121)) { + if (!filled.get(123)) { stackItemStamp3.position(stackItemStamp3.position() + 5); } - if (!filled.get(122)) { + if (!filled.get(124)) { stackItemStamp4.position(stackItemStamp4.position() + 5); } - if (!filled.get(161)) { + if (!filled.get(163)) { stpGasHi.position(stpGasHi.position() + 16); } - if (!filled.get(162)) { + if (!filled.get(164)) { stpGasLo.position(stpGasLo.position() + 16); } - if (!filled.get(125)) { - stpGasUpfrontGasCostXorGasLeftover.position( - stpGasUpfrontGasCostXorGasLeftover.position() + 8); + if (!filled.get(127)) { + stpGasUpfrontGasCostXorGasLeftover.position(stpGasUpfrontGasCostXorGasLeftover.position() + 8); } - if (!filled.get(163)) { + if (!filled.get(165)) { stpValueHi.position(stpValueHi.position() + 16); } - if (!filled.get(164)) { + if (!filled.get(166)) { stpValueLo.position(stpValueLo.position() + 16); } @@ -8815,11 +7408,10 @@ public Trace fillAndValidateRow() { } if (!filled.get(66)) { - trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position( - trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position() + 1); + trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position(trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position() + 1); } - if (!filled.get(144)) { + if (!filled.get(146)) { trmRawAddressHiXorMxpOffset1Lo.position(trmRawAddressHiXorMxpOffset1Lo.position() + 16); } @@ -8852,8 +7444,7 @@ public Trace fillAndValidateRow() { } if (!filled.get(68)) { - warmthNewXorPrcEcaddXorLogInfoFlag.position( - warmthNewXorPrcEcaddXorLogInfoFlag.position() + 1); + warmthNewXorPrcEcaddXorLogInfoFlag.position(warmthNewXorPrcEcaddXorLogInfoFlag.position() + 1); } if (!filled.get(67)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java index ab14be2dff..dd66b64468 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java @@ -29,8 +29,10 @@ @Getter public class TransactionStack implements StackedContainer { + @Getter private final List transactions = new ArrayList<>(200); // TODO: write the allocated memory from .toml file + private int currentAbsNumber; private int relativeTransactionNumber; @Setter @Getter public TxInitializationSection initializationSection; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java index aa19528202..c39352241d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java @@ -36,10 +36,12 @@ import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TraceFragment; import net.consensys.linea.zktracer.module.hub.section.halt.EphemeralAccount; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; import net.consensys.linea.zktracer.module.romlex.ContractMetadata; import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.evm.worldstate.WorldView; @@ -57,7 +59,7 @@ public final class AccountFragment @Setter private boolean requiresRomlex; private int codeFragmentIndex; private final Optional addressToTrim; - private final DomSubStampsSubFragment domSubStampsSubFragment; + @Getter private final DomSubStampsSubFragment domSubStampsSubFragment; @Setter private RlpAddrSubFragment rlpAddrSubFragment; private boolean markedForSelfDestruct; private boolean markedForSelfDestructNew; @@ -108,6 +110,14 @@ public AccountFragment( isDeployment = newState.deploymentStatus(); this.addressToTrim = addressToTrim; this.domSubStampsSubFragment = domSubStampsSubFragment; + // Updating the map + transactionProcessingMetadata.updateAccountFirstAndLast(this); + // update the minDeplMoBlock and maxDeplNoBlock maps + Hub.stateManagerMetadata() + .updateDeplNoBlockMaps( + oldState.address(), + transactionProcessingMetadata.getRelativeBlockNumber(), + deploymentNumber); // This allows us to properly fill EXISTS_INFTY, DEPLOYMENT_NUMBER_INFTY and CODE_FRAGMENT_INDEX hub.defers().scheduleForPostConflation(this); @@ -130,9 +140,28 @@ public Trace trace(Trace trace) { rlpAddrSubFragment.trace(trace); } + Map> + transactionAccountMap = transactionProcessingMetadata.getAccountFirstAndLastMap(); + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + Map< + StateManagerMetadata.AddrBlockPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + accountFirstLastBlockMap = stateManagerMetadata.getAccountFirstLastBlockMap(); + StateManagerMetadata.AddrBlockPair current = + new StateManagerMetadata.AddrBlockPair( + oldState.address(), transactionProcessingMetadata.getRelativeBlockNumber()); + + Map> + accountFirstLastConflationMap = stateManagerMetadata.getAccountFirstLastConflationMap(); + + long minDeploymentNumberInBlock = stateManagerMetadata.getMinDeplNoBlock().get(current); + long maxDeploymentNumberInBlock = stateManagerMetadata.getMaxDeplNoBlock().get(current); + final boolean hasCode = !eCodeHash.equals(EWord.of(Hash.EMPTY)); final boolean hasCodeNew = !eCodeHashNew.equals(EWord.of(Hash.EMPTY)); + return trace .peekAtAccount(true) .pAccountAddressHi(highPart(oldState.address())) @@ -165,7 +194,20 @@ public Trace trace(Trace trace) { .pAccountDeploymentStatusInfty(existsInfinity) .pAccountTrmFlag(addressToTrim.isPresent()) .pAccountTrmRawAddressHi(addressToTrim.map(a -> EWord.of(a).hi()).orElse(Bytes.EMPTY)) - .pAccountIsPrecompile(isPrecompile(oldState.address())); + .pAccountIsPrecompile(isPrecompile(oldState.address())) + .pAccountFirstInTxn(this == transactionAccountMap.get(oldState.address()).getFirst()) + .pAccountAgainInTxn(this != transactionAccountMap.get(oldState.address()).getFirst()) + .pAccountFinalInTxn(this == transactionAccountMap.get(oldState.address()).getLast()) + .pAccountFirstInBlk(this == accountFirstLastBlockMap.get(current).getFirst()) + .pAccountAgainInBlk(this != accountFirstLastBlockMap.get(current).getFirst()) + .pAccountFinalInBlk(this == accountFirstLastBlockMap.get(current).getLast()) + .pAccountFirstInCnf( + this == accountFirstLastConflationMap.get(oldState.address()).getFirst()) + .pAccountAgainInCnf( + this != accountFirstLastConflationMap.get(oldState.address()).getFirst()) + .pAccountFinalInCnf(this == accountFirstLastConflationMap.get(oldState.address()).getLast()) + .pAccountDeploymentNumberFirstInBlock(minDeploymentNumberInBlock) + .pAccountDeploymentNumberFinalInBlock(maxDeploymentNumberInBlock); } @Override diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/storage/StorageFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/storage/StorageFragment.java index 04821a2871..ae0a66ede4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/storage/StorageFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/storage/StorageFragment.java @@ -20,14 +20,18 @@ import static net.consensys.linea.zktracer.types.AddressUtils.lowPart; import java.util.HashMap; +import java.util.Map; import lombok.Getter; import lombok.RequiredArgsConstructor; +import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.State; import net.consensys.linea.zktracer.module.hub.Trace; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TraceFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; @RequiredArgsConstructor @Getter @@ -39,10 +43,14 @@ public final class StorageFragment implements TraceFragment { private final EWord valueNext; private final boolean incomingWarmth; private final boolean outgoingWarmth; - private final DomSubStampsSubFragment domSubStampsSubFragment; + @Getter private final DomSubStampsSubFragment domSubStampsSubFragment; private final int blockNumber; private final StorageFragmentPurpose purpose; // for debugging purposes + private final int deploymentNumber; + + final TransactionProcessingMetadata transactionProcessingMetadata; + public Trace trace(Trace trace) { final HashMap current = @@ -65,6 +73,36 @@ public Trace trace(Trace trace) { // tracing domSubStampsSubFragment.trace(trace); + Map< + TransactionProcessingMetadata.AddrStorageKeyPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + storageFirstAndLastMap = transactionProcessingMetadata.getStorageFirstAndLastMap(); + TransactionProcessingMetadata.AddrStorageKeyPair currentAddressKeyPair = + new TransactionProcessingMetadata.AddrStorageKeyPair( + storageSlotIdentifier.getAddress(), storageSlotIdentifier.getStorageKey()); + + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + Map< + StateManagerMetadata.AddrStorageKeyBlockNumTuple, + TransactionProcessingMetadata.FragmentFirstAndLast> + storageFirstLastBlockMap = stateManagerMetadata.getStorageFirstLastBlockMap(); + StateManagerMetadata.AddrStorageKeyBlockNumTuple storageKeyBlockNumTuple = + new StateManagerMetadata.AddrStorageKeyBlockNumTuple( + currentAddressKeyPair, this.blockNumber); + + TransactionProcessingMetadata.FragmentFirstAndLast + storageFirstLastConflationPair = + stateManagerMetadata.getStorageFirstLastConflationMap().get(currentAddressKeyPair); + + StateManagerMetadata.AddrBlockPair addressBlockPair = + new StateManagerMetadata.AddrBlockPair( + storageSlotIdentifier.getAddress(), + transactionProcessingMetadata.getRelativeBlockNumber()); + long minDeploymentNumberInBlock = + stateManagerMetadata.getMinDeplNoBlock().get(addressBlockPair); + long maxDeploymentNumberInBlock = + stateManagerMetadata.getMaxDeplNoBlock().get(addressBlockPair); + return trace .peekAtStorage(true) .pStorageAddressHi(highPart(storageSlotIdentifier.getAddress())) @@ -85,6 +123,21 @@ public Trace trace(Trace trace) { .pStorageValueCurrIsZero(valueCurrent.isZero()) .pStorageValueNextIsCurr(valueNext.equals(valueCurrent)) .pStorageValueNextIsZero(valueNext.isZero()) - .pStorageValueNextIsOrig(valueNext.equals(valueOriginal)); + .pStorageValueNextIsOrig(valueNext.equals(valueOriginal)) + .pStorageUnconstrainedFirst(isFirstOccurrence) + .pStorageUnconstrainedFinal(isFinalOccurrence) + .pStorageFirstInTxn(this == storageFirstAndLastMap.get(currentAddressKeyPair).getFirst()) + .pStorageAgainInTxn(this != storageFirstAndLastMap.get(currentAddressKeyPair).getFirst()) + .pStorageFinalInTxn(this == storageFirstAndLastMap.get(currentAddressKeyPair).getLast()) + .pStorageFirstInBlk( + this == storageFirstLastBlockMap.get(storageKeyBlockNumTuple).getFirst()) + .pStorageAgainInBlk( + this != storageFirstLastBlockMap.get(storageKeyBlockNumTuple).getFirst()) + .pStorageFinalInBlk(this == storageFirstLastBlockMap.get(storageKeyBlockNumTuple).getLast()) + .pStorageFirstInCnf(this == storageFirstLastConflationPair.getFirst()) + .pStorageAgainInCnf(this != storageFirstLastConflationPair.getFirst()) + .pStorageFinalInCnf(this == storageFirstLastConflationPair.getLast()) + .pStorageDeploymentNumberFirstInBlock(minDeploymentNumberInBlock) + .pStorageDeploymentNumberFinalInBlock(maxDeploymentNumberInBlock); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SloadSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SloadSection.java index 7f0b5f8fa5..90b5ba5cc4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SloadSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SloadSection.java @@ -28,6 +28,7 @@ import net.consensys.linea.zktracer.module.hub.signals.Exceptions; import net.consensys.linea.zktracer.runtime.callstack.CallFrame; import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.units.bigints.UInt256; import org.hyperledger.besu.datatypes.Address; @@ -89,18 +90,28 @@ public SloadSection(Hub hub, WorldView worldView) { private StorageFragment doingSload(Hub hub) { - return new StorageFragment( - hub.state, - new State.StorageSlotIdentifier( - accountAddress, accountAddressDeploymentNumber, EWord.of(storageKey)), - valueOriginal, - valueCurrent, - valueCurrent, - incomingWarmth, - true, - DomSubStampsSubFragment.standardDomSubStamps(this.hubStamp(), 0), - hub.state.firstAndLastStorageSlotOccurrences.size(), - SLOAD_DOING); + TransactionProcessingMetadata txnMetadata = hub.txStack().current(); + StorageFragment newFragment = + new StorageFragment( + hub.state, + new State.StorageSlotIdentifier( + accountAddress, accountAddressDeploymentNumber, EWord.of(storageKey)), + valueOriginal, + valueCurrent, + valueCurrent, + incomingWarmth, + true, + DomSubStampsSubFragment.standardDomSubStamps(this.hubStamp(), 0), + hub.state.firstAndLastStorageSlotOccurrences.size(), + SLOAD_DOING, + accountAddressDeploymentNumber, // Arijit — check that it is computed properly + // beforehand. + txnMetadata); + // update storage txn map values for the state manager as new storage fragment is created + TransactionProcessingMetadata.AddrStorageKeyPair mapKey = + new TransactionProcessingMetadata.AddrStorageKeyPair(accountAddress, EWord.of(storageKey)); + txnMetadata.updateStorageFirstAndLast(newFragment, mapKey); + return newFragment; } @Override @@ -116,6 +127,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca DomSubStampsSubFragment.revertWithCurrentDomSubStamps( this.hubStamp(), hub.callStack().currentCallFrame().revertStamp(), 0); + TransactionProcessingMetadata txnMetadata = hub.txStack().current(); final StorageFragment undoingSloadStorageFragment = new StorageFragment( hub.state, @@ -128,9 +140,16 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca incomingWarmth, undoingDomSubStamps, hub.state.firstAndLastStorageSlotOccurrences.size(), - SLOAD_UNDOING); + SLOAD_UNDOING, + accountAddressDeploymentNumber, // Arijit — check that it is computed properly + // beforehand. + txnMetadata); this.addFragment(undoingSloadStorageFragment); + // update storage txn map values for the state manager as new storage fragment is created + TransactionProcessingMetadata.AddrStorageKeyPair mapKey = + new TransactionProcessingMetadata.AddrStorageKeyPair(accountAddress, EWord.of(storageKey)); + txnMetadata.updateStorageFirstAndLast(undoingSloadStorageFragment, mapKey); } private boolean undoingRequired() { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SstoreSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SstoreSection.java index 93642ab7b0..0cdf6617ec 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SstoreSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/SstoreSection.java @@ -31,6 +31,7 @@ import net.consensys.linea.zktracer.module.hub.signals.Exceptions; import net.consensys.linea.zktracer.runtime.callstack.CallFrame; import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.units.bigints.UInt256; import org.hyperledger.besu.datatypes.Address; @@ -114,18 +115,28 @@ public SstoreSection(Hub hub, WorldView worldView) { private StorageFragment doingSstore(Hub hub) { - return new StorageFragment( - hub.state, - new State.StorageSlotIdentifier( - accountAddress, accountAddressDeploymentNumber, EWord.of(storageKey)), - valueOriginal, - valueCurrent, - valueNext, - incomingWarmth, - true, - DomSubStampsSubFragment.standardDomSubStamps(this.hubStamp(), 0), - hub.state.firstAndLastStorageSlotOccurrences.size(), - SSTORE_DOING); + TransactionProcessingMetadata txnMetadata = hub.txStack().current(); + StorageFragment newFragment = + new StorageFragment( + hub.state, + new State.StorageSlotIdentifier( + accountAddress, accountAddressDeploymentNumber, EWord.of(storageKey)), + valueOriginal, + valueCurrent, + valueNext, + incomingWarmth, + true, + DomSubStampsSubFragment.standardDomSubStamps(this.hubStamp(), 0), + hub.state.firstAndLastStorageSlotOccurrences.size(), + SSTORE_DOING, + accountAddressDeploymentNumber, // Arijit — check that it is computed properly + // beforehand. + txnMetadata); + TransactionProcessingMetadata.AddrStorageKeyPair mapKey = + new TransactionProcessingMetadata.AddrStorageKeyPair(accountAddress, EWord.of(storageKey)); + // update storage txn map values for the state manager as new storage fragment is created + txnMetadata.updateStorageFirstAndLast(newFragment, mapKey); + return newFragment; } @Override @@ -134,6 +145,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca DomSubStampsSubFragment.revertWithCurrentDomSubStamps( this.hubStamp(), hub.callStack().currentCallFrame().revertStamp(), 0); + TransactionProcessingMetadata txnMetadata = hub.txStack().current(); final StorageFragment undoingSstoreStorageFragment = new StorageFragment( hub.state, @@ -146,11 +158,17 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca incomingWarmth, undoingDomSubStamps, hub.state.firstAndLastStorageSlotOccurrences.size(), - SSTORE_UNDOING); + SSTORE_UNDOING, + accountAddressDeploymentNumber, // Arijit — check that it is computed properly + // beforehand. + txnMetadata); this.addFragment(undoingSstoreStorageFragment); - // undo the refund commonValues.refundDelta(0); + // update storage txn map values for the state manager as new storage fragment is created + TransactionProcessingMetadata.AddrStorageKeyPair mapKey = + new TransactionProcessingMetadata.AddrStorageKeyPair(accountAddress, EWord.of(storageKey)); + txnMetadata.updateStorageFirstAndLast(undoingSstoreStorageFragment, mapKey); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxPreWarmingMacroSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxPreWarmingMacroSection.java index bc2be6fc6c..6c307c1412 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxPreWarmingMacroSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxPreWarmingMacroSection.java @@ -113,6 +113,7 @@ public TxPreWarmingMacroSection(WorldView world, Hub hub) { new State.StorageSlotIdentifier( address, deploymentInfo.deploymentNumber(address), EWord.of(k)); + TransactionProcessingMetadata txnMetadata = hub.txStack().current(); final StorageFragment storageFragment = new StorageFragment( hub.state, @@ -125,13 +126,21 @@ public TxPreWarmingMacroSection(WorldView world, Hub hub) { true, DomSubStampsSubFragment.standardDomSubStamps(hub.stamp() + 1, 0), hub.state.firstAndLastStorageSlotOccurrences.size(), - PRE_WARMING); + PRE_WARMING, + deploymentNumber, // Arijit — check that it is computed properly + // beforehand. + txnMetadata); new TxPrewarmingSection(hub, storageFragment); hub.state.updateOrInsertStorageSlotOccurrence( storageSlotIdentifier, storageFragment); - seenKeys.get(address).add(key); + // update storage txn map values for the state manager as new storage fragment + // is created + TransactionProcessingMetadata.AddrStorageKeyPair mapKey = + new TransactionProcessingMetadata.AddrStorageKeyPair( + address, EWord.of(key)); + txnMetadata.updateStorageFirstAndLast(storageFragment, mapKey); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/StateManagerMetadata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/StateManagerMetadata.java new file mode 100644 index 0000000000..c35b9be0f3 --- /dev/null +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/StateManagerMetadata.java @@ -0,0 +1,91 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.hub.transients; + +import java.util.HashMap; +import java.util.Map; + +import lombok.*; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; + +public class StateManagerMetadata { + @Setter @Getter Hub hub; + + @EqualsAndHashCode + public static class AddrBlockPair { + @Getter private Address address; + @Getter private int blockNumber; + + public AddrBlockPair(Address addr, int blockNumber) { + this.address = addr; + this.blockNumber = blockNumber; + } + } + + @EqualsAndHashCode + public static class AddrStorageKeyBlockNumTuple { + @Getter private TransactionProcessingMetadata.AddrStorageKeyPair addrStorageKeyPair; + @Getter private int blockNumber; + + public AddrStorageKeyBlockNumTuple( + TransactionProcessingMetadata.AddrStorageKeyPair addrStorageKeyPair, int blockNumber) { + this.addrStorageKeyPair = addrStorageKeyPair; + this.blockNumber = blockNumber; + } + } + + @Getter + Map> + accountFirstLastBlockMap = new HashMap<>(); + + @Getter + Map< + AddrStorageKeyBlockNumTuple, + TransactionProcessingMetadata.FragmentFirstAndLast> + storageFirstLastBlockMap = new HashMap<>(); + + @Getter + Map> + accountFirstLastConflationMap = new HashMap<>(); + + @Getter + Map< + TransactionProcessingMetadata.AddrStorageKeyPair, + TransactionProcessingMetadata.FragmentFirstAndLast> + storageFirstLastConflationMap = new HashMap<>(); + + @Getter Map minDeplNoBlock = new HashMap<>(); + @Getter Map maxDeplNoBlock = new HashMap<>(); + + public void updateDeplNoBlockMaps(Address address, int blockNumber, int currentDeplNo) { + AddrBlockPair addrBlockPair = new AddrBlockPair(address, blockNumber); + if (minDeplNoBlock.containsKey(addrBlockPair)) { + // the maps already contain deployment info for this address, and this is not the first one in + // the block + // since it is not the first, we do not update the minDeplNoBlock + // but we update the maxDeplNoBlock + maxDeplNoBlock.put(addrBlockPair, currentDeplNo); + } else { + // this is the first time we have a deployment at this address in the block + minDeplNoBlock.put(addrBlockPair, currentDeplNo); + maxDeplNoBlock.put(addrBlockPair, currentDeplNo); + } + } +} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java index e8d9dd88a9..2055c55a2d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java @@ -26,12 +26,15 @@ import java.util.Optional; import java.util.Set; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; import net.consensys.linea.zktracer.ZkTracer; import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; import net.consensys.linea.zktracer.module.hub.section.halt.AttemptedSelfDestruct; import net.consensys.linea.zktracer.module.hub.section.halt.EphemeralAccount; import net.consensys.linea.zktracer.module.hub.transients.Block; @@ -121,7 +124,126 @@ public class TransactionProcessingMetadata { final Map> unexceptionalSelfDestructMap = new HashMap<>(); - @Getter final Map effectiveSelfDestructMap = new HashMap<>(); + @Getter Map effectiveSelfDestructMap = new HashMap<>(); + + /* FragmentFirstAndLast stores the first and last fragments relevant to the state manager in the + * current transaction segment (they will be either account fragments or storage fragments). */ + @Getter + @Setter + public static class FragmentFirstAndLast { + TraceFragment first; + TraceFragment last; + int firstDom, firstSub; + int lastDom, lastSub; + + public FragmentFirstAndLast( + TraceFragment first, + TraceFragment last, + int firstDom, + int firstSub, + int lastDom, + int lastSub) { + this.first = first; + this.last = last; + this.firstDom = firstDom; + this.firstSub = firstSub; + this.lastDom = lastDom; + this.lastSub = lastSub; + } + + public static boolean strictlySmallerStamps( + int firstDom, int firstSub, int lastDom, int lastSub) { + return firstDom < lastDom || (firstDom == lastDom && firstSub > lastSub); + } + + public FragmentFirstAndLast copy() { + return new FragmentFirstAndLast( + this.first, + this.last, + this.firstDom, + this.firstSub, + this.lastDom, + this.lastSub + ); + } + } + + @EqualsAndHashCode + public static class AddrStorageKeyPair { + @Getter private Address address; + @Getter private EWord storageKey; + + public AddrStorageKeyPair(Address addr, EWord storageKey) { + this.address = addr; + this.storageKey = storageKey; + } + } + + // Map for the first and last account occurrence + @Getter + Map> accountFirstAndLastMap = new HashMap<>(); + + // Map for the first and last storage occurrence + @Getter + Map> storageFirstAndLastMap = + new HashMap<>(); + + // Todo: Create a generic method which can handle AccountFragment and StorageFragment + public void updateAccountFirstAndLast(AccountFragment fragment) { + // Setting the post transaction first and last value + int dom = fragment.domSubStampsSubFragment().domStamp(); + int sub = fragment.domSubStampsSubFragment().subStamp(); + + Address key = fragment.oldState().address(); + + // Initialise the Account First and Last map + final Map> + txnAccountFirstAndLastMap = getAccountFirstAndLastMap(); + if (!txnAccountFirstAndLastMap.containsKey(key)) { + TransactionProcessingMetadata.FragmentFirstAndLast txnFirstAndLast = + new FragmentFirstAndLast(fragment, fragment, dom, sub, dom, sub); + txnAccountFirstAndLastMap.put(key, txnFirstAndLast); + } else { + TransactionProcessingMetadata.FragmentFirstAndLast txnFirstAndLast = + txnAccountFirstAndLastMap.get(key); + // Replace condition + if (TransactionProcessingMetadata.FragmentFirstAndLast.strictlySmallerStamps( + txnFirstAndLast.getLastDom(), txnFirstAndLast.getLastSub(), dom, sub)) { + txnFirstAndLast.setLast(fragment); + txnFirstAndLast.setLastDom(dom); + txnFirstAndLast.setLastSub(sub); + txnAccountFirstAndLastMap.put(key, txnFirstAndLast); + } + } + } + + public void updateStorageFirstAndLast(StorageFragment fragment, AddrStorageKeyPair key) { + // Setting the post transaction first and last value + int dom = fragment.getDomSubStampsSubFragment().domStamp(); + int sub = fragment.getDomSubStampsSubFragment().subStamp(); + + // Initialise the Storage First and Last map + final Map< + AddrStorageKeyPair, TransactionProcessingMetadata.FragmentFirstAndLast> + txnStorageFirstAndLastMap = getStorageFirstAndLastMap(); + if (!txnStorageFirstAndLastMap.containsKey(key)) { + TransactionProcessingMetadata.FragmentFirstAndLast txnFirstAndLast = + new FragmentFirstAndLast(fragment, fragment, dom, sub, dom, sub); + txnStorageFirstAndLastMap.put(key, txnFirstAndLast); + } else { + // the storage key has already been acessed for this account + TransactionProcessingMetadata.FragmentFirstAndLast txnFirstAndLast = + txnStorageFirstAndLastMap.get(key); + // Replace condition + if (TransactionProcessingMetadata.FragmentFirstAndLast.strictlySmallerStamps( + txnFirstAndLast.getLastDom(), txnFirstAndLast.getLastSub(), dom, sub)) { + txnFirstAndLast.setLast(fragment); + txnFirstAndLast.setLastDom(dom); + txnFirstAndLast.setLastSub(sub); + txnStorageFirstAndLastMap.put(key, txnFirstAndLast); + } + } + } public TransactionProcessingMetadata( final WorldView world, diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/StateManagerAccountTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/StateManagerAccountTest.java new file mode 100644 index 0000000000..525edb1137 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/StateManagerAccountTest.java @@ -0,0 +1,138 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.hub; + +import java.util.List; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyTransaction; +import org.hyperledger.besu.crypto.KeyPair; +import org.hyperledger.besu.crypto.SECP256K1; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Hash; +import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.junit.jupiter.api.Test; + +public class StateManagerAccountTest { + + @Test + void test() { + final ToyAccount receiverAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .nonce(116) + .address(Address.fromHexString("0xdead000000000000000000000000000beef")) + .build(); + + final KeyPair senderKeyPair1 = new SECP256K1().generateKeyPair(); + final Address senderAddress1 = + Address.extract(Hash.hash(senderKeyPair1.getPublicKey().getEncodedBytes())); + System.out.println("Sender address1: " + senderAddress1); + final ToyAccount senderAccount1 = + ToyAccount.builder().balance(Wei.fromEth(123)).nonce(5).address(senderAddress1).build(); + + final KeyPair senderKeyPair2 = new SECP256K1().generateKeyPair(); + final Address senderAddress2 = + Address.extract(Hash.hash(senderKeyPair2.getPublicKey().getEncodedBytes())); + System.out.println("Sender address2: " + senderAddress2); + final ToyAccount senderAccount2 = + ToyAccount.builder().balance(Wei.fromEth(1231)).nonce(15).address(senderAddress2).build(); + + final KeyPair senderKeyPair3 = new SECP256K1().generateKeyPair(); + final Address senderAddress3 = + Address.extract(Hash.hash(senderKeyPair3.getPublicKey().getEncodedBytes())); + System.out.println("Sender address3: " + senderAddress3); + final ToyAccount senderAccount3 = + ToyAccount.builder().balance(Wei.fromEth(1231)).nonce(15).address(senderAddress3).build(); + + final KeyPair senderKeyPair4 = new SECP256K1().generateKeyPair(); + final Address senderAddress4 = + Address.extract(Hash.hash(senderKeyPair4.getPublicKey().getEncodedBytes())); + System.out.println("Sender address4: " + senderAddress4); + final ToyAccount senderAccount4 = + ToyAccount.builder().balance(Wei.fromEth(11)).nonce(115).address(senderAddress4).build(); + + final KeyPair senderKeyPair5 = new SECP256K1().generateKeyPair(); + final Address senderAddress5 = + Address.extract(Hash.hash(senderKeyPair5.getPublicKey().getEncodedBytes())); + System.out.println("Sender address5: " + senderAddress5); + final ToyAccount senderAccount5 = + ToyAccount.builder().balance(Wei.fromEth(12)).nonce(0).address(senderAddress5).build(); + + final KeyPair senderKeyPair6 = new SECP256K1().generateKeyPair(); + final Address senderAddress6 = + Address.extract(Hash.hash(senderKeyPair6.getPublicKey().getEncodedBytes())); + System.out.println("Sender address6: " + senderAddress6); + final ToyAccount senderAccount6 = + ToyAccount.builder().balance(Wei.fromEth(12)).nonce(6).address(senderAddress6).build(); + + final KeyPair senderKeyPair7 = new SECP256K1().generateKeyPair(); + final Address senderAddress7 = + Address.extract(Hash.hash(senderKeyPair7.getPublicKey().getEncodedBytes())); + System.out.println("Sender address7: " + senderAddress7); + final ToyAccount senderAccount7 = + ToyAccount.builder().balance(Wei.fromEth(231)).nonce(21).address(senderAddress7).build(); + + final Transaction pureTransferSender1 = + ToyTransaction.builder() + .sender(senderAccount1) + .to(receiverAccount) + .keyPair(senderKeyPair1) + .value(Wei.of(123)) + .build(); + final Transaction pureTransferSender2 = + ToyTransaction.builder() + .sender(senderAccount2) + .to(receiverAccount) + .keyPair(senderKeyPair2) + .value(Wei.of(120)) + .build(); + final Transaction pureTransferSender3 = + ToyTransaction.builder() + .sender(senderAccount3) + .to(receiverAccount) + .keyPair(senderKeyPair3) + .value(Wei.of(110)) + .build(); + final Transaction pureTransferSender4 = + ToyTransaction.builder() + .sender(senderAccount4) + .to(receiverAccount) + .keyPair(senderKeyPair4) + .value(Wei.of(10)) + .build(); + + MultiBlockExecutionEnvironment.MultiBlockExecutionEnvironmentBuilder builder = + MultiBlockExecutionEnvironment.builder(); + builder + .accounts( + List.of( + senderAccount1, + senderAccount2, + senderAccount3, + senderAccount4, + senderAccount5, + senderAccount6, + senderAccount7, + receiverAccount)) + .addBlock(List.of(pureTransferSender1, pureTransferSender2)) + .addBlock(List.of(pureTransferSender3, pureTransferSender4)) + .build() + .run(); + } +} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/StateManagerStorageTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/StateManagerStorageTest.java new file mode 100644 index 0000000000..e3728804eb --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/StateManagerStorageTest.java @@ -0,0 +1,236 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer.module.hub; + +import java.util.List; + +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyTransaction; +import net.consensys.linea.zktracer.opcode.OpCode; +import org.apache.tuweni.bytes.Bytes32; +import org.hyperledger.besu.crypto.KeyPair; +import org.hyperledger.besu.crypto.SECP256K1; +import org.hyperledger.besu.datatypes.*; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.junit.jupiter.api.Test; + +public class StateManagerStorageTest { + + final KeyPair senderKeyPair1 = new SECP256K1().generateKeyPair(); + final Address senderAddress1 = + Address.extract(Hash.hash(senderKeyPair1.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount1 = + ToyAccount.builder().balance(Wei.fromEth(123)).nonce(5).address(senderAddress1).build(); + + final KeyPair senderKeyPair2 = new SECP256K1().generateKeyPair(); + final Address senderAddress2 = + Address.extract(Hash.hash(senderKeyPair2.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount2 = + ToyAccount.builder().balance(Wei.fromEth(1231)).nonce(15).address(senderAddress2).build(); + + final KeyPair senderKeyPair3 = new SECP256K1().generateKeyPair(); + final Address senderAddress3 = + Address.extract(Hash.hash(senderKeyPair3.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount3 = + ToyAccount.builder().balance(Wei.fromEth(1231)).nonce(15).address(senderAddress3).build(); + + final KeyPair senderKeyPair4 = new SECP256K1().generateKeyPair(); + final Address senderAddress4 = + Address.extract(Hash.hash(senderKeyPair4.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount4 = + ToyAccount.builder().balance(Wei.fromEth(11)).nonce(115).address(senderAddress4).build(); + + final KeyPair senderKeyPair5 = new SECP256K1().generateKeyPair(); + final Address senderAddress5 = + Address.extract(Hash.hash(senderKeyPair5.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount5 = + ToyAccount.builder().balance(Wei.fromEth(12)).nonce(0).address(senderAddress5).build(); + + final KeyPair senderKeyPair6 = new SECP256K1().generateKeyPair(); + final Address senderAddress6 = + Address.extract(Hash.hash(senderKeyPair6.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount6 = + ToyAccount.builder().balance(Wei.fromEth(12)).nonce(6).address(senderAddress6).build(); + + final KeyPair senderKeyPair7 = new SECP256K1().generateKeyPair(); + final Address senderAddress7 = + Address.extract(Hash.hash(senderKeyPair7.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount7 = + ToyAccount.builder().balance(Wei.fromEth(231)).nonce(21).address(senderAddress7).build(); + private final String keyString = + "0x00010203040060708090A0B0C0DE0F10101112131415161718191A1B1C1D1E1F"; + private final Bytes32 key = Bytes32.fromHexString(keyString); + private final Bytes32 value1 = Bytes32.repeat((byte) 1); + private final Bytes32 value2 = Bytes32.repeat((byte) 2); + + private final Address receiverAddress = + Address.fromHexString("0x00000bad0000000000000000000000000000b077"); + final ToyAccount receiverAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .address(receiverAddress) + .code( + BytecodeCompiler.newProgram() + // SLOAD initial value + .push(key) + .op(OpCode.SLOAD) + .op(OpCode.POP) + // SSTORE value 1 + .push(value1) + .push(key) + .op(OpCode.SSTORE) + // SSTORE value 2 + .push(value2) + .push(key) + .op(OpCode.SSTORE) + .compile()) + .nonce(116) + .build(); + final List simpleKey = List.of(keyString); + final List duplicateKey = List.of(keyString, keyString); + final List simpleKeyAndTrash = + List.of(keyString, "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); + + final List warmOnlyReceiver = + List.of(AccessListEntry.createAccessListEntry(receiverAddress, simpleKey)); + + final List stupidWarmer = + List.of( + AccessListEntry.createAccessListEntry(receiverAddress, duplicateKey), + AccessListEntry.createAccessListEntry(senderAddress4, simpleKeyAndTrash), + AccessListEntry.createAccessListEntry(senderAddress1, simpleKeyAndTrash), + AccessListEntry.createAccessListEntry(senderAddress3, simpleKey), + AccessListEntry.createAccessListEntry(senderAddress7, duplicateKey)); + + @Test + void test_simple() { + + System.out.println("Sender address1: " + senderAddress1); + System.out.println("Sender address2: " + senderAddress2); + System.out.println("Sender address3: " + senderAddress3); + System.out.println("Sender address4: " + senderAddress4); + System.out.println("Sender address5: " + senderAddress5); + System.out.println("Sender address6: " + senderAddress6); + System.out.println("Sender address7: " + senderAddress7); + final Transaction pureTransferSender1 = + ToyTransaction.builder() + .sender(senderAccount1) + .to(receiverAccount) + .keyPair(senderKeyPair1) + .value(Wei.of(123)) + .build(); + final Transaction pureTransferSender2 = + ToyTransaction.builder() + .sender(senderAccount2) + .to(receiverAccount) + .keyPair(senderKeyPair2) + .value(Wei.of(120)) + .build(); + final Transaction pureTransferSender3 = + ToyTransaction.builder() + .sender(senderAccount3) + .to(receiverAccount) + .keyPair(senderKeyPair3) + .value(Wei.of(110)) + .build(); + final Transaction pureTransferSender4 = + ToyTransaction.builder() + .sender(senderAccount4) + .to(receiverAccount) + .keyPair(senderKeyPair4) + .value(Wei.of(10)) + .build(); + + MultiBlockExecutionEnvironment.MultiBlockExecutionEnvironmentBuilder builder = + MultiBlockExecutionEnvironment.builder(); + builder + .accounts( + List.of( + senderAccount1, + senderAccount2, + senderAccount3, + senderAccount4, + senderAccount5, + senderAccount6, + senderAccount7, + receiverAccount)) + .addBlock(List.of(pureTransferSender1, pureTransferSender2)) + .addBlock(List.of(pureTransferSender3, pureTransferSender4)) + .build() + .run(); + } + + @Test + void test_warming() { + System.out.println("Sender address1: " + senderAddress1); + System.out.println("Sender address2: " + senderAddress2); + System.out.println("Sender address3: " + senderAddress3); + System.out.println("Sender address4: " + senderAddress4); + System.out.println("Sender address5: " + senderAddress5); + System.out.println("Sender address6: " + senderAddress6); + System.out.println("Sender address7: " + senderAddress7); + final Transaction simpleWarm = + ToyTransaction.builder() + .sender(senderAccount1) + .to(receiverAccount) + .keyPair(senderKeyPair1) + .gasLimit(1000000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(warmOnlyReceiver) + .value(Wei.of(50000)) + .build(); + + final Transaction stupidWarm = + ToyTransaction.builder() + .sender(senderAccount2) + .to(receiverAccount) + .keyPair(senderKeyPair2) + .gasLimit(1000000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(stupidWarmer) + .value(Wei.of(50000)) + .build(); + + final Transaction noWarm = + ToyTransaction.builder() + .sender(senderAccount3) + .to(receiverAccount) + .keyPair(senderKeyPair3) + .gasLimit(1000000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(List.of()) + .value(Wei.of(50000)) + .build(); + MultiBlockExecutionEnvironment.MultiBlockExecutionEnvironmentBuilder builder = + MultiBlockExecutionEnvironment.builder(); + builder + .accounts( + List.of( + senderAccount1, + senderAccount2, + senderAccount3, + senderAccount4, + senderAccount5, + senderAccount6, + senderAccount7, + receiverAccount)) + .addBlock(List.of(simpleWarm, noWarm)) + .addBlock(List.of(stupidWarm)) + .build() + .run(); + } +} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseAccountTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseAccountTest.java new file mode 100644 index 0000000000..b7c5f8f615 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseAccountTest.java @@ -0,0 +1,151 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class BlockwiseAccountTest { + TestContext tc; + + @Test + void testBlockwiseMapAccount() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates, writes, reads and self-destructs generate 2 logs, + // Reverted operations only have 1 log + List.of(3, 3, 3, + 3, 3, 3, + 3, 3, 3, 1) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // Block 1 + .addBlock(List.of( + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 1L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[2], tc.addresses[0], 2L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 5L, false, BigInteger.ONE) + )) + .addBlock(List.of( + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 10L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[2], tc.addresses[0], 20L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 50L, false, BigInteger.ONE) + )) + .addBlock(List.of( + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 100L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[2], tc.addresses[0], 200L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 500L, false, BigInteger.ONE), + tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 1234L, true, BigInteger.ONE) + )) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + + Map> + blockMap = stateManagerMetadata.getAccountFirstLastBlockMap(); + + // prepare data for asserts + // expected first values for the keys we are testing + int noBlocks = 3; + Wei[][] expectedFirst = { + { + TestContext.defaultBalance, + TestContext.defaultBalance + }, + { + TestContext.defaultBalance.subtract(1L).add(2L).subtract(5L), + TestContext.defaultBalance.add(1L).subtract(2L).add(5L), + }, + { + TestContext.defaultBalance.subtract(1L).add(2L).subtract(5L) + .subtract(10L).add(20L).subtract(50L), + TestContext.defaultBalance.add(1L).subtract(2L).add(5L) + .add(10L).subtract(20L).add(50L), + }, + }; + // expected last values for the keys we are testing + Wei[][] expectedLast = { + { + TestContext.defaultBalance.subtract(1L).add(2L).subtract(5L), + TestContext.defaultBalance.add(1L).subtract(2L).add(5L), + }, + { + TestContext.defaultBalance.subtract(1L).add(2L).subtract(5L) + .subtract(10L).add(20L).subtract(50L), + TestContext.defaultBalance.add(1L).subtract(2L).add(5L) + .add(10L).subtract(20L).add(50L), + }, + { + TestContext.defaultBalance.subtract(1L).add(2L).subtract(5L) + .subtract(10L).add(20L).subtract(50L) + .subtract(100L).add(200L).subtract(500L), + TestContext.defaultBalance.add(1L).subtract(2L).add(5L) + .add(10L).subtract(20L).add(50L) + .add(100L).subtract(200L).add(500L) + }, + + }; + // prepare the key pairs + Address[] keys = { + tc.initialAccounts[0].getAddress(), + tc.initialAccounts[2].getAddress(), + }; + + + // blocks are numbered starting from 1 + for (int block = 1; block <= noBlocks; block++) { + for (int i = 0; i < keys.length; i++) { + StateManagerMetadata.AddrBlockPair key = + new StateManagerMetadata.AddrBlockPair( + keys[i], + block); + TransactionProcessingMetadata. FragmentFirstAndLast + accountData = blockMap.get(key); + // asserts for the first and last storage values in conflation + // -1 due to block numbering + assertEquals(expectedFirst[block-1][i], accountData.getFirst().oldState().balance()); + assertEquals(expectedLast[block-1][i], accountData.getLast().newState().balance()); + } + } + + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseDeplNoTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseDeplNoTest.java new file mode 100644 index 0000000000..ec0ad9e7d5 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseDeplNoTest.java @@ -0,0 +1,153 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class BlockwiseDeplNoTest { + TestContext tc; + + @Test + void testBlockwiseDeplNo() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates, writes, reads and self-destructs generate 2 logs, + // Reverted operations only have 1 log + List.of(2, 2, 2, 2, + 2, 2, + 2, 2, 1, 2, 1) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // Block 1 + .addBlock(List.of( + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[0], TestContext.snippetsCodeForCreate2, false), + tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[0], tc.frameworkEntryPointAddress, false, BigInteger.ONE), + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[0], TestContext.snippetsCodeForCreate2,false), + tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[0], tc.frameworkEntryPointAddress, false, BigInteger.ONE) + )) + .addBlock(List.of( + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[1], TestContext.snippetsCodeForCreate2, false), + tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], tc.frameworkEntryPointAddress, false, BigInteger.ONE) + )) + .addBlock(List.of( // test some reverted calls + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[2], TestContext.snippetsCodeForCreate2, false), + tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[2], tc.frameworkEntryPointAddress, false, BigInteger.ONE), + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[2], TestContext.snippetsCodeForCreate2, true), + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[2], TestContext.snippetsCodeForCreate2, false), + tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[2], tc.frameworkEntryPointAddress, true, BigInteger.ONE) + // since the last self-destruct gets reverted, the last call will not increase the deplNo + )) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + + Map + minDeplNoMap = stateManagerMetadata.getMinDeplNoBlock(); + Map + maxDeplNoMap = stateManagerMetadata.getMaxDeplNoBlock(); + + // prepare data for asserts + // expected first values for the keys we are testing + int noBlocks = 3; + Integer[][] expectedMin = { + { + 1, + null, + null + }, + { + null, + 1, + null + }, + { + null, + null, + 1 + }, + }; + // expected last values for the keys we are testing + Integer[][] expectedMax = { + { + 4, + null, + null, + }, + { + null, + 2, + null, + }, + { + null, + null, + 4 + }, + + + }; + // prepare the key pairs + Address[] keys = { + tc.newAddresses[0], + tc.newAddresses[1], + tc.newAddresses[2], + }; + + + // blocks are numbered starting from 1 + for (int block = 1; block <= noBlocks; block++) { + for (int i = 0; i < keys.length; i++) { + StateManagerMetadata.AddrBlockPair key = + new StateManagerMetadata.AddrBlockPair( + keys[i], + block); + Integer minNo = minDeplNoMap.get(key); + Integer maxNo = maxDeplNoMap.get(key); + // asserts for the first and last storage values in conflation + // -1 due to block numbering + assertEquals(expectedMin[block-1][i], minNo); + assertEquals(expectedMax[block-1][i], maxNo); + } + } + + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseStorageTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseStorageTest.java new file mode 100644 index 0000000000..890345e3f1 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/BlockwiseStorageTest.java @@ -0,0 +1,137 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class BlockwiseStorageTest { + TestContext tc; + + @Test + void testBlockwiseMapStorage() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates, writes, reads and self-destructs generate 2 logs, + // Reverted operations only have 1 log + List.of(2, 2, 2, + 2, 2, 2, + 2, 2, 2, 1) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + // compute the addresses for several accounts that will be deployed later + tc.newAddresses[0] = tc.getCreate2AddressForSnippet("0x0000000000000000000000000000000000000000000000000000000000000002"); + tc.newAddresses[1] = tc.getCreate2AddressForSnippet("0x0000000000000000000000000000000000000000000000000000000000000003"); + tc.newAddresses[2] = tc.getCreate2AddressForSnippet("0x0000000000000000000000000000000000000000000000000000000000000004"); + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // Block 1 + .addBlock(List.of( + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 1L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 2L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 3L, false, BigInteger.ONE) + )) + .addBlock(List.of( + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 4L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 5L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 6L, false, BigInteger.ONE) + )) + .addBlock(List.of( + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 7L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 8L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 9L, false, BigInteger.ONE), + tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 3L, 1234L, true, BigInteger.ONE) + )) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + + Map> + blockMap = stateManagerMetadata.getStorageFirstLastBlockMap(); + + // prepare data for asserts + // expected first values for the keys we are testing + int noBlocks = 3; + EWord[][] expectedFirst = { + { + EWord.of(0L), + }, + { + EWord.of(3L), + }, + { + EWord.of(6L), + }, + }; + // expected last values for the keys we are testing + EWord[][] expectedLast = { + { + EWord.of(3L), + }, + { + EWord.of(6L), + }, + { + EWord.of(9L), + }, + + }; + // prepare the key pairs + TransactionProcessingMetadata.AddrStorageKeyPair[] rawKeys = { + new TransactionProcessingMetadata.AddrStorageKeyPair(tc.initialAccounts[0].getAddress(), EWord.of(3L)), + }; + + + // blocks are numbered starting from 1 + for (int block = 1; block <= noBlocks; block++) { + for (int i = 0; i < rawKeys.length; i++) { + StateManagerMetadata.AddrStorageKeyBlockNumTuple key = + new StateManagerMetadata.AddrStorageKeyBlockNumTuple( + rawKeys[i], + block); + TransactionProcessingMetadata. FragmentFirstAndLast + storageData = blockMap.get(key); + // asserts for the first and last storage values in conflation + // -1 due to block numbering + assertEquals(expectedFirst[block-1][i], storageData.getFirst().getValueCurrent()); + assertEquals(expectedLast[block-1][i], storageData.getLast().getValueNext()); + } + } + + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/ConflationAccountTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/ConflationAccountTest.java new file mode 100644 index 0000000000..c72d9b1c85 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/ConflationAccountTest.java @@ -0,0 +1,126 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ConflationAccountTest { + TestContext tc; + @Test + void testConflationMapAccount() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates and self-destructs generate 2 logs, + // Transfers generate 3 logs, the 1s are for reverted operations + List.of(3, 3, 1, 3, + 2, 3, 3, + 2, 3, 2, 2, 3, + 2, 1) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // test account operations for an account prexisting in the state + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 8L, false, BigInteger.ONE))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[2], tc.addresses[0], 20L, false, BigInteger.ONE))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 50L, true, BigInteger.ONE))) // this action is reverted + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 10L, false, BigInteger.ONE))) + // deploy another account ctxt.addresses[3] and perform account operations on it + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[0], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.newAddresses[0], 49L, false, BigInteger.ONE))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[0], tc.addresses[0], 27L, false, BigInteger.ONE))) + // deploy another account and self destruct it at the end, redeploy it and change its balance again + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[1], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.newAddresses[1], 98L, false, BigInteger.ONE))) + .addBlock(List.of(tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], tc.addresses[2], false, BigInteger.ONE))) + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[1], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.newAddresses[1], 123L, false, BigInteger.ONE))) + // deploy a new account and check revert operations on it + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[2], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[2], tc.newAddresses[2], 1L, true, BigInteger.ONE))) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + Map> + conflationMap = stateManagerMetadata.getAccountFirstLastConflationMap(); + + // prepare data for asserts + // expected first values for the keys we are testing + Wei[] expectedFirst = { + TestContext.defaultBalance, + TestContext.defaultBalance, + Wei.of(0L), + Wei.of(0L), + Wei.of(0L) + }; + // expected last values for the keys we are testing + Wei[] expectedLast = { + TestContext.defaultBalance.subtract(8L).add(20L). + subtract(10L).subtract(49L).add(27L) + .subtract(98L).subtract(123L), + TestContext.defaultBalance.add(8L).subtract(20L).add(10L) + .add(98L), // 98L obtained from the self destruct of the account at ctxt.addresses[4] + Wei.of(0L).add(49L).subtract(27L), + Wei.of(123L), + Wei.of(0L) + }; + + // prepare the key pairs + Address[] keys = { + tc.initialAccounts[0].getAddress(), + tc.initialAccounts[2].getAddress(), + tc.newAddresses[0], + tc.newAddresses[1], + tc.newAddresses[2] + }; + + for (int i = 0; i < keys.length; i++) { + System.out.println("Index is "+i); + TransactionProcessingMetadata. FragmentFirstAndLast + accountData = conflationMap.get(keys[i]); + // asserts for the first and last storage values in conflation + assertEquals(expectedFirst[i], accountData.getFirst().oldState().balance()); + assertEquals(expectedLast[i], accountData.getLast().newState().balance()); + } + + + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/ConflationStorageTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/ConflationStorageTest.java new file mode 100644 index 0000000000..623963aa2c --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/ConflationStorageTest.java @@ -0,0 +1,163 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.*; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.*; + +import static org.assertj.core.api.Fail.fail; +import static org.junit.jupiter.api.Assertions.*; + +public class ConflationStorageTest { + TestContext tc; + + @Test + void testConflationMapStorage() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates, writes, reads and self-destructs generate 2 logs, + // Reverted operations only have 1 log + List.of(2, 2, 2, 2, 2, + 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 1) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // test storage operations for an account prexisting in the state + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, 8L, false, BigInteger.ONE))) + .addBlock(List.of(tc.readFromStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, false, BigInteger.ONE))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, 10L, false, BigInteger.ONE))) + .addBlock(List.of(tc.readFromStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, false, BigInteger.ONE))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, 15L, false, BigInteger.ONE))) + // deploy another account and perform storage operations on it + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[0], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[0], 345L, 20L, false, BigInteger.ONE))) + .addBlock(List.of(tc.readFromStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[0], 345L, false, BigInteger.ONE))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[0], 345L, 40L, false, BigInteger.ONE))) + // deploy another account and self destruct it at the end, redeploy it and change the storage again + // the salt will be the same twice in a row, which will be on purpose + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[1], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], 400L, 12L, false, BigInteger.ONE))) + .addBlock(List.of(tc.readFromStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], 400L, false, BigInteger.ONE))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], 400L, 13L, false, BigInteger.ONE))) + .addBlock(List.of(tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], tc.frameworkEntryPointAddress, false, BigInteger.ONE))) + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[1], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[1], 400L, 99L, false, BigInteger.ONE))) + // deploy a new account and check revert operations on it + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, tc.salts[2], TestContext.snippetsCodeForCreate2, false))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[2], 500L, 23L, false, BigInteger.ONE))) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[2], 500L, 53L, true, BigInteger.ONE))) // revert flag on + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.newAddresses[2], 500L, 63L, true, BigInteger.ONE))) // revert flag on + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + Map> + conflationMap = stateManagerMetadata.getAccountFirstLastConflationMap(); + Map> + conflationStorage = stateManagerMetadata.getStorageFirstLastConflationMap(); + + // prepare data for asserts + // expected first values for the keys we are testing + EWord[] expectedFirst = { + EWord.of(0L), + EWord.of(0), + EWord.of(0), + EWord.of(0) + }; + // expected last values for the keys we are testing + EWord[] expectedLast = { + EWord.of(15L), + EWord.of(40L), + EWord.of(99L), + EWord.of(23L) + }; + // prepare the key pairs + TransactionProcessingMetadata.AddrStorageKeyPair[] keys = { + new TransactionProcessingMetadata.AddrStorageKeyPair(tc.initialAccounts[0].getAddress(), EWord.of(123L)), + new TransactionProcessingMetadata.AddrStorageKeyPair(tc.newAddresses[0], EWord.of(345L)), + new TransactionProcessingMetadata.AddrStorageKeyPair(tc.newAddresses[1], EWord.of(400L)), + new TransactionProcessingMetadata.AddrStorageKeyPair(tc.newAddresses[2], EWord.of(500L)) + }; + + for (int i = 0; i < keys.length; i++) { + TransactionProcessingMetadata. FragmentFirstAndLast + storageData = conflationStorage.get(keys[i]); + // asserts for the first and last storage values in conflation + assertEquals(expectedFirst[i], storageData.getFirst().getValueCurrent()); + assertEquals(expectedLast[i], storageData.getLast().getValueNext()); + } + System.out.println("Done"); + } +} + +/* + TransactionProcessingResultValidator resultValidator = + (Transaction transaction, TransactionProcessingResult result) -> { + // One event from the snippet + // One event from the framework entrypoint about contract call + //assertEquals(result.getLogs().size(), 1); + System.out.println("Number of logs: "+result.getLogs().size()); + var noTopics = result.getLogs().size(); + for (Log log : result.getLogs()) { + String logTopic = log.getTopics().getFirst().toHexString(); + String callEventSignature = EventEncoder.encode(FrameworkEntrypoint.CALLEXECUTED_EVENT); + String writeEventSignature = EventEncoder.encode(FrameworkEntrypoint.WRITE_EVENT); + String readEventSignature = EventEncoder.encode(FrameworkEntrypoint.READ_EVENT); + String destructEventSignature = EventEncoder.encode(FrameworkEntrypoint.CONTRACTDESTROYED_EVENT); + if (callEventSignature.equals(logTopic)) { + FrameworkEntrypoint.CallExecutedEventResponse response = + FrameworkEntrypoint.getCallExecutedEventFromLog(Web3jUtils.fromBesuLog(log)); + assertTrue(response.isSuccess); + assertEquals(response.destination, this.testContext.initialAccounts[0].getAddress().toHexString()); + continue; + } + if (writeEventSignature.equals(logTopic)) { + // write event + continue; + } + if (readEventSignature.equals(logTopic)) { + // read event + continue; + } + if (destructEventSignature.equals(logTopic)) { + // self destruct + continue; + } + fail(); + } + }; + */ \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/StateManagerTestValidator.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/StateManagerTestValidator.java new file mode 100644 index 0000000000..03f3394f25 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/StateManagerTestValidator.java @@ -0,0 +1,86 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer.statemanager; + +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.testing.Web3jUtils; +import net.consensys.linea.testing.generated.FrameworkEntrypoint; +import net.consensys.linea.testing.generated.StateManagerEvents; +import net.consensys.linea.testing.generated.TestSnippet_Events; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult; +import org.hyperledger.besu.evm.log.Log; +import org.web3j.abi.EventEncoder; + +import java.util.List; + +import static org.assertj.core.api.Fail.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@RequiredArgsConstructor +public class StateManagerTestValidator implements TransactionProcessingResultValidator { + @NonNull + ToyAccount frameworkEntryPointAccount; + @NonNull + List expectedNoLogs; + int txCounter = 0; + @Override + public void accept(Transaction transaction, TransactionProcessingResult result) { + TransactionProcessingResultValidator.DEFAULT_VALIDATOR.accept(transaction, result); + // One event from the snippet + // One event from the framework entrypoint about contract call + System.out.println("Number of logs: "+result.getLogs().size()); + assertEquals(expectedNoLogs.get(txCounter), result.getLogs().size()); + for (int i = 0; i < result.getLogs().size(); i++) { + Log currentLog = result.getLogs().get(i); + String callEventSignature = EventEncoder.encode(FrameworkEntrypoint.CALLEXECUTED_EVENT); + String writeEventSignature = EventEncoder.encode(StateManagerEvents.WRITE_EVENT); + String readEventSignature = EventEncoder.encode(StateManagerEvents.READ_EVENT); + String destroyedEventSignature = EventEncoder.encode(FrameworkEntrypoint.CONTRACTDESTROYED_EVENT); + String createdEventSignature = EventEncoder.encode(FrameworkEntrypoint.CONTRACTCREATED_EVENT); + String sentETHEventSignature = EventEncoder.encode(StateManagerEvents.PAYETH_EVENT); + String recETHEventSignature = EventEncoder.encode(StateManagerEvents.RECETH_EVENT); + String logTopic = currentLog.getTopics().getFirst().toHexString(); + if (EventEncoder.encode(TestSnippet_Events.DATANOINDEXES_EVENT).equals(logTopic)) { + TestSnippet_Events.DataNoIndexesEventResponse response = + TestSnippet_Events.getDataNoIndexesEventFromLog(Web3jUtils.fromBesuLog(currentLog)); + //assertEquals(response.singleInt, BigInteger.valueOf(123456)); + } else if (EventEncoder.encode(FrameworkEntrypoint.CALLEXECUTED_EVENT) + .equals(logTopic)) { + FrameworkEntrypoint.CallExecutedEventResponse response = + FrameworkEntrypoint.getCallExecutedEventFromLog(Web3jUtils.fromBesuLog(currentLog)); + if (i > 0 && !result.getLogs().get(i-1).getTopics().getFirst().toHexString().equals(callEventSignature)) { + // when the number of logs is 1, in our tests we will have an operation + // with the revert flag set to true. + assertTrue(response.isSuccess); + } + if (logTopic.equals(createdEventSignature)) { + assertEquals(response.destination, frameworkEntryPointAccount.getAddress().toHexString()); + } else { + //assertEquals(response.destination, this.testContext.initialAccounts[0].getAddress().toHexString()); + } + } else { + if (!(logTopic.equals(callEventSignature) || logTopic.equals(writeEventSignature) || logTopic.equals(readEventSignature) || logTopic.equals(destroyedEventSignature) || logTopic.equals(createdEventSignature) || logTopic.equals(sentETHEventSignature) || logTopic.equals(recETHEventSignature))) { + fail(); + } + } + } + txCounter++; + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TestContext.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TestContext.java new file mode 100644 index 0000000000..7c47bf0868 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TestContext.java @@ -0,0 +1,278 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer.statemanager; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import net.consensys.linea.testing.*; +import net.consensys.linea.testing.generated.FrameworkEntrypoint; +import net.consensys.linea.zktracer.types.AddressUtils; +import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.crypto.KeyPair; +import org.hyperledger.besu.crypto.SECP256K1; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Hash; +import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.web3j.abi.FunctionEncoder; +import org.web3j.abi.datatypes.DynamicArray; +import org.web3j.abi.datatypes.Function; +import org.web3j.abi.datatypes.generated.Uint256; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.assertj.core.api.Fail.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +@NoArgsConstructor +public class TestContext { + Long txNonce = null; + static final Long gasLimit = 5000000L; + static final Wei defaultBalance = Wei.of(4500L); + static final int numberOfAccounts = 10; + static final int numberOfNewAccounts = 10; + static final int numberOfEOA = 1; + static final Bytes snippetsCode = SmartContractUtils.getYulContractRuntimeByteCode("StateManagerSnippets.yul"); + static final Bytes snippetsCodeForCreate2 = SmartContractUtils.getYulContractCompiledByteCode("StateManagerSnippets.yul"); + @Getter + ToyAccount frameworkEntryPointAccount; + Address frameworkEntryPointAddress; + ToyAccount[] initialAccounts; + ToyAccount[] externallyOwnedAccounts; + KeyPair[] keyPairs; + Address[] addresses; + Address[] newAddresses; + String[] salts = new String[numberOfNewAccounts]; + public void initializeTestContext() { + // initialize vectors + initialAccounts = new ToyAccount[numberOfAccounts]; + addresses = new Address[numberOfAccounts]; + externallyOwnedAccounts = new ToyAccount[numberOfEOA]; + keyPairs = new KeyPair[numberOfEOA]; + newAddresses = new Address[numberOfNewAccounts]; + // generate externally owned accounts + for (int i = 0; i < numberOfEOA; i++) { + KeyPair keyPair = new SECP256K1().generateKeyPair(); + Address senderAddress = Address.extract(Hash.hash(keyPair.getPublicKey().getEncodedBytes())); + externallyOwnedAccounts[i] = + ToyAccount.builder().balance(Wei.fromEth(1)).nonce(5).address(senderAddress).build(); + keyPairs[i] = keyPair; + } + // initialize the testing framework entry point account + frameworkEntryPointAccount = + ToyAccount.builder() + .address(Address.fromHexString("0x123456")) + .balance(defaultBalance) + .nonce(5) + .code(SmartContractUtils.getSolidityContractRuntimeByteCode(FrameworkEntrypoint.class)) + .build(); + frameworkEntryPointAddress = frameworkEntryPointAccount.getAddress(); + // add to arrays + // initialize the .yul snippets account + // load the .yul bytecode + for (int i = 0; i < numberOfAccounts; i++) { + + initialAccounts[i] = + ToyAccount.builder() + .address(Address.fromHexString("0x" + i + i + i + i + i)) + .balance(defaultBalance) + .nonce(6) + .code(TestContext.snippetsCode) + .build(); + addresses[i] = initialAccounts[i].getAddress(); + } + + // initialize the new addresses vector + for (int i = 0; i < numberOfAccounts; i++) { + salts[i] = "0x000000000000000000000000000000000000000000000000000000000000000" + i; + newAddresses[i] = getCreate2AddressForSnippet(salts[i]); + } + } + + // destination must be our .yul smart contract + Transaction newTxFromCalls(ToyAccount sender, KeyPair senderKeyPair, FrameworkEntrypoint.ContractCall[] contractCalls) { + Function frameworkEntryPointFunction = + new Function( + FrameworkEntrypoint.FUNC_EXECUTECALLS, + List.of(new DynamicArray<>(FrameworkEntrypoint.ContractCall.class, contractCalls)), + Collections.emptyList()); + Bytes txPayload = + Bytes.fromHexStringLenient(FunctionEncoder.encode(frameworkEntryPointFunction)); + + + ToyTransaction.ToyTransactionBuilder tempTx = ToyTransaction.builder() + .sender(sender) + .to(this.frameworkEntryPointAccount) + .payload(txPayload) + .keyPair(senderKeyPair) + .gasLimit(TestContext.gasLimit); + + if (this.txNonce != null) { + tempTx = tempTx.nonce(++this.txNonce); + } + Transaction tx = tempTx.build(); + if (this.txNonce == null) { + this.txNonce = tx.getNonce(); + } + return tx; + } + + + // destination must be our .yul smart contract + FrameworkEntrypoint.ContractCall writeToStorageCall(Address destination, Long key, Long value, boolean revertFlag, BigInteger callType) { + Function yulFunction = new Function("writeToStorage", + Arrays.asList(new Uint256(BigInteger.valueOf(key)), new Uint256(BigInteger.valueOf(value)), new org.web3j.abi.datatypes.Bool(revertFlag)), + Collections.emptyList()); + + var encoding = FunctionEncoder.encode(yulFunction); + FrameworkEntrypoint.ContractCall snippetContractCall = + new FrameworkEntrypoint.ContractCall( + /*Address*/ destination.toHexString(), + /*calldata*/ Bytes.fromHexStringLenient(encoding).toArray(), + /*gasLimit*/ BigInteger.ZERO, + /*value*/ BigInteger.ZERO, + /*callType*/ callType); + return snippetContractCall; + } + + + // destination must be our .yul smart contract + Transaction writeToStorage(ToyAccount sender, KeyPair senderKeyPair, Address destination, Long key, Long value, boolean revertFlag, BigInteger callType) { + FrameworkEntrypoint.ContractCall snippetContractCall = writeToStorageCall(destination, key, value, revertFlag, callType); + return newTxFromCalls(sender, senderKeyPair, new FrameworkEntrypoint.ContractCall[]{snippetContractCall}); + } + + + FrameworkEntrypoint.ContractCall readFromStorageCall(ToyAccount sender, KeyPair senderKeyPair, Address destination, Long key, boolean revertFlag, BigInteger callType) { + Function yulFunction = new Function("readFromStorage", + Arrays.asList(new Uint256(BigInteger.valueOf(key)), new org.web3j.abi.datatypes.Bool(revertFlag)), + Collections.emptyList()); + + + var encoding = FunctionEncoder.encode(yulFunction); + FrameworkEntrypoint.ContractCall snippetContractCall = + new FrameworkEntrypoint.ContractCall( + /*Address*/ destination.toHexString(), + /*calldata*/ Bytes.fromHexStringLenient(encoding).toArray(), + /*gasLimit*/ BigInteger.ZERO, + /*value*/ BigInteger.ZERO, + /*callType*/ callType); + + return snippetContractCall; + } + + + // destination must be our .yul smart contract + Transaction readFromStorage(ToyAccount sender, KeyPair senderKeyPair, Address destination, Long key, boolean revertFlag, BigInteger callType) { + FrameworkEntrypoint.ContractCall snippetContractCall = readFromStorageCall(sender, senderKeyPair, destination, key, revertFlag, callType); + return newTxFromCalls(sender, senderKeyPair, new FrameworkEntrypoint.ContractCall[]{snippetContractCall}); + } + + // destination must be our .yul smart contract + Transaction selfDestruct(ToyAccount sender, KeyPair senderKeyPair, Address destination, Address recipient, boolean revertFlag, BigInteger callType) { + FrameworkEntrypoint.ContractCall snippetContractCall = selfDestructCall(destination, recipient, revertFlag, callType); + return newTxFromCalls(sender, senderKeyPair, new FrameworkEntrypoint.ContractCall[]{snippetContractCall}); + } + + // destination must be our .yul smart contract + FrameworkEntrypoint.ContractCall selfDestructCall(Address destination, Address recipient, boolean revertFlag, BigInteger callType) { + String recipientAddressString = recipient.toHexString(); + Function yulFunction = new Function("selfDestruct", + Arrays.asList(new org.web3j.abi.datatypes.Address(recipientAddressString), new org.web3j.abi.datatypes.Bool(revertFlag)), + Collections.emptyList()); + + + var encoding = FunctionEncoder.encode(yulFunction); + FrameworkEntrypoint.ContractCall snippetContractCall = + new FrameworkEntrypoint.ContractCall( + /*Address*/ destination.toHexString(), + /*calldata*/ Bytes.fromHexStringLenient(encoding).toArray(), + /*gasLimit*/ BigInteger.ZERO, + /*value*/ BigInteger.ZERO, + /*callType*/ callType); // Normal call, not a delegate call as would be the default + + return snippetContractCall; + } + + // destination must be our .yul smart contract + Transaction transferTo(ToyAccount sender, KeyPair senderKeyPair, Address destination, Address recipient, long amount, boolean revertFlag, BigInteger callType) { + FrameworkEntrypoint.ContractCall snippetContractCall = transferToCall(destination, recipient, amount, revertFlag, callType); + return newTxFromCalls(sender, senderKeyPair, new FrameworkEntrypoint.ContractCall[]{snippetContractCall}); + } + + FrameworkEntrypoint.ContractCall transferToCall(Address destination, Address recipient, long amount, boolean revertFlag, BigInteger callType) { + String recipientAddressString = recipient.toHexString(); + Function yulFunction = new Function("transferTo", + Arrays.asList(new org.web3j.abi.datatypes.Address(recipientAddressString), new Uint256(amount), new org.web3j.abi.datatypes.Bool(revertFlag)), + Collections.emptyList()); + + + var encoding = FunctionEncoder.encode(yulFunction); + FrameworkEntrypoint.ContractCall snippetContractCall = + new FrameworkEntrypoint.ContractCall( + /*Address*/ destination.toHexString(), + /*calldata*/ Bytes.fromHexStringLenient(encoding).toArray(), + /*gasLimit*/ BigInteger.ZERO, + /*value*/ BigInteger.ZERO, + /*callType*/ callType); // Normal call, not a delegate call as would be the default + return snippetContractCall; + } + + + + + // destination must be our .yul smart contract + Transaction deployWithCreate2(ToyAccount sender, KeyPair senderKeyPair, Address destination, String saltString, Bytes contractBytes, boolean revertFlag) { + FrameworkEntrypoint.ContractCall snippetContractCall = deployWithCreate2Call(destination, saltString, contractBytes, revertFlag); + return newTxFromCalls(sender, senderKeyPair, new FrameworkEntrypoint.ContractCall[]{snippetContractCall}); + } + + FrameworkEntrypoint.ContractCall deployWithCreate2Call(Address destination, String saltString, Bytes contractBytes, boolean revertFlag) { + Bytes salt = Bytes.fromHexStringLenient(saltString); + // the following is the bytecode of the .yul contract + // Bytes yulContractBytes = Bytes.fromHexStringLenient("61037d61001060003961037d6000f3fe6100076102e1565b63a770741d8114610064576397deb47b81146100715763acf07154811461007d57632d97bf1081146100b45763eba7ff7f81146100e757632b261e94811461012157633ecfd51e811461015b5763ffffffff811461017057600080fd5b61006c610177565b610171565b60005460005260206000f35b6004356024356044356100918183856102c7565b61009b828461019d565b600181036100ac576100ab61034d565b5b505050610171565b6004356024356100c481836102cf565b6100ce81846101da565b600182036100df576100de61034d565b5b505050610171565b6004356024356100f682610253565b600081036101095761010881836102db565b5b6001810361011a5761011961034d565b5b5050610171565b6004356024356044353061013682848661030a565b610141838583610217565b600182036101525761015161034d565b5b50505050610171565b61016361028b565b61016b61037a565b610171565b5b5061037c565b7f0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef600055565b7f577269746528616464726573732c75696e743235362c75696e74323536290000604051818152601e8120308585828460606020a4505050505050565b7f5265616428616464726573732c75696e743235362c75696e7432353629202020604051818152601d8120308585828460606020a4505050505050565b7f50617945544828616464726573732c616464726573732c75696e743235362900604051818152601f81208585858360606020a4505050505050565b7f436f6e747261637444657374726f796564286164647265737329000000000000604051818152601a8120838160606020a250505050565b7f52656345544828616464726573732c75696e743235362900000000000000000060405181815260178120303480828460606020a35050505050565b818155505050565b60008154905092915050565b80ff5050565b60007c010000000000000000000000000000000000000000000000000000000060003504905090565b6040517f3ecfd51e0000000000000000000000000000000000000000000000000000000080825260008060208487875af18061034557600080fd5b505050505050565b7f526576657274696e67000000000000000000000000000000000000000000000060206040518281528181fd5b565b"); + // prepare the Create2 function + Function create2Function = + new Function( + FrameworkEntrypoint.FUNC_DEPLOYWITHCREATE2, + Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(salt.toArray()), + new org.web3j.abi.datatypes.DynamicBytes(contractBytes.toArray()), + new org.web3j.abi.datatypes.Bool(revertFlag)), + Collections.emptyList()); + + String encoding = FunctionEncoder.encode(create2Function); + + FrameworkEntrypoint.ContractCall snippetContractCall = + new FrameworkEntrypoint.ContractCall( + /*Address*/ destination.toHexString(), + /*calldata*/ Bytes.fromHexStringLenient(encoding).toArray(), + /*gasLimit*/ BigInteger.ZERO, + /*value*/ BigInteger.ZERO, + /*callType*/ BigInteger.ONE); // Normal call, not a delegate call as it is the default + + return snippetContractCall; + } + + public Address getCreate2AddressForSnippet(String salt) { + org.apache.tuweni.bytes.Bytes32 initCodeHash = org.hyperledger.besu.crypto.Hash.keccak256(Bytes.wrap(TestContext.snippetsCodeForCreate2)); + org.apache.tuweni.bytes.Bytes32 targetAddress = AddressUtils.getCreate2RawAddress(frameworkEntryPointAccount.getAddress(), + org.apache.tuweni.bytes.Bytes32.wrap(Bytes.fromHexStringLenient(salt).toArray()), + initCodeHash); + return Address.extract(targetAddress); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TransactionAccountTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TransactionAccountTest.java new file mode 100644 index 0000000000..014450b951 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TransactionAccountTest.java @@ -0,0 +1,142 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.testing.generated.FrameworkEntrypoint; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TransactionAccountTest { + TestContext tc; + + @Test + void testTransactionMapAccount() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates, writes, reads and self-destructs generate 2 logs, + // transfers generate 3 logs + // Reverted operations only have 1 log + List.of(10, 10) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // Block 1 + .addBlock(List.of( + tc.newTxFromCalls(tc.externallyOwnedAccounts[0], tc.keyPairs[0], new FrameworkEntrypoint.ContractCall[] + { + tc.transferToCall(tc.addresses[0], tc.addresses[2], 8L, false, BigInteger.ONE), + tc.transferToCall(tc.addresses[2], tc.addresses[0], 9L, false, BigInteger.ONE), + tc.transferToCall(tc.addresses[0], tc.addresses[2], 15L, false, BigInteger.ONE), + tc.transferToCall(tc.addresses[2], tc.addresses[0], 1234L, true, BigInteger.ONE), // revert this one + }), + tc.newTxFromCalls(tc.externallyOwnedAccounts[0], tc.keyPairs[0], new FrameworkEntrypoint.ContractCall[] + { + tc.transferToCall(tc.addresses[0], tc.addresses[2], 200L, false, BigInteger.ONE), + tc.transferToCall(tc.addresses[2], tc.addresses[0], 500L, false, BigInteger.ONE), + tc.transferToCall(tc.addresses[2], tc.addresses[0], 1234L, true, BigInteger.ONE), // revert this one + tc.transferToCall(tc.addresses[0], tc.addresses[2], 900L, false, BigInteger.ONE), + }) + + )) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + + List txn = Hub.stateManagerMetadata().getHub().txStack().getTransactions();; + + + + // prepare data for asserts + // expected first values for the keys we are testing + Wei[][] expectedFirst = { + { + TestContext.defaultBalance, + TestContext.defaultBalance, + }, + { + TestContext.defaultBalance.subtract(8L).add(9L). + subtract(15L), + TestContext.defaultBalance.add(8L).subtract(9L). + add(15L), + } + }; + + // expected last values for the keys we are testing + Wei[][] expectedLast = { + { + TestContext.defaultBalance.subtract(8L).add(9L). + subtract(15L), + TestContext.defaultBalance.add(8L).subtract(9L). + add(15L), + }, + { + TestContext.defaultBalance.subtract(8L).add(9L). + subtract(15L).subtract(200L).add(500L). + subtract(900L), + TestContext.defaultBalance.add(8L).subtract(9L). + add(15L).add(200L).subtract(500L). + add(900L), + } + }; + + // prepare the key pairs + Address[] keys = { + tc.initialAccounts[0].getAddress(), + tc.initialAccounts[2].getAddress(), + }; + + // blocks are numbered starting from 1 + for (int txCounter = 1; txCounter <= txn.size(); txCounter++) { + Map> + accountMap = txn.get(txCounter-1).getAccountFirstAndLastMap(); + for (int i = 0; i < keys.length; i++) { + TransactionProcessingMetadata. FragmentFirstAndLast + accountData = accountMap.get(keys[i]); + // asserts for the first and last storage values in conflation + // -1 due to block numbering + assertEquals(expectedFirst[txCounter-1][i], accountData.getFirst().oldState().balance()); + assertEquals(expectedLast[txCounter-1][i], accountData.getLast().newState().balance()); + } + } + + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TransactionStorageTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TransactionStorageTest.java new file mode 100644 index 0000000000..384ecac1d0 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/TransactionStorageTest.java @@ -0,0 +1,126 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import net.consensys.linea.testing.generated.FrameworkEntrypoint; +import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; +import net.consensys.linea.zktracer.module.hub.fragment.storage.StorageFragment; +import net.consensys.linea.zktracer.module.hub.transients.StateManagerMetadata; +import net.consensys.linea.zktracer.types.EWord; +import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TransactionStorageTest { + TestContext tc; + + @Test + void testTransactionMapStorage() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + // prepare the transaction validator + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates, writes, reads and self-destructs generate 2 logs, + // Reverted operations only have 1 log + List.of(7, 7) + ); + // fetch the Hub metadata for the state manager maps + StateManagerMetadata stateManagerMetadata = Hub.stateManagerMetadata(); + + // prepare a multi-block execution of transactions + MultiBlockExecutionEnvironment.builder() + // initialize accounts + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + // Block 1 + .addBlock(List.of( + tc.newTxFromCalls(tc.externallyOwnedAccounts[0], tc.keyPairs[0], new FrameworkEntrypoint.ContractCall[] + { + tc.writeToStorageCall(tc.addresses[0], 3L, 1L, false, BigInteger.ONE), + tc.writeToStorageCall(tc.addresses[0], 3L, 2L, false, BigInteger.ONE), + tc.writeToStorageCall(tc.addresses[0], 3L, 3L, false, BigInteger.ONE), + tc.writeToStorageCall(tc.addresses[0], 3L, 1234L, true, BigInteger.ONE), + }), + tc.newTxFromCalls(tc.externallyOwnedAccounts[0], tc.keyPairs[0], new FrameworkEntrypoint.ContractCall[] + { + tc.writeToStorageCall(tc.addresses[0], 3L, 1234L, true, BigInteger.ONE), + tc.writeToStorageCall(tc.addresses[0], 3L, 4L, false, BigInteger.ONE), + tc.writeToStorageCall(tc.addresses[0], 3L, 5L, false, BigInteger.ONE), + tc.writeToStorageCall(tc.addresses[0], 3L, 6L, false, BigInteger.ONE), + }) + + )) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + + + List txn = Hub.stateManagerMetadata().getHub().txStack().getTransactions();; + + + + // prepare data for asserts + // expected first values for the keys we are testing + int noBlocks = 3; + EWord[][] expectedFirst = { + { + EWord.of(0L), + }, + { + EWord.of(3L), + }, + }; + // expected last values for the keys we are testing + EWord[][] expectedLast = { + { + EWord.of(3L), + }, + { + EWord.of(6L), + }, + }; + // prepare the key pairs + TransactionProcessingMetadata.AddrStorageKeyPair[] keys = { + new TransactionProcessingMetadata.AddrStorageKeyPair(tc.initialAccounts[0].getAddress(), EWord.of(3L)), + }; + + + // blocks are numbered starting from 1 + for (int txCounter = 1; txCounter <= txn.size(); txCounter++) { + Map> + storageMap = txn.get(txCounter-1).getStorageFirstAndLastMap(); + for (int i = 0; i < keys.length; i++) { + TransactionProcessingMetadata. FragmentFirstAndLast + storageData = storageMap.get(keys[i]); + // asserts for the first and last storage values in conflation + // -1 due to block numbering + assertEquals(expectedFirst[txCounter-1][i], storageData.getFirst().getValueCurrent()); + assertEquals(expectedLast[txCounter-1][i], storageData.getLast().getValueNext()); + } + } + + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/UtilitiesTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/UtilitiesTest.java new file mode 100644 index 0000000000..483cf05ecd --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/statemanager/UtilitiesTest.java @@ -0,0 +1,81 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.statemanager; + +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.TransactionProcessingResultValidator; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class UtilitiesTest { + TestContext tc; + + @Test + void testBuildingBlockOperations() { + // initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + // Creates and self-destructs generate 2 logs, + // Transfers generate 3 logs, the 1s are for reverted operations + List.of(2, 2, 3, 2, 2) + ); + + MultiBlockExecutionEnvironment.builder() + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.initialAccounts[2], tc.frameworkEntryPointAccount)) + .addBlock(List.of(tc.writeToStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, 1L, false, BigInteger.ZERO))) + .addBlock(List.of(tc.readFromStorage(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], 123L, false, BigInteger.ZERO))) + .addBlock(List.of(tc.transferTo(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.addresses[2], 8L, false, BigInteger.ONE))) + // test operations above, before self-destructing a snippet in the next line + .addBlock(List.of(tc.selfDestruct(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.addresses[0], tc.frameworkEntryPointAddress, false, BigInteger.ONE))) // use BigInteger.ONE, otherwise the framework entry point gets destroyed + .addBlock(List.of(tc.deployWithCreate2(tc.externallyOwnedAccounts[0], tc.keyPairs[0], tc.frameworkEntryPointAddress, "0x0000000000000000000000000000000000000000000000000000000000000002", TestContext.snippetsCodeForCreate2, false))) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + System.out.println("Done"); + } + + // Create 2 has a weird behavior and does not seem to work with the + // bytecode output by the function SmartContractUtils.getYulContractByteCode("StateManagerSnippets.yul") + @Test + void testCreate2Snippets() { +// initialize the test context + this.tc = new TestContext(); + this.tc.initializeTestContext(); + TransactionProcessingResultValidator resultValidator = new StateManagerTestValidator( + tc.frameworkEntryPointAccount, + List.of(2) + ); + MultiBlockExecutionEnvironment.builder() + .accounts(List.of(tc.initialAccounts[0], tc.externallyOwnedAccounts[0], tc.frameworkEntryPointAccount)) + .addBlock(List.of( + tc.deployWithCreate2(tc.externallyOwnedAccounts[0], + tc.keyPairs[0], + tc.frameworkEntryPointAddress, + "0x0000000000000000000000000000000000000000000000000000000000004312", + TestContext.snippetsCodeForCreate2, + false))) + .transactionProcessingResultValidator(resultValidator) + .build() + .run(); + System.out.println("Done"); + } +} \ No newline at end of file diff --git a/linea-constraints b/linea-constraints index 909628d415..d60e76258c 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 909628d4159e412ff78ee2803ce9b1579aca1a55 +Subproject commit d60e76258cd71d43bd59e2993dfc322c6f4ed1fd diff --git a/testing/src/main/resources/templates/compiler_yul.json.template b/testing/src/main/resources/templates/compiler_yul.json.template index a41daf4d5c..4e7cc62b2f 100644 --- a/testing/src/main/resources/templates/compiler_yul.json.template +++ b/testing/src/main/resources/templates/compiler_yul.json.template @@ -16,4 +16,3 @@ } } } - diff --git a/testing/src/main/solidity/StateManagerEvents.sol b/testing/src/main/solidity/StateManagerEvents.sol new file mode 100644 index 0000000000..b97975e1b0 --- /dev/null +++ b/testing/src/main/solidity/StateManagerEvents.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +/** + * @notice Shared contract containing framework events. + */ +abstract contract StateManagerEvents { + /// @dev The event for writing storage; + /// @param contractAddress is the contract addresss, x is the storage key and y is the storage value. + /// Event signature: 33d8dc4a860afa0606947f2b214f16e21e7eac41e3eb6642e859d9626d002ef6 + event Write(address contractAddress, uint256 x, uint256 y); + + /// @dev The event for reading storage; + /// @param contractAddress is the contract addresss, x is the storage key and y is the storage value. + /// the event will be generated after y is read as the value stored at x. + /// Event signature: c2db4694c1ec690e784f771a7fe3533681e081da4baa4aa1ad7dd5c33da95925 + event Read(address contractAddress, uint256 x, uint256 y); + + // Unhashed signature PayETH(address,address,uint256) + // Event signature: 86486637435fcc400fa51609bdb9068db32be14298e016223d7b7ffdae7998ff + event PayETH(address,address,uint256); + + // Received ETH event + // Unhashed signature RecETH(address,uint256) + // Event signature: e1b5c1e280a4d97847c2d5c3006bd406609f68889f3d868ed3250aa10a8629aa + event RecETH(address,uint256); +} diff --git a/testing/src/main/solidity/TestingBase.sol b/testing/src/main/solidity/TestingBase.sol index 13792b62ec..8b460d05f2 100644 --- a/testing/src/main/solidity/TestingBase.sol +++ b/testing/src/main/solidity/TestingBase.sol @@ -24,6 +24,19 @@ abstract contract TestingBase { /// @param contractAddress The contract address. event ContractDestroyed(address contractAddress); + /// @dev The event for writing storage; + /// @param contractAddress is the contract addresss, x is the storage key and y is the storage value. + /// Event signature: 33d8dc4a860afa0606947f2b214f16e21e7eac41e3eb6642e859d9626d002ef6 + event Write(address contractAddress, uint256 x, uint256 y); + + /// @dev The event for reading storage; + /// @param contractAddress is the contract addresss, x is the storage key and y is the storage value. + /// the event will be generated after y is read as the value stored at x. + /// Event signature: c2db4694c1ec690e784f771a7fe3533681e081da4baa4aa1ad7dd5c33da95925 + event Read(address contractAddress, uint256 x, uint256 y); + + event EventReadFromStorage(address contractAddress, uint256 x); + /// @dev The Call types for external calls. /// @dev Default is delegate call (value==0), so be aware. enum CallType { @@ -106,11 +119,11 @@ abstract contract TestingBase { function getCallFunction( CallType _callType ) - internal - pure - returns ( - function(address, bytes memory, uint256, uint256) returns (bool) - ) + internal + pure + returns ( + function(address, bytes memory, uint256, uint256) returns (bool) + ) { if (_callType == CallType.DELEGATE_CALL) { return doDelegateCall; @@ -198,28 +211,28 @@ abstract contract TestingBase { /// @solidity memory-safe-assembly assembly { let n := mload(_data) // Let `l` be `n + 1`. +1 as we prefix a STOP opcode. - /** - * ---------------------------------------------------+ - * Opcode | Mnemonic | Stack | Memory | - * ---------------------------------------------------| - * 61 l | PUSH2 l | l | | - * 80 | DUP1 | l l | | - * 60 0xa | PUSH1 0xa | 0xa l l | | - * 3D | RETURNDATASIZE | 0 0xa l l | | - * 39 | CODECOPY | l | [0..l): code | - * 3D | RETURNDATASIZE | 0 l | [0..l): code | - * F3 | RETURN | | [0..l): code | - * 00 | STOP | | | - * ---------------------------------------------------+ - * @dev Prefix the bytecode with a STOP opcode to ensure it cannot be called. + /** + * ---------------------------------------------------+ + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------| + * 61 l | PUSH2 l | l | | + * 80 | DUP1 | l l | | + * 60 0xa | PUSH1 0xa | 0xa l l | | + * 3D | RETURNDATASIZE | 0 0xa l l | | + * 39 | CODECOPY | l | [0..l): code | + * 3D | RETURNDATASIZE | 0 l | [0..l): code | + * F3 | RETURN | | [0..l): code | + * 00 | STOP | | | + * ---------------------------------------------------+ + * @dev Prefix the bytecode with a STOP opcode to ensure it cannot be called. * Also PUSH2 is used since max contract size cap is 24,576 bytes which is less than 2 ** 16. */ - // Do a out-of-gas revert if `n + 1` is more than 2 bytes. + // Do a out-of-gas revert if `n + 1` is more than 2 bytes. mstore( add(_data, gt(n, 0xfffe)), add(0xfe61000180600a3d393df300, shl(0x40, n)) ) - // Deploy a new contract with the generated creation code. + // Deploy a new contract with the generated creation code. pointer := create(0, add(_data, 0x15), add(n, 0xb)) if iszero(pointer) { mstore(0x00, 0x30116425) // `DeploymentFailed()`. @@ -258,7 +271,8 @@ abstract contract TestingBase { */ function deployWithCreate2( bytes32 _salt, - bytes memory _bytecode + bytes memory _bytecode, + bool _revertFlag ) public payable returns (address addr) { assembly { let value := callvalue() @@ -274,6 +288,9 @@ abstract contract TestingBase { } emit ContractCreated(addr); + if (_revertFlag) { + revert(); + } } /** @@ -314,4 +331,4 @@ abstract contract TestingBase { emit ContractDestroyed(address(this)); selfdestruct(_fundAddress); } -} +} \ No newline at end of file diff --git a/testing/src/main/yul/StateManagerSnippets.yul b/testing/src/main/yul/StateManagerSnippets.yul new file mode 100644 index 0000000000..1a96300e65 --- /dev/null +++ b/testing/src/main/yul/StateManagerSnippets.yul @@ -0,0 +1,316 @@ +object "StateManagerSnippets" { + code { + // return the bytecode of the contract + datacopy(0x00, dataoffset("runtime"), datasize("runtime")) + return(0x00, datasize("runtime")) + } + + object "runtime" { + code { + switch selector() + case 0xa770741d // Write() + { + write() + } + + case 0x97deb47b // Read() + { + // store the ID to memory at 0x00 + mstore(0x00, sload(0x00)) + + return (0x00,0x20) + } + + case 0xacf07154 // writeToStorage() + { + // Load the first argument (x) from calldata + let x := calldataload(0x04) + + // Load the second argument (y) from calldata, 0x20 is 32 bytes + let y := calldataload(0x24) + + // get the revertFlag + let revertFlag := calldataload(0x44) + + // call the writeToStorage function + writeToStorage(x, y, revertFlag) + + // log the call + logValuesWrite(x, y) + + // check the revert flag, and if true, perform a revert + if eq(revertFlag, 0x0000000000000000000000000000000000000000000000000000000000000001) { + revertWithError() + } + } + + case 0x2d97bf10 // readFromStorage() + { + // Load the first argument (x) from calldata + let x := calldataload(0x04) + + // get the revertFlag + let revertFlag := calldataload(0x24) + + // call the readFromStorage function + let y := readFromStorage(x, revertFlag) + + // log the call + logValuesRead(x, y) + + // check the revert flag, and if true, perform a revert + if eq(revertFlag, 0x0000000000000000000000000000000000000000000000000000000000000001) { + revertWithError() + } + } + + case 0xeba7ff7f // selfDestruct() + { + // Load the first argument (recipient) from calldata + let recipient := calldataload(0x04) + + // get the revertFlag + let revertFlag := calldataload(0x24) + + // log the call before self destructing + logSelfDestruct(recipient) + + // call the self-destruct function if the revert is not present + // not the best way to revert, but the self destruct does not allow for a revert afterwards + // unless the revert flag is pushed outside, after the end of the contract call + if eq(revertFlag, 0x0000000000000000000000000000000000000000000000000000000000000000) { + selfDestruct(recipient, revertFlag) + } + + // check the revert flag, and if true, perform a revert + if eq(revertFlag, 0x0000000000000000000000000000000000000000000000000000000000000001) { + revertWithError() + } + } + + case 0x2b261e94 // transferTo(), transfer to a specific address + { + // Load the recipient address from calldata + let recipient := calldataload(0x04) + + // get the amount + let amount := calldataload(0x24) + + // get the revertFlag + let revertFlag := calldataload(0x44) + + // address of the sender contract + let senderAddress := address() + + // perform the transfer + transferTo(recipient, amount, revertFlag) + + // log the call + logTransfer(senderAddress, recipient, amount) + + // check the revert flag, and if true, perform a revert + if eq(revertFlag, 0x0000000000000000000000000000000000000000000000000000000000000001) { + revertWithError() + } + } + + case 0x3ecfd51e { + // I will use 0xf1f1f1f1 as hardcoded calldata for the call opcode in case of a transfer + logReceive() + receiveETH() + } + + case 0xffffffff { + // I will use 0xf1f1f1f1 as hardcoded calldata for the call opcode in case of a transfer + } + + default { + // if the function signature sent does not match any + // of the contract functions, revert + revert(0, 0) + } + + function write() { + // take no inputs, push the 1234...EF 32 byte integer onto the stack + // add 0 as the slot key to the stack + // store the key/value + verbatim_0i_0o(hex"7f0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF600055") + } + + // Function to log two uint256 values for the write storage operation, along with the contract address + function logValuesWrite(x, y) { + // Define an event signature to generate logs for storage operations + let eventSignature := "Write(address,uint256,uint256)" // The signature is "Write(address,uint256,uint256)", signature length is 30 characters (thus 30 bytes) + + let memStart := mload(0x40) // get the free memory pointer + mstore(memStart, eventSignature) + + let eventSignatureHash := keccak256(memStart, 30) // expected 33d8dc4a860afa0606947f2b214f16e21e7eac41e3eb6642e859d9626d002ef6 + + // in the case of a delegate call, this will be the original that called the .Yul snippet. + // For a regular call, it will be the address of the .Yul contract. + let contractAddress := address() + + // call the inbuilt logging function + log4(0x20, 0x60, eventSignatureHash, contractAddress, x, y) + } + // Function to log two uint256 values for the read storage operation, along with the contract address + function logValuesRead(x, y) { + // Define an event signature to generate logs for storage operations + let eventSignatureHex := 0x5265616428616464726573732c75696e743235362c75696e7432353629202020 + // Above is the hex for "Read(address,uint256,uint256)", exact length is 29 characters, padded with 3 spaces (20 in hex) + // if we do not pad at the end, the hex is stored in the wrong manner. The spaces will be disregarded when we hash. + + let memStart := mload(0x40) // get the free memory pointer + mstore(memStart, eventSignatureHex) + + let eventSignatureHash := keccak256(memStart, 29) // 29 bytes is the string length, expected output c2db4694c1ec690e784f771a7fe3533681e081da4baa4aa1ad7dd5c33da95925 + + // in the case of a delegate call, this will be the original that called the .Yul snippet. + // For a regular call, it will be the address of the .Yul contract. + let contractAddress := address() + + // call the inbuilt logging function + log4(0x20, 0x60, eventSignatureHash, contractAddress, x, y) + } + + // Function to log a transfer + function logTransfer(sender, recipient, amount) { + // Define an event signature to generate logs for storage operations + let eventSignature := "PayETH(address,address,uint256)" + + let memStart := mload(0x40) // get the free memory pointer + mstore(memStart, eventSignature) + + let eventSignatureHash := keccak256(memStart, 31) // 31 bytes is the string length, expected output 86486637435fcc400fa51609bdb9068db32be14298e016223d7b7ffdae7998ff + + + // call the inbuilt logging function + log4(0x20, 0x60, eventSignatureHash, sender, recipient, amount) + } + + // Function to log the self destruction of the contract + function logSelfDestruct(recipient) { + // Define an event signature to generate logs for storage operations + let eventSignature := "ContractDestroyed(address)" + + let memStart := mload(0x40) // get the free memory pointer + mstore(memStart, eventSignature) + + let eventSignatureHash := keccak256(memStart, 26) // 26 bytes is the string length, expected output 3ab1d7915d663a46c292b8f01ac13567c748cff5213cb3652695882b5f9b2e0f + + // call the inbuilt logging function + log2(0x20, 0x60, eventSignatureHash, recipient) + } + + function logReceive() { + // Define an event signature to generate a log when the .yul contract receives ETH + let eventSignature := "RecETH(address,uint256)" + + let memStart := mload(0x40) // get the free memory pointer + mstore(memStart, eventSignature) + + let eventSignatureHash := keccak256(memStart, 23) // 23 bytes is the string length, expected output e1b5c1e280a4d97847c2d5c3006bd406609f68889f3d868ed3250aa10a8629aa + + let currentAddress := address() + let amount := callvalue() + // call the inbuilt logging function + log3(0x20, 0x60, eventSignatureHash, currentAddress, amount) + } + + // 0xacf071542e5c4e6701a11ffbc7a8f8e63ef5fdc6871e5d1ee4e7bc956a8d23ac + // function signature: first 4 bytes 0xacf07154 + // example of call: [["Addr",0xacf07154000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001,0,0,0]] + // writeToStorage(uint256,uint256,bool) is the unhashed function signature + function writeToStorage(x, y, revertFlag) { + // Use verbatim to include raw bytecode for storing y at storage key x + // 55 corresponds to SSTORE + verbatim_2i_0o(hex"55", x, y) + } + + // 0x2d97bf1001ed6a98a40186556bfeee30afccf7c13d4d24f6eb6e48b668210fc8 + // function signature: first 4 bytes 0x2d97bf10 + // example of call: [["Addr",0x2d97bf1000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001,0,0,0]] + // readFromStorage(uint256,bool) is the unhashed function signature + function readFromStorage(x, revertFlag) -> y{ + // Use verbatim to include raw bytecode for reading the value stored at x + // 54 corresponds to SLOAD + y := verbatim_1i_1o(hex"54", x) + } + + + // @notice Selfdestructs and sends remaining ETH to a payable address. + // @dev Keep in mind you need to compile and target London EVM version - this doesn't work for repeat addresses on Cancun etc. + // example of call: [["Addr",0xeba7ff7f0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000001,0,0,0]] + // (replace the argument 5b38da6a701c568545dcfcb03fcb875f56beddc4 with the intended recipient, as needed) + // function signature selfDestruct(address,bool)—eba7ff7f626dacfd4408d6e720f444f37df3477e2719d8610a3837a6f8b9400e + function selfDestruct(recipient, revertFlag) { + // There is a weird bug with selfdestruct(recipient), so we replace that with verbatim + // Use verbatim to include the selfdestruct opcode (0xff) + verbatim_1i_0o(hex"ff", recipient) + } + + // Return the function selector: the first 4 bytes of the call data + function selector() -> s { + s := div(calldataload(0), 0x100000000000000000000000000000000000000000000000000000000) + } + + // Implementation of the require statement from Solidity + function require(condition) { + if iszero(condition) { revert(0, 0) } + } + + // Check if the calldata has the correct number of params + function checkParamLength(len) { + require(eq(calldatasize(), add(4, mul(32, len)))) + } + + // Transfer ether to the caller address + function transfer(amount) { + if iszero(call(gas(), caller(), amount, 0, 0, 0, 0)) { + revert(0,0) + } + } + + // Transfer ether to the recipient address + // function signature transferTo(address,uint256,bool)—hash 0x2b261e94b0c8d2a13b0379d0e6facd43b4bd12e1d1b944f2ee6288c0a278d838 + // function selector 0x2b261e94 + // call example, snippet address—function selector, recipient address, wei amount and revert flag + // call example: [["addr",0x2b261e94000000000000000000000000746FfB8C87c9142519a144caB812495d2960a24b00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000,0,0,1]] + function transferTo(recipient, amount, revertFlag) { + // hardcoding f1f1f1f1 as custom calldata in case of a transfer + let formedCallData := mload(0x40) + let functionSelector := 0x3ecfd51e00000000000000000000000000000000000000000000000000000000 + mstore(formedCallData, functionSelector) + let success := call(gas(), recipient, amount, formedCallData, 0x20, 0, 0) + // Check if the transfer was successful + if iszero(success) { + // Revert the transaction if the transfer failed + revert(0, 0) + } + } + + // Function to revert with an error message + function revertWithError() { + // Define the error message in hexadecimal + let errorMessage := "Reverting" + + // Allocate memory for the error message + let errorMessageSize := 0x20 // 32 bytes + let errorMessageOffset := mload(0x40) // Load the free memory pointer + mstore(errorMessageOffset, errorMessage) + + // Revert with the error message + revert(errorMessageOffset, errorMessageSize) + } + + // 3ecfd51e90ed5312cd5bc47447919dde093173d93c6a98ab52ecf0cfc491e099 + // function selector 0x3ecfd51e + // we need this empty function in order for the contract to be sucessfully deployed + // using the java wrappers + function receiveETH() { + + } + } + } +} \ No newline at end of file