mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
params: include amsterdam in fork config lookups
This commit is contained in:
parent
6d99759f01
commit
9996f6eb53
2 changed files with 18 additions and 0 deletions
|
|
@ -1172,6 +1172,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
|
||||||
// BlobConfig returns the blob config associated with the provided fork.
|
// BlobConfig returns the blob config associated with the provided fork.
|
||||||
func (c *ChainConfig) BlobConfig(fork forks.Fork) *BlobConfig {
|
func (c *ChainConfig) BlobConfig(fork forks.Fork) *BlobConfig {
|
||||||
switch fork {
|
switch fork {
|
||||||
|
case forks.Amsterdam:
|
||||||
|
return c.BlobScheduleConfig.Amsterdam
|
||||||
case forks.BPO5:
|
case forks.BPO5:
|
||||||
return c.BlobScheduleConfig.BPO5
|
return c.BlobScheduleConfig.BPO5
|
||||||
case forks.BPO4:
|
case forks.BPO4:
|
||||||
|
|
@ -1217,6 +1219,8 @@ func (c *ChainConfig) ActiveSystemContracts(time uint64) map[string]common.Addre
|
||||||
// the fork isn't defined or isn't a time-based fork.
|
// the fork isn't defined or isn't a time-based fork.
|
||||||
func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
|
func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
|
||||||
switch {
|
switch {
|
||||||
|
case fork == forks.Amsterdam:
|
||||||
|
return c.AmsterdamTime
|
||||||
case fork == forks.BPO5:
|
case fork == forks.BPO5:
|
||||||
return c.BPO5Time
|
return c.BPO5Time
|
||||||
case fork == forks.BPO4:
|
case fork == forks.BPO4:
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/params/forks"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -155,3 +156,16 @@ func TestTimestampCompatError(t *testing.T) {
|
||||||
require.Equal(t, newTimestampCompatError(errWhat, newUint64(0), newUint64(1681338455)).Error(),
|
require.Equal(t, newTimestampCompatError(errWhat, newUint64(0), newUint64(1681338455)).Error(),
|
||||||
"mismatching Shanghai fork timestamp in database (have timestamp 0, want timestamp 1681338455, rewindto timestamp 0)")
|
"mismatching Shanghai fork timestamp in database (have timestamp 0, want timestamp 1681338455, rewindto timestamp 0)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAmsterdamBlobConfigAndTimestamp(t *testing.T) {
|
||||||
|
amsterdamTime := uint64(100)
|
||||||
|
cfg := &ChainConfig{
|
||||||
|
LondonBlock: big.NewInt(0),
|
||||||
|
AmsterdamTime: &amsterdamTime,
|
||||||
|
BlobScheduleConfig: &BlobScheduleConfig{
|
||||||
|
Amsterdam: DefaultPragueBlobConfig,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require.Equal(t, DefaultPragueBlobConfig, cfg.BlobConfig(forks.Amsterdam))
|
||||||
|
require.Equal(t, &amsterdamTime, cfg.Timestamp(forks.Amsterdam))
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue