Skip to content

Commit 0924145

Browse files
Merge branch 'develop' into reset_skipped_traces
2 parents 3cb23f0 + 9a0a87f commit 0924145

34 files changed

+467
-63
lines changed

cmd/geth/chaincmd.go

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ It expects the genesis file as argument.`,
7272
utils.GoerliFlag,
7373
utils.ScrollAlphaFlag,
7474
utils.ScrollSepoliaFlag,
75+
utils.ScrollFlag,
7576
},
7677
Category: "BLOCKCHAIN COMMANDS",
7778
Description: `

cmd/geth/consolecmd.go

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ func remoteConsole(ctx *cli.Context) error {
141141
path = filepath.Join(path, "scroll-alpha")
142142
} else if ctx.GlobalBool(utils.ScrollSepoliaFlag.Name) {
143143
path = filepath.Join(path, "scroll-sepolia")
144+
} else if ctx.GlobalBool(utils.ScrollFlag.Name) {
145+
path = filepath.Join(path, "scroll")
144146
}
145147
}
146148
endpoint = fmt.Sprintf("%s/geth.ipc", path)

cmd/geth/dbcmd.go

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Remove blockchain and state databases`,
8787
utils.GoerliFlag,
8888
utils.ScrollAlphaFlag,
8989
utils.ScrollSepoliaFlag,
90+
utils.ScrollFlag,
9091
},
9192
Usage: "Inspect the storage size for each type of data in the database",
9293
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.`,
@@ -105,6 +106,7 @@ Remove blockchain and state databases`,
105106
utils.GoerliFlag,
106107
utils.ScrollAlphaFlag,
107108
utils.ScrollSepoliaFlag,
109+
utils.ScrollFlag,
108110
},
109111
}
110112
dbCompactCmd = cli.Command{
@@ -121,6 +123,7 @@ Remove blockchain and state databases`,
121123
utils.GoerliFlag,
122124
utils.ScrollAlphaFlag,
123125
utils.ScrollSepoliaFlag,
126+
utils.ScrollFlag,
124127
utils.CacheFlag,
125128
utils.CacheDatabaseFlag,
126129
},
@@ -143,6 +146,7 @@ corruption if it is aborted during execution'!`,
143146
utils.GoerliFlag,
144147
utils.ScrollAlphaFlag,
145148
utils.ScrollSepoliaFlag,
149+
utils.ScrollFlag,
146150
},
147151
Description: "This command looks up the specified database key from the database.",
148152
}
@@ -161,6 +165,7 @@ corruption if it is aborted during execution'!`,
161165
utils.GoerliFlag,
162166
utils.ScrollAlphaFlag,
163167
utils.ScrollSepoliaFlag,
168+
utils.ScrollFlag,
164169
},
165170
Description: `This command deletes the specified database key from the database.
166171
WARNING: This is a low-level operation which may cause database corruption!`,
@@ -180,6 +185,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
180185
utils.GoerliFlag,
181186
utils.ScrollAlphaFlag,
182187
utils.ScrollSepoliaFlag,
188+
utils.ScrollFlag,
183189
},
184190
Description: `This command sets a given database key to the given value.
185191
WARNING: This is a low-level operation which may cause database corruption!`,
@@ -199,6 +205,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
199205
utils.GoerliFlag,
200206
utils.ScrollAlphaFlag,
201207
utils.ScrollSepoliaFlag,
208+
utils.ScrollFlag,
202209
},
203210
Description: "This command looks up the specified database key from the database.",
204211
}
@@ -217,6 +224,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
217224
utils.GoerliFlag,
218225
utils.ScrollAlphaFlag,
219226
utils.ScrollSepoliaFlag,
227+
utils.ScrollFlag,
220228
},
221229
Description: "This command displays information about the freezer index.",
222230
}
@@ -234,6 +242,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
234242
utils.GoerliFlag,
235243
utils.ScrollAlphaFlag,
236244
utils.ScrollSepoliaFlag,
245+
utils.ScrollFlag,
237246
},
238247
Description: "The import command imports the specific chain data from an RLP encoded stream.",
239248
}
@@ -251,6 +260,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
251260
utils.GoerliFlag,
252261
utils.ScrollAlphaFlag,
253262
utils.ScrollSepoliaFlag,
263+
utils.ScrollFlag,
254264
},
255265
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.",
256266
}

