Commit 78bd5cd8 authored by Romain's avatar Romain Committed by Seb Mondet

Carthage: get user-activated upgrades from node

parent 97efb325
......@@ -43,7 +43,7 @@ endif
cp _build/default/src/proto_$$p/lib_parameters/sandbox-parameters.json sandbox-parameters.json ; \
done
PROTOCOLS := genesis genesis_alphanet genesis_babylonnet genesis_carthagenet alpha demo_noops 000_Ps9mPmXa 001_PtCJ7pwo 002_PsYLVpVv 003_PsddFKi3 004_Pt24m4xi 005_PsBABY5H 005_PsBabyM1
PROTOCOLS := genesis genesis_alphanet genesis_babylonnet genesis_carthagenet alpha demo_noops 000_Ps9mPmXa 001_PtCJ7pwo 002_PsYLVpVv 003_PsddFKi3 004_Pt24m4xi 005_PsBABY5H 005_PsBabyM1 006_PsCARTHA
DUNE_INCS=$(patsubst %,src/proto_%/lib_protocol/dune.inc, ${PROTOCOLS})
generate_dune: ${DUNE_INCS}
......
......@@ -19,6 +19,7 @@
tezos-client-003-PsddFKi3
tezos-client-004-Pt24m4xi
tezos-client-005-PsBabyM1
tezos-client-006-PsCARTHA
tezos-client-alpha-commands.registration
tezos-client-001-PtCJ7pwo-commands.registration
......@@ -26,10 +27,12 @@
tezos-client-003-PsddFKi3-commands.registration
tezos-client-004-Pt24m4xi-commands.registration
tezos-client-005-PsBabyM1-commands.registration
tezos-client-006-PsCARTHA-commands.registration
tezos-baking-alpha-commands.registration
tezos-baking-004-Pt24m4xi-commands.registration
tezos-baking-005-PsBabyM1-commands.registration
tezos-baking-006-PsCARTHA-commands.registration
tezos-stdlib-unix
tezos-client-base-unix
......
......@@ -24,6 +24,7 @@ depends: [
"tezos-client-003-PsddFKi3"
"tezos-client-004-Pt24m4xi"
"tezos-client-005-PsBabyM1"
"tezos-client-006-PsCARTHA"
"tezos-client-alpha-commands"
"tezos-client-001-PtCJ7pwo-commands"
......@@ -31,6 +32,7 @@ depends: [
"tezos-client-003-PsddFKi3-commands"
"tezos-client-004-Pt24m4xi-commands"
"tezos-client-005-PsBabyM1-commands"
"tezos-client-006-PsCARTHA-commands"
"tezos-baking-alpha"
"tezos-baking-004-Pt24m4xi"
......@@ -39,6 +41,7 @@ depends: [
"tezos-baking-alpha-commands"
"tezos-baking-004-Pt24m4xi-commands"
"tezos-baking-005-PsBabyM1-commands"
"tezos-baking-006-PsCARTHA-commands"
"tezos-client-base-unix"
"tezos-signer-backends"
......
......@@ -25,8 +25,10 @@
tezos-embedded-protocol-004-Pt24m4xi
tezos-embedded-protocol-005-PsBABY5H
tezos-embedded-protocol-005-PsBabyM1
tezos-embedded-protocol-006-PsCARTHA
tezos-mempool-004-Pt24m4xi
tezos-mempool-005-PsBabyM1
tezos-mempool-006-PsCARTHA
cmdliner
tls)
(flags (:standard -open Tezos_base__TzPervasives
......
......@@ -30,8 +30,10 @@ depends: [
"tezos-embedded-protocol-004-Pt24m4xi"
"tezos-embedded-protocol-005-PsBABY5H"
"tezos-embedded-protocol-005-PsBabyM1"
"tezos-embedded-protocol-006-PsCARTHA"
"tezos-mempool-004-Pt24m4xi"
"tezos-mempool-005-PsBabyM1"
"tezos-mempool-006-PsCARTHA"
"cmdliner"
"tls"
"cstruct"
......
......@@ -1077,7 +1077,7 @@ let fetch_operations (cctxt : #Protocol_client_context.full) ~chain
(** Given a delegate baking slot [build_block] constructs a full block
with consistent operations that went through the client-side
validation *)
let build_block cctxt state seed_nonce_hash
let build_block ~user_activated_upgrades cctxt state seed_nonce_hash
((slot_timestamp, (bi, priority, delegate)) as slot) =
let chain = `Hash bi.Client_baking_blocks.chain_id in
let block = `Hash (bi.hash, 0) in
......@@ -1126,6 +1126,7 @@ let build_block cctxt state seed_nonce_hash
let next_version =
match
Tezos_base.Block_header.get_forced_protocol_upgrade
~user_activated_upgrades
~level:(Raw_level.to_int32 next_level.Level.level)
with
| None ->
......@@ -1269,7 +1270,8 @@ let build_block cctxt state seed_nonce_hash
(** [bake cctxt state] create a single block when woken up to do
so. All the necessary information is available in the
[state.best_slot]. *)
let bake (cctxt : #Protocol_client_context.full) ~chain state =
let bake ~user_activated_upgrades (cctxt : #Protocol_client_context.full)
~chain state =
( match state.best_slot with
| None ->
assert false (* unreachable *)
......@@ -1278,7 +1280,7 @@ let bake (cctxt : #Protocol_client_context.full) ~chain state =
>>=? fun slot ->
let seed_nonce = generate_seed_nonce () in
let seed_nonce_hash = Nonce.hash seed_nonce in
build_block cctxt state seed_nonce_hash slot
build_block ~user_activated_upgrades cctxt state seed_nonce_hash slot
>>=? function
| Some (head, priority, shell_header, operations, delegate, seed_nonce_hash)
-> (
......@@ -1500,9 +1502,9 @@ let reveal_potential_nonces (cctxt : #Client_context.full) constants ~chain
(** [create] starts the main loop of the baker. The loop monitors new blocks and
starts individual baking operations when baking-slots are available to any of
the [delegates] *)
let create (cctxt : #Protocol_client_context.full) ?minimal_fees
?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte ?max_priority
~chain ~context_path delegates block_stream =
let create (cctxt : #Protocol_client_context.full) ~user_activated_upgrades
?minimal_fees ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte
?max_priority ~chain ~context_path delegates block_stream =
let state_maker bi =
Alpha_services.Constants.all cctxt (chain, `Head 0)
>>=? fun constants ->
......@@ -1552,7 +1554,7 @@ let create (cctxt : #Protocol_client_context.full) ?minimal_fees
timeout )
in
let timeout_k cctxt state () =
bake cctxt ~chain state
bake cctxt ~user_activated_upgrades ~chain state
>>=? fun () ->
(* Stopping the timeout and waiting for the next block *)
state.best_slot <- None ;
......
......@@ -94,6 +94,7 @@ val forge_block :
val create :
#Protocol_client_context.full ->
user_activated_upgrades:User_activated.upgrades ->
?minimal_fees:Tez.t ->
?minimal_nanotez_per_gas_unit:Z.t ->
?minimal_nanotez_per_byte:Z.t ->
......
......@@ -130,6 +130,8 @@ module Baker = struct
let run (cctxt : #Protocol_client_context.full) ?minimal_fees
?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte ?max_priority
~chain ~context_path delegates =
Config_services.user_activated_upgrades cctxt
>>=? fun user_activated_upgrades ->
await_bootstrapped_node cctxt
>>=? fun _ ->
( if chain = `Test then monitor_fork_testchain cctxt ~cleanup_nonces:true
......@@ -144,6 +146,7 @@ module Baker = struct
>>= fun () ->
Client_baking_forge.create
cctxt
~user_activated_upgrades
?minimal_fees
?minimal_nanotez_per_gas_unit
?minimal_nanotez_per_byte
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment