-
Notifications
You must be signed in to change notification settings - Fork 3
Mainnet Sync - Snapshot #318
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
Merged
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
391d3af
test changes for mainnet
svlachakis 29c4fa5
more changes
svlachakis b64cb4c
latest changes
svlachakis 5e49a18
mimic SnapProvider in the importer
svlachakis 31b2b3f
exporter and changes
svlachakis 81d6f66
changes that match nitro
svlachakis cfe6904
code & more fixes
svlachakis 031e155
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync
svlachakis 0b7ffa8
update latest main
svlachakis 4d55de1
delete unused file
svlachakis 9ee6bbe
logger in ArbitrumRpcModule.cs
svlachakis 12a91e2
comments removal
svlachakis 9487d09
remove comments
svlachakis 3e16979
push nethermind submodule
svlachakis c11af7f
changes for snapshot
svlachakis 36d8841
DB from snapshot, mainnet changes, minimal cleanup.
svlachakis 11b3434
cleanup
svlachakis 15ad64b
changes
svlachakis c0b0073
cleanup
svlachakis 61ce2bd
cleanup
svlachakis e8a5fa8
cleanup
svlachakis 6f0e111
cleanup
svlachakis b3664f9
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync-2
svlachakis 746a441
cleanup
svlachakis d145d7b
makefile
svlachakis 046cfda
fix genesis from 0
svlachakis a298368
virtual isGenesis on BlockHeader.cs
svlachakis b28503e
update submodule
svlachakis 62a7663
submodule update
svlachakis 12d526b
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync-2
svlachakis dbacb9c
Improvements - fallback to local ChainSpec if this is not present in …
svlachakis 7743dda
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync-2
svlachakis 481f444
imports
svlachakis 92636bb
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync-2
svlachakis 189008e
Genesis block header from chainspec
svlachakis 078ba5d
chain config storage change
svlachakis 3eca3ee
change in test infra
svlachakis cd1280b
build fixes
svlachakis 7746e62
commit PR suggestion
svlachakis c22dc1a
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync-2
svlachakis e86f40e
update nethermind submodule with latest master
svlachakis f880295
add BuildBlocksOnMainState
svlachakis 01d88c0
small fixes
svlachakis 4aab822
Merge remote-tracking branch 'origin/main' into stavros-mainnet-sync-2
svlachakis 0f51c60
test fix
svlachakis fef03cd
small PR review comment
svlachakis 3fa900a
PR review comment
svlachakis dc6869f
Merge branch 'main' into stavros-mainnet-sync-2
svlachakis 9bfbf44
PR review comments
svlachakis 006ef28
small fixes
svlachakis dba7683
small fix
svlachakis 3cd4f33
PR review comments
svlachakis 042a5c4
PR review comments
svlachakis cce205a
update chainspec based on https://docs.arbitrum.foundation/network-up…
svlachakis 7705437
fix timestamps
svlachakis 5dfdd0e
chainspec
svlachakis 22cb438
chainspec - match sepolia + additional eips
svlachakis 921d61d
add namespace
svlachakis 81f3856
update hex
svlachakis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule Nethermind
updated
185 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| using Nethermind.Arbitrum.Config; | ||
| using Nethermind.Blockchain; | ||
| using Nethermind.Blockchain.Blocks; | ||
| using Nethermind.Blockchain.Headers; | ||
| using Nethermind.Blockchain.Synchronization; | ||
| using Nethermind.Core.Specs; | ||
| using Nethermind.Db; | ||
| using Nethermind.Db.Blooms; | ||
| using Nethermind.Logging; | ||
| using Nethermind.State.Repositories; | ||
|
|
||
| namespace Nethermind.Arbitrum.Core; | ||
|
|
||
| public class ArbitrumBlockTree( | ||
|
svlachakis marked this conversation as resolved.
|
||
| IBlockStore blockStore, | ||
| IHeaderStore headerStore, | ||
| IDbProvider dbProvider, | ||
| IBadBlockStore badBlockStore, | ||
| IChainLevelInfoRepository chainLevelInfoRepository, | ||
| ISpecProvider specProvider, | ||
| IBloomStorage bloomStorage, | ||
| ISyncConfig syncConfig, | ||
| ILogManager logManager, | ||
| ArbitrumChainSpecEngineParameters chainSpecParams) | ||
| : BlockTree( | ||
| blockStore, | ||
| headerStore, | ||
| dbProvider.BlockInfosDb, | ||
| dbProvider.MetadataDb, | ||
| badBlockStore, | ||
| chainLevelInfoRepository, | ||
| specProvider, | ||
| bloomStorage, | ||
| syncConfig, | ||
| logManager, | ||
| (long)chainSpecParams.GenesisBlockNum!) | ||
| { | ||
| } | ||
64 changes: 64 additions & 0 deletions
64
src/Nethermind.Arbitrum/Genesis/ArbitrumInitializeGenesis.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| using Nethermind.Api.Steps; | ||
| using Nethermind.Arbitrum.Config; | ||
| using Nethermind.Blockchain; | ||
| using Nethermind.Core; | ||
| using Nethermind.Evm.State; | ||
| using Nethermind.Init.Steps; | ||
| using Nethermind.Logging; | ||
|
|
||
| namespace Nethermind.Arbitrum.Init; | ||
|
|
||
| [RunnerStepDependencies(typeof(InitDatabase))] | ||
| public class ArbitrumInitializeGenesis : IStep | ||
| { | ||
| private readonly ArbitrumNethermindApi _api; | ||
| private readonly IArbitrumSpecHelper _specHelper; | ||
| private readonly ILogger _logger; | ||
|
|
||
| public ArbitrumInitializeGenesis(ArbitrumNethermindApi api, IArbitrumSpecHelper specHelper) | ||
| { | ||
| _api = api; | ||
| _specHelper = specHelper; | ||
| _logger = _api.LogManager.GetClassLogger(); | ||
| } | ||
|
|
||
| public Task Execute(CancellationToken cancellationToken) | ||
| { | ||
| if (!_specHelper.Enabled) | ||
| return Task.CompletedTask; | ||
|
|
||
| long arbitrumGenesisBlockNum = (long)_specHelper.GenesisBlockNum; | ||
|
|
||
| if (arbitrumGenesisBlockNum == 0) | ||
| { | ||
| _logger.Info("Arbitrum genesis block number is 0, skipping initialization"); | ||
| return Task.CompletedTask; | ||
| } | ||
|
|
||
| Block? arbitrumGenesisBlock = _api.BlockTree!.FindBlock(arbitrumGenesisBlockNum, BlockTreeLookupOptions.None); | ||
|
|
||
| if (arbitrumGenesisBlock is null) | ||
|
wurdum marked this conversation as resolved.
|
||
| { | ||
| throw new InvalidOperationException( | ||
| $"Arbitrum genesis block {arbitrumGenesisBlockNum} not found in BlockTree. " + | ||
| "Ensure the snapshot was downloaded correctly before this step."); | ||
| } | ||
|
|
||
| _logger.Info($"Arbitrum genesis block {arbitrumGenesisBlockNum} already exists (hash: {arbitrumGenesisBlock.Hash})"); | ||
|
|
||
| // Re-establish state registration by running the state initialization | ||
| _logger.Info("Re-initializing genesis state registration..."); | ||
|
|
||
| IWorldState worldState = _api.WorldStateManager.GlobalWorldState; | ||
| using (worldState.BeginScope(IWorldState.PreGenesis)) | ||
| { | ||
| worldState.CommitTree(arbitrumGenesisBlockNum); | ||
|
svlachakis marked this conversation as resolved.
|
||
| _logger.Info($"State tree committed for genesis block {arbitrumGenesisBlockNum}"); | ||
| } | ||
|
svlachakis marked this conversation as resolved.
|
||
|
|
||
| return Task.CompletedTask; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.