Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

fix(config): update genesis state #1315

Closed
wants to merge 1 commit into from
Closed

fix(config): update genesis state #1315

wants to merge 1 commit into from

Conversation

BrickBera
Copy link
Contributor

@BrickBera BrickBera commented Nov 16, 2023

Summary by CodeRabbit

  • New Features
    • Integrated a new default chain configuration for the genesis block.
  • Refactor
    • Updated the allocation of balances within the genesis block to reflect new parameters.

Copy link

coderabbitai bot commented Nov 16, 2023

Walkthrough

The update involves importing a new chain configuration from the berachain/polaris repository and initializing the DefaultGenesis struct with this configuration. It also adjusts the initial balance allocation for certain addresses in the genesis block, which is the first block in the blockchain.

Changes

File Change Summary
eth/core/genesis.go Imported eth/params from berachain/polaris, added Config field to DefaultGenesis, and updated balance allocations.

🐇🍂 In the brisk autumn breeze, code does dance,
A genesis anew, gives the chain a chance.
With balances set and a config embraced,
A blockchain's journey, freshly traced. 🌟


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d1ffd73 and 2d5978a.
Files selected for processing (1)
  • eth/core/genesis.go (3 hunks)
Additional comments: 3
eth/core/genesis.go (3)
  • 26-32: The new import statement for "github.com/berachain/polaris/eth/params" is added. Ensure that this package is properly versioned and maintained to avoid future compatibility issues.

  • 39-47: The addition of the "Config" field to the DefaultGenesis struct with the value "params.DefaultChainConfig" changes the default configuration for the genesis block. This should be thoroughly tested to ensure that it does not introduce any unintended side effects or incompatibilities with the existing Ethereum network.

  • 54-82: The balance allocations for several addresses have been updated. It is important to ensure that these changes are intentional and have been agreed upon by the relevant stakeholders. Additionally, the use of big.NewInt(1e18) multiplied by big.NewInt(1e7) for each address implies a very large initial balance. The implications of these balances on the network's economy should be carefully considered.

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Merging #1315 (2d5978a) into main (d1ffd73) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1315   +/-   ##
=======================================
  Coverage   48.45%   48.45%           
=======================================
  Files          84       84           
  Lines        4870     4870           
=======================================
  Hits         2360     2360           
  Misses       2336     2336           
  Partials      174      174           
Files Coverage Δ
eth/core/genesis.go 0.00% <ø> (ø)

Balance: big.NewInt(0).Mul(big.NewInt(5e18), big.NewInt(100)), //nolint:gomnd // its okay.
// 0xbac
common.HexToAddress("0xFE94Cc9f0dfbb657a6C6850701aBF6356227F8c3"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
Copy link
Contributor

@technicallyty technicallyty Nov 16, 2023

Choose a reason for hiding this comment

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

would suggest doing:

var (
    coins = big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7))
)
...
		common.HexToAddress("0xFE94Cc9f0dfbb657a6C6850701aBF6356227F8c3"): {
			Balance: coins,

and pass it into each balance so:

  1. you don't have to do the nolint line so many times
  2. easily configurable if you ever need to refactor the amt of these balances in one swoop

Copy link
Member

Choose a reason for hiding this comment

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

@BrickBera the Config: isn't used in genesis atm, also is this change for devnet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BrickBera the Config: isn't used in genesis atm, also is this change for devnet?

Need the config to change evm chain-id. The balances change is for future devnet redeploys

@itsdevbear
Copy link
Member

should be done via configuration of the node, not via changing the default config

@itsdevbear itsdevbear closed this Nov 20, 2023
@github-actions github-actions bot deleted the evm_chain_id branch February 16, 2024 06:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants