Skip to content

Commit

Permalink
Apply BSC Gibbs upgrade (for Chapel, Rialto)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu committed Sep 13, 2022
1 parent bca221b commit 44dcfe8
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions consensus/misc/eip1559_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func copyConfig(original *params.ChainConfig) *params.ChainConfig {
MirrorSyncBlock: original.MirrorSyncBlock,
BrunoBlock: original.BrunoBlock,
EulerBlock: original.EulerBlock,
GibbsBlock: original.GibbsBlock,
Ethash: original.Ethash,
Clique: original.Clique,
Aura: original.Aura,
Expand Down
1 change: 1 addition & 0 deletions core/systemcontracts/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ var (
GovHubContract = common.HexToAddress("0x0000000000000000000000000000000000001007")
TokenManagerContract = common.HexToAddress("0x0000000000000000000000000000000000001008")
CrossChainContract = common.HexToAddress("0x0000000000000000000000000000000000002000")
StakingContract = common.HexToAddress("0x0000000000000000000000000000000000002001")
)
38 changes: 38 additions & 0 deletions core/systemcontracts/upgrade.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions params/chainspecs/chapel.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"mirrorSyncBlock": 5582500,
"brunoBlock": 13837000,
"eulerBlock": 19203503,
"gibbsBlock": 22800220,
"terminalBlockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parlia": {
"DBPath": "",
Expand Down
2 changes: 2 additions & 0 deletions params/chainspecs/rialto.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"nielsBlock": 0,
"mirrorSyncBlock": 400,
"brunoBlock": 400,
"eulerBlock": 400,
"gibbsBlock": 400,
"terminalBlockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parlia": {
"DBPath": "",
Expand Down
17 changes: 16 additions & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ type ChainConfig struct {
MirrorSyncBlock *big.Int `json:"mirrorSyncBlock,omitempty" toml:",omitempty"` // mirrorSyncBlock switch block (nil = no fork, 0 = already activated)
BrunoBlock *big.Int `json:"brunoBlock,omitempty" toml:",omitempty"` // brunoBlock switch block (nil = no fork, 0 = already activated)
EulerBlock *big.Int `json:"eulerBlock,omitempty" toml:",omitempty"` // eulerBlock switch block (nil = no fork, 0 = already activated)
GibbsBlock *big.Int `json:"gibbsBlock,omitempty" toml:",omitempty"` // gibbsBlock switch block (nil = no fork, 0 = already activated)

// Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"`
Expand Down Expand Up @@ -395,13 +396,14 @@ func (c *ChainConfig) String() string {

// TODO Covalent: Refactor to more generic approach and potentially introduce tag for "ecosystem" field (Ethereum, BSC, etc.)
if c.Consensus == ParliaConsensus {
return fmt.Sprintf("{ChainID: %v Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Euler: %v, Engine: %v}",
return fmt.Sprintf("{ChainID: %v Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Euler: %v, Gibbs: %v, Engine: %v}",
c.ChainID,
c.RamanujanBlock,
c.NielsBlock,
c.MirrorSyncBlock,
c.BrunoBlock,
c.EulerBlock,
c.GibbsBlock,
engine,
)
}
Expand Down Expand Up @@ -537,6 +539,15 @@ func (c *ChainConfig) IsOnEuler(num *big.Int) bool {
return configNumEqual(c.EulerBlock, num)
}

// IsGibbs returns whether num is either equal to the euler fork block or greater.
func (c *ChainConfig) IsGibbs(num *big.Int) bool {
return isForked(c.GibbsBlock, num.Uint64())
}

func (c *ChainConfig) IsOnGibbs(num *big.Int) bool {
return configNumEqual(c.GibbsBlock, num)
}

// IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.
func (c *ChainConfig) IsMuirGlacier(num uint64) bool {
return isForked(c.MuirGlacierBlock, num)
Expand Down Expand Up @@ -625,6 +636,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "istanbulBlock", block: c.IstanbulBlock},
{name: "muirGlacierBlock", block: c.MuirGlacierBlock, optional: true},
{name: "eulerBlock", block: c.EulerBlock, optional: true},
{name: "gibbsBlock", block: c.GibbsBlock, optional: true},
{name: "berlinBlock", block: c.BerlinBlock},
{name: "londonBlock", block: c.LondonBlock},
{name: "arrowGlacierBlock", block: c.ArrowGlacierBlock, optional: true},
Expand Down Expand Up @@ -731,6 +743,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head uint64) *ConfigC
if isForkIncompatible(c.EulerBlock, newcfg.EulerBlock, head) {
return newCompatError("Euler fork block", c.EulerBlock, newcfg.EulerBlock)
}
if isForkIncompatible(c.GibbsBlock, newcfg.GibbsBlock, head) {
return newCompatError("Gibbs fork block", c.GibbsBlock, newcfg.GibbsBlock)
}
return nil
}

Expand Down

0 comments on commit 44dcfe8

Please sign in to comment.