Updater: registration or a protocol now returns the registered module

This commit is contained in:
Benjamin Canou 2018-08-09 14:56:03 +02:00 committed by Pierre Boutillier
parent 32d2bf606d
commit 6510869b73
No known key found for this signature in database
GPG Key ID: C2F73508B56A193C
4 changed files with 26 additions and 26 deletions

View File

@ -27,10 +27,6 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
module CamlinternalFormatBasics = struct include CamlinternalFormatBasics end
")))
(rule
(targets registerer.mli)
(action (write-file %%{targets} "(* empty *)")))
(rule
(targets registerer.ml)
(deps tezos_embedded_protocol_environment_%s.cmxa

View File

@ -55,11 +55,10 @@ end
let () =
Format.printf {|
let () =
let module Ignored = Tezos_protocol_updater.Registered_protocol.Register_embedded
module Registered =
Tezos_protocol_updater.Registered_protocol.Register_embedded
(Tezos_embedded_protocol_environment_%s.Environment)
(Tezos_embedded_raw_protocol_%s.Main)
(Source) in
()
(Source)
@.|}
version version

View File

@ -97,26 +97,27 @@ module Register_embedded
val sources: Protocol.t
end) = struct
let hash =
match Source.hash with
| None -> Protocol.hash Source.sources
| Some hash -> hash
module Name = struct
let name = Protocol_hash.to_b58check hash
end
module Self = struct
module P = struct
let hash = hash
include Env.Lift(Proto)
end
include P
module Block_services = Block_services.Make(P)(P)
let complete_b58prefix = Env.Context.complete
end
let () =
let hash =
match Source.hash with
| None -> Protocol.hash Source.sources
| Some hash -> hash in
let module Name = struct
let name = Protocol_hash.to_b58check hash
end in
VersionTable.add
sources hash Source.sources ;
VersionTable.add
versions hash
(module struct
module P = struct
let hash = hash
include Env.Lift(Proto)
end
include P
module Block_services = Block_services.Make(P)(P)
let complete_b58prefix = Env.Context.complete
end : T)
versions hash (module Self : T)
include Self
end

View File

@ -54,4 +54,8 @@ module Register_embedded
(Source : sig
val hash: Protocol_hash.t option
val sources: Protocol.t
end) : sig end
end) :
T with type P.block_header_data = Proto.block_header_data
and type P.operation_data = Proto.operation_data
and type P.operation_receipt = Proto.operation_receipt
and type P.validation_state = Proto.validation_state