Clarify internal sender/source options
This commit is contained in:
parent
ffe0bfb428
commit
23353b0e27
@ -75,7 +75,7 @@ let make_dry_run_options (opts : dry_run_options) : options result =
|
||||
match Memory_proto_alpha.Protocol.Alpha_context.Timestamp.of_notation st with
|
||||
| Some t -> ok (Some t)
|
||||
| None -> simple_fail ("\""^st^"\" is a bad timestamp notation") in
|
||||
ok @@ make_options ?predecessor_timestamp:predecessor_timestamp ~amount ?source:sender ?payer:source ()
|
||||
ok @@ make_options ?predecessor_timestamp:predecessor_timestamp ~amount ?sender ?source ()
|
||||
|
||||
let ex_value_ty_to_michelson (v : ex_typed_value) : Michelson.t result =
|
||||
let (Ex_typed_value (value , ty)) = v in
|
||||
|
@ -204,8 +204,8 @@ let transfer () =
|
||||
in
|
||||
let%bind () =
|
||||
let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in
|
||||
let payer = first_contract in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () in
|
||||
let source = first_contract in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in
|
||||
expect_eq_n_strict_pos_small ~options program "transfer_single" make_input make_expected in
|
||||
ok ()
|
||||
in
|
||||
@ -234,8 +234,8 @@ let sell () =
|
||||
in
|
||||
let%bind () =
|
||||
let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in
|
||||
let payer = first_contract in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () in
|
||||
let source = first_contract in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in
|
||||
expect_n_strict_pos_small ~options program "sell_single" make_input make_expecter in
|
||||
ok ()
|
||||
in
|
||||
|
@ -78,7 +78,7 @@ let commit () =
|
||||
let options =
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~predecessor_timestamp
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
()
|
||||
in
|
||||
expect_eq ~options program "commit"
|
||||
@ -127,7 +127,7 @@ let reveal_young_commit () =
|
||||
let options =
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~predecessor_timestamp
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
()
|
||||
in
|
||||
expect_string_failwith ~options program "reveal"
|
||||
@ -159,7 +159,7 @@ let reveal_breaks_commit () =
|
||||
let options =
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~predecessor_timestamp
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
()
|
||||
in
|
||||
expect_string_failwith ~options program "reveal"
|
||||
@ -191,7 +191,7 @@ let reveal_wrong_commit () =
|
||||
let options =
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~predecessor_timestamp
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
()
|
||||
in
|
||||
expect_string_failwith ~options program "reveal"
|
||||
@ -223,7 +223,7 @@ let reveal_no_reuse () =
|
||||
let options =
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~predecessor_timestamp
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
()
|
||||
in
|
||||
expect_string_failwith ~options program "reveal"
|
||||
@ -256,7 +256,7 @@ let reveal () =
|
||||
let options =
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~predecessor_timestamp
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
()
|
||||
in
|
||||
expect_eq ~options program "reveal"
|
||||
|
@ -48,7 +48,7 @@ let buy_id () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) ()
|
||||
in
|
||||
let new_website = e_bytes_string "ligolang.org" in
|
||||
@ -81,7 +81,7 @@ let buy_id_sender_addr () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) ()
|
||||
in
|
||||
let new_website = e_bytes_string "ligolang.org" in
|
||||
@ -115,7 +115,7 @@ let buy_id_wrong_amount () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) ()
|
||||
in
|
||||
let param = e_pair owner_website (e_some (e_address new_addr)) in
|
||||
@ -134,7 +134,7 @@ let update_details_owner () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -175,7 +175,7 @@ let update_details_controller () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -217,7 +217,7 @@ let update_details_nonexistent () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -284,7 +284,7 @@ let update_details_unchanged () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -316,7 +316,7 @@ let update_owner () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -355,7 +355,7 @@ let update_owner_nonexistent () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -386,7 +386,7 @@ let update_owner_wrong_addr () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||
()
|
||||
in
|
||||
@ -416,7 +416,7 @@ let skip () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) ()
|
||||
in
|
||||
let new_website = e_bytes_string "ligolang.org" in
|
||||
@ -450,7 +450,7 @@ let skip_wrong_amount () =
|
||||
in
|
||||
let new_addr = first_owner in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||
~payer:first_contract
|
||||
~sender:first_contract
|
||||
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) ()
|
||||
in
|
||||
let new_website = e_bytes_string "ligolang.org" in
|
||||
|
@ -73,8 +73,8 @@ let wrong_addr () =
|
||||
id_counter_list = [1,0 ; 2,0] ;
|
||||
msg_store_list = []
|
||||
} in
|
||||
let source = contract 3 in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 3 in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
let%bind () =
|
||||
let exp_failwith = "Unauthorized address" in
|
||||
expect_string_failwith ~options program "main"
|
||||
@ -89,8 +89,8 @@ let message_size_exceeded () =
|
||||
id_counter_list = [1,0] ;
|
||||
msg_store_list = []
|
||||
} in
|
||||
let source = contract 1 in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
let%bind () =
|
||||
let exp_failwith = "Message size exceed maximum limit" in
|
||||
expect_string_failwith ~options program "main"
|
||||
@ -107,8 +107,8 @@ let maximum_number_of_proposal () =
|
||||
id_counter_list = [1,1] ;
|
||||
msg_store_list = [(bytes1, e_set [e_address@@ addr 1])]
|
||||
} in
|
||||
let source = contract 1 in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
let%bind () =
|
||||
let exp_failwith = "Maximum number of proposal reached" in
|
||||
expect_string_failwith ~options program "main"
|
||||
@ -126,8 +126,8 @@ let send_already_accounted () =
|
||||
msg_store_list = [(bytes, e_set [e_address@@ addr 1])]
|
||||
} in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair (send_param empty_message) init_storage) (e_pair empty_op_list init_storage)
|
||||
|
||||
@ -147,8 +147,8 @@ let send_never_accounted () =
|
||||
msg_store_list = [(bytes, e_set [e_address@@ addr 1])] ;
|
||||
} in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair (send_param empty_message) init_storage) (e_pair empty_op_list final_storage)
|
||||
|
||||
@ -168,8 +168,8 @@ let withdraw_already_accounted_one () =
|
||||
id_counter_list = [1,0 ; 2,0] ;
|
||||
msg_store_list = [] } in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
||||
|
||||
@ -189,8 +189,8 @@ let withdraw_already_accounted_two () =
|
||||
id_counter_list = [1,0 ; 2,1] ;
|
||||
msg_store_list = [(bytes, e_set [e_address@@ addr 2])] } in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
||||
|
||||
@ -212,8 +212,8 @@ let counters_reset () =
|
||||
id_counter_list = [1,0 ; 2,0 ; 3,0] ;
|
||||
msg_store_list = [] } in
|
||||
let options =
|
||||
let source = contract 3 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 3 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
||||
|
||||
@ -227,8 +227,8 @@ let withdraw_never_accounted () =
|
||||
msg_store_list = [] ;
|
||||
} in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair param init_storage) (e_pair empty_op_list init_storage)
|
||||
|
||||
@ -243,8 +243,8 @@ let succeeded_storing () =
|
||||
msg_store_list = [(bytes, e_typed_set [] t_address)] ;
|
||||
} in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
let%bind () = expect_eq_n_trace_aux ~options [1;2] program "main"
|
||||
(fun th ->
|
||||
let init_storage = storage (init_storage th) in
|
||||
|
@ -44,8 +44,8 @@ let change_addr_success () =
|
||||
let init_storage = storage 1 in
|
||||
let param = entry_change_addr 2 in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair param init_storage) (e_pair empty_op_list (storage 2))
|
||||
|
||||
@ -54,8 +54,8 @@ let change_addr_fail () =
|
||||
let init_storage = storage 1 in
|
||||
let param = entry_change_addr 2 in
|
||||
let options =
|
||||
let source = contract 3 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 3 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
let exp_failwith = "Unauthorized sender" in
|
||||
expect_string_failwith ~options program "main"
|
||||
(e_pair param init_storage) exp_failwith
|
||||
@ -65,8 +65,8 @@ let pass_message_success () =
|
||||
let init_storage = storage 1 in
|
||||
let param = entry_pass_message in
|
||||
let options =
|
||||
let source = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 1 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
expect_eq ~options program "main"
|
||||
(e_pair param init_storage) (e_pair empty_op_list init_storage)
|
||||
|
||||
@ -75,8 +75,8 @@ let pass_message_fail () =
|
||||
let init_storage = storage 1 in
|
||||
let param = entry_pass_message in
|
||||
let options =
|
||||
let source = contract 2 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
||||
let sender = contract 2 in
|
||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||
let exp_failwith = "Unauthorized sender" in
|
||||
expect_string_failwith ~options program "main"
|
||||
(e_pair param init_storage) exp_failwith
|
||||
|
@ -1067,9 +1067,9 @@ type options = {
|
||||
let make_options
|
||||
?(tezos_context = dummy_environment.tezos_context)
|
||||
?(predecessor_timestamp = dummy_environment.tezos_context.predecessor_timestamp)
|
||||
?(source = (List.nth dummy_environment.identities 0).implicit_contract)
|
||||
?(sender = (List.nth dummy_environment.identities 0).implicit_contract)
|
||||
?(self = (List.nth dummy_environment.identities 0).implicit_contract)
|
||||
?(payer = (List.nth dummy_environment.identities 1).implicit_contract)
|
||||
?(source = (List.nth dummy_environment.identities 1).implicit_contract)
|
||||
?(amount = Alpha_context.Tez.one)
|
||||
?(chain_id = Environment.Chain_id.zero)
|
||||
()
|
||||
@ -1077,9 +1077,10 @@ let make_options
|
||||
let tezos_context = { tezos_context with predecessor_timestamp } in
|
||||
{
|
||||
tezos_context ;
|
||||
source ;
|
||||
(* yep *)
|
||||
source = sender ;
|
||||
payer = source ;
|
||||
self ;
|
||||
payer ;
|
||||
amount ;
|
||||
chain_id ;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user