Skip to content

Commit

Permalink
Merge pull request #10139 from MinaProtocol/feature/remove-dynamic-bp…
Browse files Browse the repository at this point in the history
…-swapping

Remove dynamic block producer keypair swapping
  • Loading branch information
mrmr1993 authored Feb 3, 2022
2 parents f7b7dc9 + 947120d commit 087f715
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 2,186 deletions.
2 changes: 0 additions & 2 deletions dockerfiles/stages/3-builder
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ RUN eval $(opam config env) \
src/app/generate_keypair/generate_keypair.exe \
src/app/validate_keypair/validate_keypair.exe \
src/app/rosetta/ocaml-signer/signer.exe \
src/app/rosetta/test-agent/agent.exe \
&& cp _build/default/src/app/archive_blocks/archive_blocks.exe $HOME/app/mina-archive-blocks \
&& cp _build/default/src/app/extract_blocks/extract_blocks.exe $HOME/app/mina-extract-blocks \
&& cp _build/default/src/app/missing_blocks_auditor/missing_blocks_auditor.exe $HOME/app/mina-missing-blocks-auditor \
Expand All @@ -68,7 +67,6 @@ RUN eval $(opam config env) \
&& mv _build/default/src/app/generate_keypair/generate_keypair.exe $HOME/app/mina-generate-keypair \
&& mv _build/default/src/app/validate_keypair/validate_keypair.exe $HOME/app/mina-validate-keypair \
&& mv _build/default/src/app/rosetta/ocaml-signer/signer.exe $HOME/app/mina-ocaml-signer \
&& mv _build/default/src/app/rosetta/test-agent/agent.exe $HOME/app/mina-rosetta-test-agent \
&& rm -rf _build

# Clear go module caches
Expand Down
1 change: 0 additions & 1 deletion dockerfiles/stages/4-deb-builder
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ RUN echo "--- Build all major tagets required for packaging" \
src/app/rosetta/rosetta.exe \
src/app/rosetta/rosetta_mainnet_signatures.exe \
src/app/rosetta/rosetta_testnet_signatures.exe \
src/app/rosetta/test-agent/agent.exe \
src/app/rosetta/ocaml-signer/signer.exe

# --- MAKE DEB
Expand Down
178 changes: 0 additions & 178 deletions graphql_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,152 +614,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "SetStakingInput",
"description": null,
"fields": [
{
"name": "publicKeys",
"description":
"Public keys of accounts you wish to stake with - these must be accounts that are in trackedAccounts",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "PublicKey",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": [
{
"name": "publicKeys",
"description":
"Public keys of accounts you wish to stake with - these must be accounts that are in trackedAccounts",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "PublicKey",
"ofType": null
}
}
}
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "SetStakingPayload",
"description": null,
"fields": [
{
"name": "lastStaking",
"description":
"Returns the public keys that were staking funds previously",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "PublicKey",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lockedPublicKeys",
"description":
"List of public keys that could not be used to stake because they were locked",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "PublicKey",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "currentStakingKeys",
"description":
"Returns the public keys that are now staking their funds",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "PublicKey",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "TarFile",
Expand Down Expand Up @@ -2735,38 +2589,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "setStaking",
"description": "Set keys you wish to stake with",
"args": [
{
"name": "input",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "SetStakingInput",
"ofType": null
}
},
"defaultValue": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "SetStakingPayload",
"ofType": null
}
},
"isDeprecated": true,
"deprecationReason":
"Restart the daemon with the flag --block-producer-key instead"
},
{
"name": "setCoinbaseReceiver",
"description": "Set the key to receive coinbases",
Expand Down
20 changes: 0 additions & 20 deletions scripts/build-and-test-rosetta-from-git.sh

This file was deleted.

9 changes: 6 additions & 3 deletions src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,11 @@ let setup_daemon logger =
Precomputed_values.genesis_ledger precomputed_values
|> Lazy.force |> Ledger.merkle_root
in
let initial_block_production_keypairs =
block_production_keypair |> Option.to_list |> Keypair.Set.of_list
let block_production_keypairs =
block_production_keypair
|> Option.map ~f:(fun kp ->
(kp, Public_key.compress kp.Keypair.public_key))
|> Option.to_list |> Keypair.And_compressed_pk.Set.of_list
in
let epoch_ledger_location = conf_dir ^/ "epoch_ledger" in
let consensus_local_state =
Expand Down Expand Up @@ -1202,7 +1205,7 @@ Pass one of -peer, -peer-list-file, -seed, -peer-list-url.|} ;
~persistent_root_location:(conf_dir ^/ "root")
~persistent_frontier_location:(conf_dir ^/ "frontier")
~epoch_ledger_location ~snark_work_fee:snark_work_fee_flag
~time_controller ~initial_block_production_keypairs ~monitor
~time_controller ~block_production_keypairs ~monitor
~consensus_local_state ~is_archive_rocksdb ~work_reassignment_wait
~archive_process_location ~log_block_creation ~precomputed_values
~start_time ?precomputed_blocks_path ~log_precomputed_blocks
Expand Down
38 changes: 0 additions & 38 deletions src/app/cli/src/init/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,43 +1241,6 @@ let stop_tracing =
| Error e ->
Daemon_rpcs.Client.print_rpc_error e))

let set_staking_graphql =
let open Command.Param in
let open Cli_lib.Arg_type in
let open Graphql_lib in
let pk_flag =
flag "--public-key" ~aliases:[ "public-key" ]
~doc:"PUBLICKEY Public key of account with which to produce blocks"
(required public_key_compressed)
in
Command.async
~summary:
"The set-staking command is deprecated and no longer has any effect.To \
enable block production, instead restart the daemon with the flag \
--block-producer-key"
(Cli_lib.Background_daemon.graphql_init pk_flag
~f:(fun graphql_endpoint public_key ->
let print_message msg arr =
if not (Array.is_empty arr) then
printf "%s: %s\n" msg
(String.concat_array ~sep:", "
(Array.map ~f:Public_key.Compressed.to_base58_check arr))
in
let%map result =
Graphql_client.query_exn
(Graphql_queries.Set_staking.make
~public_key:(Encoders.public_key public_key)
())
graphql_endpoint
in
print_message "Stopped staking with" result#setStaking#lastStaking ;
print_message
"❌ Failed to start staking with keys (try `mina accounts unlock` \
first)"
result#setStaking#lockedPublicKeys ;
print_message "Started staking with"
result#setStaking#currentStakingKeys))

let set_coinbase_receiver_graphql =
let open Command.Param in
let open Cli_lib.Arg_type in
Expand Down Expand Up @@ -2415,7 +2378,6 @@ let client =
; ("create-token-account", create_new_account_graphql)
; ("mint-tokens", mint_tokens_graphql)
; ("cancel-transaction", cancel_transaction_graphql)
; ("set-staking", set_staking_graphql)
; ("set-snark-worker", set_snark_worker)
; ("set-snark-work-fee", set_snark_work_fee)
; ("export-logs", Export_logs.export_via_graphql)
Expand Down
10 changes: 0 additions & 10 deletions src/app/cli/src/init/coda_run.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
open Core
open Async
open Signature_lib
open O1trace
module Graphql_cohttp_async =
Graphql_internal.Make (Graphql_async.Schema) (Cohttp_async.Io)
Expand Down Expand Up @@ -382,15 +381,6 @@ let setup_local_server ?(client_trustlist = []) ?rest_server_port
return (Mina_lib.visualize_frontier ~filename coda))
; implement Daemon_rpcs.Visualization.Registered_masks.rpc
(fun () filename -> return (Mina_base.Ledger.Debug.visualize ~filename))
; implement Daemon_rpcs.Set_staking.rpc (fun () keypairs ->
let keypair_and_compressed_key =
List.map keypairs
~f:(fun ({ Keypair.Stable.Latest.public_key; _ } as keypair) ->
(keypair, Public_key.compress public_key))
in
Mina_lib.replace_block_production_keypairs coda
(Keypair.And_compressed_pk.Set.of_list keypair_and_compressed_key) ;
Deferred.unit)
; implement Daemon_rpcs.Add_trustlist.rpc (fun () cidr ->
return
(let cidr_str = Unix.Cidr.to_string cidr in
Expand Down
12 changes: 0 additions & 12 deletions src/app/cli/src/init/graphql_queries.ml
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,6 @@ query pendingSnarkWork {
}
|}]

module Set_staking =
[%graphql
{|
mutation ($public_key: PublicKey) {
setStaking(input : {publicKeys: [$public_key]}) {
lastStaking @bsDecoder(fn: "Decoders.public_key_array")
lockedPublicKeys @bsDecoder(fn: "Decoders.public_key_array")
currentStakingKeys @bsDecoder(fn: "Decoders.public_key_array")
}
}
|}]

module Set_coinbase_receiver =
[%graphql
{|
Expand Down
25 changes: 12 additions & 13 deletions src/app/cli/src/tests/coda_worker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,19 @@ module T = struct
List.nth_exn (Lazy.force Genesis_ledger.accounts) i
|> Genesis_ledger.keypair_of_account_record_exn)
in
let initial_block_production_keypairs =
Keypair.Set.of_list (block_production_keypair |> Option.to_list)
let block_production_keypairs =
block_production_keypair
|> Option.map ~f:(fun kp ->
(kp, Public_key.compress kp.Keypair.public_key))
|> Option.to_list |> Keypair.And_compressed_pk.Set.of_list
in
let initial_block_production_keys =
Public_key.Compressed.Set.of_list
( Option.map block_production_keypair ~f:(fun keypair ->
let open Keypair in
Public_key.compress keypair.public_key)
|> Option.to_list )
let block_production_pubkeys =
block_production_keypairs |> Keypair.And_compressed_pk.Set.to_list
|> List.map ~f:snd |> Public_key.Compressed.Set.of_list
in
let epoch_ledger_location = conf_dir ^/ "epoch_ledger" in
let consensus_local_state =
Consensus.Data.Local_state.create initial_block_production_keys
Consensus.Data.Local_state.create block_production_pubkeys
~genesis_ledger:Genesis_ledger.t
~genesis_epoch_data:precomputed_values.genesis_epoch_data
~epoch_ledger_location
Expand Down Expand Up @@ -482,10 +482,9 @@ module T = struct
~epoch_ledger_location
~wallets_disk_location:(conf_dir ^/ "wallets") ~time_controller
~snark_work_fee:(Currency.Fee.of_int 0)
~initial_block_production_keypairs ~monitor
~consensus_local_state ~is_archive_rocksdb
~work_reassignment_wait:420000 ~precomputed_values ~start_time
~upload_blocks_to_gcloud:false
~block_production_keypairs ~monitor ~consensus_local_state
~is_archive_rocksdb ~work_reassignment_wait:420000
~precomputed_values ~start_time ~upload_blocks_to_gcloud:false
~archive_process_location:
(Option.map archive_process_location ~f:(fun host_and_port ->
Cli_lib.Flag.Types.
Expand Down
Loading

0 comments on commit 087f715

Please sign in to comment.