From 1714b59c3286c75d076e8222ed4be06c4b966102 Mon Sep 17 00:00:00 2001 From: Alexandre Bourget Date: Sat, 26 May 2018 03:31:34 -0400 Subject: [PATCH] Updated to dawn-v4.2.0. ChainID is retrieved through `get_info` now. Renamed `privkeys.keys` to `seed_network.keys`. Keep `eosio` on schedule, to complete the last transactions. Renamed some ops. TODO: get to the bottom of `delegatebw`'s `transfer`. Also, `eosio` ends up with mucho money. But he delegated so much bw.. not where where all that EOS goes.. we need to figure out how to compute that. After this launch, 118.0000 EOS are in `eosio.ram`.. might be more with the whole snapshot. Difficult to know in advance how much that RAM costs. No special case for `eosio` in the contract. First thing BPs could do is burn the remainers of `eosio`. Updated boot sequence, and ops, and my_discovery_file and published all the v4.2.0 contents. --- bios/bios.go | 3 +- bios/network.go | 2 + bios/ops.go | 29 ++++++----- eos-bios/cmd/common.go | 20 ++------ eos-bios/cmd/root.go | 2 +- files/boot_sequence.yaml | 49 ++++++++++++++----- sample_config/my_discovery_file.yaml | 38 +++++++------- .../{privkeys.keys => seed_network.keys} | 0 8 files changed, 82 insertions(+), 61 deletions(-) rename sample_config/{privkeys.keys => seed_network.keys} (100%) diff --git a/bios/bios.go b/bios/bios.go index 34e394e..37ef9ac 100644 --- a/bios/bios.go +++ b/bios/bios.go @@ -294,12 +294,13 @@ func (b *BIOS) RunBootSequence() error { if len(acts) != 0 { for idx, chunk := range ChunkifyActions(acts) { + //time.Sleep(500 * time.Millisecond) err := Retry(25, time.Second, func() error { _, err := b.TargetNetAPI.SignPushActions(chunk...) if err != nil { b.Log.Printf("r") b.Log.Debugf("error pushing transaction for step %q, chunk %d: %s\n", step.Op, idx, err) - return fmt.Errorf("SignPushActions for step %q, chunk %d: %s", step.Op, idx, err) + return fmt.Errorf("push actions for step %q, chunk %d: %s", step.Op, idx, err) } return nil }) diff --git a/bios/network.go b/bios/network.go index 7b9fb47..1acdb59 100644 --- a/bios/network.go +++ b/bios/network.go @@ -281,6 +281,8 @@ func (net *Network) DownloadIPFSRef(ref string) error { return err } + net.Log.Printf("- %q done\n", ref) + return nil } diff --git a/bios/ops.go b/bios/ops.go index a1664d4..166db60 100644 --- a/bios/ops.go +++ b/bios/ops.go @@ -33,7 +33,7 @@ var operationsRegistry = map[string]Operation{ "snapshot.create_accounts": &OpSnapshotCreateAccounts{}, "snapshot.transfer": &OpSnapshotTransfer{}, "snapshot.load_unregistered": &OpInjectUnregdSnapshot{}, - "system.destroy_accounts": &OpDestroyAccounts{}, + "system.resign_accounts": &OpResignAccounts{}, "system.create_voters": &OpCreateVoters{}, } @@ -292,7 +292,9 @@ func (op *OpEnrichProducers) Actions(b *BIOS) (out []*eos.Action, err error) { } b.Log.Debugf("- DEBUG: Enriching producer %q\n", prodName) - out = append(out, token.NewTransfer(AN("eosio"), prodName, eos.NewEOSAsset(1000000000), "Hey, make good use of it!"), nil) + + act := token.NewIssue(prodName, eos.NewEOSAsset(1000000000), "Hey, make good use of it!") + out = append(out, act, nil) } return } @@ -334,6 +336,8 @@ func (op *OpSnapshotCreateAccounts) Actions(b *BIOS) (out []*eos.Action, err err if hodler.EthereumAddress == "0x00000000000000000000000000000000000000b1" { // the undelegatebw action does special unvesting for the b1 account destAccount = "b1" + // we should have created the account before loading `eosio.system`, otherwise + // b1 wouldn't have been accepted. } else { out = append(out, system.NewNewAccount(AN("eosio"), destAccount, hodler.EOSPublicKey)) } @@ -345,6 +349,7 @@ func (op *OpSnapshotCreateAccounts) Actions(b *BIOS) (out []*eos.Action, err err firstHalf.Amount = firstHalf.Amount / 2 secondHalf.Amount = hodler.Balance.Amount - firstHalf.Amount + // special case `transfer` for `b1` ? out = append(out, system.NewDelegateBW(AN("eosio"), destAccount, firstHalf, secondHalf, false)) out = append(out, system.NewBuyRAMBytes(AN("eosio"), destAccount, uint32(op.BuyRAM))) @@ -467,12 +472,14 @@ type OpSetProds struct{} func (op *OpSetProds) ResetTestnetOptions() {} func (op *OpSetProds) Actions(b *BIOS) (out []*eos.Action, err error) { - // prodkeys := []system.ProducerKey{system.ProducerKey{ - // ProducerName: AN("eosio"), - // BlockSigningKey: b.EphemeralPrivateKey.PublicKey(), - // }} - - prodkeys := []system.ProducerKey{} + // We he can at least process the last few blocks, that wrap up + // and resigns the system accounts. + prodkeys := []system.ProducerKey{system.ProducerKey{ + ProducerName: AN("eosio"), + BlockSigningKey: b.EphemeralPrivateKey.PublicKey(), + }} + + //prodkeys := []system.ProducerKey{} for idx, prod := range b.ShuffledProducers { if idx == 0 { continue @@ -494,16 +501,16 @@ func (op *OpSetProds) Actions(b *BIOS) (out []*eos.Action, err error) { // -type OpDestroyAccounts struct { +type OpResignAccounts struct { Accounts []eos.AccountName TestnetKeepAccounts bool `json:"TESTNET_KEEP_ACCOUNTS"` } -func (op *OpDestroyAccounts) ResetTestnetOptions() { +func (op *OpResignAccounts) ResetTestnetOptions() { op.TestnetKeepAccounts = false } -func (op *OpDestroyAccounts) Actions(b *BIOS) (out []*eos.Action, err error) { +func (op *OpResignAccounts) Actions(b *BIOS) (out []*eos.Action, err error) { if op.TestnetKeepAccounts { b.Log.Debugln("DEBUG: Keeping system accounts around, for testing purposes.") return diff --git a/eos-bios/cmd/common.go b/eos-bios/cmd/common.go index 74bed39..ded89fb 100644 --- a/eos-bios/cmd/common.go +++ b/eos-bios/cmd/common.go @@ -27,16 +27,12 @@ func fetchNetwork(single, downloadRefs bool) (*bios.Network, error) { return nil, fmt.Errorf("missing `seed_network_http_address` and no `--seednet-api` override provided") } - seedNetAPI := eos.New( - seedNetHTTP, - discovery.SeedNetworkChainID, - ) - // FIXME: when the blockchain uses the chain ID, we'll set it (!!) - seedNetAPI.ChainID = make([]byte, 32, 32) + seedNetAPI := eos.New(seedNetHTTP) keyBag := eos.NewKeyBag() err = keyBag.ImportFromFile(viper.GetString("seednet-keys")) if err != nil { + fmt.Println("WARN: you might want to simply rename privkeys.keys to seed_network.keys") return nil, fmt.Errorf("importing keys: %s", err) } @@ -95,16 +91,8 @@ func setupBIOS(net *bios.Network) (b *bios.BIOS, err error) { return nil, fmt.Errorf("missing `target_http_address` and no `--target-api` override provided") } - targetNetAPI := eos.New( - targetNetHTTP, - net.MyPeer.Discovery.TargetChainID, - ) - // FIXME: this is until the blockchain (past dawn3) actually USES the chain ID - // specified in the `genesis.json`. - targetNetAPI.ChainID = make([]byte, 32, 32) - - keyBag := eos.NewKeyBag() - targetNetAPI.SetSigner(keyBag) + targetNetAPI := eos.New(targetNetHTTP) + targetNetAPI.SetSigner(eos.NewKeyBag()) return bios.NewBIOS(net.Log, net, targetNetAPI), nil } diff --git a/eos-bios/cmd/root.go b/eos-bios/cmd/root.go index bed8cf1..12f2cbd 100644 --- a/eos-bios/cmd/root.go +++ b/eos-bios/cmd/root.go @@ -63,7 +63,7 @@ func init() { RootCmd.PersistentFlags().StringP("my-discovery", "", "my_discovery_file.yaml", "path to your local discovery file") RootCmd.PersistentFlags().StringP("ipfs", "", "https://ipfs.io", "Address to reach an IPFS gateway. There are a few fallbacks anyway.") RootCmd.PersistentFlags().StringP("seednet-api", "", "", "HTTP address of the seed network pointed to by your discovery file") - RootCmd.PersistentFlags().StringP("seednet-keys", "", "./privkeys.keys", "File containing private keys to your account on the seed network") + RootCmd.PersistentFlags().StringP("seednet-keys", "", "./seed_network.keys", "File containing private keys to your account on the seed network") RootCmd.PersistentFlags().StringP("target-api", "", "", "HTTP address to reach the node you are starting (for injection and validation)") RootCmd.PersistentFlags().StringP("cache-path", "", filepath.Join(homedir, ".eos-bios-cache"), "directory to store cached data from discovered network") diff --git a/files/boot_sequence.yaml b/files/boot_sequence.yaml index 6222f75..d157a5d 100644 --- a/files/boot_sequence.yaml +++ b/files/boot_sequence.yaml @@ -29,6 +29,13 @@ boot_sequence: new_account: eosio.token pubkey: ephemeral +- op: system.newaccount + label: Create account eosio.ram (where buyram proceeds go) + data: + creator: eosio + new_account: eosio.ram + pubkey: ephemeral + - op: system.newaccount label: Create account eosio.ramfee (where buyram fees go) data: @@ -139,41 +146,59 @@ boot_sequence: - op: producers.stake label: Stake initial producers and buy them some RAM -# Already defaults to 64GB in code (see eosio.system.hpp:24), we won't increase it today. -# -# - op: system.setram -# label: Set initial RAM available -# data: -# max_ram_size: 25769803776 # 24 GB - - op: producers.enrich label: Enrich producers, to help with next stage. Disabled on mainnet. data: TESTNET_ENRICH_PRODUCERS: true + +- op: token.issue + label: Issuing more and more EOS, because initial account creation and RAM buying for the snapshot holders is REALLY PRICEY! This has to be solved otherwise. + data: + account: eosio + amount: 1000000000.0000 EOS # Another 1B.. we'll see how far this goes. + memo: "Second issuance to pay for accounts and RAM." + - op: snapshot.create_accounts label: Creating accounts for ERC-20 holders data: buy_ram_bytes: 8192 - TESTNET_TRUNCATE_SNAPSHOT: 100 + TESTNET_TRUNCATE_SNAPSHOT: 1000 - op: snapshot.transfer label: Injecting ERC-20 snapshot balances data: - TESTNET_TRUNCATE_SNAPSHOT: 100 + TESTNET_TRUNCATE_SNAPSHOT: 1000 - op: snapshot.load_unregistered label: Saving unregistered addresses in eosio.unregd account, for the future. data: - TESTNET_TRUNCATE_SNAPSHOT: 100 + TESTNET_TRUNCATE_SNAPSHOT: 1000 + + +- op: system.setcode + label: Setting eosio.bios code for account eosio + data: + account: eosio + contract_name_ref: eosio.bios + +- op: system.setprods + label: Setup appointed block producers + +- op: system.setcode + label: Replacing eosio account from eosio.bios contract to eosio.system + data: + account: eosio + contract_name_ref: eosio.system -- op: system.destroy_accounts - label: Disabling authorization for system accounts, pointing `eosio` to the `eosio.prods` system account. +- op: system.resign_accounts + label: Disabling authorization for system accounts, pointing `eosio` to the `eosio.prods` account. data: accounts: - eosio.msig - eosio.token + - eosio.ram - eosio.ramfee - eosio.stake - eosio.names diff --git a/sample_config/my_discovery_file.yaml b/sample_config/my_discovery_file.yaml index 6252ff7..958f088 100644 --- a/sample_config/my_discovery_file.yaml +++ b/sample_config/my_discovery_file.yaml @@ -3,7 +3,6 @@ # We boot a new network from a previous network, until we reach the mainnet. # We call each network a stage. Ex: stage0, stage1, stage2, stage3, until "mainnet". # -seed_network_chain_id: "0000000000000000000000000000000000000000000000000000000000000001" seed_network_account_name: examplecom11 seed_network_http_address: http://stage0.example.com # These are your peers on the SEED network. They must have published @@ -27,7 +26,6 @@ gmt_offset: -700 # in HourMinutes format target_network_is_test: 1 # 0 = mainnet, anything else is a testnet # You can only link with peers that target the same chain_id -target_chain_id: "0000000000000000000000000000000000000000000000000000000000000002" target_p2p_address: stage1.example.com:9876 target_http_address: http://stage1.example.com target_account_name: examplecom12 @@ -46,8 +44,8 @@ target_initial_authority: target_contents: - name: boot_sequence.yaml - ref: /ipfs/QmW6Wv2Q8cqjyjFRFH2UBJ7fi4KYodwJKxaHJVaAR7aCmE - comment: "Refers to github.com/eoscanada/eos-bios/files/boot_sequence.yaml" + ref: /ipfs/QmYzxLMZa5FEHvn5WGcTq2jU7sLqRk5VMWESKsGVKhLy1d + comment: "Refers to github.com/eoscanada/eos-bios/files/boot_sequence.yaml. Updated to dawn-v4.2.0." - name: snapshot.csv ref: /ipfs/QmSRbJeZaWQXXJfK34z6hah7RN8DYr45BGqwNE7YNeFH6s @@ -59,31 +57,31 @@ target_contents: - name: eosio.bios.abi ref: /ipfs/QmUeci9zVkhzctMktea8UNa5fZCizteXieT8Z21M8GpZoU - comment: "Published by EOS Canada. Tag dawn-v4.1.0, unchanged in 05-22" + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.bios.wasm - ref: /ipfs/QmW7rfu2kYk5NruE29mm3nCXaVDdh9ux5SzSwRMSFQkHMC - comment: "Published by EOS Canada. Tag dawn-v4.1.0, unchanged in 05-22" + ref: /ipfs/QmVmavtFmPhJPrNYos6xE9SuzJVCPgezGaDGWDwwR5tPx1 + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.system.abi - ref: /ipfs/QmShJs1u2TjU1CgEEsDYpEZy9WusuvmfwFhSedaR6cScGj - comment: "Published by EOS Canada. Tag DAWN-2018-05-22" + ref: /ipfs/QmRmwmks3ctxd624ToJgQE5DNic1NLNHLKrhGzHzqPjS3S + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.system.wasm - ref: /ipfs/QmaW9um27uqmVqzmARrkMiLohcuMYfEPUbma5j13AhAjpc - comment: "Published by EOS Canada. Dan's quickfix in branch issue3315, off of DAWN-2018-05-22 to fix https://github.com/EOSIO/eos/issues/3315" + ref: /ipfs/QmSxrJBUVHW67FmsCh4Xa18moEVBh9UZnKK2xhPpYHujfG + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.msig.abi ref: /ipfs/QmRgNd9Jm6UX8qseBvMhfh8Pu3kdyJDNE1StGQWoYdp7Wx - comment: "Published by EOS Canada. Tag dawn-v4.1.0, unchanged in 05-22" + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.msig.wasm ref: /ipfs/QmadUdTbjJWuqccmFZUfaNT7PTAvwVh6ffhnd8HfzMmuvL - comment: "Published by EOS Canada. Tag dawn-v4.1.0, unchanged in 05-22" + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.token.abi ref: /ipfs/QmPqC7HAwCzKTsoskec7jTohyXZ2YFUQ9SHep6JpTFcXbY - comment: "Published by EOS Canada. Tag dawn-v4.1.0, unchanged in 05-22" + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.token.wasm - ref: /ipfs/QmY7TW1Dv9ZCyRXx9P9rDv492rspGbqaKcQgXAvHYZ22wM - comment: "Published by EOS Canada. Tag DAWN-2018-05-22" + ref: /ipfs/QmNfVCvXgiXCwbRkd8yakK5LLF8SK2xzrpmKsiHyouzhWL + comment: "Published by EOS Canada. Tag dawn-v4.2.0" - name: eosio.disco.abi ref: /ipfs/QmYzxhhE9f9aZTV7rqqYSNQy9pZVKk2pur9ccRZfY7yfs9 @@ -93,8 +91,8 @@ target_contents: comment: "Published by EOS Canada. eos-bios revision a03aad3c18f07d277e44de5443850f951df551be" - name: eosio.unregd.abi - ref: /ipfs/QmaWWCwJVr3ZB7h83igMvPcqAMzV3gNeaVhdhUyHfbEYKg - comment: "Published by EOS Canada. eos-bios revision 4c6fc8b7a4f26ef81978d796e2e953c96c83b941" + ref: /ipfs/QmfTP1RDACUHUB95pYDzmtowNovjvqkt9caVdtSQ69QFyK + comment: "Published by EOS Canada. From https://github.com/eoscanada/eos-bios/commit/8f1b9503dbb4c36bb75d7c74adebbc2d5a9d9175" - name: eosio.unregd.wasm - ref: /ipfs/QmfBsgyHFZc3dJ3H1qqEQZdZsSZTXL3EwbVqdRWua1XuLm - comment: "Published by EOS Canada. eos-bios revision 4c6fc8b7a4f26ef81978d796e2e953c96c83b941" + ref: /ipfs/QmPYfn1bniet9NYjeSvyDWNvJie6Xad7uSYjydpsK4VwuP + comment: "Published by EOS Canada. From https://github.com/eoscanada/eos-bios/commit/8f1b9503dbb4c36bb75d7c74adebbc2d5a9d9175" diff --git a/sample_config/privkeys.keys b/sample_config/seed_network.keys similarity index 100% rename from sample_config/privkeys.keys rename to sample_config/seed_network.keys