Skip to content

Commit 9693de9

Browse files
authored
Merge pull request #33 from siburu/minimal-fork-sched
Add the minimal_fork_sched field to ProverConfig to make testing more flexible Signed-off-by: Jun Kimura <[email protected]>
2 parents 13024f0 + 8c29139 commit 9693de9

File tree

3 files changed

+198
-36
lines changed

3 files changed

+198
-36
lines changed

proto/relayer/provers/ethereum_light_client/config/config.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ message ProverConfig {
1313
string trusting_period = 3;
1414
string max_clock_drift = 4;
1515
Fraction refresh_threshold_rate = 5;
16+
map<string, uint64> minimal_fork_sched = 6;
1617
}
1718

1819
message Fraction {

relay/config.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ const (
2020
MINIMAL_PRESET_SYNC_COMMITTEE_SIZE = 32
2121
)
2222

23+
const (
24+
Altair = "altair"
25+
Bellatrix = "bellatrix"
26+
Capella = "capella"
27+
Deneb = "deneb"
28+
Electra = "electra"
29+
)
30+
2331
var (
2432
AltairSpec = lctypes.ForkSpec{
2533
FinalizedRootGindex: 105,
@@ -93,6 +101,14 @@ func (prc ProverConfig) Validate() error {
93101
if prc.RefreshThresholdRate.Numerator > prc.RefreshThresholdRate.Denominator {
94102
return fmt.Errorf("config attribute \"refresh_threshold_rate\" must be less than or equal to 1.0: actual=%v/%v", prc.RefreshThresholdRate.Numerator, prc.RefreshThresholdRate.Denominator)
95103
}
104+
for hf := range prc.MinimalForkSched {
105+
switch hf {
106+
case Altair, Bellatrix, Capella, Deneb, Electra:
107+
// OK
108+
default:
109+
return fmt.Errorf("config attribute \"minimal_fork_sched\" contains an unknown key: %s", hf)
110+
}
111+
}
96112
return nil
97113
}
98114

@@ -158,27 +174,27 @@ func (prc *ProverConfig) getForkParameters() *lctypes.ForkParameters {
158174
Forks: []*lctypes.Fork{
159175
{
160176
Version: []byte{1, 0, 0, 1},
161-
Epoch: 0,
177+
Epoch: prc.MinimalForkSched[Altair],
162178
Spec: &AltairSpec,
163179
},
164180
{
165181
Version: []byte{2, 0, 0, 1},
166-
Epoch: 0,
182+
Epoch: prc.MinimalForkSched[Bellatrix],
167183
Spec: &BellatrixSpec,
168184
},
169185
{
170186
Version: []byte{3, 0, 0, 1},
171-
Epoch: 0,
187+
Epoch: prc.MinimalForkSched[Capella],
172188
Spec: &CapellaSpec,
173189
},
174190
{
175191
Version: []byte{4, 0, 0, 1},
176-
Epoch: 0,
192+
Epoch: prc.MinimalForkSched[Deneb],
177193
Spec: &DenebSpec,
178194
},
179195
{
180196
Version: []byte{5, 0, 0, 1},
181-
Epoch: 0,
197+
Epoch: prc.MinimalForkSched[Electra],
182198
Spec: &ElectraSpec,
183199
},
184200
},

relay/config.pb.go

Lines changed: 176 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)