Skip to content

Commit 01d0ce0

Browse files
rjl493456442fjl
andauthored
params: add blob config information in the banner (#32771)
Extend the chain banner with blob config information. Co-authored-by: Felix Lange <[email protected]>
1 parent 891bbad commit 01d0ce0

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

params/config.go

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -618,34 +618,32 @@ func (c *ChainConfig) Description() string {
618618
// makes sense for mainnet should be optional at printing to avoid bloating
619619
// the output for testnets and private networks.
620620
banner += "Pre-Merge hard forks (block based):\n"
621-
banner += fmt.Sprintf(" - Homestead: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/homestead/__init__.py.html)\n", c.HomesteadBlock)
621+
banner += fmt.Sprintf(" - Homestead: #%-8v\n", c.HomesteadBlock)
622622
if c.DAOForkBlock != nil {
623-
banner += fmt.Sprintf(" - DAO Fork: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/dao_fork/__init__.py.html)\n", c.DAOForkBlock)
624-
}
625-
banner += fmt.Sprintf(" - Tangerine Whistle (EIP 150): #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/tangerine_whistle/__init__.py.html)\n", c.EIP150Block)
626-
banner += fmt.Sprintf(" - Spurious Dragon/1 (EIP 155): #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/spurious_dragon/__init__.py.html)\n", c.EIP155Block)
627-
banner += fmt.Sprintf(" - Spurious Dragon/2 (EIP 158): #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/spurious_dragon/__init__.py.html)\n", c.EIP155Block)
628-
banner += fmt.Sprintf(" - Byzantium: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/byzantium/__init__.py.html)\n", c.ByzantiumBlock)
629-
banner += fmt.Sprintf(" - Constantinople: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/constantinople/__init__.py.html)\n", c.ConstantinopleBlock)
630-
banner += fmt.Sprintf(" - Petersburg: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/constantinople/__init__.py.html)\n", c.PetersburgBlock)
631-
banner += fmt.Sprintf(" - Istanbul: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/istanbul/__init__.py.html)\n", c.IstanbulBlock)
623+
banner += fmt.Sprintf(" - DAO Fork: #%-8v\n", c.DAOForkBlock)
624+
}
625+
banner += fmt.Sprintf(" - Tangerine Whistle (EIP 150): #%-8v\n", c.EIP150Block)
626+
banner += fmt.Sprintf(" - Spurious Dragon/1 (EIP 155): #%-8v\n", c.EIP155Block)
627+
banner += fmt.Sprintf(" - Spurious Dragon/2 (EIP 158): #%-8v\n", c.EIP155Block)
628+
banner += fmt.Sprintf(" - Byzantium: #%-8v\n", c.ByzantiumBlock)
629+
banner += fmt.Sprintf(" - Constantinople: #%-8v\n", c.ConstantinopleBlock)
630+
banner += fmt.Sprintf(" - Petersburg: #%-8v\n", c.PetersburgBlock)
631+
banner += fmt.Sprintf(" - Istanbul: #%-8v\n", c.IstanbulBlock)
632632
if c.MuirGlacierBlock != nil {
633-
banner += fmt.Sprintf(" - Muir Glacier: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/muir_glacier/__init__.py.html)\n", c.MuirGlacierBlock)
633+
banner += fmt.Sprintf(" - Muir Glacier: #%-8v\n", c.MuirGlacierBlock)
634634
}
635-
banner += fmt.Sprintf(" - Berlin: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/berlin/__init__.py.html)\n", c.BerlinBlock)
636-
banner += fmt.Sprintf(" - London: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/london/__init__.py.html)\n", c.LondonBlock)
635+
banner += fmt.Sprintf(" - Berlin: #%-8v\n", c.BerlinBlock)
636+
banner += fmt.Sprintf(" - London: #%-8v\n", c.LondonBlock)
637637
if c.ArrowGlacierBlock != nil {
638-
banner += fmt.Sprintf(" - Arrow Glacier: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/arrow_glacier/__init__.py.html)\n", c.ArrowGlacierBlock)
638+
banner += fmt.Sprintf(" - Arrow Glacier: #%-8v\n", c.ArrowGlacierBlock)
639639
}
640640
if c.GrayGlacierBlock != nil {
641-
banner += fmt.Sprintf(" - Gray Glacier: #%-8v (https://ethereum.github.io/execution-specs/src/ethereum/forks/gray_glacier/__init__.py.html)\n", c.GrayGlacierBlock)
641+
banner += fmt.Sprintf(" - Gray Glacier: #%-8v\n", c.GrayGlacierBlock)
642642
}
643643
banner += "\n"
644644

645645
// Add a special section for the merge as it's non-obvious
646646
banner += "Merge configured:\n"
647-
banner += " - Hard-fork specification: https://ethereum.github.io/execution-specs/src/ethereum/forks/paris/__init__.py.html\n"
648-
banner += " - Network known to be merged\n"
649647
banner += fmt.Sprintf(" - Total terminal difficulty: %v\n", c.TerminalTotalDifficulty)
650648
if c.MergeNetsplitBlock != nil {
651649
banner += fmt.Sprintf(" - Merge netsplit block: #%-8v\n", c.MergeNetsplitBlock)
@@ -655,38 +653,39 @@ func (c *ChainConfig) Description() string {
655653
// Create a list of forks post-merge
656654
banner += "Post-Merge hard forks (timestamp based):\n"
657655
if c.ShanghaiTime != nil {
658-
banner += fmt.Sprintf(" - Shanghai: @%-10v (https://ethereum.github.io/execution-specs/src/ethereum/forks/shanghai/__init__.py.html)\n", *c.ShanghaiTime)
656+
banner += fmt.Sprintf(" - Shanghai: @%-10v\n", *c.ShanghaiTime)
659657
}
660658
if c.CancunTime != nil {
661-
banner += fmt.Sprintf(" - Cancun: @%-10v (https://ethereum.github.io/execution-specs/src/ethereum/forks/cancun/__init__.py.html)\n", *c.CancunTime)
659+
banner += fmt.Sprintf(" - Cancun: @%-10v blob: (%s)\n", *c.CancunTime, c.BlobScheduleConfig.Cancun)
662660
}
663661
if c.PragueTime != nil {
664-
banner += fmt.Sprintf(" - Prague: @%-10v (https://ethereum.github.io/execution-specs/src/ethereum/forks/prague/__init__.py.html)\n", *c.PragueTime)
662+
banner += fmt.Sprintf(" - Prague: @%-10v blob: (%s)\n", *c.PragueTime, c.BlobScheduleConfig.Prague)
665663
}
666664
if c.OsakaTime != nil {
667-
banner += fmt.Sprintf(" - Osaka: @%-10v (https://ethereum.github.io/execution-specs/src/ethereum/forks/osaka/__init__.py.html)\n", *c.OsakaTime)
665+
banner += fmt.Sprintf(" - Osaka: @%-10v blob: (%s)\n", *c.OsakaTime, c.BlobScheduleConfig.Osaka)
668666
}
669667
if c.BPO1Time != nil {
670-
banner += fmt.Sprintf(" - BPO1: @%-10v\n", *c.BPO1Time)
668+
banner += fmt.Sprintf(" - BPO1: @%-10v blob: (%s)\n", *c.BPO1Time, c.BlobScheduleConfig.BPO1)
671669
}
672670
if c.BPO2Time != nil {
673-
banner += fmt.Sprintf(" - BPO2: @%-10v\n", *c.BPO2Time)
671+
banner += fmt.Sprintf(" - BPO2: @%-10v blob: (%s)\n", *c.BPO2Time, c.BlobScheduleConfig.BPO2)
674672
}
675673
if c.BPO3Time != nil {
676-
banner += fmt.Sprintf(" - BPO3: @%-10v\n", *c.BPO3Time)
674+
banner += fmt.Sprintf(" - BPO3: @%-10v blob: (%s)\n", *c.BPO3Time, c.BlobScheduleConfig.BPO3)
677675
}
678676
if c.BPO4Time != nil {
679-
banner += fmt.Sprintf(" - BPO4: @%-10v\n", *c.BPO4Time)
677+
banner += fmt.Sprintf(" - BPO4: @%-10v blob: (%s)\n", *c.BPO4Time, c.BlobScheduleConfig.BPO4)
680678
}
681679
if c.BPO5Time != nil {
682-
banner += fmt.Sprintf(" - BPO5: @%-10v\n", *c.BPO5Time)
680+
banner += fmt.Sprintf(" - BPO5: @%-10v blob: (%s)\n", *c.BPO5Time, c.BlobScheduleConfig.BPO5)
683681
}
684682
if c.AmsterdamTime != nil {
685-
banner += fmt.Sprintf(" - Amsterdam: @%-10v\n", *c.AmsterdamTime)
683+
banner += fmt.Sprintf(" - Amsterdam: @%-10v blob: (%s)\n", *c.AmsterdamTime, c.BlobScheduleConfig.Amsterdam)
686684
}
687685
if c.VerkleTime != nil {
688-
banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime)
686+
banner += fmt.Sprintf(" - Verkle: @%-10v blob: (%s)\n", *c.VerkleTime, c.BlobScheduleConfig.Verkle)
689687
}
688+
banner += fmt.Sprintf("\nAll fork specifications can be found at https://ethereum.github.io/execution-specs/src/ethereum/forks/\n")
690689
return banner
691690
}
692691

@@ -697,6 +696,14 @@ type BlobConfig struct {
697696
UpdateFraction uint64 `json:"baseFeeUpdateFraction"`
698697
}
699698

699+
// String implement fmt.Stringer, returning string format blob config.
700+
func (bc *BlobConfig) String() string {
701+
if bc == nil {
702+
return "nil"
703+
}
704+
return fmt.Sprintf("target: %d, max: %d, fraction: %d", bc.Target, bc.Max, bc.UpdateFraction)
705+
}
706+
700707
// BlobScheduleConfig determines target and max number of blobs allow per fork.
701708
type BlobScheduleConfig struct {
702709
Cancun *BlobConfig `json:"cancun,omitempty"`

0 commit comments

Comments
 (0)