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
7b25a75e
Commit
7b25a75e
authored
Apr 14, 2021
by
Liam Horne
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'contracts/master'
parents
fde84dd1
fb884373
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
10191 additions
and
7 deletions
+10191
-7
.editorconfig
packages/contracts/.editorconfig
+13
-0
.env.example
packages/contracts/.env.example
+8
-0
CODEOWNERS
packages/contracts/.github/CODEOWNERS
+1
-0
build-test-lint-contracts.yml
...contracts/.github/workflows/build-test-lint-contracts.yml
+50
-0
dockerhub-build-push.yml
...ages/contracts/.github/workflows/dockerhub-build-push.yml
+38
-0
integration.yml
packages/contracts/.github/workflows/integration.yml
+42
-0
push-to-integration-repo.yml
.../contracts/.github/workflows/push-to-integration-repo.yml
+38
-0
tag-release.yml
packages/contracts/.github/workflows/tag-release.yml
+114
-0
.gitignore
packages/contracts/.gitignore
+15
-0
deploy.js
packages/contracts/bin/deploy.js
+47
-0
serve_dump.sh
packages/contracts/bin/serve_dump.sh
+3
-1
hardhat.config.ts
packages/contracts/hardhat.config.ts
+3
-0
index.ts
packages/contracts/hh/index.ts
+1
-0
task-deploy.ts
packages/contracts/hh/tasks/task-deploy.ts
+128
-0
prettier-config.json
packages/contracts/prettier-config.json
+8
-1
prettier-config.json
packages/contracts/prettier-config.json
+8
-1
hardhat-deploy-ethers.ts
packages/contracts/src/hardhat-deploy-ethers.ts
+3
-2
nuisance-gas.spec.ts
...s/OVM/execution/OVM_ExecutionManager/nuisance-gas.spec.ts
+1
-1
tslint.json
packages/contracts/tslint.json
+2
-1
yarn.lock
packages/contracts/yarn.lock
+9668
-0
No files found.
packages/contracts/.editorconfig
0 → 100644
View file @
7b25a75e
root = true
# defaults
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.sol]
indent_size = 4
packages/contracts/.env.example
0 → 100644
View file @
7b25a75e
# name of the network to deploy to e.g., kovan or mainnet
CONTRACTS_TARGET_NETWORK=
# private key for the account that will execute the deploy
CONTRACTS_DEPLOYER_KEY=
# rpc url for the node that will receive deploy transactions
CONTRACTS_RPC_URL=
packages/contracts/.github/CODEOWNERS
0 → 100644
View file @
7b25a75e
* @smartcontracts @ben-chain @maurelian
packages/contracts/.github/workflows/build-test-lint-contracts.yml
0 → 100644
View file @
7b25a75e
name
:
CI - contracts
on
:
push
:
branches
:
-
master
pull_request
:
branches
:
-
master
jobs
:
build-test-lint
:
name
:
Run Contracts Test Suite on Node ${{matrix.node}}
runs-on
:
ubuntu-latest
strategy
:
matrix
:
node
:
[
'
10'
,
'
12'
,
'
14'
]
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Setup node ${{ matrix.node }}
uses
:
actions/setup-node@v1
with
:
node-version
:
${{ matrix.node }}
# START DEPENDENCY CACHING
-
name
:
Cache root deps
uses
:
actions/cache@v1
id
:
cache_base
with
:
path
:
node_modules
key
:
${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json') }}
# END DEPENDENCY CACHING
-
name
:
Install Dependencies
run
:
yarn install
-
name
:
Lint
run
:
yarn lint:check
-
name
:
Build
run
:
|
yarn clean
yarn build
-
name
:
Test
run
:
yarn test
packages/contracts/.github/workflows/dockerhub-build-push.yml
0 → 100644
View file @
7b25a75e
name
:
Build & Push to DockerHub
on
:
push
:
branches
:
-
master
-
testnet
-
uat
jobs
:
build
:
name
:
Build & Push to DockerHub
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
webfactory/ssh-agent@v0.4.1
with
:
ssh-private-key
:
${{ secrets.SSH_PRIVATE_KEY_READ }}
-
name
:
Login to DockerHub Registry
run
:
echo ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }} | docker login -u ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME}} --password-stdin
-
name
:
Build and push Deployer image to DockerHub
run
:
|
git clone https://github.com/ethereum-optimism/docker.git \
$HOME/docker
cd $HOME/docker
BRANCH=${GITHUB_REF##*/}
./build.sh -s deployer -b $BRANCH
if [ $BRANCH == 'master' ]; then
docker push ethereumoptimism/deployer:latest
elif [[ $BRANCH == 'uat' || $BRANCH == 'testnet' ]]; then
docker push ethereumoptimism/deployer:$BRANCH
fi
-
name
:
Logout of DockerHub
run
:
docker logout
packages/contracts/.github/workflows/integration.yml
0 → 100644
View file @
7b25a75e
name
:
Setup & Run Integration Test Suite
on
:
push
:
branches
:
-
master
pull_request
:
branches
:
-
master
jobs
:
build
:
name
:
Setup & Run Integration Tests
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Build
run
:
|
git clone https://github.com/ethereum-optimism/optimism-integration.git \
$HOME/optimism-integration
cd $HOME/optimism-integration
sed -i -Ee's#git@github.com:([^/]*)/(.*).git#https://github.com/\1/\2.git#' .gitmodules
git submodule init
git submodule update
if [ -z $GITHUB_HEAD_REF ]; then
GITHUB_HEAD_REF=${GITHUB_REF##*/}
fi
GIT_COMMIT=$(git rev-parse HEAD | head -c 8)
REMOTE=${{ github.event.pull_request.head.repo.html_url }}
echo "optimism-integration $GIT_COMMIT"
if [ -z $REMOTE ]; then
./docker/build.sh -s deployer -b $GITHUB_HEAD_REF
else
./docker/build.sh -s deployer -b $GITHUB_HEAD_REF -r $REMOTE
fi
-
name
:
Test
run
:
|
cd $HOME/optimism-integration
DEPLOYER_TAG=$GITHUB_HEAD_REF ./test.sh
packages/contracts/.github/workflows/push-to-integration-repo.yml
0 → 100644
View file @
7b25a75e
name
:
Update submodules in integration repo
on
:
push
:
branches
:
-
master
jobs
:
run
:
name
:
Update submodules
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
webfactory/ssh-agent@v0.4.1
with
:
ssh-private-key
:
${{ secrets.INTEGRATION_PUSH_ACTION }}
-
name
:
Clone repo
run
:
|
git clone git@github.com:ethereum-optimism/optimism-integration.git $HOME/optimism-integration
cd $HOME/optimism-integration
git submodule init && git submodule update
REPO=$(echo $GITHUB_REPOSITORY | cut -d '/' -f2)
cd $HOME/optimism-integration/$REPO
git pull origin master
-
name
:
Commit
run
:
|
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
cd $HOME/optimism-integration
REPO=$(echo $GITHUB_REPOSITORY | cut -d '/' -f2)
SHORT=$(echo $GITHUB_SHA | head -c 8)
git add $REPO
git commit -m "submodule bump: $REPO $SHORT"
git push origin master
packages/contracts/.github/workflows/tag-release.yml
0 → 100644
View file @
7b25a75e
name
:
Auto tag-release-publish
on
:
push
:
branches
:
-
master
jobs
:
tag
:
name
:
Create tag for new version
runs-on
:
ubuntu-latest
outputs
:
tag_name
:
${{ steps.create_new_tag.outputs.tag }}
steps
:
-
uses
:
actions/checkout@v2
with
:
fetch-depth
:
2
-
uses
:
salsify/action-detect-and-tag-new-version@v2
id
:
create_new_tag
release
:
name
:
Create release
runs-on
:
ubuntu-latest
needs
:
tag
if
:
needs.tag.outputs.tag_name
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/create-release@v1
id
:
create_release
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
with
:
tag_name
:
${{ needs.tag.outputs.tag_name }}
release_name
:
${{ needs.tag.outputs.tag_name }}
draft
:
false
prerelease
:
false
npm-publish
:
name
:
Build and publish
runs-on
:
ubuntu-latest
needs
:
tag
if
:
needs.tag.outputs.tag_name
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/setup-node@v2
with
:
node-version
:
'
14.x'
registry-url
:
'
https://registry.npmjs.org'
-
run
:
yarn
-
run
:
yarn build
-
run
:
npm publish --access public
env
:
NODE_AUTH_TOKEN
:
${{ secrets.NPM_TOKEN }}
docker
:
name
:
Build & Push to DockerHub
runs-on
:
ubuntu-latest
needs
:
tag
if
:
needs.tag.outputs.tag_name
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Login to DockerHub Registry
run
:
echo ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }} | docker login -u ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME}} --password-stdin
-
name
:
Clone the docker repo
run
:
|
git clone https://github.com/ethereum-optimism/docker.git \
$HOME/docker
-
name
:
Build and push Deployer image to DockerHub
run
:
|
cd $HOME/docker
./build.sh -s deployer -b ${{ needs.tag.outputs.tag_name }}
docker push ethereumoptimism/deployer:${{ needs.tag.outputs.tag_name }}
-
name
:
Extract State Dump from Deployer Image
run
:
docker run --rm --entrypoint cat ethereumoptimism/deployer:${{ steps.get_version.outputs.VERSION }} /opt/contracts/build/dumps/state-dump.latest.json > ${{ steps.get_version.outputs.VERSION }}.json
-
name
:
Store state dump artifact for git job
uses
:
actions/upload-artifact@v2
with
:
name
:
state-dump-artifact
path
:
${{ steps.get_version.outputs.VERSION }}.json
-
name
:
Logout of DockerHub
run
:
docker logout
git
:
name
:
Commit State Dump
needs
:
[
docker
,
tag
]
runs-on
:
ubuntu-latest
if
:
needs.tag.outputs.tag_name
steps
:
-
uses
:
actions/checkout@v2
with
:
repository
:
ethereum-optimism/regenesis
ssh-key
:
${{ secrets.REGENESIS_DEPLOY_KEY }}
-
name
:
Download State Dump Artifact
uses
:
actions/download-artifact@v2
with
:
name
:
state-dump-artifact
path
:
./tags
-
name
:
Commit to Repository
uses
:
stefanzweifel/git-auto-commit-action@v4
with
:
branch
:
master
commit_message
:
Add tagged state dump artfiact
commit_user_name
:
GitHub Action
commit_user_email
:
action@github.com
commit_author
:
Github Action <action@github.com>
packages/contracts/.gitignore
0 → 100644
View file @
7b25a75e
node_modules/
artifacts/
artifacts-ovm/
cache/
cache-ovm/
yarn-error.log
build/
.DS_STORE
# Coverage output
coverage/
coverage.json
# Environment variables
.env
packages/contracts/bin/deploy.js
0 → 100755
View file @
7b25a75e
#!/usr/bin/env node
const
path
=
require
(
'
path
'
)
const
{
spawn
}
=
require
(
'
child_process
'
)
const
dirtree
=
require
(
'
directory-tree
'
)
const
main
=
async
()
=>
{
const
task
=
spawn
(
path
.
join
(
__dirname
,
'
deploy.ts
'
))
await
new
Promise
((
resolve
)
=>
{
task
.
on
(
'
exit
'
,
()
=>
{
resolve
()
})
})
// Stuff below this line is currently required for CI to work properly. We probably want to
// update our CI so this is no longer necessary. But I'm adding it for backwards compat so we can
// get the hardhat-deploy stuff merged. Woot.
const
nicknames
=
{
'
Lib_AddressManager
'
:
'
AddressManager
'
,
'
mockOVM_BondManager
'
:
'
OVM_BondManager
'
}
const
contracts
=
dirtree
(
path
.
resolve
(
__dirname
,
`../deployments/custom`
)
).
children
.
filter
((
child
)
=>
{
return
child
.
extension
===
'
.json
'
}).
reduce
((
contracts
,
child
)
=>
{
const
contractName
=
child
.
name
.
replace
(
'
.json
'
,
''
)
const
artifact
=
require
(
path
.
resolve
(
__dirname
,
`../deployments/custom/
${
child
.
name
}
`
))
contracts
[
nicknames
[
contractName
]
||
contractName
]
=
artifact
.
address
return
contracts
},
{})
// We *must* console.log here because CI will pipe the output of this script into an
// addresses.json file. Also something we should probably remove.
console
.
log
(
JSON
.
stringify
(
contracts
,
null
,
2
))
}
main
()
.
then
(()
=>
process
.
exit
(
0
))
.
catch
((
error
)
=>
{
console
.
log
(
JSON
.
stringify
({
error
:
error
.
message
,
stack
:
error
.
stack
},
null
,
2
)
)
process
.
exit
(
1
)
})
packages/contracts/bin/serve_dump.sh
View file @
7b25a75e
...
...
@@ -6,10 +6,12 @@
# development. The state dump can be found at
# `GET /state-dump.latest.json`
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null
&&
pwd
)
"
PYTHON
=
${
PYTHON
:-
python
}
HOST
=
${
HOST
:-
0
.0.0.0
}
PORT
=
${
PORT
:-
8081
}
DIRECTORY
=
dist/dumps
DIRECTORY
=
$DIR
/../
dist/dumps
if
[
!
command
-v
$PYTHON
&>/dev/null
]
;
then
echo
"Please install python"
...
...
packages/contracts/hardhat.config.ts
View file @
7b25a75e
...
...
@@ -41,6 +41,9 @@ const config: HardhatUserConfig = {
version
:
'
0.7.6
'
,
settings
:
{
optimizer
:
{
enabled
:
true
,
runs
:
200
},
metadata
:
{
bytecodeHash
:
'
none
'
,
},
outputSelection
:
{
'
*
'
:
{
'
*
'
:
[
'
storageLayout
'
],
...
...
packages/contracts/hh/index.ts
0 → 100644
View file @
7b25a75e
import
'
./tasks/task-deploy
'
packages/contracts/hh/tasks/task-deploy.ts
0 → 100644
View file @
7b25a75e
/* Imports: External */
import
{
ethers
}
from
'
ethers
'
import
{
task
}
from
'
hardhat/config
'
import
*
as
types
from
'
hardhat/internal/core/params/argumentTypes
'
const
DEFAULT_L1_BLOCK_TIME_SECONDS
=
15
const
DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS
=
60
*
60
*
24
*
30
// 30 days
const
DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT
=
9
_000_000
const
DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT
=
50
_000
const
DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT
=
9
_000_000
const
DEFAULT_EM_MAX_GAS_PER_QUEUE_PER_EPOCH
=
250
_000_000
const
DEFAULT_EM_SECONDS_PER_EPOCH
=
0
const
DEFAULT_EM_OVM_CHAIN_ID
=
420
const
DEFAULT_SCC_FRAUD_PROOF_WINDOW
=
60
*
60
*
24
*
7
// 7 days
const
DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW
=
60
*
30
// 30 minutes
task
(
'
deploy
'
)
.
addOptionalParam
(
'
l1BlockTimeSeconds
'
,
'
Number of seconds on average between every L1 block.
'
,
DEFAULT_L1_BLOCK_TIME_SECONDS
,
types
.
int
)
.
addOptionalParam
(
'
ctcForceInclusionPeriodSeconds
'
,
'
Number of seconds that the sequencer has to include transactions before the L1 queue.
'
,
DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS
,
types
.
int
)
.
addOptionalParam
(
'
ctcMaxTransactionGasLimit
'
,
'
Max gas limit for L1 queue transactions.
'
,
DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT
,
types
.
int
)
.
addOptionalParam
(
'
emMinTransactionGasLimit
'
,
'
Minimum allowed transaction gas limit.
'
,
DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT
,
types
.
int
)
.
addOptionalParam
(
'
emMaxTransactionGasLimit
'
,
'
Maximum allowed transaction gas limit.
'
,
DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT
,
types
.
int
)
.
addOptionalParam
(
'
emMaxGasPerQueuePerEpoch
'
,
'
Maximum gas allowed in a given queue for each epoch.
'
,
DEFAULT_EM_MAX_GAS_PER_QUEUE_PER_EPOCH
,
types
.
int
)
.
addOptionalParam
(
'
emSecondsPerEpoch
'
,
'
Number of seconds in each epoch.
'
,
DEFAULT_EM_SECONDS_PER_EPOCH
,
types
.
int
)
.
addOptionalParam
(
'
emOvmChainId
'
,
'
Chain ID for the L2 network.
'
,
DEFAULT_EM_OVM_CHAIN_ID
,
types
.
int
)
.
addOptionalParam
(
'
sccFraudProofWindow
'
,
'
Number of seconds until a transaction is considered finalized.
'
,
DEFAULT_SCC_FRAUD_PROOF_WINDOW
,
types
.
int
)
.
addOptionalParam
(
'
sccSequencerPublishWindow
'
,
'
Number of seconds that the sequencer is exclusively allowed to post state roots.
'
,
DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW
,
types
.
int
)
.
addOptionalParam
(
'
ovmSequencerAddress
'
,
'
Address of the sequencer. Must be provided or this deployment will fail.
'
,
undefined
,
types
.
string
)
.
addOptionalParam
(
'
ovmProposerAddress
'
,
'
Address of the account that will propose state roots. Must be provided or this deployment will fail.
'
,
undefined
,
types
.
string
)
.
addOptionalParam
(
'
ovmRelayerAddress
'
,
'
Address of the message relayer. Must be provided or this deployment will fail.
'
,
undefined
,
types
.
string
)
.
addOptionalParam
(
'
ovmAddressManagerOwner
'
,
'
Address that will own the Lib_AddressManager. Must be provided or this deployment will fail.
'
,
undefined
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
:
any
,
runSuper
)
=>
{
// Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks.
const
validateAddressArg
=
(
argName
:
string
)
=>
{
if
(
args
[
argName
]
===
undefined
)
{
throw
new
Error
(
`argument for
${
argName
}
is required but was not provided`
)
}
if
(
!
ethers
.
utils
.
isAddress
(
args
[
argName
]))
{
throw
new
Error
(
`argument for
${
argName
}
is not a valid address:
${
args
[
argName
]}
`
)
}
}
validateAddressArg
(
'
ovmSequencerAddress
'
)
validateAddressArg
(
'
ovmProposerAddress
'
)
validateAddressArg
(
'
ovmRelayerAddress
'
)
validateAddressArg
(
'
ovmAddressManagerOwner
'
)
args
.
ctcForceInclusionPeriodBlocks
=
Math
.
floor
(
args
.
ctcForceInclusionPeriodSeconds
/
args
.
l1BlockTimeSeconds
)
hre
.
deployConfig
=
args
return
runSuper
(
args
)
})
packages/contracts/prettier-config.json
deleted
120000 → 0
View file @
fde84dd1
../../prettier-config.json
\ No newline at end of file
packages/contracts/prettier-config.json
0 → 100644
View file @
7b25a75e
{
"$schema"
:
"http://json.schemastore.org/prettierrc"
,
"trailingComma"
:
"es5"
,
"tabWidth"
:
2
,
"semi"
:
false
,
"singleQuote"
:
true
,
"arrowParens"
:
"always"
}
packages/contracts/src/hardhat-deploy-ethers.ts
View file @
7b25a75e
...
...
@@ -2,6 +2,7 @@
import
{
Contract
}
from
'
ethers
'
import
{
Provider
}
from
'
@ethersproject/abstract-provider
'
import
{
Signer
}
from
'
@ethersproject/abstract-signer
'
import
{
HardhatRuntimeEnvironment
}
from
'
hardhat/types
'
export
const
registerAddress
=
async
({
hre
,
...
...
@@ -50,7 +51,7 @@ export const deployAndRegister = async ({
args
,
contract
,
}:
{
hre
:
any
hre
:
HardhatRuntimeEnvironment
name
:
string
args
:
any
[]
contract
?:
string
...
...
@@ -77,7 +78,7 @@ export const deployAndRegister = async ({
}
export
const
getDeployedContract
=
async
(
hre
:
any
,
hre
:
HardhatRuntimeEnvironment
,
name
:
string
,
options
:
{
iface
?:
string
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/nuisance-gas.spec.ts
View file @
7b25a75e
...
...
@@ -188,7 +188,7 @@ const test_nuisanceGas: TestDefinition = {
// This is because there is natural gas consumption between the ovmCALL(GAS/2) and ovmCREATE, which allots nuisance gas via _getNuisanceGasLimit.
// This means that the ovmCREATE exception, DOES consumes all nuisance gas allotted, but that allotment
// is less than the full OVM_TX_GAS_LIMIT / 2 which is alloted to the parent ovmCALL.
nuisanceGasLeft
:
41
84829
,
nuisanceGasLeft
:
41
97042
,
},
},
},
...
...
packages/contracts/tslint.json
View file @
7b25a75e
...
...
@@ -2,6 +2,7 @@
"extends"
:
"../../tslint.base.json"
,
"rules"
:
{
"array-type"
:
false
,
"class-name"
:
false
"class-name"
:
false
,
"prefer-conditional-expression"
:
false
}
}
packages/contracts/yarn.lock
0 → 100644
View file @
7b25a75e
This diff is collapsed.
Click to expand it.
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