Commit c236b1d4 authored by ben-chain's avatar ben-chain

contracts building

parent cbc8925e
...@@ -126,7 +126,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager { ...@@ -126,7 +126,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
// Make sure the transaction's gas limit is valid. We don't revert here because we reserve // Make sure the transaction's gas limit is valid. We don't revert here because we reserve
// reverts for INVALID_STATE_ACCESS. // reverts for INVALID_STATE_ACCESS.
if (_isValidGasLimit(_transaction.gasLimit, _transaction.queueOrigin) == false) { if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {
return; return;
} }
...@@ -143,7 +143,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager { ...@@ -143,7 +143,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
uint256 gasUsed = gasProvided - gasleft(); uint256 gasUsed = gasProvided - gasleft();
// Update the cumulative gas based on the amount of gas used. // Update the cumulative gas based on the amount of gas used.
_updateCumulativeGas(gasUsed, _transaction.queueOrigin); _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);
// Wipe the execution context. // Wipe the execution context.
_resetContext(); _resetContext();
...@@ -1532,7 +1532,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager { ...@@ -1532,7 +1532,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
*/ */
function _isValidGasLimit( function _isValidGasLimit(
uint256 _gasLimit, uint256 _gasLimit,
uint256 _queueOrigin Lib_OVMCodec.QueueOrigin _queueOrigin
) )
internal internal
returns ( returns (
...@@ -1549,7 +1549,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager { ...@@ -1549,7 +1549,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
GasMetadataKey cumulativeGasKey; GasMetadataKey cumulativeGasKey;
GasMetadataKey prevEpochGasKey; GasMetadataKey prevEpochGasKey;
if (_queueOrigin == uint256(QueueOrigin.SEQUENCER_QUEUE)) { if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {
cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS; cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;
prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS; prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;
} else { } else {
...@@ -1573,12 +1573,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager { ...@@ -1573,12 +1573,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
*/ */
function _updateCumulativeGas( function _updateCumulativeGas(
uint256 _gasUsed, uint256 _gasUsed,
uint256 _queueOrigin Lib_OVMCodec.QueueOrigin _queueOrigin
) )
internal internal
{ {
GasMetadataKey cumulativeGasKey; GasMetadataKey cumulativeGasKey;
if (_queueOrigin == uint256(QueueOrigin.SEQUENCER_QUEUE)) { if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {
cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS; cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;
} else { } else {
cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS; cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;
...@@ -1692,12 +1692,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager { ...@@ -1692,12 +1692,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
function _resetContext() function _resetContext()
internal internal
{ {
transactionContext.ovmORIGIN = address(0); transactionContext.ovmL1TXORIGIN = address(0);
transactionContext.ovmTIMESTAMP = 0; transactionContext.ovmTIMESTAMP = 0;
transactionContext.ovmNUMBER = 0; transactionContext.ovmNUMBER = 0;
transactionContext.ovmGASLIMIT = 0; transactionContext.ovmGASLIMIT = 0;
transactionContext.ovmTXGASLIMIT = 0; transactionContext.ovmTXGASLIMIT = 0;
transactionContext.ovmQUEUEORIGIN = 0; transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;
transactionRecord.ovmGasRefund = 0; transactionRecord.ovmGasRefund = 0;
......
...@@ -30,12 +30,6 @@ interface iOVM_ExecutionManager { ...@@ -30,12 +30,6 @@ interface iOVM_ExecutionManager {
PREV_EPOCH_L1TOL2_QUEUE_GAS PREV_EPOCH_L1TOL2_QUEUE_GAS
} }
enum QueueOrigin {
SEQUENCER_QUEUE,
L1TOL2_QUEUE
}
/*********** /***********
* Structs * * Structs *
***********/ ***********/
...@@ -52,12 +46,12 @@ interface iOVM_ExecutionManager { ...@@ -52,12 +46,12 @@ interface iOVM_ExecutionManager {
} }
struct TransactionContext { struct TransactionContext {
address ovmORIGIN;
uint256 ovmTIMESTAMP; uint256 ovmTIMESTAMP;
uint256 ovmNUMBER; uint256 ovmNUMBER;
uint256 ovmGASLIMIT; uint256 ovmGASLIMIT;
uint256 ovmTXGASLIMIT; uint256 ovmTXGASLIMIT;
uint256 ovmL1QUEUEORIGIN; Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;
address ovmL1TXORIGIN;
} }
struct TransactionRecord { struct TransactionRecord {
...@@ -94,6 +88,7 @@ interface iOVM_ExecutionManager { ...@@ -94,6 +88,7 @@ interface iOVM_ExecutionManager {
function ovmCALLER() external view returns (address _caller); function ovmCALLER() external view returns (address _caller);
function ovmADDRESS() external view returns (address _address); function ovmADDRESS() external view returns (address _address);
function ovmTIMESTAMP() external view returns (uint256 _timestamp); function ovmTIMESTAMP() external view returns (uint256 _timestamp);
function ovmNUMBER() external view returns (uint256 _number);
function ovmGASLIMIT() external view returns (uint256 _gasLimit); function ovmGASLIMIT() external view returns (uint256 _gasLimit);
function ovmCHAINID() external view returns (uint256 _chainId); function ovmCHAINID() external view returns (uint256 _chainId);
......
...@@ -43,13 +43,17 @@ library Lib_OVMCodec { ...@@ -43,13 +43,17 @@ library Lib_OVMCodec {
bytes32[] siblings; bytes32[] siblings;
} }
enum QueueOrigin {
SEQUENCER_QUEUE,
L1TOL2_QUEUE
}
struct Transaction { struct Transaction {
uint256 timestamp; uint256 timestamp;
uint256 number; uint256 number;
uint256 l1QueueOrigin; QueueOrigin l1QueueOrigin;
address l1Txorigin; address l1Txorigin;
address entrypoint; address entrypoint;
address msgSender;
uint256 gasLimit; uint256 gasLimit;
bytes data; bytes data;
} }
...@@ -124,10 +128,10 @@ library Lib_OVMCodec { ...@@ -124,10 +128,10 @@ library Lib_OVMCodec {
{ {
return abi.encodePacked( return abi.encodePacked(
_transaction.timestamp, _transaction.timestamp,
_transaction.queueOrigin, _transaction.number,
_transaction.l1QueueOrigin,
_transaction.l1Txorigin,
_transaction.entrypoint, _transaction.entrypoint,
_transaction.origin,
_transaction.msgSender,
_transaction.gasLimit, _transaction.gasLimit,
_transaction.data _transaction.data
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment