From b9be88faf0bbb667cbd8aaa63b807ec4f66ad186 Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Fri, 14 Jul 2023 05:35:54 +0000 Subject: [PATCH] genesis: configuration updates for v1.0.2 (#4700) - ledger from https://github.com/spacemeshos/wiki/wiki/Genesis-ledger - updated max num units to max uint32, as node expects non-zero number there --- cmd/root.go | 2 +- config/mainnet.go | 4 +++- config/mainnet_accounts.go | 35 +++++++++++++++++++++++++++++++++ config/mainnet_accounts_test.go | 16 +++++++++++++++ config/presets/fastnet.go | 1 + config/presets/standalone.go | 1 + 6 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 config/mainnet_accounts.go create mode 100644 config/mainnet_accounts_test.go diff --git a/cmd/root.go b/cmd/root.go index 40eadee1a9..e4ffde6770 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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", diff --git a/config/mainnet.go b/config/mainnet.go index 7ede97549b..a048e99361 100644 --- a/config/mainnet.go +++ b/config/mainnet.go @@ -1,6 +1,7 @@ package config import ( + "math" "math/big" "os" "path/filepath" @@ -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, @@ -91,6 +92,7 @@ func MainnetConfig() Config { }, POST: activation.PostConfig{ MinNumUnits: 4, + MaxNumUnits: math.MaxUint32, LabelsPerUnit: 4294967296, K1: 26, K2: 37, diff --git a/config/mainnet_accounts.go b/config/mainnet_accounts.go new file mode 100644 index 0000000000..b9b9311372 --- /dev/null +++ b/config/mainnet_accounts.go @@ -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, + } +} diff --git a/config/mainnet_accounts_test.go b/config/mainnet_accounts_test.go new file mode 100644 index 0000000000..6ae6644dde --- /dev/null +++ b/config/mainnet_accounts_test.go @@ -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)) +} diff --git a/config/presets/fastnet.go b/config/presets/fastnet.go index 8903bc80ce..4f4dc7f635 100644 --- a/config/presets/fastnet.go +++ b/config/presets/fastnet.go @@ -33,6 +33,7 @@ func fastnet() config.Config { conf.Genesis = &config.GenesisConfig{ ExtraData: "fastnet", + Accounts: map[string]uint64{}, } conf.LayerAvgSize = 50 diff --git a/config/presets/standalone.go b/config/presets/standalone.go index ccdb57567c..018f48d73d 100644 --- a/config/presets/standalone.go +++ b/config/presets/standalone.go @@ -36,6 +36,7 @@ func standalone() config.Config { conf.Genesis = &config.GenesisConfig{ ExtraData: "standalone", + Accounts: map[string]uint64{}, } conf.LayerAvgSize = 50