Documentation ¶
Index ¶
- Variables
- type API
- type APIBackend
- func (api *APIBackend) Active(_ context.Context) (bool, error)
- func (api *APIBackend) AddServerAsNonvoter(ctx context.Context, id string, addr string) error
- func (api *APIBackend) AddServerAsVoter(ctx context.Context, id string, addr string) error
- func (api *APIBackend) ClusterMembership(ctx context.Context) ([]*consensus.ServerInfo, error)
- func (api *APIBackend) CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
- func (api *APIBackend) Leader(ctx context.Context) (bool, error)
- func (api *APIBackend) LeaderWithID(ctx context.Context) (*consensus.ServerInfo, error)
- func (api *APIBackend) Pause(ctx context.Context) error
- func (api *APIBackend) RemoveServer(ctx context.Context, id string) error
- func (api *APIBackend) Resume(ctx context.Context) error
- func (api *APIBackend) SequencerHealthy(ctx context.Context) (bool, error)
- func (api *APIBackend) TransferLeader(ctx context.Context) error
- func (api *APIBackend) TransferLeaderToServer(ctx context.Context, id string, addr string) error
- type APIClient
- func (c *APIClient) Active(ctx context.Context) (bool, error)
- func (c *APIClient) AddServerAsNonvoter(ctx context.Context, id string, addr string) error
- func (c *APIClient) AddServerAsVoter(ctx context.Context, id string, addr string) error
- func (c *APIClient) Close()
- func (c *APIClient) ClusterMembership(ctx context.Context) ([]*consensus.ServerInfo, error)
- func (c *APIClient) CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
- func (c *APIClient) Leader(ctx context.Context) (bool, error)
- func (c *APIClient) LeaderWithID(ctx context.Context) (*consensus.ServerInfo, error)
- func (c *APIClient) Pause(ctx context.Context) error
- func (c *APIClient) RemoveServer(ctx context.Context, id string) error
- func (c *APIClient) Resume(ctx context.Context) error
- func (c *APIClient) SequencerHealthy(ctx context.Context) (bool, error)
- func (c *APIClient) TransferLeader(ctx context.Context) error
- func (c *APIClient) TransferLeaderToServer(ctx context.Context, id string, addr string) error
- type ExecutionProxyAPI
- type ExecutionProxyBackend
- type NodeAdminProxyAPI
- type NodeAdminProxyBackend
- type NodeProxyAPI
- type NodeProxyBackend
Constants ¶
This section is empty.
Variables ¶
var ErrNotLeader = errors.New("refusing to proxy request to non-leader sequencer")
var ExecutionRPCNamespace = "eth"
var NodeAdminRPCNamespace = "admin"
var NodeRPCNamespace = "optimism"
var RPCNamespace = "conductor"
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { // Pause pauses op-conductor. Pause(ctx context.Context) error // Resume resumes op-conductor. Resume(ctx context.Context) error // SequencerHealthy returns true if the sequencer is healthy. SequencerHealthy(ctx context.Context) (bool, error) // Consensus related APIs // Leader returns true if the server is the leader. Leader(ctx context.Context) (bool, error) // LeaderWithID returns the current leader's server info. LeaderWithID(ctx context.Context) (*consensus.ServerInfo, error) // AddServerAsVoter adds a server as a voter to the cluster. AddServerAsVoter(ctx context.Context, id string, addr string) error // AddServerAsNonvoter adds a server as a non-voter to the cluster. non-voter will not participate in leader election. AddServerAsNonvoter(ctx context.Context, id string, addr string) error // RemoveServer removes a server from the cluster. RemoveServer(ctx context.Context, id string) error // TransferLeader transfers leadership to another server. TransferLeader(ctx context.Context) error // TransferLeaderToServer transfers leadership to a specific server. TransferLeaderToServer(ctx context.Context, id string, addr string) error // ClusterMembership returns the current cluster membership configuration. ClusterMembership(ctx context.Context) ([]*consensus.ServerInfo, error) // APIs called by op-node // Active returns true if op-conductor is active. Active(ctx context.Context) (bool, error) // CommitUnsafePayload commits a unsafe payload (latest head) to the consensus layer. CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error }
API defines the interface for the op-conductor API.
type APIBackend ¶
type APIBackend struct {
// contains filtered or unexported fields
}
APIBackend is the backend implementation of the API. TODO: (https://github.com/ethereum-optimism/protocol-quest/issues/45) Add metrics tracer here. TODO: (https://github.com/ethereum-optimism/protocol-quest/issues/44) add tests after e2e setup.
func NewAPIBackend ¶
func NewAPIBackend(log log.Logger, con conductor) *APIBackend
NewAPIBackend creates a new APIBackend instance.
func (*APIBackend) Active ¶
func (api *APIBackend) Active(_ context.Context) (bool, error)
Active implements API.
func (*APIBackend) AddServerAsNonvoter ¶
AddServerAsNonvoter implements API.
func (*APIBackend) AddServerAsVoter ¶
AddServerAsVoter implements API.
func (*APIBackend) ClusterMembership ¶
func (api *APIBackend) ClusterMembership(ctx context.Context) ([]*consensus.ServerInfo, error)
ClusterMembership implements API.
func (*APIBackend) CommitUnsafePayload ¶
func (api *APIBackend) CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
CommitUnsafePayload implements API.
func (*APIBackend) Leader ¶
func (api *APIBackend) Leader(ctx context.Context) (bool, error)
Leader implements API, returns true if current conductor is leader of the cluster.
func (*APIBackend) LeaderWithID ¶
func (api *APIBackend) LeaderWithID(ctx context.Context) (*consensus.ServerInfo, error)
LeaderWithID implements API, returns the leader's server ID and address (not necessarily the current conductor).
func (*APIBackend) Pause ¶
func (api *APIBackend) Pause(ctx context.Context) error
Pause implements API.
func (*APIBackend) RemoveServer ¶
func (api *APIBackend) RemoveServer(ctx context.Context, id string) error
RemoveServer implements API.
func (*APIBackend) Resume ¶
func (api *APIBackend) Resume(ctx context.Context) error
Resume implements API.
func (*APIBackend) SequencerHealthy ¶
func (api *APIBackend) SequencerHealthy(ctx context.Context) (bool, error)
SequencerHealthy implements API.
func (*APIBackend) TransferLeader ¶
func (api *APIBackend) TransferLeader(ctx context.Context) error
TransferLeader implements API. With Raft implementation, a successful call does not mean that leadership transfer is complete It just means that leadership transfer is in progress (current leader has initiated a new leader election round and stepped down as leader)
func (*APIBackend) TransferLeaderToServer ¶
TransferLeaderToServer implements API. With Raft implementation, a successful call does not mean that leadership transfer is complete It just means that leadership transfer is in progress (current leader has initiated a new leader election round and stepped down as leader)
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient provides a client for calling API methods.
func NewAPIClient ¶
NewAPIClient creates a new APIClient instance.
func (*APIClient) AddServerAsNonvoter ¶
AddServerAsNonvoter implements API.
func (*APIClient) AddServerAsVoter ¶
AddServerAsVoter implements API.
func (*APIClient) ClusterMembership ¶
ClusterMembership implements API.
func (*APIClient) CommitUnsafePayload ¶
func (c *APIClient) CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
CommitUnsafePayload implements API.
func (*APIClient) LeaderWithID ¶
LeaderWithID implements API.
func (*APIClient) RemoveServer ¶
RemoveServer implements API.
func (*APIClient) SequencerHealthy ¶
SequencerHealthy implements API.
func (*APIClient) TransferLeader ¶
TransferLeader implements API.
type ExecutionProxyAPI ¶
type ExecutionProxyAPI interface {
GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
}
ExecutionProxyAPI defines the methods proxied to the execution rpc backend This should include all methods that are called by op-batcher or op-proposer
type ExecutionProxyBackend ¶
type ExecutionProxyBackend struct {
// contains filtered or unexported fields
}
ExecutionProxyBackend implements an execution rpc proxy with a leadership check before each call.
func NewExecutionProxyBackend ¶
func NewExecutionProxyBackend(log log.Logger, con conductor, client *ethclient.Client) *ExecutionProxyBackend
func (*ExecutionProxyBackend) GetBlockByNumber ¶
func (api *ExecutionProxyBackend) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
type NodeAdminProxyAPI ¶
NodeProxyAPI defines the methods proxied to the node rpc backend This should include all methods that are called by op-batcher or op-proposer
func NewNodeAdminProxyBackend ¶
func NewNodeAdminProxyBackend(log log.Logger, con conductor, client *sources.RollupClient) NodeAdminProxyAPI
NewNodeAdminProxyBackend creates a new NodeAdminProxyBackend instance.
type NodeAdminProxyBackend ¶
type NodeAdminProxyBackend struct {
// contains filtered or unexported fields
}
NodeAdminProxyAPI implements a node admin rpc proxy with a leadership check to make sure only leader returns the result.
func (*NodeAdminProxyBackend) SequencerActive ¶
func (api *NodeAdminProxyBackend) SequencerActive(ctx context.Context) (bool, error)
type NodeProxyAPI ¶
type NodeProxyAPI interface { OutputAtBlock(ctx context.Context, blockNum uint64) (*eth.OutputResponse, error) SyncStatus(ctx context.Context) (*eth.SyncStatus, error) RollupConfig(ctx context.Context) (*rollup.Config, error) }
NodeProxyAPI defines the methods proxied to the node rpc backend This should include all methods that are called by op-batcher or op-proposer
type NodeProxyBackend ¶
type NodeProxyBackend struct {
// contains filtered or unexported fields
}
NodeProxyBackend implements a node rpc proxy with a leadership check before each call.
func NewNodeProxyBackend ¶
func NewNodeProxyBackend(log log.Logger, con conductor, client *sources.RollupClient) *NodeProxyBackend
func (*NodeProxyBackend) OutputAtBlock ¶
func (api *NodeProxyBackend) OutputAtBlock(ctx context.Context, blockNum uint64) (*eth.OutputResponse, error)
func (*NodeProxyBackend) RollupConfig ¶
func (*NodeProxyBackend) SyncStatus ¶
func (api *NodeProxyBackend) SyncStatus(ctx context.Context) (*eth.SyncStatus, error)