cmd/geth/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ var (
148148
utils.GoerliFlag,
149149
utils.ScrollAlphaFlag,
150150
utils.ScrollSepoliaFlag,
151+
utils.ScrollFlag,
151152
utils.VMEnableDebugFlag,
152153
utils.NetworkIdFlag,
153154
utils.EthStatsURLFlag,
@@ -190,6 +191,7 @@ var (
190191
utils.RPCGlobalEVMTimeoutFlag,
191192
utils.RPCGlobalTxFeeCapFlag,
192193
utils.AllowUnprotectedTxs,
194+
utils.MaxBlockRangeFlag,
193195
}
194196

195197
metricsFlags = []cli.Flag{

cmd/geth/snapshot.go

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ var (
6868
utils.GoerliFlag,
6969
utils.ScrollAlphaFlag,
7070
utils.ScrollSepoliaFlag,
71+
utils.ScrollFlag,
7172
utils.CacheTrieJournalFlag,
7273
utils.BloomFilterSizeFlag,
7374
},
@@ -101,6 +102,7 @@ the trie clean cache with default directory will be deleted.
101102
utils.GoerliFlag,
102103
utils.ScrollAlphaFlag,
103104
utils.ScrollSepoliaFlag,
105+
utils.ScrollFlag,
104106
},
105107
Description: `
106108
geth snapshot verify-state <state-root>
@@ -124,6 +126,7 @@ In other words, this command does the snapshot to trie conversion.
124126
utils.GoerliFlag,
125127
utils.ScrollAlphaFlag,
126128
utils.ScrollSepoliaFlag,
129+
utils.ScrollFlag,
127130
},
128131
Description: `
129132
geth snapshot traverse-state <state-root>
@@ -149,6 +152,7 @@ It's also usable without snapshot enabled.
149152
utils.GoerliFlag,
150153
utils.ScrollAlphaFlag,
151154
utils.ScrollSepoliaFlag,
155+
utils.ScrollFlag,
152156
},
153157
Description: `
154158
geth snapshot traverse-rawstate <state-root>
@@ -175,6 +179,7 @@ It's also usable without snapshot enabled.
175179
utils.GoerliFlag,
176180
utils.ScrollAlphaFlag,
177181
utils.ScrollSepoliaFlag,
182+
utils.ScrollFlag,
178183
utils.ExcludeCodeFlag,
179184
utils.ExcludeStorageFlag,
180185
utils.StartKeyFlag,

cmd/geth/usage.go

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
4949
utils.SepoliaFlag,
5050
utils.ScrollAlphaFlag,
5151
utils.ScrollSepoliaFlag,
52+
utils.ScrollFlag,
5253
utils.SyncModeFlag,
5354
utils.ExitWhenSyncedFlag,
5455
utils.GCModeFlag,

cmd/utils/flags.go

+54-1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ var (
177177
Name: "scroll-sepolia",
178178
Usage: "Scroll Sepolia test network",
179179
}
180+
ScrollFlag = cli.BoolFlag{
181+
Name: "scroll",
182+
Usage: "Scroll mainnet",
183+
}
180184
DeveloperFlag = cli.BoolFlag{
181185
Name: "dev",
182186
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
@@ -831,6 +835,12 @@ var (
831835
Name: "ccc",
832836
Usage: "Enable circuit capacity check during block validation",
833837
}
838+
839+
// Max block range for `eth_getLogs` method
840+
MaxBlockRangeFlag = cli.Int64Flag{
841+
Name: "rpc.getlogs.maxrange",
842+
Usage: "Limit max fetched block range for `eth_getLogs` method",
843+
}
834844
)
835845

836846
// MakeDataDir retrieves the currently requested data directory, terminating
@@ -858,6 +868,9 @@ func MakeDataDir(ctx *cli.Context) string {
858868
if ctx.GlobalBool(ScrollSepoliaFlag.Name) {
859869
return filepath.Join(path, "scroll-sepolia")
860870
}
871+
if ctx.GlobalBool(ScrollFlag.Name) {
872+
return filepath.Join(path, "scroll")
873+
}
861874
return path
862875
}
863876
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@@ -916,6 +929,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
916929
urls = params.ScrollAlphaBootnodes
917930
case ctx.GlobalBool(ScrollSepoliaFlag.Name):
918931
urls = params.ScrollSepoliaBootnodes
932+
case ctx.GlobalBool(ScrollFlag.Name):
933+
urls = params.ScrollMainnetBootnodes
919934
case cfg.BootstrapNodes != nil:
920935
return // already set, don't apply defaults.
921936
}
@@ -1378,6 +1393,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
13781393
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "scroll-alpha")
13791394
case ctx.GlobalBool(ScrollSepoliaFlag.Name) && cfg.DataDir == node.DefaultDataDir():
13801395
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "scroll-sepolia")
1396+
case ctx.GlobalBool(ScrollFlag.Name) && cfg.DataDir == node.DefaultDataDir():
1397+
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "scroll")
13811398

13821399
}
13831400
}
@@ -1529,6 +1546,14 @@ func setCircuitCapacityCheck(ctx *cli.Context, cfg *ethconfig.Config) {
15291546
}
15301547
}
15311548

1549+
func setMaxBlockRange(ctx *cli.Context, cfg *ethconfig.Config) {
1550+
if ctx.GlobalIsSet(MaxBlockRangeFlag.Name) {
1551+
cfg.MaxBlockRange = ctx.GlobalInt64(MaxBlockRangeFlag.Name)
1552+
} else {
1553+
cfg.MaxBlockRange = -1
1554+
}
1555+
}
1556+
15321557
// CheckExclusive verifies that only a single instance of the provided flags was
15331558
// set by the user. Each flag might optionally be followed by a string type to
15341559
// specialize it further.
@@ -1573,7 +1598,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
15731598
// SetEthConfig applies eth-related command line flags to the config.
15741599
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
15751600
// Avoid conflicting network flags
1576-
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, ScrollAlphaFlag, ScrollSepoliaFlag)
1601+
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, ScrollAlphaFlag, ScrollSepoliaFlag, ScrollFlag)
15771602
CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light")
15781603
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
15791604
if ctx.GlobalString(GCModeFlag.Name) == GCModeArchive && ctx.GlobalUint64(TxLookupLimitFlag.Name) != 0 {
@@ -1595,6 +1620,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
15951620
setWhitelist(ctx, cfg)
15961621
setLes(ctx, cfg)
15971622
setCircuitCapacityCheck(ctx, cfg)
1623+
setMaxBlockRange(ctx, cfg)
15981624

15991625
// Cap the cache allowance and tune the garbage collector
16001626
mem, err := gopsutil.VirtualMemory()
@@ -1761,6 +1787,25 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
17611787
// disable prefetch
17621788
log.Info("Prefetch disabled")
17631789
cfg.NoPrefetch = true
1790+
case ctx.GlobalBool(ScrollFlag.Name):
1791+
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
1792+
cfg.NetworkId = 534352
1793+
}
1794+
cfg.Genesis = core.DefaultScrollMainnetGenesisBlock()
1795+
// forced for mainnet
1796+
log.Info("Setting flag", "--l1.confirmations", "finalized")
1797+
stack.Config().L1Confirmations = rpc.FinalizedBlockNumber
1798+
log.Info("Setting flag", "--l1.sync.startblock", "18306000")
1799+
stack.Config().L1DeploymentBlock = 18306000
1800+
// disable pruning
1801+
if ctx.GlobalString(GCModeFlag.Name) != GCModeArchive {
1802+
log.Crit("Must use --gcmode=archive")
1803+
}
1804+
log.Info("Pruning disabled")
1805+
cfg.NoPruning = true
1806+
// disable prefetch
1807+
log.Info("Prefetch disabled")
1808+
cfg.NoPrefetch = true
17641809
case ctx.GlobalBool(DeveloperFlag.Name):
17651810
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
17661811
cfg.NetworkId = 1337
@@ -1813,6 +1858,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
18131858
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
18141859
}
18151860
}
1861+
1862+
// set db prefix for backward-compatibility
1863+
if cfg.NetworkId == 534351 {
1864+
log.Warn("Using legacy db prefix for L1 messages")
1865+
rawdb.SetL1MessageLegacyPrefix()
1866+
}
18161867
}
18171868

18181869
// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
@@ -2003,6 +2054,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
20032054
genesis = core.DefaultScrollAlphaGenesisBlock()
20042055
case ctx.GlobalBool(ScrollSepoliaFlag.Name):
20052056
genesis = core.DefaultScrollSepoliaGenesisBlock()
2057+
case ctx.GlobalBool(ScrollFlag.Name):
2058+
genesis = core.DefaultScrollMainnetGenesisBlock()
20062059
case ctx.GlobalBool(DeveloperFlag.Name):
20072060
Fatalf("Developer chains are ephemeral")
20082061
}

core/block_validator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engin
5656
bc: blockchain,
5757
checkCircuitCapacity: checkCircuitCapacity,
5858
db: db,
59-
circuitCapacityChecker: circuitcapacitychecker.NewCircuitCapacityChecker(),
59+
circuitCapacityChecker: circuitcapacitychecker.NewCircuitCapacityChecker(true),
6060
}
6161
log.Info("created new BlockValidator", "CircuitCapacityChecker ID", validator.circuitCapacityChecker.ID)
6262
return validator

core/genesis.go

+12
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,18 @@ func DefaultScrollSepoliaGenesisBlock() *Genesis {
460460
}
461461
}
462462

463+
// DefaultScrollMainnetGenesisBlock returns the Scroll mainnet genesis block.
464+
func DefaultScrollMainnetGenesisBlock() *Genesis {
465+
return &Genesis{
466+
Config: params.ScrollMainnetChainConfig,
467+
Timestamp: 0x6524e860,
468+
ExtraData: hexutil.MustDecode("0x4c61206573746f6e7465636f206573746173206d616c6665726d6974612e0000d2ACF5d16a983DB0d909d9D761B8337Fabd6cBd10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
469+
GasLimit: 10000000,
470+
Difficulty: big.NewInt(1),
471+
Alloc: decodePrealloc(scrollMainnetAllocData),
472+
}
473+
}
474+
463475
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
464476
func DeveloperGenesisBlock(period uint64, gasLimit uint64, faucet common.Address) *Genesis {
465477
// Override the default period to the user requested one

core/genesis_alloc.go

+1
Large diffs are not rendered by default.

core/genesis_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func TestGenesisHashes(t *testing.T) {
175175
// {DefaultSepoliaGenesisBlock(), params.SepoliaGenesisHash},
176176
// {DefaultScrollAlphaGenesisBlock(), params.ScrollAlphaGenesisHash},
177177
{DefaultScrollSepoliaGenesisBlock(), params.ScrollSepoliaGenesisHash},
178+
{DefaultScrollMainnetGenesisBlock(), params.ScrollMainnetGenesisHash},
178179
} {
179180
// Test via MustCommit
180181
if have := c.genesis.MustCommit(rawdb.NewMemoryDatabase()).Hash(); have != c.want {

0 commit comments

Comments
 (0)