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

contracts building

parent cbc8925e
......@@ -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
// reverts for INVALID_STATE_ACCESS.
if (_isValidGasLimit(_transaction.gasLimit, _transaction.queueOrigin) == false) {
if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {
return;
}
......@@ -143,7 +143,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
uint256 gasUsed = gasProvided - gasleft();
// Update the cumulative gas based on the amount of gas used.
_updateCumulativeGas(gasUsed, _transaction.queueOrigin);
_updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);
// Wipe the execution context.
_resetContext();
......@@ -1532,7 +1532,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
*/
function _isValidGasLimit(
uint256 _gasLimit,
uint256 _queueOrigin
Lib_OVMCodec.QueueOrigin _queueOrigin
)
internal
returns (
......@@ -1549,7 +1549,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
GasMetadataKey cumulativeGasKey;
GasMetadataKey prevEpochGasKey;
if (_queueOrigin == uint256(QueueOrigin.SEQUENCER_QUEUE)) {
if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {
cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;
prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;
} else {
......@@ -1573,12 +1573,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
*/
function _updateCumulativeGas(
uint256 _gasUsed,
uint256 _queueOrigin
Lib_OVMCodec.QueueOrigin _queueOrigin
)
internal
{
GasMetadataKey cumulativeGasKey;
if (_queueOrigin == uint256(QueueOrigin.SEQUENCER_QUEUE)) {
if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {
cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;
} else {
cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;
......@@ -1692,12 +1692,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager {
function _resetContext()
internal
{
transactionContext.ovmORIGIN = address(0);
transactionContext.ovmL1TXORIGIN = address(0);
transactionContext.ovmTIMESTAMP = 0;
transactionContext.ovmNUMBER = 0;
transactionContext.ovmGASLIMIT = 0;
transactionContext.ovmTXGASLIMIT = 0;
transactionContext.ovmQUEUEORIGIN = 0;
transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;
transactionRecord.ovmGasRefund = 0;
......
......@@ -29,12 +29,6 @@ interface iOVM_ExecutionManager {
PREV_EPOCH_SEQUENCER_QUEUE_GAS,
PREV_EPOCH_L1TOL2_QUEUE_GAS
}
enum QueueOrigin {
SEQUENCER_QUEUE,
L1TOL2_QUEUE
}
/***********
* Structs *
......@@ -52,12 +46,12 @@ interface iOVM_ExecutionManager {
}
struct TransactionContext {
address ovmORIGIN;
uint256 ovmTIMESTAMP;
uint256 ovmNUMBER;
uint256 ovmGASLIMIT;
uint256 ovmTXGASLIMIT;
uint256 ovmL1QUEUEORIGIN;
Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;
address ovmL1TXORIGIN;
}
struct TransactionRecord {
......@@ -94,6 +88,7 @@ interface iOVM_ExecutionManager {
function ovmCALLER() external view returns (address _caller);
function ovmADDRESS() external view returns (address _address);
function ovmTIMESTAMP() external view returns (uint256 _timestamp);
function ovmNUMBER() external view returns (uint256 _number);
function ovmGASLIMIT() external view returns (uint256 _gasLimit);
function ovmCHAINID() external view returns (uint256 _chainId);
......
......@@ -43,13 +43,17 @@ library Lib_OVMCodec {
bytes32[] siblings;
}
enum QueueOrigin {
SEQUENCER_QUEUE,
L1TOL2_QUEUE
}
struct Transaction {
uint256 timestamp;
uint256 number;
uint256 l1QueueOrigin;
QueueOrigin l1QueueOrigin;
address l1Txorigin;
address entrypoint;
address msgSender;
uint256 gasLimit;
bytes data;
}
......@@ -124,10 +128,10 @@ library Lib_OVMCodec {
{
return abi.encodePacked(
_transaction.timestamp,
_transaction.queueOrigin,
_transaction.number,
_transaction.l1QueueOrigin,
_transaction.l1Txorigin,
_transaction.entrypoint,
_transaction.origin,
_transaction.msgSender,
_transaction.gasLimit,
_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