Alpha: remove unused parameters
This commit is contained in:
parent
25ecd68b90
commit
c167d0eaae
@ -597,7 +597,7 @@ let apply_sourced_operation ctxt pred_block block_prio operation ops =
|
||||
fork_test_chain ctxt hash expiration >>= fun ctxt ->
|
||||
return (ctxt, Dictator_operation_result)
|
||||
|
||||
let apply_anonymous_operation ctxt _delegate kind =
|
||||
let apply_anonymous_operation ctxt kind =
|
||||
match kind with
|
||||
| Seed_nonce_revelation { level ; nonce } ->
|
||||
let level = Level.from_raw ctxt level in
|
||||
@ -698,13 +698,13 @@ let apply_anonymous_operation ctxt _delegate kind =
|
||||
return (ctxt, Activation_result [(* FIXME *)])
|
||||
|
||||
let apply_operation
|
||||
ctxt delegate pred_block block_prio hash operation =
|
||||
ctxt pred_block block_prio hash operation =
|
||||
let ctxt = Contract.init_origination_nonce ctxt hash in
|
||||
begin match operation.contents with
|
||||
| Anonymous_operations ops ->
|
||||
fold_left_s
|
||||
(fun (ctxt, acc) op ->
|
||||
apply_anonymous_operation ctxt delegate op >>=? fun (ctxt, result) ->
|
||||
apply_anonymous_operation ctxt op >>=? fun (ctxt, result) ->
|
||||
return (ctxt, result :: acc))
|
||||
(ctxt, []) ops
|
||||
>>=? fun (ctxt, results) ->
|
||||
|
@ -141,12 +141,8 @@ module I = struct
|
||||
| None -> Error_monad.fail Operation.Cannot_parse_operation
|
||||
| Some (shell, contents) ->
|
||||
let operation = { shell ; contents ; signature } in
|
||||
let level = Level.succ ctxt (Level.current ctxt) in
|
||||
Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (baker_pk, _)) ->
|
||||
let baker_pkh = Signature.Public_key.hash baker_pk in
|
||||
let block_prio = 0 in
|
||||
Apply.apply_operation
|
||||
ctxt (Some baker_pkh) pred_block block_prio hash operation
|
||||
Apply.apply_operation ctxt pred_block block_prio hash operation
|
||||
>>=? fun (_, result) -> return result
|
||||
|
||||
end
|
||||
|
@ -103,18 +103,17 @@ let begin_construction
|
||||
return { mode ; ctxt ; op_count = 0 ; deposit }
|
||||
|
||||
let apply_operation ({ mode ; ctxt ; op_count ; _ } as data) operation =
|
||||
let pred_block, block_prio, baker =
|
||||
let pred_block, block_prio =
|
||||
match mode with
|
||||
| Partial_construction { predecessor } ->
|
||||
predecessor, 0, None
|
||||
predecessor, 0
|
||||
| Application
|
||||
{ baker ; block_header = { shell = { predecessor ; _ } ;
|
||||
protocol_data ; _ } }
|
||||
| Full_construction { predecessor ; protocol_data ; baker } ->
|
||||
{ block_header = { shell = { predecessor ; _ } ;
|
||||
protocol_data ; _ } ; _ }
|
||||
| Full_construction { predecessor ; protocol_data ; _ } ->
|
||||
predecessor,
|
||||
protocol_data.priority,
|
||||
Some baker in
|
||||
Apply.apply_operation ctxt baker pred_block block_prio
|
||||
protocol_data.priority in
|
||||
Apply.apply_operation ctxt pred_block block_prio
|
||||
(Alpha_context.Operation.hash operation) operation
|
||||
>>=? fun (ctxt, _) ->
|
||||
let op_count = op_count + 1 in
|
||||
|
@ -33,13 +33,12 @@ let bind_result (tc, result) =
|
||||
return (contracts, tc)
|
||||
|
||||
let operation
|
||||
~tc ?(baker: Helpers_account.t option) ?(src: Helpers_account.t option)
|
||||
~tc ?(src: Helpers_account.t option)
|
||||
pred_block_hash op_sh proto_op =
|
||||
return @@ Helpers_operation.apply_of_proto src op_sh proto_op >>=? fun operation ->
|
||||
let hash = Proto_alpha.Alpha_context.Operation.hash operation in
|
||||
Proto_alpha.Apply.apply_operation
|
||||
tc
|
||||
(Option.map ~f:(fun x -> x.Helpers_account.hpub) baker)
|
||||
pred_block_hash
|
||||
0
|
||||
hash
|
||||
@ -47,7 +46,7 @@ let operation
|
||||
>>=? bind_result
|
||||
|
||||
|
||||
let transaction ~tc ?(fee = 0) ?baker
|
||||
let transaction ~tc ?(fee = 0)
|
||||
pbh opsh src (dst: Helpers_account.t)
|
||||
amount =
|
||||
Helpers_operation.transaction_full
|
||||
@ -57,13 +56,13 @@ let transaction ~tc ?(fee = 0) ?baker
|
||||
(Proto_alpha.Alpha_context.Constants.hard_gas_limit_per_operation tc)
|
||||
@@ Helpers_cast.ctxt_of_tc tc
|
||||
>>=? fun protop ->
|
||||
operation ~tc ?baker ~src pbh opsh protop
|
||||
operation ~tc ~src pbh opsh protop
|
||||
|
||||
|
||||
let transaction_pred ?tc ~(pred: Helpers_block.result) ?baker (src, dst, amount, fee) =
|
||||
let transaction_pred ?tc ~(pred: Helpers_block.result) (src, dst, amount, fee) =
|
||||
let tc = Option.unopt ~default:pred.tezos_context tc in
|
||||
let fee = Option.unopt ~default:10 fee in
|
||||
transaction ~tc ~fee ?baker pred.hash (Helpers_block.get_op_header_res pred) src dst amount
|
||||
transaction ~tc ~fee pred.hash (Helpers_block.get_op_header_res pred) src dst amount
|
||||
|
||||
|
||||
let script_origination
|
||||
@ -72,11 +71,11 @@ let script_origination
|
||||
script src (Helpers_cast.cents_of_int amount)
|
||||
(Proto_alpha.Alpha_context.Constants.hard_gas_limit_per_operation tc)
|
||||
@@ Helpers_cast.ctxt_of_tc tc
|
||||
>>=? fun protop -> operation ~tc ?baker: None ~src pbh opsh protop
|
||||
>>=? fun protop -> operation ~tc ~src pbh opsh protop
|
||||
|
||||
|
||||
let origination
|
||||
~tc ?baker ?(spendable = true) ?(fee = 0) ?(delegatable = true)
|
||||
~tc ?(spendable = true) ?(fee = 0) ?(delegatable = true)
|
||||
pbh opsh src amount =
|
||||
Helpers_operation.origination_full
|
||||
src ~spendable ~delegatable
|
||||
@ -84,7 +83,7 @@ let origination
|
||||
(Proto_alpha.Alpha_context.Constants.hard_gas_limit_per_operation tc)
|
||||
@@ Helpers_cast.ctxt_of_tc tc
|
||||
>>=? fun protop ->
|
||||
operation ~tc ?baker ~src pbh opsh protop
|
||||
operation ~tc ~src pbh opsh protop
|
||||
|
||||
|
||||
let script_origination_pred
|
||||
@ -94,25 +93,25 @@ let script_origination_pred
|
||||
|
||||
|
||||
let origination_pred
|
||||
?tc ?baker ~(pred: Helpers_block.result) (src, amount, spendable, delegatable, fee) =
|
||||
?tc ~(pred: Helpers_block.result) (src, amount, spendable, delegatable, fee) =
|
||||
let tc = Option.unopt ~default:pred.tezos_context tc in
|
||||
origination ~tc ?baker ~spendable ~fee ~delegatable
|
||||
origination ~tc ~spendable ~fee ~delegatable
|
||||
pred.hash
|
||||
(Helpers_block.get_op_header_res pred)
|
||||
src amount
|
||||
|
||||
|
||||
let delegation ~tc ?baker ?(fee = 0) pbh opsh src delegate =
|
||||
let delegation ~tc ?(fee = 0) pbh opsh src delegate =
|
||||
Helpers_operation.delegation_full
|
||||
src delegate ~fee:(Helpers_cast.cents_of_int fee)
|
||||
@@ Helpers_cast.ctxt_of_tc tc
|
||||
>>=? fun protop ->
|
||||
operation ~tc ?baker ~src pbh opsh protop
|
||||
operation ~tc ~src pbh opsh protop
|
||||
|
||||
|
||||
let delegation_pred
|
||||
?tc ?baker ~(pred: Helpers_block.result) (src, delegate, fee) =
|
||||
?tc ~(pred: Helpers_block.result) (src, delegate, fee) =
|
||||
let tc = Option.unopt ~default:pred.tezos_context tc in
|
||||
delegation ~tc ?baker ~fee pred.hash (Helpers_block.get_op_header_res pred) src delegate
|
||||
delegation ~tc ~fee pred.hash (Helpers_block.get_op_header_res pred) src delegate
|
||||
|
||||
|
||||
|
@ -13,17 +13,17 @@ open Proto_alpha
|
||||
open Alpha_context
|
||||
|
||||
val operation :
|
||||
tc:context -> ?baker:Helpers_account.t -> ?src:Helpers_account.t ->
|
||||
tc:context -> ?src:Helpers_account.t ->
|
||||
Block_hash.t -> Tezos_base.Operation.shell_header -> proto_operation ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
val transaction :
|
||||
tc:context -> ?fee:int -> ?baker:Helpers_account.t -> Block_hash.t ->
|
||||
tc:context -> ?fee:int -> Block_hash.t ->
|
||||
Tezos_base.Operation.shell_header -> Helpers_account.t -> Helpers_account.t -> int ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
val transaction_pred :
|
||||
?tc:t -> pred:Helpers_block.result -> ?baker:Helpers_account.t ->
|
||||
?tc:t -> pred:Helpers_block.result ->
|
||||
Helpers_account.t * Helpers_account.t * int * int option ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
@ -33,7 +33,7 @@ val script_origination :
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
val origination :
|
||||
tc:context -> ?baker:Helpers_account.t -> ?spendable:bool -> ?fee:int ->
|
||||
tc:context -> ?spendable:bool -> ?fee:int ->
|
||||
?delegatable:bool -> Block_hash.t -> Tezos_base.Operation.shell_header ->
|
||||
Helpers_account.t -> int ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
@ -43,16 +43,16 @@ val script_origination_pred :
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
val origination_pred :
|
||||
?tc:t -> ?baker:Helpers_account.t -> pred:Helpers_block.result ->
|
||||
?tc:t -> pred:Helpers_block.result ->
|
||||
Helpers_account.t * int * bool * bool * int ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
val delegation :
|
||||
tc:context -> ?baker:Helpers_account.t -> ?fee:int -> Block_hash.t ->
|
||||
tc:context -> ?fee:int -> Block_hash.t ->
|
||||
Tezos_base.Operation.shell_header -> Helpers_account.t -> public_key_hash ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
||||
val delegation_pred :
|
||||
?tc:t -> ?baker:Helpers_account.t -> pred:Helpers_block.result ->
|
||||
?tc:t -> pred:Helpers_block.result ->
|
||||
Helpers_account.t * public_key_hash * int ->
|
||||
(Contract.contract list * context) proto_tzresult Lwt.t
|
||||
|
@ -20,12 +20,11 @@ open Helpers_block
|
||||
let (>>?=) = Assert.(>>?=)
|
||||
let (>>=??) = Assert.(>>=??)
|
||||
|
||||
let originate root ?(tc=root.tezos_context) ?baker ?spendable ?fee ?delegatable src amount =
|
||||
let originate root ?(tc=root.tezos_context) ?spendable ?fee ?delegatable src amount =
|
||||
let delegatable = Option.unopt ~default:true delegatable in
|
||||
let spendable = Option.unopt ~default:true spendable in
|
||||
let fee = Option.unopt ~default:10 fee in
|
||||
Apply.origination_pred
|
||||
?baker
|
||||
~tc
|
||||
~pred: root
|
||||
(src, amount, spendable, delegatable, fee)
|
||||
@ -40,10 +39,9 @@ let test_simple_origination () =
|
||||
return ()
|
||||
|
||||
|
||||
let delegate root ?(tc=root.tezos_context) ?baker ?fee src delegate =
|
||||
let delegate root ?(tc=root.tezos_context) ?fee src delegate =
|
||||
let fee = Option.unopt ~default:10 fee in
|
||||
Apply.delegation_pred
|
||||
?baker
|
||||
~tc
|
||||
~pred: root
|
||||
(src, delegate, fee)
|
||||
|
Loading…
Reference in New Issue
Block a user