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
1ed50c44
Unverified
Commit
1ed50c44
authored
Feb 04, 2024
by
smartcontracts
Committed by
GitHub
Feb 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update wd-mon to work for OptimismPortal2 (#9334)
parent
31845fd2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
112 deletions
+179
-112
dry-bobcats-obey.md
.changeset/dry-bobcats-obey.md
+5
-0
ninety-pugs-clap.md
.changeset/ninety-pugs-clap.md
+5
-0
constants.ts
packages/chain-mon/src/wd-mon/constants.ts
+21
-0
helpers.ts
packages/chain-mon/src/wd-mon/helpers.ts
+0
-41
service.ts
packages/chain-mon/src/wd-mon/service.ts
+139
-71
validators.ts
packages/common-ts/src/base-service/validators.ts
+9
-0
No files found.
.changeset/dry-bobcats-obey.md
0 → 100644
View file @
1ed50c44
---
'
@eth-optimism/common-ts'
:
patch
---
Adds a new validator for address types.
.changeset/ninety-pugs-clap.md
0 → 100644
View file @
1ed50c44
---
'
@eth-optimism/chain-mon'
:
minor
---
Updates wd-mon inside chain-mon to support FPAC.
packages/chain-mon/src/wd-mon/constants.ts
0 → 100644
View file @
1ed50c44
import
{
L2ChainID
}
from
'
@eth-optimism/sdk
'
// TODO: Consider moving to `@eth-optimism/constants` and generating from superchain registry.
// @see https://github.com/ethereum-optimism/optimism/pull/9041
/**
* Mapping of L2ChainIDs to the L1 block numbers where the wd-mon service should start looking for
* withdrawals by default. L1 block numbers here are based on the block number in which the
* OptimismPortal proxy contract was deployed to L1.
*/
export
const
DEFAULT_STARTING_BLOCK_NUMBERS
:
{
[
ChainID
in
L2ChainID
]?:
number
}
=
{
[
L2ChainID
.
OPTIMISM
]:
17365802
as
const
,
[
L2ChainID
.
OPTIMISM_GOERLI
]:
8299684
as
const
,
[
L2ChainID
.
OPTIMISM_SEPOLIA
]:
4071248
as
const
,
[
L2ChainID
.
BASE_MAINNET
]:
17482143
as
const
,
[
L2ChainID
.
BASE_GOERLI
]:
8411116
as
const
,
[
L2ChainID
.
BASE_SEPOLIA
]:
4370901
as
const
,
[
L2ChainID
.
ZORA_MAINNET
]:
17473938
as
const
,
}
packages/chain-mon/src/wd-mon/helpers.ts
deleted
100644 → 0
View file @
31845fd2
import
{
Provider
}
from
'
@ethersproject/abstract-provider
'
import
{
Logger
}
from
'
@eth-optimism/common-ts
'
/**
* Finds
*
* @param
* @param
* @param
* @returns
*/
export
const
getLastFinalizedBlock
=
async
(
l1RpcProvider
:
Provider
,
faultProofWindow
:
number
,
logger
:
Logger
):
Promise
<
number
>
=>
{
let
guessWindowStartBlock
try
{
const
l1Block
=
await
l1RpcProvider
.
getBlock
(
'
latest
'
)
// The time corresponding to the start of the FPW, based on the current block.
const
windowStartTime
=
l1Block
.
timestamp
-
faultProofWindow
// Use the FPW to find the block number that is the start of the FPW.
guessWindowStartBlock
=
l1Block
.
number
-
faultProofWindow
/
12
let
block
=
await
l1RpcProvider
.
getBlock
(
guessWindowStartBlock
)
while
(
block
.
timestamp
>
windowStartTime
)
{
guessWindowStartBlock
--
block
=
await
l1RpcProvider
.
getBlock
(
guessWindowStartBlock
)
}
return
block
.
number
}
catch
(
err
)
{
logger
.
fatal
(
'
error when calling querying for block
'
,
{
errors
:
err
,
})
throw
new
Error
(
`unable to find block number
${
guessWindowStartBlock
||
'
latest
'
}
`
)
}
}
packages/chain-mon/src/wd-mon/service.ts
View file @
1ed50c44
This diff is collapsed.
Click to expand it.
packages/common-ts/src/base-service/validators.ts
View file @
1ed50c44
...
@@ -49,6 +49,14 @@ const logLevel = makeValidator<LogLevel>((input) => {
...
@@ -49,6 +49,14 @@ const logLevel = makeValidator<LogLevel>((input) => {
}
}
})
})
const
address
=
makeValidator
<
string
>
((
input
)
=>
{
if
(
!
ethers
.
utils
.
isHexString
(
input
,
20
))
{
throw
new
Error
(
`expected input to be an address:
${
input
}
`
)
}
else
{
return
input
as
`0x
${
string
}
`
}
})
export
const
validators
=
{
export
const
validators
=
{
str
,
str
,
bool
,
bool
,
...
@@ -63,4 +71,5 @@ export const validators = {
...
@@ -63,4 +71,5 @@ export const validators = {
jsonRpcProvider
,
jsonRpcProvider
,
staticJsonRpcProvider
,
staticJsonRpcProvider
,
logLevel
,
logLevel
,
address
,
}
}
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