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
02c1193e
Unverified
Commit
02c1193e
authored
Apr 17, 2024
by
Francis Li
Committed by
GitHub
Apr 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[op-conductor] Add status check apis (#10196)
parent
6f99544c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletion
+47
-1
api.go
op-conductor/rpc/api.go
+5
-1
backend.go
op-conductor/rpc/backend.go
+10
-0
client.go
op-conductor/rpc/client.go
+14
-0
sequencer_failover_setup.go
op-e2e/sequencer_failover_setup.go
+18
-0
No files found.
op-conductor/rpc/api.go
View file @
02c1193e
...
@@ -19,6 +19,10 @@ type API interface {
...
@@ -19,6 +19,10 @@ type API interface {
Pause
(
ctx
context
.
Context
)
error
Pause
(
ctx
context
.
Context
)
error
// Resume resumes op-conductor.
// Resume resumes op-conductor.
Resume
(
ctx
context
.
Context
)
error
Resume
(
ctx
context
.
Context
)
error
// Paused returns true if op-conductor is paused.
Paused
(
ctx
context
.
Context
)
(
bool
,
error
)
// Stopped returns true if op-conductor is stopped.
Stopped
(
ctx
context
.
Context
)
(
bool
,
error
)
// SequencerHealthy returns true if the sequencer is healthy.
// SequencerHealthy returns true if the sequencer is healthy.
SequencerHealthy
(
ctx
context
.
Context
)
(
bool
,
error
)
SequencerHealthy
(
ctx
context
.
Context
)
(
bool
,
error
)
...
@@ -41,7 +45,7 @@ type API interface {
...
@@ -41,7 +45,7 @@ type API interface {
ClusterMembership
(
ctx
context
.
Context
)
([]
*
consensus
.
ServerInfo
,
error
)
ClusterMembership
(
ctx
context
.
Context
)
([]
*
consensus
.
ServerInfo
,
error
)
// APIs called by op-node
// APIs called by op-node
// Active returns true if op-conductor is active.
// Active returns true if op-conductor is active
(not paused or stopped)
.
Active
(
ctx
context
.
Context
)
(
bool
,
error
)
Active
(
ctx
context
.
Context
)
(
bool
,
error
)
// CommitUnsafePayload commits a unsafe payload (latest head) to the consensus layer.
// CommitUnsafePayload commits a unsafe payload (latest head) to the consensus layer.
CommitUnsafePayload
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayloadEnvelope
)
error
CommitUnsafePayload
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayloadEnvelope
)
error
...
...
op-conductor/rpc/backend.go
View file @
02c1193e
...
@@ -45,6 +45,16 @@ func NewAPIBackend(log log.Logger, con conductor) *APIBackend {
...
@@ -45,6 +45,16 @@ func NewAPIBackend(log log.Logger, con conductor) *APIBackend {
var
_
API
=
(
*
APIBackend
)(
nil
)
var
_
API
=
(
*
APIBackend
)(
nil
)
// Paused implements API.
func
(
api
*
APIBackend
)
Paused
(
ctx
context
.
Context
)
(
bool
,
error
)
{
return
api
.
con
.
Paused
(),
nil
}
// Stopped implements API.
func
(
api
*
APIBackend
)
Stopped
(
ctx
context
.
Context
)
(
bool
,
error
)
{
return
api
.
con
.
Stopped
(),
nil
}
// Active implements API.
// Active implements API.
func
(
api
*
APIBackend
)
Active
(
_
context
.
Context
)
(
bool
,
error
)
{
func
(
api
*
APIBackend
)
Active
(
_
context
.
Context
)
(
bool
,
error
)
{
return
!
api
.
con
.
Stopped
()
&&
!
api
.
con
.
Paused
(),
nil
return
!
api
.
con
.
Stopped
()
&&
!
api
.
con
.
Paused
(),
nil
...
...
op-conductor/rpc/client.go
View file @
02c1193e
...
@@ -27,6 +27,20 @@ func prefixRPC(method string) string {
...
@@ -27,6 +27,20 @@ func prefixRPC(method string) string {
return
RPCNamespace
+
"_"
+
method
return
RPCNamespace
+
"_"
+
method
}
}
// Paused implements API.
func
(
c
*
APIClient
)
Paused
(
ctx
context
.
Context
)
(
bool
,
error
)
{
var
paused
bool
err
:=
c
.
c
.
CallContext
(
ctx
,
&
paused
,
prefixRPC
(
"paused"
))
return
paused
,
err
}
// Stopped implements API.
func
(
c
*
APIClient
)
Stopped
(
ctx
context
.
Context
)
(
bool
,
error
)
{
var
stopped
bool
err
:=
c
.
c
.
CallContext
(
ctx
,
&
stopped
,
prefixRPC
(
"stopped"
))
return
stopped
,
err
}
// Active implements API.
// Active implements API.
func
(
c
*
APIClient
)
Active
(
ctx
context
.
Context
)
(
bool
,
error
)
{
func
(
c
*
APIClient
)
Active
(
ctx
context
.
Context
)
(
bool
,
error
)
{
var
active
bool
var
active
bool
...
...
op-e2e/sequencer_failover_setup.go
View file @
02c1193e
...
@@ -111,6 +111,12 @@ func setupSequencerFailoverTest(t *testing.T) (*System, map[string]*conductor) {
...
@@ -111,6 +111,12 @@ func setupSequencerFailoverTest(t *testing.T) (*System, map[string]*conductor) {
require
.
NoError
(
t
,
c3
.
client
.
Resume
(
ctx
))
require
.
NoError
(
t
,
c3
.
client
.
Resume
(
ctx
))
// final check, make sure everything is in the right place
// final check, make sure everything is in the right place
require
.
True
(
t
,
conductorResumed
(
t
,
ctx
,
c1
))
require
.
True
(
t
,
conductorResumed
(
t
,
ctx
,
c2
))
require
.
True
(
t
,
conductorResumed
(
t
,
ctx
,
c3
))
require
.
False
(
t
,
conductorStopped
(
t
,
ctx
,
c1
))
require
.
False
(
t
,
conductorStopped
(
t
,
ctx
,
c2
))
require
.
False
(
t
,
conductorStopped
(
t
,
ctx
,
c3
))
require
.
True
(
t
,
conductorActive
(
t
,
ctx
,
c1
))
require
.
True
(
t
,
conductorActive
(
t
,
ctx
,
c1
))
require
.
True
(
t
,
conductorActive
(
t
,
ctx
,
c2
))
require
.
True
(
t
,
conductorActive
(
t
,
ctx
,
c2
))
require
.
True
(
t
,
conductorActive
(
t
,
ctx
,
c3
))
require
.
True
(
t
,
conductorActive
(
t
,
ctx
,
c3
))
...
@@ -411,6 +417,18 @@ func conductorActive(t *testing.T, ctx context.Context, con *conductor) bool {
...
@@ -411,6 +417,18 @@ func conductorActive(t *testing.T, ctx context.Context, con *conductor) bool {
return
active
return
active
}
}
func
conductorResumed
(
t
*
testing
.
T
,
ctx
context
.
Context
,
con
*
conductor
)
bool
{
paused
,
err
:=
con
.
client
.
Paused
(
ctx
)
require
.
NoError
(
t
,
err
)
return
!
paused
}
func
conductorStopped
(
t
*
testing
.
T
,
ctx
context
.
Context
,
con
*
conductor
)
bool
{
stopped
,
err
:=
con
.
client
.
Stopped
(
ctx
)
require
.
NoError
(
t
,
err
)
return
stopped
}
func
sequencerActive
(
t
*
testing
.
T
,
ctx
context
.
Context
,
rollupClient
*
sources
.
RollupClient
)
bool
{
func
sequencerActive
(
t
*
testing
.
T
,
ctx
context
.
Context
,
rollupClient
*
sources
.
RollupClient
)
bool
{
active
,
err
:=
rollupClient
.
SequencerActive
(
ctx
)
active
,
err
:=
rollupClient
.
SequencerActive
(
ctx
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
...
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