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

Add geth iliad config and data folder defaults #7

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

leeren
Copy link

@leeren leeren commented Aug 16, 2024

This change bakes in our iliad testnet network configurations to geth so that users may bootstrap running a geth node simply by running ./build/bin/geth --iliad --syncmode full (we are still fixing snap sync mode which is the default).

Additionally, it proposes a more sensible default data directory so that:

  • confusions do not arise between data configs used by normal geth nodes and story execution nodes
  • data directories used for consesus and execution clients can be more intuitively colocated

Summary by CodeRabbit

  • New Features

    • Introduced a new command-line flag for the Iliad test network.
    • Enhanced the genesis block functionality to support the Iliad network, ensuring proper initialization and configuration.
    • Added a new variable for Iliad bootnodes and a unique genesis hash for the Iliad network.
    • Implemented a new blockchain configuration structure for Iliad.
  • Bug Fixes

    • Updated test cases to validate the genesis block setup for Iliad, improving error handling.
  • Chores

    • Modified default data directory paths for Ethereum-related data in line with the new Iliad network.

Copy link

coderabbitai bot commented Aug 16, 2024

Walkthrough

The changes introduce support for the Iliad proof-of-stake test network in the Ethereum codebase. This includes the addition of a new command-line flag, enhancements for managing the genesis block, updates to bootnode configurations, and modifications to data directory paths. Robust test cases for the Iliad configurations have also been implemented, expanding the functionality and testing framework for the network.

Changes

Files Change Summary
cmd/utils/flags.go Introduced IliadFlag, a new CLI flag for the Iliad network, integrated into various functions.
core/genesis.go, core/genesis_test.go Added support for the Iliad genesis block, including a new function and validation test case.
node/defaults.go Updated DefaultDataDir function for new directory paths associated with the Iliad structure.
params/bootnodes.go, params/config.go Introduced IliadBootnodes for P2P connections and new configuration parameters for the Iliad network.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as Command Line Interface
    participant Flags as Flags Management
    participant Config as Configuration Management
    participant Genesis as Genesis Block Handling

    CLI->>Flags: Set IliadFlag
    Flags->>Config: Check IliadFlag
    Config->>Genesis: Configure Iliad Genesis Block
    Genesis-->>Config: Return Iliad Chain Configuration
    Config-->>CLI: Confirm Iliad Network Setup
Loading

🐇 In the meadow of code, where rabbits play,
A flag for Iliad hops into the fray!
Genesis blocks bloom, bootnodes take flight,
With paths all renewed, the future is bright.
Let’s leap into testing, with joy and delight,
For Ethereum’s journey is a wondrous sight! 🌼


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@leeren leeren force-pushed the feat/add-geth-config-defaults branch from d8438f3 to a6e403a Compare August 16, 2024 21:09
@leeren leeren changed the title Ad geth iliad config and data folder defaults Add geth iliad config and data folder defaults Aug 16, 2024
cmd/utils/flags.go Outdated Show resolved Hide resolved
core/genesis.go Outdated Show resolved Hide resolved
params/bootnodes.go Outdated Show resolved Hide resolved
params/config.go Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 820a852 and a6e403a.

Files selected for processing (6)
  • cmd/utils/flags.go (8 hunks)
  • core/genesis.go (5 hunks)
  • core/genesis_test.go (2 hunks)
  • node/defaults.go (1 hunks)
  • params/bootnodes.go (1 hunks)
  • params/config.go (3 hunks)
Additional context used
golangci-lint
cmd/utils/flags.go

621-621: File is not goimports-ed

(goimports)

Additional comments not posted (17)
node/defaults.go (1)

86-98: Inform users about the data directory changes.

The updated paths for data directories may affect users who have existing data in the old directories. Ensure that this change is communicated clearly to users to prevent data loss or confusion.

Verification successful

Old data directory paths are not found in the codebase.

The absence of old data directory paths suggests that the changes to the new paths are localized and consistent with the update in node/defaults.go. Ensure that users are informed about this change to prevent any confusion regarding data storage locations.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the new data directory paths are used consistently across the codebase.

