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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions eth/core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/berachain/polaris/eth/common"
"github.com/berachain/polaris/eth/common/hexutil"
"github.com/berachain/polaris/eth/core/types"
"github.com/berachain/polaris/eth/params"

"github.com/ethereum/go-ethereum/core"
)
Expand All @@ -38,6 +39,9 @@ type (

// DefaultGenesis is the default genesis block used by Polaris.
var DefaultGenesis = &core.Genesis{
// Chain Config
Config: params.DefaultChainConfig,

// Genesis Block
Nonce: 0,
Timestamp: 0,
Expand All @@ -50,9 +54,30 @@ var DefaultGenesis = &core.Genesis{

// Genesis Accounts
Alloc: core.GenesisAlloc{
// 0xfffdbb37105441e14b0ee6330d855d8504ff39e705c3afa8f859ac9865f99306
common.HexToAddress("0x20f33CE90A13a4b5E7697E3544c3083B8F8A51D4"): {
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
Contributor

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

},
common.HexToAddress("0x11e2E77c864BAcCF47E8D70dA82f15426BEc7816"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
common.HexToAddress("0x318D5326BBbabaBb208531cAC6B29aB116497179"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
common.HexToAddress("0x7B856C6D250eED55D2D7543ae2169a1cd7f034Ad"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
common.HexToAddress("0x08D9255C2922528da6e8853319bcc85A1f6e283c"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
common.HexToAddress("0xF6581Da6b4e27A6eA0aD60C2b31FDD0B34b04FF7"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
common.HexToAddress("0xD8F62DB27ae97a22914b01BAA229502124A4597b"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
common.HexToAddress("0xfeC42ac9FB61185f43697194fBcA8ff726cCaE7B"): {
Balance: big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(1e7)), //nolint:gomnd // its okay.
},
},

Expand Down
Loading