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
1fbcb714
Unverified
Commit
1fbcb714
authored
Jan 08, 2024
by
felipe
Committed by
GitHub
Jan 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(multisig-mon): monitor optimismportal paused state (#8896)
parent
8ba19b94
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11417 additions
and
21 deletions
+11417
-21
OptimismPortal.json
packages/chain-mon/src/abi/OptimismPortal.json
+11338
-0
service.ts
packages/chain-mon/src/multisig-mon/service.ts
+78
-21
tsconfig.json
packages/chain-mon/tsconfig.json
+1
-0
No files found.
packages/chain-mon/src/abi/OptimismPortal.json
0 → 100644
View file @
1fbcb714
This diff is collapsed.
Click to expand it.
packages/chain-mon/src/multisig-mon/service.ts
View file @
1fbcb714
...
@@ -11,6 +11,7 @@ import { Provider } from '@ethersproject/abstract-provider'
...
@@ -11,6 +11,7 @@ import { Provider } from '@ethersproject/abstract-provider'
import
{
ethers
}
from
'
ethers
'
import
{
ethers
}
from
'
ethers
'
import
Safe
from
'
../abi/IGnosisSafe.0.8.19.json
'
import
Safe
from
'
../abi/IGnosisSafe.0.8.19.json
'
import
OptimismPortal
from
'
../abi/OptimismPortal.json
'
import
{
version
}
from
'
../../package.json
'
import
{
version
}
from
'
../../package.json
'
type
MultisigMonOptions
=
{
type
MultisigMonOptions
=
{
...
@@ -22,11 +23,17 @@ type MultisigMonOptions = {
...
@@ -22,11 +23,17 @@ type MultisigMonOptions = {
type
MultisigMonMetrics
=
{
type
MultisigMonMetrics
=
{
safeNonce
:
Gauge
safeNonce
:
Gauge
latestPreSignedPauseNonce
:
Gauge
latestPreSignedPauseNonce
:
Gauge
pausedState
:
Gauge
unexpectedRpcErrors
:
Counter
unexpectedRpcErrors
:
Counter
}
}
type
MultisigMonState
=
{
type
MultisigMonState
=
{
accounts
:
Array
<
{
address
:
string
;
nickname
:
string
;
vault
:
string
}
>
accounts
:
Array
<
{
nickname
:
string
safeAddress
:
string
optimismPortalAddress
:
string
vault
:
string
}
>
}
}
export
class
MultisigMonService
extends
BaseServiceV2
<
export
class
MultisigMonService
extends
BaseServiceV2
<
...
@@ -50,7 +57,7 @@ export class MultisigMonService extends BaseServiceV2<
...
@@ -50,7 +57,7 @@ export class MultisigMonService extends BaseServiceV2<
},
},
accounts
:
{
accounts
:
{
validator
:
validators
.
str
,
validator
:
validators
.
str
,
desc
:
'
JSON array of [{
address, nickname, vault }] to monitor balances and nonces of
'
,
desc
:
'
JSON array of [{
nickname, safeAddress, optimismPortalAddress, vault }] to monitor
'
,
public
:
true
,
public
:
true
,
},
},
onePassServiceToken
:
{
onePassServiceToken
:
{
...
@@ -69,6 +76,11 @@ export class MultisigMonService extends BaseServiceV2<
...
@@ -69,6 +76,11 @@ export class MultisigMonService extends BaseServiceV2<
desc
:
'
Latest pre-signed pause nonce
'
,
desc
:
'
Latest pre-signed pause nonce
'
,
labels
:
[
'
address
'
,
'
nickname
'
],
labels
:
[
'
address
'
,
'
nickname
'
],
},
},
pausedState
:
{
type
:
Gauge
,
desc
:
'
OptimismPortal paused state
'
,
labels
:
[
'
address
'
,
'
nickname
'
],
},
unexpectedRpcErrors
:
{
unexpectedRpcErrors
:
{
type
:
Counter
,
type
:
Counter
,
desc
:
'
Number of unexpected RPC errors
'
,
desc
:
'
Number of unexpected RPC errors
'
,
...
@@ -90,48 +102,57 @@ export class MultisigMonService extends BaseServiceV2<
...
@@ -90,48 +102,57 @@ export class MultisigMonService extends BaseServiceV2<
}
}
// get the nonce from deployed safe
// get the nonce from deployed safe
await
this
.
getSafeNonce
(
account
)
if
(
account
.
safeAddress
)
{
await
this
.
getSafeNonce
(
account
)
}
// get the paused state of the OptimismPortal
if
(
account
.
optimismPortalAddress
)
{
await
this
.
getPausedState
(
account
)
}
}
}
}
}
private
async
getSafeNonce
(
account
:
{
private
async
getPausedState
(
account
:
{
address
:
string
nickname
:
string
nickname
:
string
safeAddress
:
string
optimismPortalAddress
:
string
vault
:
string
vault
:
string
})
{
})
{
try
{
try
{
const
safeContract
=
new
ethers
.
Contract
(
const
optimismPortal
=
new
ethers
.
Contract
(
account
.
a
ddress
,
account
.
optimismPortalA
ddress
,
Safe
.
abi
,
OptimismPortal
.
abi
,
this
.
options
.
rpc
this
.
options
.
rpc
)
)
const
safeNonce
=
await
safeContract
.
nonce
()
const
paused
=
await
optimismPortal
.
paused
()
this
.
logger
.
info
(
`got
nonc
e`
,
{
this
.
logger
.
info
(
`got
paused stat
e`
,
{
address
:
account
.
a
ddress
,
optimismPortalAddress
:
account
.
optimismPortalA
ddress
,
nickname
:
account
.
nickname
,
nickname
:
account
.
nickname
,
nonce
:
safeNonce
.
toString
()
,
paused
,
})
})
this
.
metrics
.
safeNonc
e
.
set
(
this
.
metrics
.
pausedStat
e
.
set
(
{
address
:
account
.
a
ddress
,
nickname
:
account
.
nickname
},
{
address
:
account
.
optimismPortalA
ddress
,
nickname
:
account
.
nickname
},
parseInt
(
safeNonce
.
toString
(),
10
)
parseInt
(
paused
.
toString
(),
10
)
)
)
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
logger
.
error
(
`got unexpected RPC error`
,
{
this
.
logger
.
error
(
`got unexpected RPC error`
,
{
section
:
'
safeNonc
e
'
,
section
:
'
pausedStat
e
'
,
name
:
'
get
SafeNonc
e
'
,
name
:
'
get
PausedStat
e
'
,
err
,
err
,
})
})
this
.
metrics
.
unexpectedRpcErrors
.
inc
({
this
.
metrics
.
unexpectedRpcErrors
.
inc
({
section
:
'
safeNonc
e
'
,
section
:
'
pausedStat
e
'
,
name
:
'
get
SafeNonc
e
'
,
name
:
'
get
PausedStat
e
'
,
})
})
}
}
}
}
private
async
getOnePassNonce
(
account
:
{
private
async
getOnePassNonce
(
account
:
{
address
:
string
nickname
:
string
nickname
:
string
safeAddress
:
string
optimismPortalAddress
:
string
vault
:
string
vault
:
string
})
{
})
{
try
{
try
{
...
@@ -167,7 +188,7 @@ export class MultisigMonService extends BaseServiceV2<
...
@@ -167,7 +188,7 @@ export class MultisigMonService extends BaseServiceV2<
}
}
}
}
this
.
metrics
.
latestPreSignedPauseNonce
.
set
(
this
.
metrics
.
latestPreSignedPauseNonce
.
set
(
{
address
:
account
.
a
ddress
,
nickname
:
account
.
nickname
},
{
address
:
account
.
safeA
ddress
,
nickname
:
account
.
nickname
},
latestNonce
latestNonce
)
)
this
.
logger
.
debug
(
`latestNonce:
${
latestNonce
}
`
)
this
.
logger
.
debug
(
`latestNonce:
${
latestNonce
}
`
)
...
@@ -185,6 +206,42 @@ export class MultisigMonService extends BaseServiceV2<
...
@@ -185,6 +206,42 @@ export class MultisigMonService extends BaseServiceV2<
})
})
}
}
}
}
private
async
getSafeNonce
(
account
:
{
nickname
:
string
safeAddress
:
string
optimismPortalAddress
:
string
vault
:
string
})
{
try
{
const
safeContract
=
new
ethers
.
Contract
(
account
.
safeAddress
,
Safe
.
abi
,
this
.
options
.
rpc
)
const
safeNonce
=
await
safeContract
.
nonce
()
this
.
logger
.
info
(
`got nonce`
,
{
address
:
account
.
safeAddress
,
nickname
:
account
.
nickname
,
nonce
:
safeNonce
.
toString
(),
})
this
.
metrics
.
safeNonce
.
set
(
{
address
:
account
.
safeAddress
,
nickname
:
account
.
nickname
},
parseInt
(
safeNonce
.
toString
(),
10
)
)
}
catch
(
err
)
{
this
.
logger
.
error
(
`got unexpected RPC error`
,
{
section
:
'
safeNonce
'
,
name
:
'
getSafeNonce
'
,
err
,
})
this
.
metrics
.
unexpectedRpcErrors
.
inc
({
section
:
'
safeNonce
'
,
name
:
'
getSafeNonce
'
,
})
}
}
}
}
if
(
require
.
main
===
module
)
{
if
(
require
.
main
===
module
)
{
...
...
packages/chain-mon/tsconfig.json
View file @
1fbcb714
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
"include"
:
[
"include"
:
[
"package.json"
,
"package.json"
,
"src/abi/IGnosisSafe.0.8.19.json"
,
"src/abi/IGnosisSafe.0.8.19.json"
,
"src/abi/OptimismPortal.json"
,
"src/**/*"
"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