Skip to content

Commit

Permalink
genesis: configuration updates for v1.0.2 (#4700)
Browse files Browse the repository at this point in the history
- ledger from https://github.com/spacemeshos/wiki/wiki/Genesis-ledger
- updated max num units to max uint32, as node expects non-zero number there
  • Loading branch information
dshulyak committed Jul 14, 2023
1 parent 084a83a commit b9be88f
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func AddCommands(cmd *cobra.Command) {
cmd.PersistentFlags().IntVar(&cfg.OptFilterThreshold, "optimistic-filtering-threshold",
cfg.OptFilterThreshold, "threshold for optimistic filtering in percentage")

cmd.PersistentFlags().VarP(flags.NewStringToUint64Value(cfg.Genesis.Accounts), "accounts", "a",
cmd.PersistentFlags().VarP(flags.NewStringToUint64Value(map[string]uint64{}), "accounts", "a",
"List of prefunded accounts")

cmd.PersistentFlags().IntVar(&cfg.DatabaseConnections, "db-connections",
Expand Down
4 changes: 3 additions & 1 deletion config/mainnet.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"math"
"math/big"
"os"
"path/filepath"
Expand Down Expand Up @@ -47,7 +48,7 @@ func MainnetConfig() Config {
},
Genesis: &GenesisConfig{
GenesisTime: "2023-07-14T08:00:00Z",
Accounts: map[string]uint64{},
Accounts: MainnetAccounts(),
},
Tortoise: tortoise.Config{
Hdist: 200,
Expand Down Expand Up @@ -91,6 +92,7 @@ func MainnetConfig() Config {
},
POST: activation.PostConfig{
MinNumUnits: 4,
MaxNumUnits: math.MaxUint32,
LabelsPerUnit: 4294967296,
K1: 26,
K2: 37,
Expand Down
35 changes: 35 additions & 0 deletions config/mainnet_accounts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package config

// MainnetAccounts generated from preimages at https://github.com/spacemeshos/wiki/wiki/Genesis-ledger.
func MainnetAccounts() map[string]uint64 {
return map[string]uint64{
"sm1qqqqqqylyl2l0zsmmax0wnutt4dwnrkcwef5eeq3xladz": 2743200000000000,
"sm1qqqqqqyp8ueuuh2dgrc2g6ps4xvueyjpky6rfaqnxdy97": 5867100000000000,
"sm1qqqqqqzgmt5vv4jgucas8vvrlu4daa4r29cunwqpv0trt": 1022800000000000,
"sm1qqqqqq80we5pmwztmqgpxu6xasapgn65r4xjczqxu39a2": 409000000000000,
"sm1qqqqqqy6anfdew2sdtvuuaffjy0l7ssu9r8vjsss5c442": 2045400000000000,
"sm1qqqqqqyw9lvmmayckrxlnf8u7850tsjdg8zz6dg956gxg": 270600000000000,
"sm1qqqqqq9a8g5act6ewmmmmmux8l570kr6l68htzsq94wg4": 4090900000000000,
"sm1qqqqqqrgqc65x5q6exujgjs970fvcakd790na3gsr3uu7": 333300000000000,
"sm1qqqqqqpc4ppx8s4gmdaa5tzg35s6l3v6ujg6hmqz3s4lc": 859100000000000,
"sm1qqqqqq8za0geafhj4avegdwhtaw9fmgjh07s55cufk695": 293300000000000,
"sm1qqqqqqpf6djx3axy7aag8zhyf84ljsulhfypfxgpw5y0u": 1990600000000000,
"sm1qqqqqq827v998nt99vupxlrfucdk0tapp2hjyygmn3kyd": 409100000000000,
"sm1qqqqqqpc55ghjq6sxf5k77yc8n82fkwhlj0jedcgw2zck": 4909100000000000,
"sm1qqqqqqxq54zvz484hhcnrghnqrjlw26twwld32slz3lxa": 191800000000000,
"sm1qqqqqqyf5uc2n8mutm3tuateu5efcm9awvrclmcm5mhdf": 2933540000000000,
"sm1qqqqqq99klpy92mwlfcft5lmz8q5sef2v2qvtucd9y55v": 2933540000000000,
"sm1qqqqqqyjpjgup8fz32cufcv2nlqrr3nyvge7akqt0daea": 2933540000000000,
"sm1qqqqqq8zukfwtggnfq4jaqpv6m8xgtg5ay2ezaqpr2w6y": 2933540000000000,
"sm1qqqqqqrhftrq9knsetema7dt0qfzgd5a20m9rcczk0gk5": 2933540000000000,
"sm1qqqqqqyfq5f522mmrzs4lczhaf30jh4pmqyfrzcg8vrpc": 3303792000000000,
"sm1qqqqqqx55z5795569fq5kym3gw2h6zp6ajeh46c5wtrzf": 455300000000000,
"sm1qqqqqqyvet26gqsxjt6w50nnp80jvajr3n25xzsdpxn65": 831250000000000,
"sm1qqqqqqzgqpjxdw77aw74f8mz540rykda4x2jgjgaca7z5": 184375000000000,
"sm1qqqqqq9s5l9tc87wspycr68dfagmzxplzdn7zlcymnkup": 15000000000000,
"sm1qqqqqqptx3mdg4gm67arv4ykau6nfy6w9v03x9s49wmru": 100000000000000,
"sm1qqqqqq9fwfymdr7qv0tfc3ppa4q8ara6qm7kwugw9gdme": 500000000000000,
"sm1qqqqqqy3fc8nvdetan6qjz5cju7h4c60mjyvdlqnlqpxu": 15688500000000000,
"sm1qqqqqqrt64knhuxu3kzq50ak04nrkk9yf2zxprshmvkcy": 88818783000000000,
}
}
16 changes: 16 additions & 0 deletions config/mainnet_accounts_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package config

import (
"testing"

"github.com/spacemeshos/economics/constants"
"github.com/stretchr/testify/require"
)

func TestVaulted(t *testing.T) {
sum := uint64(0)
for _, balance := range MainnetAccounts() {
sum += balance
}
require.Equal(t, constants.TotalVaulted, int(sum))
}
1 change: 1 addition & 0 deletions config/presets/fastnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func fastnet() config.Config {

conf.Genesis = &config.GenesisConfig{
ExtraData: "fastnet",
Accounts: map[string]uint64{},
}

conf.LayerAvgSize = 50
Expand Down
1 change: 1 addition & 0 deletions config/presets/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func standalone() config.Config {

conf.Genesis = &config.GenesisConfig{
ExtraData: "standalone",
Accounts: map[string]uint64{},
}

conf.LayerAvgSize = 50
Expand Down

0 comments on commit b9be88f

Please sign in to comment.