Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions builder/files/genesis-mainnet-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"bhilaiBlock": 73440256,
"rioBlock": 77414656,
"madhugiriBlock": 79783223,
"madhugiriProBlock": 79783223,
"stateSyncConfirmationDelay": {
"44934656": 128
},
Expand All @@ -43,7 +44,7 @@
"0": 2
},
"coinbase": {
"0": "0x0000000000000000000000000000000000000000",
"0": "0x0000000000000000000000000000000000000000",
"77414656": "0x7Ee41D8A25641000661B1EF5E6AE8A00400466B0"
},
"validatorContract": "0x0000000000000000000000000000000000001000",
Expand All @@ -60,7 +61,11 @@
"14953856": 0
},
"overrideStateSyncRecordsInRange": [
{ "startBlock": 73812433, "endBlock": 73826700, "value": 0 }
{
"startBlock": 73812433,
"endBlock": 73826700,
"value": 0
}
],
"blockAlloc": {
"22156660": {
Expand Down
47 changes: 39 additions & 8 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,39 @@ var PrecompiledContractsMadhugiri = PrecompiledContracts{
common.BytesToAddress([]byte{0x11}): &bls12381MapG2{},
}

// PrecompiledContractsMadhugiriPro contains the set of pre-compiled Ethereum
// contracts used in the MadhugiriPro release (bor HF).
var PrecompiledContractsMadhugiriPro = PrecompiledContracts{
common.BytesToAddress([]byte{0x01}): &ecrecover{},
common.BytesToAddress([]byte{0x02}): &sha256hash{},
common.BytesToAddress([]byte{0x03}): &ripemd160hash{},
common.BytesToAddress([]byte{0x04}): &dataCopy{},
common.BytesToAddress([]byte{0x05}): &bigModExp{eip2565: true, eip7823: true, eip7883: true},
common.BytesToAddress([]byte{0x06}): &bn256AddIstanbul{},
common.BytesToAddress([]byte{0x07}): &bn256ScalarMulIstanbul{},
common.BytesToAddress([]byte{0x08}): &bn256PairingIstanbul{},
common.BytesToAddress([]byte{0x09}): &blake2F{},
common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{},
common.BytesToAddress([]byte{0x0b}): &bls12381G1Add{},
common.BytesToAddress([]byte{0x0c}): &bls12381G1MultiExp{},
common.BytesToAddress([]byte{0x0d}): &bls12381G2Add{},
common.BytesToAddress([]byte{0x0e}): &bls12381G2MultiExp{},
common.BytesToAddress([]byte{0x0f}): &bls12381Pairing{},
common.BytesToAddress([]byte{0x10}): &bls12381MapG1{},
common.BytesToAddress([]byte{0x11}): &bls12381MapG2{},
common.BytesToAddress([]byte{0x01, 0x00}): &p256Verify{},
}

var (
PrecompiledAddressesMadhugiri []common.Address
PrecompiledAddressesOsaka []common.Address
PrecompiledAddressesPrague []common.Address
PrecompiledAddressesCancun []common.Address
PrecompiledAddressesBerlin []common.Address
PrecompiledAddressesIstanbul []common.Address
PrecompiledAddressesByzantium []common.Address
PrecompiledAddressesHomestead []common.Address
PrecompiledAddressesMadhugiriPro []common.Address
PrecompiledAddressesMadhugiri []common.Address
PrecompiledAddressesOsaka []common.Address
PrecompiledAddressesPrague []common.Address
PrecompiledAddressesCancun []common.Address
PrecompiledAddressesBerlin []common.Address
PrecompiledAddressesIstanbul []common.Address
PrecompiledAddressesByzantium []common.Address
PrecompiledAddressesHomestead []common.Address
)

func init() {
Expand Down Expand Up @@ -225,10 +249,15 @@ func init() {
for k := range PrecompiledContractsMadhugiri {
PrecompiledAddressesMadhugiri = append(PrecompiledAddressesMadhugiri, k)
}
for k := range PrecompiledContractsMadhugiriPro {
PrecompiledAddressesMadhugiriPro = append(PrecompiledAddressesMadhugiriPro, k)
}
}

func activePrecompiledContracts(rules params.Rules) PrecompiledContracts {
switch {
case rules.IsMadhugiriPro:
return PrecompiledContractsMadhugiriPro
case rules.IsMadhugiri:
return PrecompiledContractsMadhugiri
case rules.IsVerkle:
Expand Down Expand Up @@ -258,6 +287,8 @@ func ActivePrecompiledContracts(rules params.Rules) PrecompiledContracts {
// ActivePrecompiles returns the precompile addresses enabled with the current configuration.
func ActivePrecompiles(rules params.Rules) []common.Address {
switch {
case rules.IsMadhugiriPro:
return PrecompiledAddressesMadhugiriPro
case rules.IsMadhugiri:
return PrecompiledAddressesMadhugiri
case rules.IsOsaka:
Expand Down
2 changes: 2 additions & 0 deletions core/vm/jump_table_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
switch {
case rules.IsVerkle:
return newCancunInstructionSet(), errors.New("verkle-fork not defined yet")
case rules.IsMadhugiriPro:
return newPragueInstructionSet(), errors.New("madhugiriPro-fork not defined yet")
case rules.IsMadhugiri:
return newPragueInstructionSet(), errors.New("madhugiri-fork not defined yet")
case rules.IsOsaka:
Expand Down
15 changes: 8 additions & 7 deletions internal/cli/server/chains/amoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ var amoyTestnet = &Chain{
CancunBlock: big.NewInt(5423600),
PragueBlock: big.NewInt(22765056),
Bor: &params.BorConfig{
JaipurBlock: big.NewInt(73100),
DelhiBlock: big.NewInt(73100),
IndoreBlock: big.NewInt(73100),
AhmedabadBlock: big.NewInt(11865856),
BhilaiBlock: big.NewInt(22765056),
RioBlock: big.NewInt(26272256),
MadhugiriBlock: big.NewInt(28899616),
JaipurBlock: big.NewInt(73100),
DelhiBlock: big.NewInt(73100),
IndoreBlock: big.NewInt(73100),
AhmedabadBlock: big.NewInt(11865856),
BhilaiBlock: big.NewInt(22765056),
RioBlock: big.NewInt(26272256),
MadhugiriBlock: big.NewInt(28899616),
MadhugiriProBlock: big.NewInt(29244175),
StateSyncConfirmationDelay: map[string]uint64{
"0": 128,
},
Expand Down
15 changes: 8 additions & 7 deletions internal/cli/server/chains/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ var mainnetBor = &Chain{
CancunBlock: big.NewInt(54876000),
PragueBlock: big.NewInt(73440256),
Bor: &params.BorConfig{
JaipurBlock: big.NewInt(23850000),
DelhiBlock: big.NewInt(38189056),
IndoreBlock: big.NewInt(44934656),
AhmedabadBlock: big.NewInt(62278656),
BhilaiBlock: big.NewInt(73440256),
RioBlock: big.NewInt(77414656),
MadhugiriBlock: big.NewInt(79783223),
JaipurBlock: big.NewInt(23850000),
DelhiBlock: big.NewInt(38189056),
IndoreBlock: big.NewInt(44934656),
AhmedabadBlock: big.NewInt(62278656),
BhilaiBlock: big.NewInt(73440256),
RioBlock: big.NewInt(77414656),
MadhugiriBlock: big.NewInt(79783223),
MadhugiriProBlock: big.NewInt(79783223),
StateSyncConfirmationDelay: map[string]uint64{
"44934656": 128,
},
Expand Down
37 changes: 23 additions & 14 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,14 @@ var (
CancunBlock: big.NewInt(5423600),
PragueBlock: big.NewInt(22765056),
Bor: &BorConfig{
JaipurBlock: big.NewInt(73100),
DelhiBlock: big.NewInt(73100),
IndoreBlock: big.NewInt(73100),
AhmedabadBlock: big.NewInt(11865856),
BhilaiBlock: big.NewInt(22765056),
RioBlock: big.NewInt(26272256),
MadhugiriBlock: big.NewInt(28899616),
JaipurBlock: big.NewInt(73100),
DelhiBlock: big.NewInt(73100),
IndoreBlock: big.NewInt(73100),
AhmedabadBlock: big.NewInt(11865856),
BhilaiBlock: big.NewInt(22765056),
RioBlock: big.NewInt(26272256),
MadhugiriBlock: big.NewInt(28899616),
MadhugiriProBlock: big.NewInt(29244175),
StateSyncConfirmationDelay: map[string]uint64{
"0": 128,
},
Expand Down Expand Up @@ -414,13 +415,14 @@ var (
CancunBlock: big.NewInt(54876000),
PragueBlock: big.NewInt(73440256),
Bor: &BorConfig{
JaipurBlock: big.NewInt(23850000),
DelhiBlock: big.NewInt(38189056),
IndoreBlock: big.NewInt(44934656),
AhmedabadBlock: big.NewInt(62278656),
BhilaiBlock: big.NewInt(73440256),
RioBlock: big.NewInt(77414656),
MadhugiriBlock: big.NewInt(79783223),
JaipurBlock: big.NewInt(23850000),
DelhiBlock: big.NewInt(38189056),
IndoreBlock: big.NewInt(44934656),
AhmedabadBlock: big.NewInt(62278656),
BhilaiBlock: big.NewInt(73440256),
RioBlock: big.NewInt(77414656),
MadhugiriBlock: big.NewInt(79783223),
MadhugiriProBlock: big.NewInt(79783223),
StateSyncConfirmationDelay: map[string]uint64{
"44934656": 128,
},
Expand Down Expand Up @@ -885,6 +887,7 @@ type BorConfig struct {
BhilaiBlock *big.Int `json:"bhilaiBlock"` // Bhilai switch block (nil = no fork, 0 = already on bhilai)
RioBlock *big.Int `json:"rioBlock"` // Rio switch block (nil = no fork, 0 = already on rio)
MadhugiriBlock *big.Int `json:"madhugiriBlock"` // Madhugiri switch block (nil = no fork, 0 = already on madhugiri)
MadhugiriProBlock *big.Int `json:"madhugiriProBlock"` // MadhugiriPro switch block (nil = no fork, 0 = already on madhugiriPro)
}

// String implements the stringer interface, returning the consensus engine details.
Expand Down Expand Up @@ -940,6 +943,10 @@ func (c *BorConfig) IsMadhugiri(number *big.Int) bool {
return isBlockForked(c.MadhugiriBlock, number)
}

func (c *BorConfig) IsMadhugiriPro(number *big.Int) bool {
return isBlockForked(c.MadhugiriProBlock, number)
}

// // TODO: modify this function once the block number is finalized
// func (c *BorConfig) IsNapoli(number *big.Int) bool {
// if c.NapoliBlock != nil {
Expand Down Expand Up @@ -1640,6 +1647,7 @@ type Rules struct {
IsMerge, IsShanghai, IsCancun, IsPrague, IsOsaka bool
IsVerkle bool
IsMadhugiri bool
IsMadhugiriPro bool
}

// Rules ensures c's ChainID is not nil.
Expand Down Expand Up @@ -1672,5 +1680,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
IsOsaka: c.IsOsaka(num),
IsEIP4762: c.IsVerkle(num),
IsMadhugiri: c.Bor != nil && c.Bor.IsMadhugiri(num),
IsMadhugiriPro: c.Bor != nil && c.Bor.IsMadhugiriPro(num),
}
}
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

const (
VersionMajor = 2 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release
VersionMinor = 5 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)
Expand Down
Loading