# Test: Search for usage of old and new data directory paths. Expect: Only occurrences of the new paths.
rg --type go -e 'Library/Ethereum' -e 'Library/Story/geth' -e 'AppData/Roaming/Ethereum' -e 'AppData/Roaming/Story/geth' -e 'home/.ethereum' -e 'home/.story/geth'

Length of output: 152


Script:

#!/bin/bash
# Description: Verify if any old data directory paths are still present in the codebase.

# Test: Search for usage of old data directory paths. Expect: No occurrences of old paths.
rg --type go -e 'Library/Ethereum' -e 'AppData/Roaming/Ethereum' -e 'home/.ethereum'

Length of output: 80

params/bootnodes.go (1)

50-57: LGTM! New bootnodes added for Iliad test network.

The addition of IliadBootnodes is clear and well-documented. Ensure these bootnodes are correctly configured and reachable.

core/genesis_test.go (2)

118-128: LGTM! New test cases for Iliad genesis configuration.

The new test cases effectively validate the genesis block setup for the Iliad configuration, enhancing the test coverage.


200-200: LGTM! Inclusion of Iliad genesis hash in TestGenesisHashes.

The addition of the Iliad genesis hash to the TestGenesisHashes function ensures comprehensive coverage of genesis configurations.

core/genesis.go (4)

212-213: LGTM! Addition of IliadGenesisHash case is consistent.

The new case for params.IliadGenesisHash is consistent with the existing pattern for other networks.


299-300: LGTM! Logging of Genesis Block Hash is a useful addition.

The addition of the logging statement for the genesis block hash improves traceability and debugging.


416-417: LGTM! Addition of IliadGenesisHash case is consistent.

The new case for ghash == params.IliadGenesisHash is consistent with the existing pattern for other networks.


581-591: LGTM! DefaultIliadGenesisBlock is correctly implemented.

The DefaultIliadGenesisBlock function follows the established pattern for defining network-specific genesis blocks.

params/config.go (3)

33-33: LGTM! IliadGenesisHash declaration is consistent.

The declaration of IliadGenesisHash is consistent with the existing pattern for other network genesis hashes.


142-160: LGTM! IliadChainConfig is correctly implemented.

The IliadChainConfig follows the established pattern for defining network-specific chain configurations.


341-341: LGTM! NetworkNames map update is consistent.

The update to include the Iliad network in the NetworkNames map is consistent with existing entries.

cmd/utils/flags.go (6)

620-624: LGTM! IliadFlag declaration is consistent.

The declaration of IliadFlag follows the established pattern for defining network-specific CLI flags.

Tools
golangci-lint

621-621: File is not goimports-ed

(goimports)


1005-1007: LGTM! IliadFlag integration in MakeDataDir is consistent.

The integration of IliadFlag in the MakeDataDir function is consistent with existing network flag handling.


1070-1071: LGTM! IliadFlag integration in setBootstrapNodes is consistent.

The integration of IliadFlag in the setBootstrapNodes function is consistent with existing network flag handling.


1503-1504: LGTM! IliadFlag integration in SetDataDir is consistent.

The integration of IliadFlag in the SetDataDir function is consistent with existing network flag handling.


1660-1660: LGTM! IliadFlag integration in SetEthConfig is consistent.

The integration of IliadFlag in the SetEthConfig function is consistent with existing network flag handling.

Also applies to: 1835-1840


2164-2165: LGTM! IliadFlag integration in MakeGenesis is consistent.

The integration of IliadFlag in the MakeGenesis function is consistent with existing network flag handling.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a6e403a and 5f402ff.

Files selected for processing (1)
  • core/genesis.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • core/genesis.go

@leeren leeren force-pushed the feat/add-geth-config-defaults branch from 5f402ff to aa41239 Compare August 16, 2024 22:27
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fa573fc and aa41239.

Files selected for processing (6)
  • cmd/utils/flags.go (8 hunks)
  • core/genesis.go (4 hunks)
  • core/genesis_test.go (2 hunks)
  • node/defaults.go (1 hunks)
  • params/bootnodes.go (1 hunks)
  • params/config.go (3 hunks)
Files skipped from review due to trivial changes (2)
  • params/bootnodes.go
  • params/config.go
Files skipped from review as they are similar to previous changes (3)
  • cmd/utils/flags.go
  • core/genesis_test.go
  • node/defaults.go
