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
a14047b0
Unverified
Commit
a14047b0
authored
Aug 23, 2021
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: remove hardhat-ovm plugin and its deps
parent
1e63ffa0
Changes
37
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
54 additions
and
2263 deletions
+54
-2263
CODEOWNERS
.github/CODEOWNERS
+0
-1
labeler.yml
.github/labeler.yml
+0
-3
.gitignore
.gitignore
+0
-2
settings.json
.vscode/settings.json
+0
-1
CONTRIBUTING.md
CONTRIBUTING.md
+0
-1
README.md
README.md
+0
-1
package.json
integration-tests/package.json
+1
-1
Dockerfile.batch-submitter
ops/docker/Dockerfile.batch-submitter
+0
-1
Dockerfile.data-transport-layer
ops/docker/Dockerfile.data-transport-layer
+0
-1
Dockerfile.deployer
ops/docker/Dockerfile.deployer
+0
-4
Dockerfile.integration-tests
ops/docker/Dockerfile.integration-tests
+0
-3
Dockerfile.message-relayer
ops/docker/Dockerfile.message-relayer
+0
-1
Dockerfile.monorepo
ops/docker/Dockerfile.monorepo
+0
-1
hardhat.config.ts
packages/contracts/hardhat.config.ts
+0
-6
package.json
packages/contracts/package.json
+1
-6
build.sh
packages/contracts/scripts/build.sh
+0
-1
generate-artifacts.js
packages/contracts/scripts/generate-artifacts.js
+9
-35
connect-contracts.ts
packages/contracts/src/connect-contracts.ts
+1
-1
contract-data.ts
packages/contracts/src/contract-data.ts
+8
-8
contract-defs.ts
packages/contracts/src/contract-defs.ts
+25
-31
l2-gasprice.ts
packages/contracts/tasks/l2-gasprice.ts
+1
-4
native-eth.spec.ts
...cts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts
+0
-343
ovmCALL.spec.ts
...tracts/OVM/execution/OVM_ExecutionManager/ovmCALL.spec.ts
+0
-266
ovmCREATE.spec.ts
...acts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts
+0
-965
ovmCREATEEOA.spec.ts
...s/OVM/execution/OVM_ExecutionManager/ovmCREATEEOA.spec.ts
+1
-1
run.spec.ts
.../contracts/OVM/execution/OVM_ExecutionManager/run.spec.ts
+0
-131
test-runner.ts
packages/contracts/test/helpers/test-runner/test-runner.ts
+3
-6
.eslintrc.js
packages/hardhat-ovm/.eslintrc.js
+0
-3
.lintstagedrc.yml
packages/hardhat-ovm/.lintstagedrc.yml
+0
-2
.prettierrc.js
packages/hardhat-ovm/.prettierrc.js
+0
-3
LICENSE
packages/hardhat-ovm/LICENSE
+0
-22
README.md
packages/hardhat-ovm/README.md
+0
-45
index.ts
packages/hardhat-ovm/src/index.ts
+0
-300
type-extensions.ts
packages/hardhat-ovm/src/type-extensions.ts
+0
-44
tsconfig.build.json
packages/hardhat-ovm/tsconfig.build.json
+0
-12
tsconfig.json
packages/hardhat-ovm/tsconfig.json
+0
-3
yarn.lock
yarn.lock
+4
-4
No files found.
.github/CODEOWNERS
View file @
a14047b0
...
...
@@ -7,7 +7,6 @@
# packages/contracts/ @smartcontracts @ben-chain @maurelian @elenadimitrova
# packages/specs/protocol/ @smartcontracts @ben-chain @maurelian
# ops/ @tynes @karlfloersch
# packages/hardhat-ovm/ @smartcontracts
# packages/core-utils/ @smartcontracts @annieke @ben-chain
# packages/common-ts/ @annieke
# packages/core-utils/src/watcher.ts @K-Ho
...
...
.github/labeler.yml
View file @
a14047b0
...
...
@@ -30,8 +30,5 @@ M-core-utils:
M-dtl
:
-
any
:
[
'
packages/data-transport-layer/**/*'
]
M-hardhat-ovm
:
-
any
:
[
'
packages/hardhat-ovm/**/*'
]
M-ops
:
-
any
:
[
'
ops/**/*'
]
.gitignore
View file @
a14047b0
...
...
@@ -8,9 +8,7 @@ coverage.json
dist
artifacts
artifacts-ovm
cache
cache-ovm
l2geth/build/bin
packages/contracts/deployments/custom
...
...
.vscode/settings.json
View file @
a14047b0
...
...
@@ -6,7 +6,6 @@
"eslint.workingDirectories"
:
[
{
"directory"
:
"packages/core-utils", "changeProcessCWD"
:
true
},
{
"directory"
:
"packages/common-ts", "changeProcessCWD"
:
true
},
{
"directory"
:
"packages/hardhat-ovm", "changeProcessCWD"
:
true
},
{
"directory"
:
"packages/contracts", "changeProcessCWD"
:
true
},
{
"directory"
:
"packages/data-transport-layer", "changeProcessCWD"
:
true
},
{
"directory"
:
"packages/batch-submitter", "changeProcessCWD"
:
true
},
...
...
CONTRIBUTING.md
View file @
a14047b0
...
...
@@ -5,7 +5,6 @@
These packages only require 1 reviewer (all other packages require 2 reviewers, unless the changes do not affect production or test code).
-
packages/core-utils
-
packages/hardhat-ovm
-
packages/common-ts
-
integration-tests
...
...
README.md
View file @
a14047b0
...
...
@@ -27,7 +27,6 @@ Extensive documentation is available [here](http://community.optimism.io/docs/).
*
[
`contracts`
](
./packages/contracts
)
: Solidity smart contracts implementing the OVM
*
[
`core-utils`
](
./packages/core-utils
)
: Low-level utilities and encoding packages
*
[
`common-ts`
](
./packages/common-ts
)
: Common tools for TypeScript code that runs in Node
*
[
`hardhat-ovm`
](
./packages/hardhat-ovm
)
: Hardhat plugin which enables the
[
OVM Compiler
](
https://github.com/ethereum-optimism/solidity
)
*
[
`data-transport-layer`
](
./packages/data-transport-layer
)
: Event indexer, allowing the
`l2geth`
node to access L1 data
*
[
`batch-submitter`
](
./packages/batch-submitter
)
: Daemon for submitting L2 transaction and state root batches to L1
*
[
`message-relayer`
](
./packages/message-relayer
)
: Service for relaying L2 messages to L1
...
...
integration-tests/package.json
View file @
a14047b0
...
...
@@ -14,7 +14,7 @@
"test:integration"
:
"hardhat --network optimism test"
,
"test:integration:live"
:
"IS_LIVE_NETWORK=true hardhat --network optimism test"
,
"test:sync"
:
"hardhat --network optimism test sync-tests/*.spec.ts --no-compile"
,
"clean"
:
"rimraf cache artifacts
artifacts-ovm cache-ovm
"
"clean"
:
"rimraf cache artifacts"
},
"devDependencies"
:
{
"@eth-optimism/contracts"
:
"^0.4.14"
,
...
...
ops/docker/Dockerfile.batch-submitter
View file @
a14047b0
...
...
@@ -21,7 +21,6 @@ COPY --from=builder /optimism/packages/contracts/package.json ./packages/contrac
COPY --from=builder /optimism/packages/contracts/deployments ./packages/contracts/deployments
COPY --from=builder /optimism/packages/contracts/dist ./packages/contracts/dist
COPY --from=builder /optimism/packages/contracts/artifacts ./packages/contracts/artifacts
COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./packages/contracts/artifacts-ovm
# copy the service
WORKDIR /opt/optimism/packages/batch-submitter
...
...
ops/docker/Dockerfile.data-transport-layer
View file @
a14047b0
...
...
@@ -22,7 +22,6 @@ COPY --from=builder /optimism/packages/contracts/package.json ./packages/contrac
COPY --from=builder /optimism/packages/contracts/deployments ./packages/contracts/deployments
COPY --from=builder /optimism/packages/contracts/dist ./packages/contracts/dist
COPY --from=builder /optimism/packages/contracts/artifacts ./packages/contracts/artifacts
COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./packages/contracts/artifacts-ovm
# copy the service
WORKDIR /opt/optimism/packages/data-transport-layer
...
...
ops/docker/Dockerfile.deployer
View file @
a14047b0
...
...
@@ -14,16 +14,12 @@ COPY --from=builder /optimism/node_modules ./node_modules
COPY --from=builder /optimism/packages/core-utils/package.json ./packages/core-utils/package.json
COPY --from=builder /optimism/packages/core-utils/dist ./packages/core-utils/dist
COPY --from=builder /optimism/packages/hardhat-ovm/package.json ./packages/hardhat-ovm/package.json
COPY --from=builder /optimism/packages/hardhat-ovm/dist ./packages/hardhat-ovm/dist
# get the needed built artifacts
WORKDIR /opt/optimism/packages/contracts
COPY --from=builder /optimism/packages/contracts/dist ./dist
COPY --from=builder /optimism/packages/contracts/*.json ./
COPY --from=builder /optimism/packages/contracts/node_modules ./node_modules
COPY --from=builder /optimism/packages/contracts/artifacts ./artifacts
COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./artifacts-ovm
# get non-build artifacts from the host
COPY packages/contracts/bin ./bin
...
...
ops/docker/Dockerfile.integration-tests
View file @
a14047b0
...
...
@@ -17,9 +17,6 @@ COPY --from=builder /optimism/packages/core-utils/dist ./packages/core-utils/dis
COPY --from=builder /optimism/packages/message-relayer/package.json ./packages/message-relayer/package.json
COPY --from=builder /optimism/packages/message-relayer/dist ./packages/message-relayer/dist
COPY --from=builder /optimism/packages/hardhat-ovm/package.json ./packages/hardhat-ovm/package.json
COPY --from=builder /optimism/packages/hardhat-ovm/dist ./packages/hardhat-ovm/dist
COPY --from=builder /optimism/packages/contracts ./packages/contracts
# get the needed built artifacts
...
...
ops/docker/Dockerfile.message-relayer
View file @
a14047b0
...
...
@@ -22,7 +22,6 @@ COPY --from=builder /optimism/packages/contracts/package.json ./packages/contrac
COPY --from=builder /optimism/packages/contracts/deployments ./packages/contracts/deployments
COPY --from=builder /optimism/packages/contracts/dist ./packages/contracts/dist
COPY --from=builder /optimism/packages/contracts/artifacts ./packages/contracts/artifacts
COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./packages/contracts/artifacts-ovm
# copy the service
WORKDIR /opt/optimism/packages/message-relayer
...
...
ops/docker/Dockerfile.monorepo
View file @
a14047b0
...
...
@@ -26,7 +26,6 @@ WORKDIR /optimism
COPY *.json yarn.lock ./
COPY packages/core-utils/package.json ./packages/core-utils/package.json
COPY packages/common-ts/package.json ./packages/common-ts/package.json
COPY packages/hardhat-ovm/package.json ./packages/hardhat-ovm/package.json
COPY packages/contracts/package.json ./packages/contracts/package.json
COPY packages/data-transport-layer/package.json ./packages/data-transport-layer/package.json
COPY packages/batch-submitter/package.json ./packages/batch-submitter/package.json
...
...
packages/contracts/hardhat.config.ts
View file @
a14047b0
...
...
@@ -13,7 +13,6 @@ import '@nomiclabs/hardhat-waffle'
import
'
@nomiclabs/hardhat-etherscan
'
import
'
hardhat-deploy
'
import
'
@typechain/hardhat
'
import
'
@eth-optimism/hardhat-ovm
'
import
'
./tasks/deploy
'
import
'
./tasks/l2-gasprice
'
import
'
./tasks/set-owner
'
...
...
@@ -39,10 +38,8 @@ const config: HardhatUserConfig = {
tags
:
[
'
local
'
],
hardfork
:
'
istanbul
'
,
},
// Add this network to your config!
optimism
:
{
url
:
'
http://127.0.0.1:8545
'
,
ovm
:
true
,
saveDeployments
:
false
,
},
'
optimism-kovan
'
:
{
...
...
@@ -77,9 +74,6 @@ const config: HardhatUserConfig = {
},
},
},
ovm
:
{
solcVersion
:
'
0.7.6+commit.3b061308
'
,
},
typechain
:
{
outDir
:
'
dist/types
'
,
target
:
'
ethers-v5
'
,
...
...
packages/contracts/package.json
View file @
a14047b0
...
...
@@ -5,9 +5,7 @@
"files"
:
[
"dist/**/*.js"
,
"dist/types/*.ts"
,
"dist/types-ovm/*.ts"
,
"artifacts/contracts/**/*.json"
,
"artifacts-ovm/contracts/**/*.json"
,
"deployments/**/*.json"
,
"OVM"
,
"iOVM"
,
...
...
@@ -24,10 +22,8 @@
"build:mainnet"
:
"yarn run build:contracts && yarn run build:typescript && yarn run build:copy && CHAIN_ID=10 yarn run build:dump && yarn run build:typechain"
,
"build:typescript"
:
"tsc -p ./tsconfig.build.json"
,
"build:contracts"
:
"hardhat compile --show-stack-traces"
,
"build:contracts:ovm"
:
"hardhat compile --network optimism"
,
"build:dump"
:
"ts-node
\"
bin/take-dump.ts
\"
"
,
"build:typechain"
:
"hardhat typechain"
,
"build:typechain:ovm"
:
"hardhat --network optimism typechain"
,
"test"
:
"yarn run test:contracts"
,
"test:contracts"
:
"hardhat test --show-stack-traces"
,
"test:gas"
:
"hardhat test
\"
test/contracts/OVM/execution/OVM_StateManager.gas-spec.ts
\"
--no-compile --show-stack-traces"
,
...
...
@@ -38,7 +34,7 @@
"lint:check"
:
"eslint ."
,
"lint:fix"
:
"yarn lint:check --fix"
,
"lint:contracts"
:
"yarn solhint -f table contracts/optimistic-ethereum/**/*.sol"
,
"clean"
:
"rm -rf ./dist ./artifacts ./
artifacts-ovm ./cache ./cache-ovm
./tsconfig.build.tsbuildinfo"
,
"clean"
:
"rm -rf ./dist ./artifacts ./
cache
./tsconfig.build.tsbuildinfo"
,
"deploy"
:
"ts-node
\"
./bin/deploy.ts
\"
&& yarn generate:markdown"
,
"serve"
:
"./bin/serve_dump.sh"
,
"prepublishOnly"
:
"yarn copyfiles -u 2
\"
contracts/optimistic-ethereum/**/*
\"
./"
,
...
...
@@ -60,7 +56,6 @@
},
"devDependencies"
:
{
"@codechecks/client"
:
"^0.1.11"
,
"@eth-optimism/hardhat-ovm"
:
"^0.2.4"
,
"@eth-optimism/smock"
:
"^1.1.10"
,
"@ethersproject/transactions"
:
"^5.4.0"
,
"@nomiclabs/hardhat-ethers"
:
"^2.0.2"
,
...
...
packages/contracts/scripts/build.sh
View file @
a14047b0
...
...
@@ -3,6 +3,5 @@
set
-e
yarn build:contracts
yarn build:contracts:ovm
yarn generate:artifacts
yarn build:typescript
packages/contracts/scripts/generate-artifacts.js
View file @
a14047b0
...
...
@@ -15,9 +15,6 @@ const fs = require('fs')
const
evmArtifactPaths
=
getContractJsonFiles
(
path
.
resolve
(
__dirname
,
`../artifacts/contracts`
)
)
const
ovmArtifactPaths
=
getContractJsonFiles
(
path
.
resolve
(
__dirname
,
`../artifacts-ovm/contracts`
)
)
const
content
=
`
/* eslint-disable @typescript-eslint/no-var-requires, no-empty */
...
...
@@ -26,18 +23,6 @@ const fs = require('fs')
DO NOT EDIT.
*/
${
ovmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
const
relPath
=
path
.
relative
(
__dirname
,
artifactPath
)
return
`
let ovm__
${
artifact
.
contractName
}
try {
ovm__
${
artifact
.
contractName
}
= require('
${
relPath
}
')
} catch {}
`
})
.
join
(
'
\n
'
)}
${
evmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
...
...
@@ -51,26 +36,15 @@ const fs = require('fs')
})
.
join
(
'
\n
'
)}
export const getContractArtifact = (name: string, ovm: boolean): any => {
if (ovm) {
return {
${
ovmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
return
`
${
artifact
.
contractName
}
: ovm__
${
artifact
.
contractName
}
`
})
.
join
(
'
,
\n
'
)}
}[name]
} else {
return {
${
evmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
return
`
${
artifact
.
contractName
}
:
${
artifact
.
contractName
}
`
})
.
join
(
'
,
\n
'
)}
}[name]
}
export const getContractArtifact = (name: string): any => {
return {
${
evmArtifactPaths
.
map
((
artifactPath
)
=>
{
const
artifact
=
require
(
artifactPath
)
return
`
${
artifact
.
contractName
}
:
${
artifact
.
contractName
}
`
})
.
join
(
'
,
\n
'
)}
}[name]
}
`
...
...
packages/contracts/src/connect-contracts.ts
View file @
a14047b0
import
{
Signer
,
Contract
,
providers
,
ethers
}
from
'
ethers
'
import
{
Signer
,
Contract
}
from
'
ethers
'
import
{
Provider
}
from
'
@ethersproject/abstract-provider
'
import
{
getL1ContractData
,
getL2ContractData
}
from
'
./contract-data
'
...
...
packages/contracts/src/contract-data.ts
View file @
a14047b0
...
...
@@ -112,15 +112,15 @@ export const getL1ContractData = (network: Network) => {
}
}
const
OVM_ETH
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol/OVM_ETH.json
'
)
const
OVM_L2CrossDomainMessenger
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol/OVM_L2CrossDomainMessenger.json
'
)
const
OVM_L2ToL1MessagePasser
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol/OVM_L2ToL1MessagePasser.json
'
)
const
OVM_ETH
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol/OVM_ETH.json
'
)
const
OVM_L2CrossDomainMessenger
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol/OVM_L2CrossDomainMessenger.json
'
)
const
OVM_L2ToL1MessagePasser
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol/OVM_L2ToL1MessagePasser.json
'
)
const
OVM_L1MessageSender
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L1MessageSender.sol/OVM_L1MessageSender.json
'
)
const
OVM_DeployerWhitelist
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol/OVM_DeployerWhitelist.json
'
)
const
OVM_ECDSAContractAccount
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol/OVM_ECDSAContractAccount.json
'
)
const
OVM_SequencerEntrypoint
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol/OVM_SequencerEntrypoint.json
'
)
const
ERC1820Registry
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/OVM/predeploys/ERC1820Registry.sol/ERC1820Registry.json
'
)
const
Lib_AddressManager
=
require
(
'
../artifacts
-ovm
/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol/Lib_AddressManager.json
'
)
const
OVM_DeployerWhitelist
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol/OVM_DeployerWhitelist.json
'
)
const
OVM_ECDSAContractAccount
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol/OVM_ECDSAContractAccount.json
'
)
const
OVM_SequencerEntrypoint
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol/OVM_SequencerEntrypoint.json
'
)
const
ERC1820Registry
=
require
(
'
../artifacts/contracts/optimistic-ethereum/OVM/predeploys/ERC1820Registry.sol/ERC1820Registry.json
'
)
const
Lib_AddressManager
=
require
(
'
../artifacts/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol/Lib_AddressManager.json
'
)
export
const
getL2ContractData
=
()
=>
{
return
{
...
...
packages/contracts/src/contract-defs.ts
View file @
a14047b0
import
{
ethers
,
ContractFactory
,
Signer
,
providers
,
Contract
,
constants
,
}
from
'
ethers
'
import
{
Interface
}
from
'
ethers/lib/utils
'
import
{
ethers
}
from
'
ethers
'
export
const
getContractDefinition
=
(
name
:
string
,
ovm
?:
boolean
):
any
=>
{
export
const
getContractDefinition
=
(
name
:
string
):
any
=>
{
// We import this using `require` because hardhat tries to build this file when compiling
// the contracts, but we need the contracts to be compiled before the contract-artifacts.ts
// file can be generated.
// eslint-disable-next-line @typescript-eslint/no-var-requires
const
{
getContractArtifact
}
=
require
(
'
./contract-artifacts
'
)
const
artifact
=
getContractArtifact
(
name
,
ovm
)
const
artifact
=
getContractArtifact
(
name
)
if
(
artifact
===
undefined
)
{
throw
new
Error
(
`Unable to find artifact for contract:
${
name
}
`
)
}
return
artifact
}
export
const
getContractInterface
=
(
name
:
string
,
ovm
?:
boolean
):
Interface
=>
{
const
definition
=
getContractDefinition
(
name
,
ovm
)
export
const
getContractInterface
=
(
name
:
string
):
ethers
.
utils
.
Interface
=>
{
const
definition
=
getContractDefinition
(
name
)
return
new
ethers
.
utils
.
Interface
(
definition
.
abi
)
}
export
const
getContractFactory
=
(
name
:
string
,
signer
?:
Signer
,
ovm
?:
boolean
):
ContractFactory
=>
{
const
definition
=
getContractDefinition
(
name
,
ovm
)
const
contractInterface
=
getContractInterface
(
name
,
ovm
)
return
new
ContractFactory
(
contractInterface
,
definition
.
bytecode
,
signer
)
signer
?:
ethers
.
Signer
):
ethers
.
ContractFactory
=>
{
const
definition
=
getContractDefinition
(
name
)
const
contractInterface
=
getContractInterface
(
name
)
return
new
ethers
.
ContractFactory
(
contractInterface
,
definition
.
bytecode
,
signer
)
}
export
const
loadContract
=
(
name
:
string
,
address
:
string
,
provider
:
providers
.
JsonRpcProvider
):
Contract
=>
{
return
new
Contract
(
address
,
getContractInterface
(
name
)
as
any
,
provider
)
provider
:
ethers
.
providers
.
JsonRpcProvider
):
ethers
.
Contract
=>
{
return
new
ethers
.
Contract
(
address
,
getContractInterface
(
name
)
as
any
,
provider
)
}
export
const
loadContractFromManager
=
async
(
args
:
{
name
:
string
proxy
?:
string
Lib_AddressManager
:
Contract
provider
:
providers
.
JsonRpcProvider
}):
Promise
<
Contract
>
=>
{
Lib_AddressManager
:
ethers
.
Contract
provider
:
ethers
.
providers
.
JsonRpcProvider
}):
Promise
<
ethers
.
Contract
>
=>
{
const
{
name
,
proxy
,
Lib_AddressManager
,
provider
}
=
args
const
address
=
await
Lib_AddressManager
.
getAddress
(
proxy
?
proxy
:
name
)
if
(
address
===
constants
.
AddressZero
)
{
if
(
address
===
ethers
.
constants
.
AddressZero
)
{
throw
new
Error
(
`Lib_AddressManager does not have a record for a contract named:
${
name
}
`
)
}
return
loadContract
(
name
,
address
,
provider
)
}
packages/contracts/tasks/l2-gasprice.ts
View file @
a14047b0
...
...
@@ -27,10 +27,7 @@ task('set-l2-gasprice')
provider
)
const
GasPriceOracleArtifact
=
getContractDefinition
(
'
OVM_GasPriceOracle
'
,
true
)
const
GasPriceOracleArtifact
=
getContractDefinition
(
'
OVM_GasPriceOracle
'
)
const
GasPriceOracle
=
new
ethers
.
Contract
(
predeploys
.
OVM_GasPriceOracle
,
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts
deleted
100644 → 0
View file @
1e63ffa0
This diff is collapsed.
Click to expand it.
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCALL.spec.ts
deleted
100644 → 0
View file @
1e63ffa0
/* Internal Imports */
import
{
ExecutionManagerTestRunner
,
TestDefinition
,
OVM_TX_GAS_LIMIT
,
NON_NULL_BYTES32
,
REVERT_FLAGS
,
VERIFIED_EMPTY_CONTRACT_HASH
,
}
from
'
../../../../helpers
'
const
DUMMY_REVERT_DATA
=
'
0xdeadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420
'
const
DEAD_ADDRESS
=
'
0xdeaddeaddeaddeaddeaddeaddeaddeaddead1234
'
const
test_ovmCALL
:
TestDefinition
=
{
name
:
'
Basic tests for ovmCALL
'
,
preState
:
{
ExecutionManager
:
{
ovmStateManager
:
'
$OVM_STATE_MANAGER
'
,
ovmSafetyChecker
:
'
$OVM_SAFETY_CHECKER
'
,
messageRecord
:
{
nuisanceGasLeft
:
OVM_TX_GAS_LIMIT
,
},
},
StateManager
:
{
owner
:
'
$OVM_EXECUTION_MANAGER
'
,
accounts
:
{
$DUMMY_OVM_ADDRESS_1
:
{
codeHash
:
NON_NULL_BYTES32
,
ethAddress
:
'
$OVM_CALL_HELPER
'
,
},
$DUMMY_OVM_ADDRESS_2
:
{
codeHash
:
NON_NULL_BYTES32
,
ethAddress
:
'
$OVM_CALL_HELPER
'
,
},
$DUMMY_OVM_ADDRESS_3
:
{
codeHash
:
VERIFIED_EMPTY_CONTRACT_HASH
,
ethAddress
:
'
0x
'
+
'
00
'
.
repeat
(
20
),
},
},
verifiedContractStorage
:
{
$DUMMY_OVM_ADDRESS_1
:
{
[
NON_NULL_BYTES32
]:
true
,
},
},
},
},
parameters
:
[
{
name
:
'
ovmCALL(ADDRESS_1) => ovmADDRESS
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmADDRESS
'
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_1
'
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
{
name
:
'
ovmCALL(ADDRESS_1) => ovmSSTORE
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmSSTORE
'
,
functionParams
:
{
key
:
NON_NULL_BYTES32
,
value
:
NON_NULL_BYTES32
,
},
expectedReturnStatus
:
true
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
{
name
:
'
ovmCALL(ADDRESS_1) => ovmSSTORE + ovmSLOAD, ovmCALL(ADDRESS_1) => ovmSLOAD
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmSSTORE
'
,
functionParams
:
{
key
:
NON_NULL_BYTES32
,
value
:
NON_NULL_BYTES32
,
},
expectedReturnStatus
:
true
,
},
{
functionName
:
'
ovmSLOAD
'
,
functionParams
:
{
key
:
NON_NULL_BYTES32
,
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
NON_NULL_BYTES32
,
},
],
},
expectedReturnStatus
:
true
,
},
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmSLOAD
'
,
functionParams
:
{
key
:
NON_NULL_BYTES32
,
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
NON_NULL_BYTES32
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
{
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmADDRESS + ovmCALLER
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_2
'
,
subSteps
:
[
{
functionName
:
'
ovmADDRESS
'
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_2
'
,
},
{
functionName
:
'
ovmCALLER
'
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_1
'
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
{
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_3)
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_3
'
,
calldata
:
'
0x
'
,
},
expectedReturnStatus
:
true
,
},
],
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
'
0x
'
,
},
],
},
{
name
:
'
ovmCALL(ADDRESS_1) => INTENTIONAL_REVERT
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
evmREVERT
'
,
returnData
:
{
flag
:
REVERT_FLAGS
.
INTENTIONAL_REVERT
,
data
:
DUMMY_REVERT_DATA
,
},
},
],
},
expectedReturnStatus
:
false
,
expectedReturnValue
:
DUMMY_REVERT_DATA
,
},
],
},
{
name
:
'
ovmCALL(ADDRESS_1) => EXCEEDS_NUISANCE_GAS
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
evmREVERT
'
,
returnData
:
{
flag
:
REVERT_FLAGS
.
EXCEEDS_NUISANCE_GAS
,
},
},
],
},
expectedReturnStatus
:
false
,
expectedReturnValue
:
'
0x
'
,
},
],
},
{
name
:
'
ovmCALL(0xdeaddeaddead...) returns (true, 0x)
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
DEAD_ADDRESS
,
subSteps
:
[],
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
{
ovmSuccess
:
true
,
returnData
:
'
0x
'
,
},
},
],
},
],
}
const
runner
=
new
ExecutionManagerTestRunner
()
runner
.
run
(
test_ovmCALL
)
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts
deleted
100644 → 0
View file @
1e63ffa0
This diff is collapsed.
Click to expand it.
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATEEOA.spec.ts
View file @
a14047b0
...
...
@@ -71,7 +71,7 @@ const test_ovmCREATEEOA: TestDefinition = {
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
fromHexString
(
getContractDefinition
(
'
OVM_ProxyEOA
'
,
true
).
deployedBytecode
getContractDefinition
(
'
OVM_ProxyEOA
'
).
deployedBytecode
).
length
,
},
],
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/run.spec.ts
deleted
100644 → 0
View file @
1e63ffa0
/* Internal Imports */
import
{
constants
}
from
'
ethers
'
import
{
ExecutionManagerTestRunner
,
TestDefinition
,
OVM_TX_GAS_LIMIT
,
NON_NULL_BYTES32
,
VERIFIED_EMPTY_CONTRACT_HASH
,
}
from
'
../../../../helpers
'
const
GAS_METADATA_ADDRESS
=
'
0x06a506a506a506a506a506a506a506a506a506a5
'
enum
GasMetadataKey
{
CURRENT_EPOCH_START_TIMESTAMP
,
CUMULATIVE_SEQUENCER_QUEUE_GAS
,
CUMULATIVE_L1TOL2_QUEUE_GAS
,
PREV_EPOCH_SEQUENCER_QUEUE_GAS
,
PREV_EPOCH_L1TOL2_QUEUE_GAS
,
}
const
keyToBytes32
=
(
key
:
GasMetadataKey
):
string
=>
{
return
'
0x
'
+
`0
${
key
}
`
.
padStart
(
64
,
'
0
'
)
}
const
test_run
:
TestDefinition
=
{
name
:
'
Basic tests for ovmCALL
'
,
preState
:
{
ExecutionManager
:
{
ovmStateManager
:
'
$OVM_STATE_MANAGER
'
,
ovmSafetyChecker
:
'
$OVM_SAFETY_CHECKER
'
,
messageRecord
:
{
nuisanceGasLeft
:
OVM_TX_GAS_LIMIT
,
},
},
StateManager
:
{
owner
:
'
$OVM_EXECUTION_MANAGER
'
,
accounts
:
{
$DUMMY_OVM_ADDRESS_1
:
{
codeHash
:
NON_NULL_BYTES32
,
ethAddress
:
'
$OVM_CALL_HELPER
'
,
},
$DUMMY_OVM_ADDRESS_2
:
{
codeHash
:
NON_NULL_BYTES32
,
ethAddress
:
'
$OVM_CALL_HELPER
'
,
},
$DUMMY_OVM_ADDRESS_3
:
{
codeHash
:
VERIFIED_EMPTY_CONTRACT_HASH
,
ethAddress
:
'
0x
'
+
'
00
'
.
repeat
(
20
),
},
},
contractStorage
:
{
[
GAS_METADATA_ADDRESS
]:
{
[
keyToBytes32
(
GasMetadataKey
.
CURRENT_EPOCH_START_TIMESTAMP
)]:
1
,
[
keyToBytes32
(
GasMetadataKey
.
CUMULATIVE_SEQUENCER_QUEUE_GAS
)]:
0
,
[
keyToBytes32
(
GasMetadataKey
.
CUMULATIVE_L1TOL2_QUEUE_GAS
)]:
0
,
[
keyToBytes32
(
GasMetadataKey
.
PREV_EPOCH_SEQUENCER_QUEUE_GAS
)]:
0
,
[
keyToBytes32
(
GasMetadataKey
.
PREV_EPOCH_L1TOL2_QUEUE_GAS
)]:
0
,
},
},
verifiedContractStorage
:
{
[
GAS_METADATA_ADDRESS
]:
{
[
keyToBytes32
(
GasMetadataKey
.
CURRENT_EPOCH_START_TIMESTAMP
)]:
true
,
[
keyToBytes32
(
GasMetadataKey
.
CUMULATIVE_SEQUENCER_QUEUE_GAS
)]:
true
,
[
keyToBytes32
(
GasMetadataKey
.
CUMULATIVE_L1TOL2_QUEUE_GAS
)]:
true
,
[
keyToBytes32
(
GasMetadataKey
.
PREV_EPOCH_SEQUENCER_QUEUE_GAS
)]:
true
,
[
keyToBytes32
(
GasMetadataKey
.
PREV_EPOCH_L1TOL2_QUEUE_GAS
)]:
true
,
},
},
},
},
parameters
:
[
{
name
:
'
run => ovmCALL(ADDRESS_1) => ovmADDRESS
'
,
// TODO: Appears to be failing because of a bug in smock.
skip
:
true
,
steps
:
[
{
functionName
:
'
run
'
,
functionParams
:
{
timestamp
:
0
,
queueOrigin
:
0
,
entrypoint
:
'
$OVM_CALL_HELPER
'
,
origin
:
constants
.
AddressZero
,
msgSender
:
constants
.
AddressZero
,
gasLimit
:
OVM_TX_GAS_LIMIT
,
subSteps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmADDRESS
'
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_1
'
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
},
],
},
// This functionality has moved to the OVM_StateTransitioner,
// but leaving here for future reference on how to use this feature of the EM TestRunner.
// {
// name: 'run with insufficient gas supplied',
// steps: [
// {
// functionName: 'run',
// suppliedGas: OVM_TX_GAS_LIMIT / 2,
// functionParams: {
// timestamp: 0,
// queueOrigin: 0,
// entrypoint: '$OVM_CALL_HELPER',
// origin: constants.AddressZero,
// msgSender: constants.AddressZero,
// gasLimit: OVM_TX_GAS_LIMIT,
// subSteps: [],
// },
// expectedRevertValue: 'Not enough gas to execute deterministically',
// },
// ],
// },
],
}
const
runner
=
new
ExecutionManagerTestRunner
()
runner
.
run
(
test_run
)
packages/contracts/test/helpers/test-runner/test-runner.ts
View file @
a14047b0
...
...
@@ -231,24 +231,21 @@ export class ExecutionManagerTestRunner {
const
DeployerWhitelist
=
await
getContractFactory
(
'
OVM_DeployerWhitelist
'
,
AddressManager
.
signer
,
true
AddressManager
.
signer
).
deploy
()
this
.
contracts
.
OVM_DeployerWhitelist
=
DeployerWhitelist
const
OvmEth
=
await
getContractFactory
(
'
OVM_ETH
'
,
AddressManager
.
signer
,
true
AddressManager
.
signer
).
deploy
()
this
.
contracts
.
OVM_ETH
=
OvmEth
this
.
contracts
.
OVM_ProxyEOA
=
await
getContractFactory
(
'
OVM_ProxyEOA
'
,
AddressManager
.
signer
,
true
AddressManager
.
signer
).
deploy
()
this
.
contracts
.
OVM_ExecutionManager
=
await
(
...
...
packages/hardhat-ovm/.eslintrc.js
deleted
100644 → 0
View file @
1e63ffa0
module
.
exports
=
{
extends
:
'
../../.eslintrc.js
'
,
}
packages/hardhat-ovm/.lintstagedrc.yml
deleted
100644 → 0
View file @
1e63ffa0
"
*.{ts,js}"
:
-
eslint
packages/hardhat-ovm/.prettierrc.js
deleted
100644 → 0
View file @
1e63ffa0
module
.
exports
=
{
...
require
(
'
../../.prettierrc.js
'
),
};
\ No newline at end of file
packages/hardhat-ovm/LICENSE
deleted
100644 → 0
View file @
1e63ffa0
(The MIT License)
Copyright 2020-2021 Optimism
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
packages/hardhat-ovm/README.md
deleted
100644 → 0
View file @
1e63ffa0
# @eth-optimism/hardhat-ovm
A plugin that brings OVM compiler support to Hardhat projects.
## Installation
```
yarn add --dev @eth-optimism/hardhat-ovm
```
Next, import the plugin inside your
`hardhat.config.js`
:
```
js
// hardhat.config.js
require
(
"
@eth-optimism/hardhat-ovm
"
)
```
Or if using TypeScript:
```
ts
// hardhat.config.ts
import
"
@eth-optimism/hardhat-ovm
"
```
## Configuration
**By default, this plugin will use OVM compiler version 0.7.6**
.
Configure this plugin by adding an
`ovm`
field to your Hardhat config:
```
js
// hardhat.config.js
require
(
"
@eth-optimism/hardhat-ovm
"
)
module
.
exports
=
{
ovm
:
{
solcVersion
:
'
X.Y.Z
'
// Your version goes here.
}
}
```
This package also has typings so it won't break your Hardhat config if you're using TypeScript.
packages/hardhat-ovm/src/index.ts
deleted
100644 → 0
View file @
1e63ffa0
This diff is collapsed.
Click to expand it.
packages/hardhat-ovm/src/type-extensions.ts
deleted
100644 → 0
View file @
1e63ffa0
import
'
hardhat/types/config
'
declare
module
'
hardhat/types/config
'
{
interface
HardhatUserConfig
{
ovm
?:
{
solcVersion
?:
string
}
}
interface
HardhatConfig
{
ovm
?:
{
solcVersion
?:
string
}
}
interface
HardhatNetworkUserConfig
{
ovm
?:
boolean
ignoreRxList
?:
string
[]
}
interface
HttpNetworkUserConfig
{
ovm
?:
boolean
ignoreRxList
?:
string
[]
}
interface
HardhatNetworkConfig
{
ovm
:
boolean
ignoreRxList
:
string
[]
interval
?:
number
}
interface
HttpNetworkConfig
{
ovm
:
boolean
ignoreRxList
:
string
[]
interval
?:
number
}
}
declare
module
'
hardhat/types/runtime
'
{
interface
Network
{
ovm
:
boolean
ignoreRxList
:
string
[]
}
}
packages/hardhat-ovm/tsconfig.build.json
deleted
100644 → 0
View file @
1e63ffa0
{
"extends"
:
"../../tsconfig.build.json"
,
"compilerOptions"
:
{
"rootDir"
:
"./src"
,
"outDir"
:
"./dist"
},
"include"
:
[
"src/**/*"
]
}
packages/hardhat-ovm/tsconfig.json
deleted
100644 → 0
View file @
1e63ffa0
{
"extends"
:
"../../tsconfig.json"
}
yarn.lock
View file @
a14047b0
...
...
@@ -2606,10 +2606,10 @@
dependencies:
"@types/tz-offset" "*"
"@types/node-fetch@^2.5.
10", "@types/node-fetch@^2.5.5
":
version "2.5.1
2
"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.1
2.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66
"
integrity sha512-
MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw
==
"@types/node-fetch@^2.5.
5", "@types/node-fetch@^2.5.8
":
version "2.5.1
0
"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.1
0.tgz#9b4d4a0425562f9fcea70b12cb3fcdd946ca8132
"
integrity sha512-
IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ
==
dependencies:
"@types/node" "*"
form-data "^3.0.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