Proto: let genesis
be agnostic on fitness
This commit is contained in:
parent
e88e4b0848
commit
c277b5b56d
@ -59,6 +59,8 @@ let commands () =
|
|||||||
end
|
end
|
||||||
(fun hash fitness seckey cctxt ->
|
(fun hash fitness seckey cctxt ->
|
||||||
let block = Client_config.block () in
|
let block = Client_config.block () in
|
||||||
|
let fitness =
|
||||||
|
Client_embedded_proto_alpha.Fitness_repr.from_int64 fitness in
|
||||||
mine cctxt block (Activate hash) fitness seckey >>= handle_error cctxt)
|
mine cctxt block (Activate hash) fitness seckey >>= handle_error cctxt)
|
||||||
;
|
;
|
||||||
command ~desc: "Fork a test protocol" begin
|
command ~desc: "Fork a test protocol" begin
|
||||||
@ -77,6 +79,8 @@ let commands () =
|
|||||||
end
|
end
|
||||||
(fun hash fitness seckey cctxt ->
|
(fun hash fitness seckey cctxt ->
|
||||||
let block = Client_config.block () in
|
let block = Client_config.block () in
|
||||||
|
let fitness =
|
||||||
|
Client_embedded_proto_alpha.Fitness_repr.from_int64 fitness in
|
||||||
mine cctxt block (Activate_testnet hash) fitness seckey >>= handle_error cctxt) ;
|
mine cctxt block (Activate_testnet hash) fitness seckey >>= handle_error cctxt) ;
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -11,5 +11,7 @@ val mine:
|
|||||||
Client_commands.context ->
|
Client_commands.context ->
|
||||||
Client_node_rpcs.Blocks.block ->
|
Client_node_rpcs.Blocks.block ->
|
||||||
Data.Command.t ->
|
Data.Command.t ->
|
||||||
int64 -> Sodium.secret Sodium.Sign.key -> unit tzresult Lwt.t
|
Fitness.fitness ->
|
||||||
|
Environment.Ed25519.secret_key ->
|
||||||
|
unit tzresult Lwt.t
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ module Forge = struct
|
|||||||
(req "net_id" Updater.Net_id.encoding)
|
(req "net_id" Updater.Net_id.encoding)
|
||||||
(req "predecessor" Block_hash.encoding)
|
(req "predecessor" Block_hash.encoding)
|
||||||
(req "timestamp" Time.encoding)
|
(req "timestamp" Time.encoding)
|
||||||
(req "fitness" Data_encoding.int64))
|
(req "fitness" Fitness.encoding))
|
||||||
Data.Command.encoding)
|
Data.Command.encoding)
|
||||||
~output: (obj1 (req "payload" bytes))
|
~output: (obj1 (req "payload" bytes))
|
||||||
RPC.Path.(custom_root / "helpers" / "forge" / "block")
|
RPC.Path.(custom_root / "helpers" / "forge" / "block")
|
||||||
@ -60,7 +60,6 @@ let rpc_services : Context.t RPC.directory =
|
|||||||
dir
|
dir
|
||||||
(Forge.block RPC.Path.root)
|
(Forge.block RPC.Path.root)
|
||||||
(fun _ctxt ((net_id, predecessor, timestamp, fitness), command) ->
|
(fun _ctxt ((net_id, predecessor, timestamp, fitness), command) ->
|
||||||
let fitness = [ MBytes.of_string "\000" ; int64_to_bytes fitness ] in
|
|
||||||
let shell = { Updater.net_id ; predecessor ; timestamp ;
|
let shell = { Updater.net_id ; predecessor ; timestamp ;
|
||||||
fitness ; operations = [] } in
|
fitness ; operations = [] } in
|
||||||
let bytes = Data.Command.forge shell command in
|
let bytes = Data.Command.forge shell command in
|
||||||
|
@ -82,9 +82,11 @@ let genesis_sk =
|
|||||||
"edskRhxswacLW6jF6ULavDdzwqnKJVS4UcDTNiCyiH6H8ZNnn2pmNviL7pRNz9kRxxaWQFzEQEcZExGHKbwmuaAcoMegj5T99z"
|
"edskRhxswacLW6jF6ULavDdzwqnKJVS4UcDTNiCyiH6H8ZNnn2pmNviL7pRNz9kRxxaWQFzEQEcZExGHKbwmuaAcoMegj5T99z"
|
||||||
|
|
||||||
let switch_protocol () =
|
let switch_protocol () =
|
||||||
|
let fitness =
|
||||||
|
Client_embedded_proto_alpha.Fitness_repr.from_int64 0L in
|
||||||
Client_genesis.Client_proto_main.mine cctxt `Genesis
|
Client_genesis.Client_proto_main.mine cctxt `Genesis
|
||||||
(Activate Client_alpha.Client_proto_main.protocol)
|
(Activate Client_alpha.Client_proto_main.protocol)
|
||||||
0L genesis_sk
|
fitness genesis_sk
|
||||||
|
|
||||||
let bootstrap_accounts () =
|
let bootstrap_accounts () =
|
||||||
Client_proto_rpcs.Constants.bootstrap cctxt (`Head 0)
|
Client_proto_rpcs.Constants.bootstrap cctxt (`Head 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user