Additional context used
golangci-lint
core/genesis.go

612-612: expected operand, found '<<'

(typecheck)

Additional comments not posted (3)
core/genesis.go (3)

212-213: LGTM! The Iliad network integration is consistent.

The addition of the Iliad genesis block handling in getGenesisState is consistent with other network configurations.


414-415: LGTM! The Iliad chain configuration is well integrated.

The addition of the Iliad chain configuration handling in configOrDefault is consistent with other network configurations.


579-589: LGTM! The Iliad genesis block is well defined.

The DefaultIliadGenesisBlock function correctly encapsulates the Iliad network parameters, consistent with other network definitions.

core/genesis.go Outdated
@@ -593,7 +609,11 @@ func DeveloperGenesisBlock(gasLimit uint64, faucet *common.Address) *Genesis {
common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
<<<<<<< HEAD
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix syntax error: Unexpected operand.

There is a syntax error due to an unexpected operand at this line. Please ensure the code is correctly structured.

Tools
golangci-lint

612-612: expected operand, found '<<'

(typecheck)

@leeren leeren force-pushed the feat/add-geth-config-defaults branch from aa41239 to a1ff718 Compare August 16, 2024 23:21
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa41239 and a1ff718.

Files selected for processing (6)
  • cmd/utils/flags.go (8 hunks)
  • core/genesis.go (4 hunks)
  • core/genesis_test.go (2 hunks)
  • node/defaults.go (1 hunks)
  • params/bootnodes.go (1 hunks)
  • params/config.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • params/config.go
Files skipped from review as they are similar to previous changes (5)
  • cmd/utils/flags.go
  • core/genesis.go
  • core/genesis_test.go
  • node/defaults.go
  • params/bootnodes.go

@leeren leeren marked this pull request as draft August 18, 2024 00:48
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a1ff718 and fe7682a.

Files selected for processing (3)
  • cmd/utils/flags.go (8 hunks)
  • params/bootnodes.go (1 hunks)
  • params/config.go (3 hunks)
Files skipped from review as they are similar to previous changes (3)
  • cmd/utils/flags.go
  • params/bootnodes.go
  • params/config.go

@leeren leeren force-pushed the feat/add-geth-config-defaults branch from fe7682a to 5043f1e Compare August 18, 2024 23:27
@leeren leeren dismissed jdubpark’s stale review August 18, 2024 23:43

Changes resolved

@leeren leeren marked this pull request as ready for review August 18, 2024 23:43
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fe7682a and 5043f1e.

Files selected for processing (6)
  • cmd/utils/flags.go (8 hunks)
  • core/genesis.go (4 hunks)
  • core/genesis_test.go (2 hunks)
  • node/defaults.go (1 hunks)
  • params/bootnodes.go (1 hunks)
  • params/config.go (3 hunks)
Files skipped from review as they are similar to previous changes (6)
  • cmd/utils/flags.go
  • core/genesis.go
  • core/genesis_test.go
  • node/defaults.go
  • params/bootnodes.go
  • params/config.go

@@ -1819,6 +1832,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
cfg.Genesis = core.DefaultGoerliGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.GoerliGenesisHash)
case ctx.Bool(IliadFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1723078116
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is number coming from?

Difficulty: big.NewInt(0x20000),
GasLimit: 0x7A1200,
Nonce: 0x42,
Timestamp: 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 0?

return &Genesis{
Config: params.IliadChainConfig,
Difficulty: big.NewInt(0x20000),
GasLimit: 0x7A1200,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any impact of the gas limit at genesis? 8m

common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, please remove the extra space to reduce the unnecessary changes.

Copy link
Member

@LeoHChen LeoHChen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a few questions.

// Iliad test network.
var IliadBootnodes = []string{
// Upstream bootnodes
"enode://5e85033276299eff126d0c86a42b76cbad98920b4f77ae894b8a52daffa558f36de1281beca96b71e67795955bf769ce6ab3e35af66790816b37ada3d9c2b09a@52.9.220.233:30303",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup b1.testnet.storyrpc.io and b2.testnet.storyrpc.io

@leeren leeren merged commit 54a3595 into main Aug 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants