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
9f05c877
Commit
9f05c877
authored
Mar 16, 2022
by
inphi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add txpublisher.enable flag
parent
a11c4c4f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
8 deletions
+22
-8
main.go
l2geth/cmd/geth/main.go
+1
-0
usage.go
l2geth/cmd/geth/usage.go
+1
-0
flags.go
l2geth/cmd/utils/flags.go
+8
-0
backend.go
l2geth/eth/backend.go
+4
-7
google.go
l2geth/rollup/pub/google.go
+8
-1
No files found.
l2geth/cmd/geth/main.go
View file @
9f05c877
...
@@ -164,6 +164,7 @@ var (
...
@@ -164,6 +164,7 @@ var (
utils
.
RollupFeeThresholdDownFlag
,
utils
.
RollupFeeThresholdDownFlag
,
utils
.
RollupFeeThresholdUpFlag
,
utils
.
RollupFeeThresholdUpFlag
,
utils
.
SequencerClientHttpFlag
,
utils
.
SequencerClientHttpFlag
,
utils
.
TxPublisherEnableFlag
,
utils
.
TxPublisherProjectIDFlag
,
utils
.
TxPublisherProjectIDFlag
,
utils
.
TxPublisherTopicIDFlag
,
utils
.
TxPublisherTopicIDFlag
,
utils
.
TxPublisherTimeoutFlag
,
utils
.
TxPublisherTimeoutFlag
,
...
...
l2geth/cmd/geth/usage.go
View file @
9f05c877
...
@@ -78,6 +78,7 @@ var AppHelpFlagGroups = []flagGroup{
...
@@ -78,6 +78,7 @@ var AppHelpFlagGroups = []flagGroup{
utils
.
RollupFeeThresholdDownFlag
,
utils
.
RollupFeeThresholdDownFlag
,
utils
.
RollupFeeThresholdUpFlag
,
utils
.
RollupFeeThresholdUpFlag
,
utils
.
SequencerClientHttpFlag
,
utils
.
SequencerClientHttpFlag
,
utils
.
TxPublisherEnableFlag
,
utils
.
TxPublisherProjectIDFlag
,
utils
.
TxPublisherProjectIDFlag
,
utils
.
TxPublisherTopicIDFlag
,
utils
.
TxPublisherTopicIDFlag
,
utils
.
TxPublisherTimeoutFlag
,
utils
.
TxPublisherTimeoutFlag
,
...
...
l2geth/cmd/utils/flags.go
View file @
9f05c877
...
@@ -867,6 +867,11 @@ var (
...
@@ -867,6 +867,11 @@ var (
Usage
:
"HTTP endpoint for the sequencer client"
,
Usage
:
"HTTP endpoint for the sequencer client"
,
EnvVar
:
"SEQUENCER_CLIENT_HTTP"
,
EnvVar
:
"SEQUENCER_CLIENT_HTTP"
,
}
}
TxPublisherEnableFlag
=
cli
.
BoolFlag
{
Name
:
"txpublisher.enable"
,
Usage
:
"Enable Transaction logging to PubSub"
,
EnvVar
:
"TX_PUBLISHER_ENABLE"
,
}
TxPublisherProjectIDFlag
=
cli
.
StringFlag
{
TxPublisherProjectIDFlag
=
cli
.
StringFlag
{
Name
:
"txpublisher.projectid"
,
Name
:
"txpublisher.projectid"
,
Usage
:
"GCP Project ID for the tx PubSub"
,
Usage
:
"GCP Project ID for the tx PubSub"
,
...
@@ -1166,6 +1171,9 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) {
...
@@ -1166,6 +1171,9 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) {
// UsingOVM
// UsingOVM
// setTxPublisher configures the transaction logger
// setTxPublisher configures the transaction logger
func
setTxPublisher
(
ctx
*
cli
.
Context
,
cfg
*
pub
.
Config
)
{
func
setTxPublisher
(
ctx
*
cli
.
Context
,
cfg
*
pub
.
Config
)
{
if
ctx
.
GlobalIsSet
(
TxPublisherEnableFlag
.
Name
)
{
cfg
.
Enable
=
ctx
.
GlobalBool
(
TxPublisherEnableFlag
.
Name
)
}
if
ctx
.
GlobalIsSet
(
TxPublisherProjectIDFlag
.
Name
)
{
if
ctx
.
GlobalIsSet
(
TxPublisherProjectIDFlag
.
Name
)
{
cfg
.
ProjectID
=
ctx
.
GlobalString
(
TxPublisherProjectIDFlag
.
Name
)
cfg
.
ProjectID
=
ctx
.
GlobalString
(
TxPublisherProjectIDFlag
.
Name
)
}
}
...
...
l2geth/eth/backend.go
View file @
9f05c877
...
@@ -207,14 +207,11 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
...
@@ -207,14 +207,11 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
}
}
eth
.
txPool
=
core
.
NewTxPool
(
config
.
TxPool
,
chainConfig
,
eth
.
blockchain
)
eth
.
txPool
=
core
.
NewTxPool
(
config
.
TxPool
,
chainConfig
,
eth
.
blockchain
)
var
txLogger
pub
.
Publisher
=
&
pub
.
NoopPublisher
{}
var
txLogger
pub
.
Publisher
if
config
.
TxPublisher
.
ProjectID
!=
""
{
var
err
error
txLogger
,
err
=
pub
.
NewGooglePublisher
(
context
.
Background
(),
config
.
TxPublisher
)
txLogger
,
err
=
pub
.
NewGooglePublisher
(
context
.
Background
(),
config
.
TxPublisher
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
eth
.
syncService
,
err
=
rollup
.
NewSyncService
(
context
.
Background
(),
config
.
Rollup
,
eth
.
txPool
,
eth
.
blockchain
,
eth
.
chainDb
,
txLogger
)
eth
.
syncService
,
err
=
rollup
.
NewSyncService
(
context
.
Background
(),
config
.
Rollup
,
eth
.
txPool
,
eth
.
blockchain
,
eth
.
chainDb
,
txLogger
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
l2geth/rollup/pub/google.go
View file @
9f05c877
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
const
messageOrderingKey
=
"o"
const
messageOrderingKey
=
"o"
type
Config
struct
{
type
Config
struct
{
Enable
bool
ProjectID
string
ProjectID
string
TopicID
string
TopicID
string
Timeout
time
.
Duration
Timeout
time
.
Duration
...
@@ -25,7 +26,11 @@ type GooglePublisher struct {
...
@@ -25,7 +26,11 @@ type GooglePublisher struct {
mutex
sync
.
Mutex
mutex
sync
.
Mutex
}
}
func
NewGooglePublisher
(
ctx
context
.
Context
,
config
Config
)
(
*
GooglePublisher
,
error
)
{
func
NewGooglePublisher
(
ctx
context
.
Context
,
config
Config
)
(
Publisher
,
error
)
{
if
!
config
.
Enable
{
return
&
NoopPublisher
{},
nil
}
client
,
err
:=
pubsub
.
NewClient
(
ctx
,
config
.
ProjectID
)
client
,
err
:=
pubsub
.
NewClient
(
ctx
,
config
.
ProjectID
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -43,6 +48,8 @@ func NewGooglePublisher(ctx context.Context, config Config) (*GooglePublisher, e
...
@@ -43,6 +48,8 @@ func NewGooglePublisher(ctx context.Context, config Config) (*GooglePublisher, e
log
.
Info
(
"Sanitizing publisher timeout to 2 seconds"
)
log
.
Info
(
"Sanitizing publisher timeout to 2 seconds"
)
timeout
=
time
.
Second
*
2
timeout
=
time
.
Second
*
2
}
}
log
.
Info
(
"Initialized transaction log to PubSub"
,
"topic"
,
config
.
TopicID
)
return
&
GooglePublisher
{
return
&
GooglePublisher
{
client
:
client
,
client
:
client
,
topic
:
topic
,
topic
:
topic
,
...
...
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