Skip to content

Commit 0d1cf34

Browse files
authored
all: add bogota fork to config (#34057)
Adds stubs for Bogota fork.
1 parent 1ef0ffb commit 0d1cf34

7 files changed

Lines changed: 53 additions & 6 deletions

File tree

core/vm/contracts.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ func activePrecompiledContracts(rules params.Rules) PrecompiledContracts {
215215
switch {
216216
case rules.IsUBT:
217217
return PrecompiledContractsVerkle
218+
case rules.IsBogota:
219+
return PrecompiledContractsOsaka
218220
case rules.IsOsaka:
219221
return PrecompiledContractsOsaka
220222
case rules.IsPrague:
@@ -240,6 +242,8 @@ func ActivePrecompiledContracts(rules params.Rules) PrecompiledContracts {
240242
// ActivePrecompiles returns the precompile addresses enabled with the current configuration.
241243
func ActivePrecompiles(rules params.Rules) []common.Address {
242244
switch {
245+
case rules.IsBogota:
246+
return PrecompiledAddressesOsaka
243247
case rules.IsOsaka:
244248
return PrecompiledAddressesOsaka
245249
case rules.IsPrague:

core/vm/evm.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainCon
150150
evm.precompiles = activePrecompiledContracts(evm.chainRules)
151151

152152
switch {
153+
case evm.chainRules.IsBogota:
154+
evm.table = &bogotaInstructionSet
153155
case evm.chainRules.IsAmsterdam:
154156
evm.table = &amsterdamInstructionSet
155157
case evm.chainRules.IsOsaka:

core/vm/jump_table.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ var (
6868
pragueInstructionSet = newPragueInstructionSet()
6969
osakaInstructionSet = newOsakaInstructionSet()
7070
amsterdamInstructionSet = newAmsterdamInstructionSet()
71+
bogotaInstructionSet = newBogotaInstructionSet()
7172
)
7273

7374
// JumpTable contains the EVM opcodes supported at a given fork.
@@ -91,6 +92,11 @@ func validate(jt JumpTable) JumpTable {
9192
return jt
9293
}
9394

95+
func newBogotaInstructionSet() JumpTable {
96+
instructionSet := newOsakaInstructionSet()
97+
return validate(instructionSet)
98+
}
99+
94100
func newVerkleInstructionSet() JumpTable {
95101
instructionSet := newShanghaiInstructionSet()
96102
enable4762(&instructionSet)

core/vm/jump_table_export.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
2828
switch {
2929
case rules.IsUBT:
3030
return newCancunInstructionSet(), errors.New("verkle-fork not defined yet")
31+
case rules.IsBogota:
32+
return newBogotaInstructionSet(), nil
3133
case rules.IsAmsterdam:
3234
return newAmsterdamInstructionSet(), nil
3335
case rules.IsOsaka:

eth/catalyst/witness.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV3(ctx context.Context, upd
7474
return engine.STATUS_INVALID, attributesErr("missing withdrawals")
7575
case params.BeaconRoot == nil:
7676
return engine.STATUS_INVALID, attributesErr("missing beacon root")
77-
case !api.checkFork(params.Timestamp, forks.Cancun, forks.Prague, forks.Osaka, forks.BPO1, forks.BPO2, forks.BPO3, forks.BPO4, forks.BPO5):
77+
case !api.checkFork(params.Timestamp, forks.Cancun, forks.Prague, forks.Osaka, forks.BPO1, forks.BPO2, forks.BPO3, forks.BPO4, forks.BPO5, forks.Bogota):
7878
return engine.STATUS_INVALID, unsupportedForkErr("fcuV3 must only be called for cancun/prague/osaka payloads")
7979
}
8080
}
@@ -152,7 +152,7 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV4(ctx context.Context, params eng
152152
return invalidStatus, paramsErr("nil beaconRoot post-cancun")
153153
case executionRequests == nil:
154154
return invalidStatus, paramsErr("nil executionRequests post-prague")
155-
case !api.checkFork(params.Timestamp, forks.Prague, forks.Osaka, forks.BPO1, forks.BPO2, forks.BPO3, forks.BPO4, forks.BPO5):
155+
case !api.checkFork(params.Timestamp, forks.Prague, forks.Osaka, forks.BPO1, forks.BPO2, forks.BPO3, forks.BPO4, forks.BPO5, forks.Bogota):
156156
return invalidStatus, unsupportedForkErr("newPayloadV4 must only be called for prague/osaka payloads")
157157
}
158158
requests := convertRequests(executionRequests)
@@ -259,7 +259,7 @@ func (api *ConsensusAPI) ExecuteStatelessPayloadV4(params engine.ExecutableData,
259259
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, paramsErr("nil beaconRoot post-cancun")
260260
case executionRequests == nil:
261261
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, paramsErr("nil executionRequests post-prague")
262-
case !api.checkFork(params.Timestamp, forks.Prague, forks.Osaka, forks.BPO1, forks.BPO2, forks.BPO3, forks.BPO4, forks.BPO5):
262+
case !api.checkFork(params.Timestamp, forks.Prague, forks.Osaka, forks.BPO1, forks.BPO2, forks.BPO3, forks.BPO4, forks.BPO5, forks.Bogota):
263263
return engine.StatelessPayloadStatusV1{Status: engine.INVALID}, unsupportedForkErr("newPayloadV4 must only be called for prague/osaka payloads")
264264
}
265265
requests := convertRequests(executionRequests)

params/config.go

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var (
6464
OsakaTime: newUint64(1764798551),
6565
BPO1Time: newUint64(1765290071),
6666
BPO2Time: newUint64(1767747671),
67+
BogotaTime: nil,
6768
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cbb839cbe05303d7705fa"),
6869
Ethash: new(EthashConfig),
6970
BlobScheduleConfig: &BlobScheduleConfig{
@@ -99,6 +100,7 @@ var (
99100
OsakaTime: newUint64(1759308480),
100101
BPO1Time: newUint64(1759800000),
101102
BPO2Time: newUint64(1760389824),
103+
BogotaTime: nil,
102104
DepositContractAddress: common.HexToAddress("0x4242424242424242424242424242424242424242"),
103105
Ethash: new(EthashConfig),
104106
BlobScheduleConfig: &BlobScheduleConfig{
@@ -134,6 +136,7 @@ var (
134136
OsakaTime: newUint64(1760427360),
135137
BPO1Time: newUint64(1761017184),
136138
BPO2Time: newUint64(1761607008),
139+
BogotaTime: nil,
137140
DepositContractAddress: common.HexToAddress("0x7f02c3e3c98b133055b8b348b2ac625669ed295d"),
138141
Ethash: new(EthashConfig),
139142
BlobScheduleConfig: &BlobScheduleConfig{
@@ -169,6 +172,7 @@ var (
169172
OsakaTime: newUint64(1761677592),
170173
BPO1Time: newUint64(1762365720),
171174
BPO2Time: newUint64(1762955544),
175+
BogotaTime: nil,
172176
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cBB839Cbe05303d7705Fa"),
173177
Ethash: new(EthashConfig),
174178
BlobScheduleConfig: &BlobScheduleConfig{
@@ -203,6 +207,7 @@ var (
203207
CancunTime: nil,
204208
PragueTime: nil,
205209
OsakaTime: nil,
210+
BogotaTime: nil,
206211
UBTTime: nil,
207212
Ethash: new(EthashConfig),
208213
Clique: nil,
@@ -228,6 +233,7 @@ var (
228233
TerminalTotalDifficulty: big.NewInt(0),
229234
PragueTime: newUint64(0),
230235
OsakaTime: newUint64(0),
236+
BogotaTime: newUint64(0),
231237
BlobScheduleConfig: &BlobScheduleConfig{
232238
Cancun: DefaultCancunBlobConfig,
233239
Prague: DefaultPragueBlobConfig,
@@ -258,6 +264,7 @@ var (
258264
CancunTime: nil,
259265
PragueTime: nil,
260266
OsakaTime: nil,
267+
BogotaTime: nil,
261268
UBTTime: nil,
262269
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
263270
Ethash: nil,
@@ -288,6 +295,7 @@ var (
288295
CancunTime: nil,
289296
PragueTime: nil,
290297
OsakaTime: nil,
298+
BogotaTime: nil,
291299
UBTTime: nil,
292300
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
293301
Ethash: new(EthashConfig),
@@ -318,6 +326,7 @@ var (
318326
CancunTime: newUint64(0),
319327
PragueTime: newUint64(0),
320328
OsakaTime: newUint64(0),
329+
BogotaTime: nil,
321330
UBTTime: nil,
322331
TerminalTotalDifficulty: big.NewInt(0),
323332
Ethash: new(EthashConfig),
@@ -352,6 +361,7 @@ var (
352361
CancunTime: nil,
353362
PragueTime: nil,
354363
OsakaTime: nil,
364+
BogotaTime: nil,
355365
UBTTime: nil,
356366
TerminalTotalDifficulty: big.NewInt(math.MaxInt64),
357367
Ethash: new(EthashConfig),
@@ -453,6 +463,7 @@ type ChainConfig struct {
453463
BPO4Time *uint64 `json:"bpo4Time,omitempty"` // BPO4 switch time (nil = no fork, 0 = already on bpo4)
454464
BPO5Time *uint64 `json:"bpo5Time,omitempty"` // BPO5 switch time (nil = no fork, 0 = already on bpo5)
455465
AmsterdamTime *uint64 `json:"amsterdamTime,omitempty"` // Amsterdam switch time (nil = no fork, 0 = already on amsterdam)
466+
BogotaTime *uint64 `json:"bogotaTime,omitempty"` // Bogota switch time (nil = no fork, 0 = already on bogota)
456467
UBTTime *uint64 `json:"ubtTime,omitempty"` // UBT switch time (nil = no fork, 0 = already on UBT)
457468

458469
// TerminalTotalDifficulty is the amount of total difficulty reached by
@@ -582,6 +593,9 @@ func (c *ChainConfig) String() string {
582593
if c.AmsterdamTime != nil {
583594
result += fmt.Sprintf(", AmsterdamTime: %v", *c.AmsterdamTime)
584595
}
596+
if c.BogotaTime != nil {
597+
result += fmt.Sprintf(", BogotaTime: %v", *c.BogotaTime)
598+
}
585599
if c.UBTTime != nil {
586600
result += fmt.Sprintf(", UBTTime: %v", *c.UBTTime)
587601
}
@@ -677,6 +691,9 @@ func (c *ChainConfig) Description() string {
677691
if c.AmsterdamTime != nil {
678692
banner += fmt.Sprintf(" - Amsterdam: @%-10v\n", *c.AmsterdamTime)
679693
}
694+
if c.BogotaTime != nil {
695+
banner += fmt.Sprintf(" - Bogota: @%-10v\n", *c.BogotaTime)
696+
}
680697
if c.UBTTime != nil {
681698
banner += fmt.Sprintf(" - UBT: @%-10v\n", *c.UBTTime)
682699
}
@@ -854,6 +871,11 @@ func (c *ChainConfig) IsAmsterdam(num *big.Int, time uint64) bool {
854871
return c.IsLondon(num) && isTimestampForked(c.AmsterdamTime, time)
855872
}
856873

874+
// IsBogota returns whether time is either equal to the Bogota fork time or greater.
875+
func (c *ChainConfig) IsBogota(num *big.Int, time uint64) bool {
876+
return c.IsLondon(num) && isTimestampForked(c.BogotaTime, time)
877+
}
878+
857879
// IsUBT returns whether time is either equal to the Verkle fork time or greater.
858880
func (c *ChainConfig) IsUBT(num *big.Int, time uint64) bool {
859881
return c.IsLondon(num) && isTimestampForked(c.UBTTime, time)
@@ -940,6 +962,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
940962
{name: "bpo4", timestamp: c.BPO4Time, optional: true},
941963
{name: "bpo5", timestamp: c.BPO5Time, optional: true},
942964
{name: "amsterdam", timestamp: c.AmsterdamTime, optional: true},
965+
{name: "bogota", timestamp: c.BogotaTime, optional: true},
943966
} {
944967
if lastFork.name != "" {
945968
switch {
@@ -1111,6 +1134,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
11111134
if isForkTimestampIncompatible(c.AmsterdamTime, newcfg.AmsterdamTime, headTimestamp) {
11121135
return newTimestampCompatError("Amsterdam fork timestamp", c.AmsterdamTime, newcfg.AmsterdamTime)
11131136
}
1137+
if isForkTimestampIncompatible(c.BogotaTime, newcfg.BogotaTime, headTimestamp) {
1138+
return newTimestampCompatError("Bogota fork timestamp", c.BogotaTime, newcfg.BogotaTime)
1139+
}
11141140
return nil
11151141
}
11161142

@@ -1130,6 +1156,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
11301156
london := c.LondonBlock
11311157

11321158
switch {
1159+
case c.IsBogota(london, time):
1160+
return forks.Bogota
11331161
case c.IsAmsterdam(london, time):
11341162
return forks.Amsterdam
11351163
case c.IsBPO5(london, time):
@@ -1213,6 +1241,10 @@ func (c *ChainConfig) ActiveSystemContracts(time uint64) map[string]common.Addre
12131241
// the fork isn't defined or isn't a time-based fork.
12141242
func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
12151243
switch {
1244+
case fork == forks.Bogota:
1245+
return c.BogotaTime
1246+
case fork == forks.Amsterdam:
1247+
return c.AmsterdamTime
12161248
case fork == forks.BPO5:
12171249
return c.BPO5Time
12181250
case fork == forks.BPO4:
@@ -1231,8 +1263,6 @@ func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
12311263
return c.CancunTime
12321264
case fork == forks.Shanghai:
12331265
return c.ShanghaiTime
1234-
case fork == forks.Amsterdam:
1235-
return c.AmsterdamTime
12361266
default:
12371267
return nil
12381268
}
@@ -1378,7 +1408,7 @@ type Rules struct {
13781408
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
13791409
IsBerlin, IsLondon bool
13801410
IsMerge, IsShanghai, IsCancun, IsPrague, IsOsaka bool
1381-
IsAmsterdam, IsUBT bool
1411+
IsAmsterdam, IsBogota, IsUBT bool
13821412
}
13831413

13841414
// Rules ensures c's ChainID is not nil.
@@ -1404,6 +1434,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
14041434
IsPrague: isMerge && c.IsPrague(num, timestamp),
14051435
IsOsaka: isMerge && c.IsOsaka(num, timestamp),
14061436
IsAmsterdam: isMerge && c.IsAmsterdam(num, timestamp),
1437+
IsBogota: isMerge && c.IsBogota(num, timestamp),
14071438
IsUBT: isUBT,
14081439
IsEIP4762: isUBT,
14091440
}

params/forks/forks.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const (
4646
BPO4
4747
BPO5
4848
Amsterdam
49+
Bogota
4950
)
5051

5152
// String implements fmt.Stringer.
@@ -84,4 +85,5 @@ var forkToString = map[Fork]string{
8485
BPO4: "BPO4",
8586
BPO5: "BPO5",
8687
Amsterdam: "Amsterdam",
88+
Bogota: "Bogota",
8789
}

0 commit comments

Comments
 (0)