Repository navigation
Expand file tree
/
Copy pathrollup_boost.go
More file actions
79 lines (60 loc) · 2.08 KB
/
Copy pathrollup_boost.go
File metadata and controls
79 lines (60 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package stack
import (
"log/slog"
"github.com/ethereum-optimism/optimism/op-service/apis"
"github.com/ethereum-optimism/optimism/op-service/client"
"github.com/ethereum-optimism/optimism/op-service/eth"
)
// RollupBoostNodeID identifies a RollupBoost node by name and chainID, is type-safe, and can be value-copied and used as map key.
type RollupBoostNodeID L2ELNodeID
var _ IDWithChain = (*RollupBoostNodeID)(nil)
const RollupBoostNodeKind Kind = "RollupBoostNode"
func NewRollupBoostNodeID(key string, chainID eth.ChainID) RollupBoostNodeID {
return RollupBoostNodeID{
key: key,
chainID: chainID,
}
}
func (id RollupBoostNodeID) String() string {
return idWithChain(id).string(RollupBoostNodeKind)
}
func (id RollupBoostNodeID) ChainID() eth.ChainID {
return id.chainID
}
func (id RollupBoostNodeID) Kind() Kind {
return RollupBoostNodeKind
}
func (id RollupBoostNodeID) Key() string {
return id.key
}
func (id RollupBoostNodeID) LogValue() slog.Value {
return slog.StringValue(id.String())
}
func (id RollupBoostNodeID) MarshalText() ([]byte, error) {
return idWithChain(id).marshalText(RollupBoostNodeKind)
}
func (id *RollupBoostNodeID) UnmarshalText(data []byte) error {
return (*idWithChain)(id).unmarshalText(RollupBoostNodeKind, data)
}
func SortRollupBoostIDs(ids []RollupBoostNodeID) []RollupBoostNodeID {
return copyAndSort(ids, func(a, b RollupBoostNodeID) bool {
return lessIDWithChain(idWithChain(a), idWithChain(b))
})
}
func SortRollupBoostNodes(elems []RollupBoostNode) []RollupBoostNode {
return copyAndSort(elems, func(a, b RollupBoostNode) bool {
return lessIDWithChain(idWithChain(a.ID()), idWithChain(b.ID()))
})
}
var _ RollupBoostNodeMatcher = RollupBoostNodeID{}
func (id RollupBoostNodeID) Match(elems []RollupBoostNode) []RollupBoostNode {
return findByID(id, elems)
}
// RollupBoostNode is a shim service between an L2 consensus-layer node and an L2 ethereum execution-layer node
type RollupBoostNode interface {
ID() RollupBoostNodeID
L2EthClient() apis.L2EthClient
L2EngineClient() apis.EngineClient
FlashblocksClient() *client.WSClient
ELNode
}