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
86b34454
Unverified
Commit
86b34454
authored
Mar 16, 2022
by
Murphy Law
Committed by
GitHub
Mar 16, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2322 from Inphi/feat/dtl-auth-config
dtl: Support Basic Authentication for RPC endpoints
parents
17b11bee
2163f1a9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
8 deletions
+26
-8
old-weeks-study.md
.changeset/old-weeks-study.md
+5
-0
README.md
packages/data-transport-layer/README.md
+4
-0
service.ts
...data-transport-layer/src/services/l1-ingestion/service.ts
+7
-8
service.ts
...data-transport-layer/src/services/l2-ingestion/service.ts
+2
-0
service.ts
packages/data-transport-layer/src/services/main/service.ts
+4
-0
run.ts
packages/data-transport-layer/src/services/run.ts
+4
-0
No files found.
.changeset/old-weeks-study.md
0 → 100644
View file @
86b34454
---
'
@eth-optimism/data-transport-layer'
:
patch
---
dtl: Support basic authentication for RPC endpoints
packages/data-transport-layer/README.md
View file @
86b34454
...
...
@@ -55,9 +55,13 @@ Here's the list of environment variables you can change:
| DATA_TRANSPORT_LAYER__SERVER_PORT | 7878 | Port to run the API on. |
| DATA_TRANSPORT_LAYER__SYNC_FROM_L1 | true | Whether or not to sync from L1. |
| DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT | - | RPC endpoint for an L1 node. |
| DATA_TRANSPORT_LAYER__L1_RPC_USER | - | Basic Authentication user for the L1 node endpoint. |
| DATA_TRANSPORT_LAYER__L1_RPC_PASSWORD | - | Basic Authentication password for the L1 node endpoint. |
| DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL | 2000 | Logs to sync per polling interval. |
| DATA_TRANSPORT_LAYER__SYNC_FROM_L2 | false | Whether or not to sync from L2. |
| DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT | - | RPC endpoint for an L2 node. |
| DATA_TRANSPORT_LAYER__L2_RPC_USER | - | Basic Authentication user for the L2 node endpoint. |
| DATA_TRANSPORT_LAYER__L2_RPC_PASSWORD | - | Basic Authentication password for the L2 node endpoint. |
| DATA_TRANSPORT_LAYER__TRANSACTIONS_PER_POLLING_INTERVAL | 1000 | Number of L2 transactions to query per polling interval. |
| DATA_TRANSPORT_LAYER__L2_CHAIN_ID | - | L2 chain ID. |
| DATA_TRANSPORT_LAYER__LEGACY_SEQUENCER_COMPATIBILITY | false | Whether or not to enable "legacy" sequencer sync (without the custom
`eth_getBlockRange`
endpoint) |
...
...
packages/data-transport-layer/src/services/l1-ingestion/service.ts
View file @
86b34454
/* Imports: External */
import
{
fromHexString
,
FallbackProvider
,
sleep
,
}
from
'
@eth-optimism/core-utils
'
import
{
fromHexString
,
sleep
}
from
'
@eth-optimism/core-utils
'
import
{
BaseService
,
Metrics
}
from
'
@eth-optimism/common-ts
'
import
{
TypedEvent
}
from
'
@eth-optimism/contracts/dist/types/common
'
import
{
BaseProvider
}
from
'
@ethersproject/providers
'
import
{
BaseProvider
,
StaticJsonRpcProvider
}
from
'
@ethersproject/providers
'
import
{
LevelUp
}
from
'
levelup
'
import
{
constants
}
from
'
ethers
'
import
{
Gauge
,
Counter
}
from
'
prom-client
'
...
...
@@ -114,8 +110,11 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
this
.
l1IngestionMetrics
=
registerMetrics
(
this
.
metrics
)
if
(
typeof
this
.
options
.
l1RpcProvider
===
'
string
'
)
{
this
.
state
.
l1RpcProvider
=
FallbackProvider
(
this
.
options
.
l1RpcProvider
,
{
'
User-Agent
'
:
'
data-transport-layer
'
,
this
.
state
.
l1RpcProvider
=
new
StaticJsonRpcProvider
({
url
:
this
.
options
.
l1RpcProvider
,
user
:
this
.
options
.
l1RpcProviderUser
,
password
:
this
.
options
.
l1RpcProviderPassword
,
headers
:
{
'
User-Agent
'
:
'
data-transport-layer
'
},
})
}
else
{
this
.
state
.
l1RpcProvider
=
this
.
options
.
l1RpcProvider
...
...
packages/data-transport-layer/src/services/l2-ingestion/service.ts
View file @
86b34454
...
...
@@ -93,6 +93,8 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
typeof
this
.
options
.
l2RpcProvider
===
'
string
'
?
new
StaticJsonRpcProvider
({
url
:
this
.
options
.
l2RpcProvider
,
user
:
this
.
options
.
l2RpcProviderUser
,
password
:
this
.
options
.
l2RpcProviderPassword
,
headers
:
{
'
User-Agent
'
:
'
data-transport-layer
'
},
})
:
this
.
options
.
l2RpcProvider
...
...
packages/data-transport-layer/src/services/main/service.ts
View file @
86b34454
...
...
@@ -20,8 +20,12 @@ export interface L1DataTransportServiceOptions {
dangerouslyCatchAllErrors
?:
boolean
hostname
:
string
l1RpcProvider
:
string
l1RpcProviderUser
?:
string
l1RpcProviderPassword
?:
string
l2ChainId
:
number
l2RpcProvider
:
string
l2RpcProviderUser
?:
string
l2RpcProviderPassword
?:
string
metrics
?:
Metrics
dbPath
:
string
logsPerPollingInterval
:
number
...
...
packages/data-transport-layer/src/services/run.ts
View file @
86b34454
...
...
@@ -26,6 +26,8 @@ type ethNetwork = 'mainnet' | 'kovan' | 'goerli'
hostname
:
config
.
str
(
'
server-hostname
'
,
'
localhost
'
),
confirmations
:
config
.
uint
(
'
confirmations
'
,
35
),
l1RpcProvider
:
config
.
str
(
'
l1-rpc-endpoint
'
),
l1RpcProviderUser
:
config
.
str
(
'
l1-rpc-user
'
),
l1RpcProviderPassword
:
config
.
str
(
'
l1-rpc-password
'
),
addressManager
:
config
.
str
(
'
address-manager
'
),
pollingInterval
:
config
.
uint
(
'
polling-interval
'
,
5000
),
logsPerPollingInterval
:
config
.
uint
(
'
logs-per-polling-interval
'
,
2000
),
...
...
@@ -34,6 +36,8 @@ type ethNetwork = 'mainnet' | 'kovan' | 'goerli'
false
),
l2RpcProvider
:
config
.
str
(
'
l2-rpc-endpoint
'
),
l2RpcProviderUser
:
config
.
str
(
'
l2-rpc-user
'
),
l2RpcProviderPassword
:
config
.
str
(
'
l2-rpc-password
'
),
l2ChainId
:
config
.
uint
(
'
l2-chain-id
'
),
syncFromL1
:
config
.
bool
(
'
sync-from-l1
'
,
true
),
syncFromL2
:
config
.
bool
(
'
sync-from-l2
'
,
false
),
...
...
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