feat: sepolia flag and config (#377)

* add sepolia flag and configuration

* bump patch version

* Update params/version.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* Update params/config.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* Update params/config.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* explicitly set l1.confirmations and l1.sync.startblock for sepolia

* update config

---------

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
vyzo 2023-08-04 20:45:39 +03:00 committed by GitHub
parent 86c7cbe020
commit 94190f0163
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 112 additions and 19 deletions

View file

@ -71,6 +71,7 @@ It expects the genesis file as argument.`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `

View file

@ -139,6 +139,8 @@ func remoteConsole(ctx *cli.Context) error {
path = filepath.Join(path, "sepolia")
} else if ctx.GlobalBool(utils.ScrollAlphaFlag.Name) {
path = filepath.Join(path, "scroll-alpha")
} else if ctx.GlobalBool(utils.ScrollSepoliaFlag.Name) {
path = filepath.Join(path, "scroll-sepolia")
}
}
endpoint = fmt.Sprintf("%s/geth.ipc", path)

View file

@ -86,6 +86,7 @@ Remove blockchain and state databases`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Usage: "Inspect the storage size for each type of data in the database",
Description: `This commands iterates the entire database. If the optional 'prefix' and 'start' arguments are provided, then the iteration is limited to the given subset of data.`,
@ -103,6 +104,7 @@ Remove blockchain and state databases`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
}
dbCompactCmd = cli.Command{
@ -118,10 +120,11 @@ Remove blockchain and state databases`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
utils.CacheFlag,
utils.CacheDatabaseFlag,
},
Description: `This command performs a database compaction.
Description: `This command performs a database compaction.
WARNING: This operation may take a very long time to finish, and may cause database
corruption if it is aborted during execution'!`,
}
@ -139,6 +142,7 @@ corruption if it is aborted during execution'!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: "This command looks up the specified database key from the database.",
}
@ -156,8 +160,9 @@ corruption if it is aborted during execution'!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: `This command deletes the specified database key from the database.
Description: `This command deletes the specified database key from the database.
WARNING: This is a low-level operation which may cause database corruption!`,
}
dbPutCmd = cli.Command{
@ -174,8 +179,9 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: `This command sets a given database key to the given value.
Description: `This command sets a given database key to the given value.
WARNING: This is a low-level operation which may cause database corruption!`,
}
dbGetSlotsCmd = cli.Command{
@ -192,6 +198,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: "This command looks up the specified database key from the database.",
}
@ -209,6 +216,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: "This command displays information about the freezer index.",
}
@ -225,6 +233,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: "The import command imports the specific chain data from an RLP encoded stream.",
}
@ -241,6 +250,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.",
}

View file

@ -146,6 +146,7 @@ var (
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
utils.VMEnableDebugFlag,
utils.NetworkIdFlag,
utils.EthStatsURLFlag,
@ -287,6 +288,9 @@ func prepare(ctx *cli.Context) {
case ctx.GlobalIsSet(utils.ScrollAlphaFlag.Name):
log.Info("Starting l2geth on Scroll Alpha testnet...")
case ctx.GlobalIsSet(utils.ScrollSepoliaFlag.Name):
log.Info("Starting l2geth on Scroll Sepolia testnet...")
case ctx.GlobalIsSet(utils.DeveloperFlag.Name):
log.Info("Starting Geth in ephemeral dev mode...")
@ -296,7 +300,7 @@ func prepare(ctx *cli.Context) {
// If we're a full node on mainnet without --cache specified, bump default cache allowance
if ctx.GlobalString(utils.SyncModeFlag.Name) != "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) && !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
// Make sure we're not on any supported preconfigured testnet either
if !ctx.GlobalIsSet(utils.RopstenFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.ScrollAlphaFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
if !ctx.GlobalIsSet(utils.RopstenFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.ScrollAlphaFlag.Name) && !ctx.GlobalIsSet(utils.ScrollSepoliaFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
// Nope, we're really on mainnet. Bump that cache up!
log.Info("Bumping default cache on mainnet", "provided", ctx.GlobalInt(utils.CacheFlag.Name), "updated", 4096)
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(4096))

View file

@ -67,6 +67,7 @@ var (
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
utils.CacheTrieJournalFlag,
utils.BloomFilterSizeFlag,
},
@ -99,6 +100,7 @@ the trie clean cache with default directory will be deleted.
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: `
geth snapshot verify-state <state-root>
@ -121,6 +123,7 @@ In other words, this command does the snapshot to trie conversion.
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: `
geth snapshot traverse-state <state-root>
@ -145,13 +148,14 @@ It's also usable without snapshot enabled.
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
},
Description: `
geth snapshot traverse-rawstate <state-root>
will traverse the whole state from the given root and will abort if any referenced
trie node or contract code is missing. This command can be used for state integrity
verification. The default checking target is the HEAD state. It's basically identical
to traverse-state, but the check granularity is smaller.
to traverse-state, but the check granularity is smaller.
It's also usable without snapshot enabled.
`,
@ -170,6 +174,7 @@ It's also usable without snapshot enabled.
utils.RinkebyFlag,
utils.GoerliFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
utils.ExcludeCodeFlag,
utils.ExcludeStorageFlag,
utils.StartKeyFlag,
@ -177,7 +182,7 @@ It's also usable without snapshot enabled.
},
Description: `
This command is semantically equivalent to 'geth dump', but uses the snapshots
as the backend data source, making this command a lot faster.
as the backend data source, making this command a lot faster.
The argument is interpreted as block number or hash. If none is provided, the latest
block is used.

View file

@ -48,6 +48,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.RopstenFlag,
utils.SepoliaFlag,
utils.ScrollAlphaFlag,
utils.ScrollSepoliaFlag,
utils.SyncModeFlag,
utils.ExitWhenSyncedFlag,
utils.GCModeFlag,

View file

@ -168,6 +168,10 @@ var (
Name: "scroll-alpha",
Usage: "Scroll Alpha test network",
}
ScrollSepoliaFlag = cli.BoolFlag{
Name: "scroll-sepolia",
Usage: "Scroll Sepolia test network",
}
DeveloperFlag = cli.BoolFlag{
Name: "dev",
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
@ -842,6 +846,9 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.GlobalBool(ScrollAlphaFlag.Name) {
return filepath.Join(path, "scroll-alpha")
}
if ctx.GlobalBool(ScrollSepoliaFlag.Name) {
return filepath.Join(path, "scroll-sepolia")
}
return path
}
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@ -898,6 +905,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls = params.GoerliBootnodes
case ctx.GlobalBool(ScrollAlphaFlag.Name):
urls = params.ScrollAlphaBootnodes
case ctx.GlobalBool(ScrollSepoliaFlag.Name):
urls = params.ScrollSepoliaBootnodes
case cfg.BootstrapNodes != nil:
return // already set, don't apply defaults.
}
@ -1358,6 +1367,9 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "sepolia")
case ctx.GlobalBool(ScrollAlphaFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "scroll-alpha")
case ctx.GlobalBool(ScrollSepoliaFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "scroll-sepolia")
}
}
@ -1549,7 +1561,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
// SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Avoid conflicting network flags
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, ScrollAlphaFlag)
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, ScrollAlphaFlag, ScrollSepoliaFlag)
CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light")
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
if ctx.GlobalString(GCModeFlag.Name) == "archive" && ctx.GlobalUint64(TxLookupLimitFlag.Name) != 0 {
@ -1718,6 +1730,16 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
cfg.Genesis = core.DefaultScrollAlphaGenesisBlock()
// SetDNSDiscoveryDefaults(cfg, params.ScrollAlphaGenesisHash)
case ctx.GlobalBool(ScrollSepoliaFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 534351
}
cfg.Genesis = core.DefaultScrollSepoliaGenesisBlock()
// forced for sepolia
log.Info("Setting flag", "--l1.confirmations", "finalized")
stack.Config().L1Confirmations = rpc.FinalizedBlockNumber
log.Info("Setting flag", "--l1.sync.startblock", "4025746")
stack.Config().L1DeploymentBlock = 4025746
case ctx.GlobalBool(DeveloperFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1337
@ -1958,6 +1980,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
genesis = core.DefaultGoerliGenesisBlock()
case ctx.GlobalBool(ScrollAlphaFlag.Name):
genesis = core.DefaultScrollAlphaGenesisBlock()
case ctx.GlobalBool(ScrollSepoliaFlag.Name):
genesis = core.DefaultScrollSepoliaGenesisBlock()
case ctx.GlobalBool(DeveloperFlag.Name):
Fatalf("Developer chains are ephemeral")
}

View file

@ -144,10 +144,10 @@ func (e *GenesisMismatchError) Error() string {
// SetupGenesisBlock writes or updates the genesis block in db.
// The block that will be used is:
//
// genesis == nil genesis != nil
// +------------------------------------------
// db has no genesis | main-net default | genesis
// db has genesis | from DB | genesis (if compatible)
// genesis == nil genesis != nil
// +------------------------------------------
// db has no genesis | main-net default | genesis
// db has genesis | from DB | genesis (if compatible)
//
// The stored chain configuration will be updated if it is compatible (i.e. does not
// specify a fork block below the local head block). In case of a conflict, the
@ -451,12 +451,12 @@ func DefaultScrollAlphaGenesisBlock() *Genesis {
// DefaultScrollSepoliaGenesisBlock returns the Scroll Sepolia network genesis block.
func DefaultScrollSepoliaGenesisBlock() *Genesis {
return &Genesis{
Config: params.ScrollAlphaChainConfig,
Timestamp: 0x63f67207,
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000b7C0c58702D0781C0e2eB3aaE301E4c340073448Ec9c139eFCBBe6323DA406fffBF4Db02a60A9720589c71deC4302fE718bE62350c174922782Cc6600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
Config: params.ScrollSepoliaChainConfig,
Timestamp: 0x64cd2e85,
ExtraData: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000048C3F81f3D998b6652900e1C3183736C238Fe4290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
GasLimit: 8000000,
Difficulty: big.NewInt(1),
Alloc: decodePrealloc(scrollAlphaAllocData),
Alloc: decodePrealloc(scrollSepoliaAllocData),
}
}

File diff suppressed because one or more lines are too long

View file

@ -83,6 +83,13 @@ var ScrollAlphaBootnodes = []string{
"enode://cf85bfa5828239b1f6b21758579ee8aaaba2a1fb4c658d6967c5f7ed4f040d95dee5b5cef0c77d656a191f6b0875dd03f05b30a3b2b3e15bfcf18b500d8f634c@35.155.117.77:30303",
}
// ScrollSepoliaBootnodes are the enode URLs of the P2P bootstrap nodes running on the Scroll Alpha test network.
var ScrollSepoliaBootnodes = []string{
"enode://ceb1636bac5cbb262e5ad5b2cd22014bdb35ffe7f58b3506970d337a63099481814a338dbcd15f2d28757151e3ecd40ba38b41350b793cd0d910ff0436654f8c@35.85.84.250:30303",
"enode://29cee709c400533ae038a875b9ca975c8abef9eade956dcf3585e940acd5c0ae916968f514bd37d1278775aad1b7db30f7032a70202a87fd7365bd8de3c9f5fc@44.242.39.33:30303",
"enode://dd1ac5433c5c2b04ca3166f4cb726f8ff6d2da83dbc16d9b68b1ea83b7079b371eb16ef41c00441b6e85e32e33087f3b7753ea9e8b1e3f26d3e4df9208625e7f@54.148.111.168:30303",
}
var V5Bootnodes = []string{
// Teku team's bootnode
"enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA",

View file

@ -35,7 +35,7 @@ var (
RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
ScrollAlphaGenesisHash = common.HexToHash("0xa4fc62b9b0643e345bdcebe457b3ae898bef59c7203c3db269200055e037afda")
ScrollSepoliaGenesisHash = common.HexToHash("0x8deefb75edbf59fbff1cd9ffd6ebcd42dced646a1487ef369e0a64ccfc8b1fa2")
ScrollSepoliaGenesisHash = common.HexToHash("0x82f79483ba08c0411b4cb52031b57695eebecebf4169d777740cd069959b0ba1")
)
// TrustedCheckpoints associates each known checkpoint with the genesis hash of
@ -257,7 +257,7 @@ var (
}
// ScrollAlphaChainConfig contains the chain parameters to run a node on the Scroll Alpha test network.
ScrollMaxTxPerBlock = 44
ScrollMaxTxPerBlock = 100
ScrollMaxTxPayloadBytesPerBlock = 120 * 1024
ScrollAlphaChainConfig = &ChainConfig{
@ -297,6 +297,44 @@ var (
},
}
// TODO fix this config
ScrollSepoliaChainConfig = &ChainConfig{
ChainID: big.NewInt(534351),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
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: nil,
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
ArchimedesBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0),
Clique: &CliqueConfig{
Period: 3,
Epoch: 30000,
},
Scroll: ScrollConfig{
UseZktrie: true,
MaxTxPerBlock: &ScrollMaxTxPerBlock,
MaxTxPayloadBytesPerBlock: &ScrollMaxTxPayloadBytesPerBlock,
FeeVaultAddress: &rcfg.ScrollFeeVaultAddress,
EnableEIP2718: false,
EnableEIP1559: false,
L1Config: &L1Config{
L1ChainId: 11155111,
L1MessageQueueAddress: common.HexToAddress("0xF0B2293F5D834eAe920c6974D50957A1732de763"),
NumL1MessagesPerBlock: 10,
},
},
}
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus.
//

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 4 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 21 // Patch version component of the current release
VersionPatch = 22 // Patch version component of the current release
VersionMeta = "sepolia" // Version metadata to append to the version string
)
@ -44,7 +44,7 @@ var VersionWithMeta = func() string {
// ArchiveVersion holds the textual version string used for Geth archives.
// e.g. "1.8.11-dea1ce05" for stable releases, or
// "1.8.13-unstable-21c059b6" for unstable releases
// "1.8.13-unstable-21c059b6" for unstable releases
func ArchiveVersion(gitCommit string) string {
vsn := Version
if VersionMeta != "stable" {