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
7085f475
Commit
7085f475
authored
Jan 18, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(2step): copy over scaffolding from fault-detector
parent
117e5746
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
197 additions
and
0 deletions
+197
-0
.depcheckrc
packages/two-step-monitor/.depcheckrc
+13
-0
.env.example
packages/two-step-monitor/.env.example
+11
-0
.eslintrc.js
packages/two-step-monitor/.eslintrc.js
+3
-0
.gitignore
packages/two-step-monitor/.gitignore
+2
-0
.lintstagedrc.yml
packages/two-step-monitor/.lintstagedrc.yml
+2
-0
.prettierrc.js
packages/two-step-monitor/.prettierrc.js
+3
-0
LICENSE
packages/two-step-monitor/LICENSE
+22
-0
README.md
packages/two-step-monitor/README.md
+62
-0
hardhat.config.ts
packages/two-step-monitor/hardhat.config.ts
+13
-0
package.json
packages/two-step-monitor/package.json
+44
-0
index.ts
packages/two-step-monitor/src/index.ts
+1
-0
service.ts
packages/two-step-monitor/src/service.ts
+1
-0
setup.ts
packages/two-step-monitor/test/setup.ts
+10
-0
tsconfig.json
packages/two-step-monitor/tsconfig.json
+10
-0
No files found.
packages/two-step-monitor/.depcheckrc
0 → 100644
View file @
7085f475
ignores: [
"@babel/eslint-parser",
"@typescript-eslint/parser",
"eslint-plugin-import",
"eslint-plugin-unicorn",
"eslint-plugin-jsdoc",
"eslint-plugin-prefer-arrow",
"eslint-plugin-react",
"@typescript-eslint/eslint-plugin",
"eslint-config-prettier",
"eslint-plugin-prettier",
"chai"
]
packages/two-step-monitor/.env.example
0 → 100644
View file @
7085f475
# URL for an L1 RPC provider, used to query L2 output proposals
TWO_STEP_MONITOR__L1_RPC_PROVIDER=
# URL for an L2 RPC provider, used to query canonical L2 state
TWO_STEP_MONITOR__L2_RPC_PROVIDER=
TWO_STEP_MONITOR__HOSTNAME=
TWO_STEP_MONITOR__PORT=
TWO_STEP_MONITOR__START_BATCH_INDEX=
TWO_STEP_MONITOR__LOOP_INTERVAL_MS=
packages/two-step-monitor/.eslintrc.js
0 → 100644
View file @
7085f475
module
.
exports
=
{
extends
:
'
../../.eslintrc.js
'
,
}
packages/two-step-monitor/.gitignore
0 → 100644
View file @
7085f475
node_modules/
build/
packages/two-step-monitor/.lintstagedrc.yml
0 → 100644
View file @
7085f475
"
*.{ts,js}"
:
-
eslint
packages/two-step-monitor/.prettierrc.js
0 → 100644
View file @
7085f475
module
.
exports
=
{
...
require
(
'
../../.prettierrc.js
'
),
};
packages/two-step-monitor/LICENSE
0 → 100644
View file @
7085f475
(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/two-step-monitor/README.md
0 → 100644
View file @
7085f475
# @eth-optimism/two-step-monitor
[

](https://codecov.io/gh/ethereum-optimism/optimism)
The
`two-step-monitor`
is a simple service for detecting discrepancies between withdrawals created on L2, and
withdrawals proven on L1.
## Installation
Clone, install, and build the Optimism monorepo:
```
git clone https://github.com/ethereum-optimism/optimism.git
yarn install
yarn build
```
## Running the service
Copy
`.env.example`
into a new file named
`.env`
, then set the environment variables listed there.
Once your environment variables have been set, run the service via:
```
yarn start
```
## Ports
-
API is exposed at
`$TWO_STEP_MONITOR__HOSTNAME:$TWO_STEP_MONITOR__PORT/api`
-
Metrics are exposed at
`$TWO_STEP_MONITOR__HOSTNAME:$TWO_STEP_MONITOR__PORT/metrics`
-
`$TWO_STEP_MONITOR__HOSTNAME`
defaults to
`0.0.0.0`
-
`$TWO_STEP_MONITOR__PORT`
defaults to
`7300`
## What this service does
The
`two-step-monitor`
detects when a withdrawal is proven on L1, and verifies that a corresponding withdrawal
has been created on L2.
We export a series of Prometheus metrics that you can use to trigger alerting when issues are detected.
Check the list of available metrics via
`yarn start --help`
:
```
sh
>
yarn start
--help
yarn run v1.22.19
$
ts-node ./src/service.ts
--help
Usage: service
[
options]
Options:
--l1rpcprovider
Provider
for
interacting with L1
(
env
: TWO_STEP_MONITOR__L1_RPC_PROVIDER
)
--l2rpcprovider
Provider
for
interacting with L2
(
env
: TWO_STEP_MONITOR__L2_RPC_PROVIDER
)
--port
Port
for
the app server
(
env
: TWO_STEP_MONITOR__PORT
)
--hostname
Hostname
for
the app server
(
env
: TWO_STEP_MONITOR__HOSTNAME
)
-h
,
--help
display
help
for
command
Metrics:
l1_node_connection_failures Number of
times
L1 node connection has failed
(
type
: Gauge
)
l2_node_connection_failures Number of
times
L2 node connection has failed
(
type
: Gauge
)
metadata Service metadata
(
type
: Gauge
)
unhandled_errors Unhandled errors
(
type
: Counter
)
Done
in
2.19s.
```
packages/two-step-monitor/hardhat.config.ts
0 → 100644
View file @
7085f475
import
{
HardhatUserConfig
}
from
'
hardhat/types
'
// Hardhat plugins
import
'
@nomiclabs/hardhat-ethers
'
import
'
@nomiclabs/hardhat-waffle
'
const
config
:
HardhatUserConfig
=
{
mocha
:
{
timeout
:
50000
,
},
}
export
default
config
packages/two-step-monitor/package.json
0 → 100644
View file @
7085f475
{
"private"
:
true
,
"name"
:
"@eth-optimism/two-step-monitor"
,
"version"
:
"0.5.0"
,
"description"
:
"[Optimism] Service for detecting faulty L2 output proposals"
,
"main"
:
"dist/index"
,
"types"
:
"dist/index"
,
"files"
:
[
"dist/*"
],
"scripts"
:
{
"start"
:
"ts-node ./src/service.ts"
,
"test"
:
"hardhat test"
,
"test:coverage"
:
"nyc hardhat test && nyc merge .nyc_output coverage.json"
,
"build"
:
"tsc -p tsconfig.json"
,
"clean"
:
"rimraf dist/ ./tsconfig.tsbuildinfo"
,
"lint"
:
"yarn lint:fix && yarn lint:check"
,
"pre-commit"
:
"lint-staged"
,
"lint:fix"
:
"yarn lint:check --fix"
,
"lint:check"
:
"eslint . --max-warnings=0"
},
"keywords"
:
[
"optimism"
,
"ethereum"
,
"fault"
,
"detector"
],
"homepage"
:
"https://github.com/ethereum-optimism/optimism/tree/develop/packages/two-step-monitor#readme"
,
"license"
:
"MIT"
,
"author"
:
"Optimism PBC"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"https://github.com/ethereum-optimism/optimism.git"
},
"devDependencies"
:
{
"@nomiclabs/hardhat-ethers"
:
"^2.0.6"
,
"@nomiclabs/hardhat-waffle"
:
"^2.0.3"
,
"@types/chai"
:
"^4.3.1"
,
"chai-as-promised"
:
"^7.1.1"
,
"ethers"
:
"^5.7.0"
,
"hardhat"
:
"^2.9.6"
,
"ts-node"
:
"^10.9.1"
}
}
packages/two-step-monitor/src/index.ts
0 → 100644
View file @
7085f475
export
*
from
'
./service
'
packages/two-step-monitor/src/service.ts
0 → 100644
View file @
7085f475
export
const
todo
=
'
implement me
'
packages/two-step-monitor/test/setup.ts
0 → 100644
View file @
7085f475
import
chai
=
require
(
'
chai
'
)
import
chaiAsPromised
from
'
chai-as-promised
'
// Chai plugins go here.
chai
.
use
(
chaiAsPromised
)
const
should
=
chai
.
should
()
const
expect
=
chai
.
expect
export
{
should
,
expect
}
packages/two-step-monitor/tsconfig.json
0 → 100644
View file @
7085f475
{
"extends"
:
"../../tsconfig.json"
,
"compilerOptions"
:
{
"outDir"
:
"./dist"
},
"include"
:
[
"package.json"
,
"src/**/*"
]
}
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