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
63b4f0cd
Commit
63b4f0cd
authored
Oct 12, 2020
by
Karl Floersch
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/freeze' of github.com:ethereum-optimism/contracts-v2 into feat/pointer-queue
parents
726dd197
333d4cfc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
11 deletions
+43
-11
README.md
packages/contracts/README.md
+5
-1
OVM_ExecutionManager.sol
...ptimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol
+8
-2
OVM_L1ToL2TransactionQueue.sol
...imistic-ethereum/OVM/queue/OVM_L1ToL2TransactionQueue.sol
+28
-7
OVM_L1ToL2TransactionQueue.spec.ts
...st/contracts/OVM/queue/OVM_L1ToL2TransactionQueue.spec.ts
+1
-1
test.types.ts
packages/contracts/test/helpers/test-runner/test.types.ts
+1
-0
No files found.
packages/contracts/README.md
View file @
63b4f0cd
# Optimism's Contracts (V2)
This package contains the various Ethereum smart contracts that make up the Layer 1 component of Optimism's Optimistic Rollup construction.
This package contains the various Ethereum smart contracts that make up the Layer 1 component of Optimism's Optimistic Rollup construction.
## Building and Running
This package requires that
`yarn`
be installed on your machine! Once it is, run
`yarn test`
to build and run tests.
## Disclaimer
...
...
packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol
View file @
63b4f0cd
...
...
@@ -729,7 +729,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
)
override
public
{
{
// Since this function is public, anyone can attempt to directly call it. We need to make
// sure that the OVM_ExecutionManager itself is the only party that can actually try to
// call this function.
...
...
@@ -871,10 +871,16 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
bytes memory _returndata
)
{
// EVM precompiles have the same address on L1 and L2 --> no trie lookup neededgit s.
address codeContractAddress =
uint(_contract) < 100
? _contract
: _getAccountEthAddress(_contract)
return _handleExternalInteraction(
_nextMessageContext,
_gasLimit,
_getAccountEthAddress(_contract)
,
codeContractAddress
,
_calldata,
_isStaticEntrypoint
);
...
...
packages/contracts/contracts/optimistic-ethereum/OVM/queue/OVM_L1ToL2TransactionQueue.sol
View file @
63b4f0cd
...
...
@@ -17,12 +17,12 @@ import { OVM_BaseQueue } from "./OVM_BaseQueue.sol";
*/
contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueue, Lib_AddressResolver {
/*************************************************
* Contract Variables: Transaction Restrinctions *
*************************************************/
/*********************************
* Contract Variables: Constants *
********************************/
uint constant public L2_GAS_DISCOUNT_DIVISOR = 10;
uint constant MAX_ROLLUP_TX_SIZE = 10000;
uint constant L2_GAS_DISCOUNT_DIVISOR = 10;
/*******************************************
* Contract Variables: Contract References *
...
...
@@ -66,10 +66,14 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
public
{
require(_gasLimit >= 20000, "Gas limit too low.");
uint gasToBurn = _gasLimit / L2_GAS_DISCOUNT_DIVISOR;
require(
_data.length <= MAX_ROLLUP_TX_SIZE,
"Transaction exceeds maximum rollup data size."
);
uint gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;
uint startingGas = gasleft();
uint i;
while(startingGas - gasleft() > gasTo
Burn
) {
while(startingGas - gasleft() > gasTo
Consume
) {
i++; // TODO: Replace this dumb work with minting gas token.
}
...
...
@@ -100,4 +104,21 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
_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 @
63b4f0cd
...
...
@@ -31,7 +31,7 @@ const makeQueueElements = (count: number): any => {
return
[...
Array
(
count
)].
map
((
el
,
idx
)
=>
{
return
{
target
:
NON_ZERO_ADDRESS
,
gasLimit
:
(
idx
+
1
)
*
20
000
,
gasLimit
:
idx
+
30
_
000
,
data
:
DUMMY_BYTES32
[
0
],
}
})
...
...
packages/contracts/test/helpers/test-runner/test.types.ts
View file @
63b4f0cd
...
...
@@ -176,6 +176,7 @@ export const isTestStep_Context = (
'
ovmCALLER
'
,
'
ovmNUMBER
'
,
'
ovmADDRESS
'
,
'
ovmNUMBER
'
,
'
ovmL1TXORIGIN
'
,
'
ovmTIMESTAMP
'
,
'
ovmGASLIMIT
'
,
...
...
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