Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
4f1ebd2d
Commit
4f1ebd2d
authored
Oct 04, 2020
by
ben-chain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add back EVM precompiles, l2 gas burn, max l2 tx size
parent
869dba6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
OVM_L1ToL2TransactionQueue.sol
...imistic-ethereum/OVM/queue/OVM_L1ToL2TransactionQueue.sol
+33
-0
OVM_L1ToL2TransactionQueue.spec.ts
...st/contracts/OVM/queue/OVM_L1ToL2TransactionQueue.spec.ts
+1
-1
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/queue/OVM_L1ToL2TransactionQueue.sol
View file @
4f1ebd2d
...
@@ -17,6 +17,13 @@ import { OVM_BaseQueue } from "./OVM_BaseQueue.sol";
...
@@ -17,6 +17,13 @@ import { OVM_BaseQueue } from "./OVM_BaseQueue.sol";
*/
*/
contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueue, Lib_AddressResolver {
contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueue, Lib_AddressResolver {
/*************************************************
* Contract Variables: Transaction Restrinctions *
*************************************************/
uint constant MAX_ROLLUP_TX_SIZE = 10000;
uint constant L2_GAS_DISCOUNT_DIVISOR = 10;
/*******************************************
/*******************************************
* Contract Variables: Contract References *
* Contract Variables: Contract References *
*******************************************/
*******************************************/
...
@@ -58,6 +65,15 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
...
@@ -58,6 +65,15 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
override
override
public
public
{
{
require(
_data.length <= MAX_ROLLUP_TX_SIZE,
"Transaction exceeds maximum rollup data size."
);
uint gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;
// The methodId for consumeAllGasProvided() is 0xfd4cbdd9.
address(this).call{gas: gasToConsume}(hex"fd4cbdd9");
Lib_OVMCodec.QueueElement memory element = Lib_OVMCodec.QueueElement({
Lib_OVMCodec.QueueElement memory element = Lib_OVMCodec.QueueElement({
timestamp: block.timestamp,
timestamp: block.timestamp,
batchRoot: keccak256(abi.encodePacked(
batchRoot: keccak256(abi.encodePacked(
...
@@ -85,4 +101,21 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
...
@@ -85,4 +101,21 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
_dequeue();
_dequeue();
}
}
/***************************************
* External Functions: Gas Consumption *
***************************************/
/**
* Consumes all gas provided.
* Note: this is an external function, but is only called by self.
*/
function consumeAllGasProvided()
external
{
assembly {
invalid()
}
}
}
}
packages/contracts/test/contracts/OVM/queue/OVM_L1ToL2TransactionQueue.spec.ts
View file @
4f1ebd2d
...
@@ -31,7 +31,7 @@ const makeQueueElements = (count: number): any => {
...
@@ -31,7 +31,7 @@ const makeQueueElements = (count: number): any => {
return
[...
Array
(
count
)].
map
((
el
,
idx
)
=>
{
return
[...
Array
(
count
)].
map
((
el
,
idx
)
=>
{
return
{
return
{
target
:
NON_ZERO_ADDRESS
,
target
:
NON_ZERO_ADDRESS
,
gasLimit
:
idx
,
gasLimit
:
idx
+
30
_000
,
data
:
DUMMY_BYTES32
[
0
],
data
:
DUMMY_BYTES32
[
0
],
}
}
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment