Alpha: update bootstrap parameters.

This commit is contained in:
Benjamin Canou 2017-05-31 18:05:29 +02:00
parent 512fde82e4
commit 90f87bec4a
3 changed files with 16 additions and 16 deletions

View File

@ -14,7 +14,7 @@ type account = {
(* FIXME: when incresing wealth *10, the node is very slow to initialize...
this should be investigated... *)
let wealth = Tez_repr.of_cents_exn 2_000_000_00L
let wealth = Tez_repr.of_cents_exn 4_000_000_00L
let init_account ctxt account =
Storage.Public_key.init ctxt account.public_key_hash account.public_key >>=? fun ctxt ->
@ -55,7 +55,7 @@ let refill ctxt =
Contract_storage.get_balance ctxt contract >>=? fun balance ->
total >>=? fun total -> Lwt.return Tez_repr.(total +? balance))
(return Tez_repr.zero) contracts >>=? fun total ->
(* The 5 bootstrap accounts should have at least 1/2 of the total amount
(* The bootstrap accounts should have at least 1/2 of the total amount
of tokens. *)
let accounts = accounts ctxt in
let min_balance =

View File

@ -66,10 +66,10 @@ let default = {
bootstrap_keys =
List.map read_public_key [
"dd5d3536916765fd00a8cd402bddd34e87b49ae5159c43b8feecfd9f06b267d2" ;
"ce09f1c6b91d48cdd9f2aa98daf780f07353c759866c7dfbe50eb023bde51629" ;
"2dc874e66659ef2df0b7c6f29af7c913d32a01acecb36c4ad1a4ed74af7de33a" ;
"9c328bddf6249bbe550121076194d99bbe60e5b1e144da4f426561b5d3bbc6ab" ;
"a3db517734e07ace089ad0a2388e7276fb9b114bd79259dd5c93b0c33d57d6a2" ;
"6d2d52e62f1d48f3cf9badbc90cfe5f3aa600194bf21eda44b8e64698a82d341" ;
"30cdca1f0713916c9f1f2d3efc9fb688deb3e2f87b19ccd77f4c06676dc9baa9" ;
] ;
dictator_pubkey =
read_public_key

View File

@ -79,9 +79,9 @@ let test_invalid_endorsement_slot contract block =
let test_endorsement_rewards
block ({ Helpers.Account.b5 = b1 ; _ } as baccounts) =
let get_endorser_except_b1 accounts =
let get_endorser_except bs accounts =
let account, cpt = ref accounts.(0), ref 0 in
while !account = b1 do
while List.mem !account bs do
incr cpt ;
account := accounts.(!cpt)
done ;
@ -92,7 +92,7 @@ let test_endorsement_rewards
(* Endorsement Rights *)
(* #1 endorse & inject in a block *)
Helpers.Endorse.endorsers_list block baccounts >>=? fun accounts ->
get_endorser_except_b1 accounts >>=? fun (account0, slot0) ->
get_endorser_except [ b1 ] accounts >>=? fun (account0, slot0) ->
Helpers.Account.balance account0 >>=? fun balance0 ->
Helpers.Endorse.endorse ~slot:slot0 ~force:true account0 block >>=? fun ops ->
Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 block >>=? fun head0 ->
@ -104,7 +104,7 @@ let test_endorsement_rewards
(* #2 endorse & inject in a block *)
let block0 = `Hash head0 in
Helpers.Endorse.endorsers_list block0 baccounts >>=? fun accounts ->
get_endorser_except_b1 accounts >>=? fun (account1, slot1) ->
get_endorser_except [ b1 ; account0 ] accounts >>=? fun (account1, slot1) ->
Helpers.Account.balance account1 >>=? fun balance1 ->
Helpers.Endorse.endorse ~slot:slot1 ~force:true account1 block0 >>=? fun ops ->
Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 block0 >>=? fun head1 ->
@ -116,7 +116,7 @@ let test_endorsement_rewards
(* #3 endorse but the operation is not included in a block, so no reward *)
let block1 = `Hash head1 in
Helpers.Endorse.endorsers_list block1 baccounts >>=? fun accounts ->
get_endorser_except_b1 accounts >>=? fun (account2, slot2) ->
get_endorser_except [ b1 ; account0 ; account1 ] accounts >>=? fun (account2, slot2) ->
Helpers.Account.balance account2 >>=? fun balance2 ->
Helpers.Endorse.endorse ~slot:slot2 ~force:true account2 block1 >>=? fun _ops ->
Assert.balance_equal ~msg:__LOC__ account2
@ -151,7 +151,7 @@ let test_endorsement_rewards
(* working on head *)
Helpers.Endorse.endorsers_list (`Hash head) baccounts >>=? fun accounts ->
get_endorser_except_b1 accounts >>=? fun (account3, slot3) ->
get_endorser_except [ b1 ] accounts >>=? fun (account3, slot3) ->
Helpers.Account.balance account3 >>=? fun balance3 ->
Helpers.Endorse.endorse
~slot:slot3 ~force:true account3 (`Hash head) >>=? fun ops ->
@ -160,7 +160,7 @@ let test_endorsement_rewards
(* working on fork *)
Helpers.Endorse.endorsers_list (`Hash fork) baccounts >>=? fun accounts ->
get_endorser_except_b1 accounts >>=? fun (account4, slot4) ->
get_endorser_except [ b1 ] accounts >>=? fun (account4, slot4) ->
Helpers.Account.balance account4 >>=? fun _balance4 ->
Helpers.Endorse.endorse ~slot:slot4 ~force:true account4 (`Hash fork) >>=? fun ops ->
Helpers.Mining.mine ~fitness_gap:2 ~operations:[ ops ] b1 (`Hash fork) >>=? fun _new_fork ->
@ -200,11 +200,11 @@ let run head (({ b1 ; b2 ; b3 ; b4 ; b5 } : Helpers.Account.bootstrap_accounts)
test_endorsement_rights b1 head >>=? fun has_right_to_endorse ->
Assert.equal_bool ~msg:__LOC__ has_right_to_endorse true ;
Assert.balance_equal ~msg:__LOC__ b1 2_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b2 2_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b3 2_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b4 2_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b5 2_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b1 4_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b2 4_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b3 4_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b4 4_000_000_00L >>=? fun () ->
Assert.balance_equal ~msg:__LOC__ b5 4_000_000_00L >>=? fun () ->
(* Check Rewards *)
test_endorsement_rewards head baccounts >>=? fun head ->