...
 
Commits (8)
......@@ -678,37 +678,32 @@ opam:59:tezos-accuser-alpha:
variables:
package: tezos-accuser-alpha
opam:60:flextesa:
<<: *opam_definition
variables:
package: flextesa
opam:61:tezos-endorser-alpha:
opam:60:tezos-endorser-alpha:
<<: *opam_definition
variables:
package: tezos-endorser-alpha
opam:62:tezos-accuser-alpha-commands:
opam:61:tezos-accuser-alpha-commands:
<<: *opam_definition
variables:
package: tezos-accuser-alpha-commands
opam:63:tezos-baker-alpha:
opam:62:tezos-baker-alpha:
<<: *opam_definition
variables:
package: tezos-baker-alpha
opam:64:tezos-signer:
opam:63:tezos-signer:
<<: *opam_definition
variables:
package: tezos-signer
opam:65:tezos-node:
opam:64:tezos-node:
<<: *opam_definition
variables:
package: tezos-node
opam:66:ocplib-json-typed-browser:
opam:65:ocplib-json-typed-browser:
<<: *opam_definition
variables:
package: ocplib-json-typed-browser
......
......@@ -21,7 +21,7 @@ let little_mesh_with_bakers ?base_port ?kiln state ~starting_level ~node_exec
; bootstrap_accounts=
List.map d.bootstrap_accounts ~f:(fun (n, v) ->
if List.exists bakers ~f:(fun baker -> n = fst baker) then (n, v)
else (n, 1_000) ) }
else (n, 1_000L) ) }
, bakers )
in
let net_size = 3 in
......@@ -377,7 +377,7 @@ let with_accusers ?kiln ~state ~base_port node_exec accuser_exec client_exec ()
time_between_blocks= [block_interval; block_interval * 2]
; bootstrap_accounts=
List.map d.bootstrap_accounts ~f:(fun (n, v) ->
if n = fst baker then (n, v) else (n, 1_000) ) }
if n = fst baker then (n, v) else (n, 1_000L) ) }
, baker )
in
let topology =
......
......@@ -62,7 +62,7 @@ let voting_period_to_string (p : voting_period) =
let transfer state ~client ~src ~dst ~amount =
Tezos_client.successful_client_cmd state ~client
[ "--wait"; "none"; "transfer"; sprintf "%d" amount; "from"; src; "to"; dst
[ "--wait"; "none"; "transfer"; sprintf "%Ld" amount; "from"; src; "to"; dst
; "--fee"; "0.05"; "--burn-cap"; "0.3" ]
let bake_until_voting_period ?keep_alive_delegate state ~baker ~attempts period
......@@ -76,7 +76,7 @@ let bake_until_voting_period ?keep_alive_delegate state ~baker ~attempts period
| `String p when p = period_name -> return (`Done (nth - 1))
| other ->
Asynchronous_result.map_option keep_alive_delegate ~f:(fun dst ->
transfer state ~client ~amount:1
transfer state ~client ~amount:1L
~src:baker.Tezos_client.Keyed.key_name ~dst
>>= fun res -> return () )
>>= fun _ ->
......@@ -103,7 +103,7 @@ let run state ~demo_path ~node_exec ~client_exec ~admin_exec ~size ~base_port
time_between_blocks= [1; 0]
; bootstrap_accounts=
List.map d.bootstrap_accounts ~f:(fun (n, v) ->
if fst baker = n then (n, v) else (n, 1_000) ) }
if fst baker = n then (n, v) else (n, 1_000L) ) }
, fst baker
, snd baker )
in
......@@ -157,7 +157,7 @@ let run state ~demo_path ~node_exec ~client_exec ~admin_exec ~size ~base_port
~clients:[special_baker.Tezos_client.Keyed.client] ] ;
transfer state (* Tezos_client.successful_client_cmd state *)
~client:(client 0)
~amount:(baker_0_balance / 2_000_000)
~amount:(Int64.div baker_0_balance 2_000_000L)
~src:"baker-0" ~dst:special_baker.Tezos_client.Keyed.key_name
>>= fun res ->
Console.say state
......@@ -230,8 +230,8 @@ let run state ~demo_path ~node_exec ~client_exec ~admin_exec ~size ~base_port
Console.say state EF.(wf "Injecting protocol from %s" tmpdir)
>>= fun () ->
Running_processes.run_successful_cmdf state
"cp -r %s %s && echo '(* Protocol %s *)' >> %s/main.mli"
(Filename.quote demo_path) (Filename.quote tmpdir) name
"cp -L -r %s %s && echo '(* Protocol %s *)' >> %s/main.mli"
(Filename.quote (Filename.dirname demo_path)) (Filename.quote tmpdir) name
(Filename.quote tmpdir)
>>= fun _ ->
Tezos_admin_client.successful_command admin_0 state
......@@ -409,7 +409,7 @@ let run state ~demo_path ~node_exec ~client_exec ~admin_exec ~size ~base_port
match Jqo.field json_metadata ~k:"next_protocol" with
| `String p when p = winner -> return (`Done (nth - 1))
| other ->
transfer state ~client ~amount:1
transfer state ~client ~amount:1L
~src:baker_0.Tezos_client.Keyed.key_name
~dst:special_baker.Tezos_client.Keyed.key_name
>>= fun _ ->
......
(executables
(names main)
(public_names flextesa)
(libraries tezos-network-sandbox)
(flags (:standard -w -9-27-30-32-40@8 -safe-string)))
......@@ -17,21 +16,22 @@
(alias
(name runtest_sandbox_accusations_simple_double_endorsing)
(locks /tcp-port/10000_range)
(locks /tcp-port/20000_range)
(action
(run %{exe:main.exe} accusations simple-double-endorsing
--root-path %{env:ROOT_PATH=/tmp/flextesa-acc-sde/}
--with-timestamp
--base-port 10_000
--base-port 20_000
--tezos-client-binary %{bin:tezos-client}
--tezos-node-binary %{bin:tezos-node} )))
(alias
(name runtest_sandbox_voting_demo)
(deps (package tezos-embedded-protocol-demo))
(locks /tcp-port/30000_range)
(action
(run %{exe:main.exe} voting
../../../../src/bin_client/test/proto_test_injection
%{lib:tezos-embedded-protocol-demo:raw/TEZOS_PROTOCOL}
--root-path %{env:ROOT_PATH=/tmp/flextesa-voting-demo/}
--base-port 30_000
--size 3
......@@ -46,5 +46,4 @@
(deps
(alias runtest_sandbox_accusations_simple_double_baking)
(alias runtest_sandbox_accusations_simple_double_endorsing)
(alias runtest_sandbox_voting_demo)
))
(alias runtest_sandbox_voting_demo)))
opam-version: "2.0"
version: "dev"
maintainer: "contact@tezos.com"
authors: [ "Tezos devteam" ]
homepage: "https://www.tezos.com/"
bug-reports: "https://gitlab.com/tezos/tezos/issues"
dev-repo: "git+https://gitlab.com/tezos/tezos.git"
license: "MIT"
depends: [
"ocamlfind" { build }
"dune" { build & >= "1.0.1" }
"tezos-network-sandbox"
]
build: [
[ "dune" "build" "-p" name "-j" jobs ]
]
run-test: [
[ "dune" "runtest" "-p" name "-j" jobs ]
]
synopsis: "Tezos: `flextesa` binary"
......@@ -194,7 +194,7 @@ end
type t =
{ id: string
; bootstrap_accounts: (Account.t * int) list
; bootstrap_accounts: (Account.t * Int64.t) list
; dictator: Account.t
; bootstrap_contracts: (Account.t * int * Script.origin) list
; expected_pow: int
......@@ -214,7 +214,7 @@ let default () =
{ id= "default-bootstrap"
; bootstrap_accounts=
List.init 4 ~f:(fun n ->
(Account.of_namef "bootacc-%d" n, 4_000_000_000_000) )
(Account.of_namef "bootacc-%d" n, 4_000_000_000_000L) )
; dictator
; bootstrap_contracts= [(dictator, 10_000_000, `Sandbox_faucet)]
; expected_pow= 1
......@@ -230,7 +230,7 @@ let default () =
let protocol_parameters_json t : Ezjsonm.t =
let open Ezjsonm in
let make_account (account, amount) =
strings [Account.pubkey account; sprintf "%d" amount]
strings [Account.pubkey account; sprintf "%Ld" amount]
in
let make_contract (deleg, amount, script) =
dict
......@@ -240,7 +240,7 @@ let protocol_parameters_json t : Ezjsonm.t =
in
dict
[ ( "bootstrap_accounts"
, list make_account (t.bootstrap_accounts @ [(t.dictator, 1)]) )
, list make_account (t.bootstrap_accounts @ [(t.dictator, 1L)]) )
; ("bootstrap_contracts", list make_contract t.bootstrap_contracts)
; ("time_between_blocks", list (ksprintf string "%d") t.time_between_blocks)
; ("blocks_per_roll_snapshot", int t.blocks_per_roll_snapshot)
......@@ -330,7 +330,7 @@ let cli_term () =
)
$ value
(opt_all
(pair ~sep:'@' (t4 ~sep:',' string string string string) int)
(pair ~sep:'@' (t4 ~sep:',' string string string string) int64)
[]
(info ["add-bootstrap-account"]
~docv:"NAME,PUBKEY,PUBKEY-HASH,PRIVATE-URI@MUTEZ-AMOUNT"
......
......@@ -67,7 +67,7 @@ end
(** [t] wraps bootstrap parameters for sandboxed protocols. *)
type t =
{ id: string
; bootstrap_accounts: (Account.t * int) list
; bootstrap_accounts: (Account.t * Int64.t) list
; dictator: Account.t
; bootstrap_contracts: (Account.t * int * Script.origin) list
; expected_pow: int
......
......@@ -53,6 +53,11 @@
-open Error_monad))
(modules %%MODULES%%))
(install
(section lib)
(package tezos-embedded-protocol-%%VERSION%%)
(files (TEZOS_PROTOCOL as raw/TEZOS_PROTOCOL)))
(library
(name tezos_embedded_protocol_%%LIB_VERSION%%)
(public_name tezos-embedded-protocol-%%VERSION%%)
......
......@@ -12,7 +12,7 @@ depends: [
"tezos-protocol-environment"
"tezos-protocol-alpha"
"tezos-shell-services"
"tezos-client-base"
"tezos-client-base-unix"
"tezos-client-alpha"
"tezos-client-commands"
]
......
......@@ -120,7 +120,8 @@ let get_delegates cctxt state = match state.delegates with
| [] ->
Client_keys.get_keys cctxt >>=? fun keys ->
let delegates = List.map (fun (_,pkh,_,_) -> pkh) keys in
return delegates
return Signature.Public_key_hash.Set.
(delegates |> of_list |> elements)
| (_ :: _) as delegates -> return delegates
let endorse_for_delegate cctxt block delegate_pkh =
......
......@@ -242,10 +242,18 @@ let endorser_commands () =
may_lock_pidfile pidfile >>=? fun () ->
Tezos_signer_backends.Encrypted.decrypt_list
cctxt (List.map fst delegates) >>=? fun () ->
let delegates = List.map snd delegates in
let delegates_no_duplicates = Signature.Public_key_hash.Set.
(delegates |> of_list |> elements) in
begin if List.length delegates <> List.length delegates_no_duplicates then
cctxt#message "Warning: the list of public key hash aliases contains \
duplicate hashes, which are ignored"
else Lwt.return ()
end >>= fun () ->
Client_daemon.Endorser.run cctxt
~chain:cctxt#chain
~delay:endorsement_delay
(List.map snd delegates)
delegates_no_duplicates
)
]
......
......@@ -61,6 +61,11 @@
-open Error_monad))
(modules Misc Storage_description State_hash Nonce_hash Script_expr_hash Contract_hash Blinded_public_key_hash Qty_repr Tez_repr Period_repr Time_repr Constants_repr Fitness_repr Raw_level_repr Voting_period_repr Cycle_repr Level_repr Seed_repr Gas_limit_repr Script_int_repr Script_timestamp_repr Michelson_v1_primitives Script_repr Contract_repr Roll_repr Vote_repr Block_header_repr Operation_repr Manager_repr Commitment_repr Parameters_repr Raw_context Storage_sigs Storage_functors Storage Constants_storage Level_storage Nonce_storage Seed_storage Roll_storage Delegate_storage Contract_storage Bootstrap_storage Fitness_storage Vote_storage Commitment_storage Init_storage Fees_storage Alpha_context Script_typed_ir Script_tc_errors Michelson_v1_gas Script_ir_annot Script_ir_translator Script_tc_errors_registration Script_interpreter Baking Amendment Apply_results Apply Services_registration Constants_services Contract_services Delegate_services Helpers_services Voting_services Alpha_services Main))
(install
(section lib)
(package tezos-embedded-protocol-alpha)
(files (TEZOS_PROTOCOL as raw/TEZOS_PROTOCOL)))
(library
(name tezos_embedded_protocol_alpha)
(public_name tezos-embedded-protocol-alpha)
......
......@@ -61,6 +61,11 @@
-open Error_monad))
(modules Error Services Main))
(install
(section lib)
(package tezos-embedded-protocol-demo)
(files (TEZOS_PROTOCOL as raw/TEZOS_PROTOCOL)))
(library
(name tezos_embedded_protocol_demo)
(public_name tezos-embedded-protocol-demo)
......
......@@ -61,6 +61,11 @@
-open Error_monad))
(modules Data Services Main))
(install
(section lib)
(package tezos-embedded-protocol-genesis)
(files (TEZOS_PROTOCOL as raw/TEZOS_PROTOCOL)))
(library
(name tezos_embedded_protocol_genesis)
(public_name tezos-embedded-protocol-genesis)
......
......@@ -34,9 +34,9 @@ class TestAllDeamonsWithOperations:
we kill the bakers and check everyone synchronize to the same head. '''
def test_setup_network(self, sandbox):
# Set appropriate time to avoid double-baking
parameters = dict(constants.PARAMETERS)
parameters["time_between_blocks"] = ["15", "0"]
# each priority has a delay of 1 sec
parameters["time_between_blocks"] = ["1"]
for i in range(NUM_NODES):
sandbox.add_node(i, params=['--connections', '500'])
utils.activate_alpha(sandbox.client(0), parameters)
......