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
9c0dc1fd
Commit
9c0dc1fd
authored
Oct 12, 2020
by
Karl Floersch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up gas burn & err msg
parent
5778931f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
OVM_L1ToL2TransactionQueue.sol
...imistic-ethereum/OVM/queue/OVM_L1ToL2TransactionQueue.sol
+13
-13
OVM_L1ToL2TransactionQueue.spec.ts
...st/contracts/OVM/queue/OVM_L1ToL2TransactionQueue.spec.ts
+2
-2
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/queue/OVM_L1ToL2TransactionQueue.sol
View file @
9c0dc1fd
...
@@ -65,17 +65,13 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
...
@@ -65,17 +65,13 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
override
override
public
public
{
{
require(_gasLimit >= 20000, "Gas limit too low.");
require(
require(
_data.length <= MAX_ROLLUP_TX_SIZE,
_data.length <= MAX_ROLLUP_TX_SIZE,
"Transaction exceeds maximum rollup data size."
"Transaction exceeds maximum rollup data size."
);
);
uint gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;
require(_gasLimit >= 20000, "Gas limit too low.");
uint startingGas = gasleft();
uint i;
consumeGas(_gasLimit/L2_GAS_DISCOUNT_DIVISOR);
while(startingGas - gasleft() > gasToConsume) {
i++; // TODO: Replace this dumb work with minting gas token.
}
Lib_OVMCodec.QueueElement memory element = Lib_OVMCodec.QueueElement({
Lib_OVMCodec.QueueElement memory element = Lib_OVMCodec.QueueElement({
timestamp: block.timestamp,
timestamp: block.timestamp,
...
@@ -99,7 +95,7 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
...
@@ -99,7 +95,7 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
{
{
require(
require(
msg.sender == ovmCanonicalTransactionChain,
msg.sender == ovmCanonicalTransactionChain,
"Sender is not allowed to
en
queue."
"Sender is not allowed to
de
queue."
);
);
_dequeue();
_dequeue();
...
@@ -112,13 +108,17 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
...
@@ -112,13 +108,17 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
/**
/**
* Consumes all gas provided.
* Consumes all gas provided.
* Note: this is an external function, but is only called by self.
*/
*/
function consumeAllGasProvided()
function consumeGas
external
(
uint gasToConsume
)
internal
{
{
assembly {
uint startingGas = gasleft();
invalid()
uint i;
while(startingGas - gasleft() > gasToConsume) {
i++; // TODO: Replace this dumb work with minting gas token.
}
}
}
}
}
}
packages/contracts/test/contracts/OVM/queue/OVM_L1ToL2TransactionQueue.spec.ts
View file @
9c0dc1fd
...
@@ -37,7 +37,7 @@ const makeQueueElements = (count: number): any => {
...
@@ -37,7 +37,7 @@ const makeQueueElements = (count: number): any => {
})
})
}
}
describe
(
'
OVM_L1ToL2TransactionQueue
'
,
()
=>
{
describe
.
only
(
'
OVM_L1ToL2TransactionQueue
'
,
()
=>
{
let
signer
:
Signer
let
signer
:
Signer
before
(
async
()
=>
{
before
(
async
()
=>
{
;[
signer
]
=
await
ethers
.
getSigners
()
;[
signer
]
=
await
ethers
.
getSigners
()
...
@@ -98,7 +98,7 @@ describe('OVM_L1ToL2TransactionQueue', () => {
...
@@ -98,7 +98,7 @@ describe('OVM_L1ToL2TransactionQueue', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
OVM_L1ToL2TransactionQueue
.
dequeue
()).
to
.
be
.
revertedWith
(
await
expect
(
OVM_L1ToL2TransactionQueue
.
dequeue
()).
to
.
be
.
revertedWith
(
'
Sender is not allowed to
en
queue.
'
'
Sender is not allowed to
de
queue.
'
)
)
})
})
})
})
...
...
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