all: remove notion of trusted checkpoints in the post-merge world (#27147)
* all: remove notion of trusted checkpoints in the post-merge world * light: remove unused function * eth/ethconfig, les: remove unused config option * les: make linter happy --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com>
This commit is contained in:
co-authored by
Gary Rong
parent
d3ece3a07c
commit
1e556d220c
@@ -17,12 +17,10 @@
|
||||
package params
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
// Genesis hashes to enforce below configs on.
|
||||
@@ -33,23 +31,6 @@ var (
|
||||
GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
|
||||
)
|
||||
|
||||
// TrustedCheckpoints associates each known checkpoint with the genesis hash of
|
||||
// the chain it belongs to.
|
||||
var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{
|
||||
MainnetGenesisHash: MainnetTrustedCheckpoint,
|
||||
SepoliaGenesisHash: SepoliaTrustedCheckpoint,
|
||||
RinkebyGenesisHash: RinkebyTrustedCheckpoint,
|
||||
GoerliGenesisHash: GoerliTrustedCheckpoint,
|
||||
}
|
||||
|
||||
// CheckpointOracles associates each known checkpoint oracles with the genesis hash of
|
||||
// the chain it belongs to.
|
||||
var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{
|
||||
MainnetGenesisHash: MainnetCheckpointOracle,
|
||||
RinkebyGenesisHash: RinkebyCheckpointOracle,
|
||||
GoerliGenesisHash: GoerliCheckpointOracle,
|
||||
}
|
||||
|
||||
func newUint64(val uint64) *uint64 { return &val }
|
||||
|
||||
var (
|
||||
@@ -78,28 +59,6 @@ var (
|
||||
ShanghaiTime: newUint64(1681338455),
|
||||
Ethash: new(EthashConfig),
|
||||
}
|
||||
|
||||
// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
|
||||
MainnetTrustedCheckpoint = &TrustedCheckpoint{
|
||||
SectionIndex: 506,
|
||||
SectionHead: common.HexToHash("0x3d1a139a6fc7764211236ef7c64d9e8c1fe55b358d7414e25277bac1144486cd"),
|
||||
CHTRoot: common.HexToHash("0xef7fc3321a239a54238593bdf68d82933d903cb533b0d03228a8d958cd35ea77"),
|
||||
BloomRoot: common.HexToHash("0x51d7bfe7c6397b1caa8b1cb046de4aeaf7e7fbd3fb6c726b60bf750de78809e8"),
|
||||
}
|
||||
|
||||
// MainnetCheckpointOracle contains a set of configs for the main network oracle.
|
||||
MainnetCheckpointOracle = &CheckpointOracleConfig{
|
||||
Address: common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"),
|
||||
Signers: []common.Address{
|
||||
common.HexToAddress("0x1b2C260efc720BE89101890E4Db589b44E950527"), // Peter
|
||||
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
|
||||
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
|
||||
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
|
||||
common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume
|
||||
},
|
||||
Threshold: 2,
|
||||
}
|
||||
|
||||
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
|
||||
SepoliaChainConfig = &ChainConfig{
|
||||
ChainID: big.NewInt(11155111),
|
||||
@@ -122,15 +81,6 @@ var (
|
||||
ShanghaiTime: newUint64(1677557088),
|
||||
Ethash: new(EthashConfig),
|
||||
}
|
||||
|
||||
// SepoliaTrustedCheckpoint contains the light client trusted checkpoint for the Sepolia test network.
|
||||
SepoliaTrustedCheckpoint = &TrustedCheckpoint{
|
||||
SectionIndex: 55,
|
||||
SectionHead: common.HexToHash("0xb70ea113ab4db9d6e015c5b55d486713f60c40bda666121914a71ce3aec53a75"),
|
||||
CHTRoot: common.HexToHash("0x206456d8847b66aaf427ed551f55e24cff90241bdb0a02583c761bf8164f78e4"),
|
||||
BloomRoot: common.HexToHash("0x4369228d59a8fe285fee874c636531091e659b3b1294bb978eb159860a1cede2"),
|
||||
}
|
||||
|
||||
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
|
||||
RinkebyChainConfig = &ChainConfig{
|
||||
ChainID: big.NewInt(4),
|
||||
@@ -153,27 +103,6 @@ var (
|
||||
Epoch: 30000,
|
||||
},
|
||||
}
|
||||
|
||||
// RinkebyTrustedCheckpoint contains the light client trusted checkpoint for the Rinkeby test network.
|
||||
RinkebyTrustedCheckpoint = &TrustedCheckpoint{
|
||||
SectionIndex: 373,
|
||||
SectionHead: common.HexToHash("0x09f6d8f0d08d61025ccf4578dc214220b78013841470d445ed86faab4a5a885a"),
|
||||
CHTRoot: common.HexToHash("0xef72902b944a111e9fdfee5fb69a5e46f68bf11a1f0bd430321f92d6b66987df"),
|
||||
BloomRoot: common.HexToHash("0xd0120268729c51dd6fa2714f7f88527adfecbdb08592c671233ad2e0ad7cd835"),
|
||||
}
|
||||
|
||||
// RinkebyCheckpointOracle contains a set of configs for the Rinkeby test network oracle.
|
||||
RinkebyCheckpointOracle = &CheckpointOracleConfig{
|
||||
Address: common.HexToAddress("0xebe8eFA441B9302A0d7eaECc277c09d20D684540"),
|
||||
Signers: []common.Address{
|
||||
common.HexToAddress("0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3"), // Peter
|
||||
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
|
||||
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
|
||||
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
|
||||
},
|
||||
Threshold: 2,
|
||||
}
|
||||
|
||||
// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
|
||||
GoerliChainConfig = &ChainConfig{
|
||||
ChainID: big.NewInt(5),
|
||||
@@ -199,28 +128,6 @@ var (
|
||||
Epoch: 30000,
|
||||
},
|
||||
}
|
||||
|
||||
// GoerliTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network.
|
||||
GoerliTrustedCheckpoint = &TrustedCheckpoint{
|
||||
SectionIndex: 229,
|
||||
SectionHead: common.HexToHash("0xc5a7b57cb4af7b3d4cc251ac5f29acaac94e7464365358e7ad26129083b7729a"),
|
||||
CHTRoot: common.HexToHash("0x54c0d5c756d9c48eda26ea13c2a49c2e31f1cb7dfb01514ddc49f3d24272c77e"),
|
||||
BloomRoot: common.HexToHash("0xd681970a496f6187d089f8c8665a3587b5a78212d79b6ceef97c0dabd0188e56"),
|
||||
}
|
||||
|
||||
// GoerliCheckpointOracle contains a set of configs for the Goerli test network oracle.
|
||||
GoerliCheckpointOracle = &CheckpointOracleConfig{
|
||||
Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"),
|
||||
Signers: []common.Address{
|
||||
common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter
|
||||
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
|
||||
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
|
||||
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
|
||||
common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume
|
||||
},
|
||||
Threshold: 2,
|
||||
}
|
||||
|
||||
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
|
||||
// and accepted by the Ethereum core developers into the Ethash consensus.
|
||||
AllEthashProtocolChanges = &ChainConfig{
|
||||
@@ -347,54 +254,6 @@ var NetworkNames = map[string]string{
|
||||
SepoliaChainConfig.ChainID.String(): "sepolia",
|
||||
}
|
||||
|
||||
// TrustedCheckpoint represents a set of post-processed trie roots (CHT and
|
||||
// BloomTrie) associated with the appropriate section index and head hash. It is
|
||||
// used to start light syncing from this checkpoint and avoid downloading the
|
||||
// entire header chain while still being able to securely access old headers/logs.
|
||||
type TrustedCheckpoint struct {
|
||||
SectionIndex uint64 `json:"sectionIndex"`
|
||||
SectionHead common.Hash `json:"sectionHead"`
|
||||
CHTRoot common.Hash `json:"chtRoot"`
|
||||
BloomRoot common.Hash `json:"bloomRoot"`
|
||||
}
|
||||
|
||||
// HashEqual returns an indicator comparing the itself hash with given one.
|
||||
func (c *TrustedCheckpoint) HashEqual(hash common.Hash) bool {
|
||||
if c.Empty() {
|
||||
return hash == common.Hash{}
|
||||
}
|
||||
return c.Hash() == hash
|
||||
}
|
||||
|
||||
// Hash returns the hash of checkpoint's four key fields(index, sectionHead, chtRoot and bloomTrieRoot).
|
||||
func (c *TrustedCheckpoint) Hash() common.Hash {
|
||||
var sectionIndex [8]byte
|
||||
binary.BigEndian.PutUint64(sectionIndex[:], c.SectionIndex)
|
||||
|
||||
w := sha3.NewLegacyKeccak256()
|
||||
w.Write(sectionIndex[:])
|
||||
w.Write(c.SectionHead[:])
|
||||
w.Write(c.CHTRoot[:])
|
||||
w.Write(c.BloomRoot[:])
|
||||
|
||||
var h common.Hash
|
||||
w.Sum(h[:0])
|
||||
return h
|
||||
}
|
||||
|
||||
// Empty returns an indicator whether the checkpoint is regarded as empty.
|
||||
func (c *TrustedCheckpoint) Empty() bool {
|
||||
return c.SectionHead == (common.Hash{}) || c.CHTRoot == (common.Hash{}) || c.BloomRoot == (common.Hash{})
|
||||
}
|
||||
|
||||
// CheckpointOracleConfig represents a set of checkpoint contract(which acts as an oracle)
|
||||
// config which used for light client checkpoint syncing.
|
||||
type CheckpointOracleConfig struct {
|
||||
Address common.Address `json:"address"`
|
||||
Signers []common.Address `json:"signers"`
|
||||
Threshold uint64 `json:"threshold"`
|
||||
}
|
||||
|
||||
// ChainConfig is the core config which determines the blockchain settings.
|
||||
//
|
||||
// ChainConfig is stored in the database on a per block basis. This means
|
||||
|
||||
Reference in New Issue
Block a user