Alpha: remove Faucet limit
This commit is contained in:
parent
5fa0b074bf
commit
e81c02c27a
@ -107,8 +107,5 @@ let configure_sandbox = Raw_context.configure_sandbox
|
|||||||
let activate = Raw_context.activate
|
let activate = Raw_context.activate
|
||||||
let fork_test_chain = Raw_context.fork_test_chain
|
let fork_test_chain = Raw_context.fork_test_chain
|
||||||
|
|
||||||
let faucet_count = Raw_context.faucet_count
|
|
||||||
let incr_faucet_count = Raw_context.incr_faucet_count
|
|
||||||
|
|
||||||
let endorsement_already_recorded = Raw_context.endorsement_already_recorded
|
let endorsement_already_recorded = Raw_context.endorsement_already_recorded
|
||||||
let record_endorsement = Raw_context.record_endorsement
|
let record_endorsement = Raw_context.record_endorsement
|
||||||
|
@ -769,9 +769,3 @@ val fork_test_chain: context -> Protocol_hash.t -> Time.t -> context Lwt.t
|
|||||||
|
|
||||||
val endorsement_already_recorded: context -> int -> bool
|
val endorsement_already_recorded: context -> int -> bool
|
||||||
val record_endorsement: context -> int -> context
|
val record_endorsement: context -> int -> context
|
||||||
|
|
||||||
(**/**)
|
|
||||||
|
|
||||||
(* HACK alphanet *)
|
|
||||||
val faucet_count: context -> int
|
|
||||||
val incr_faucet_count: context -> context
|
|
||||||
|
@ -15,7 +15,6 @@ type error += Wrong_voting_period of Voting_period.t * Voting_period.t (* `Tempo
|
|||||||
type error += Wrong_endorsement_predecessor of Block_hash.t * Block_hash.t (* `Temporary *)
|
type error += Wrong_endorsement_predecessor of Block_hash.t * Block_hash.t (* `Temporary *)
|
||||||
type error += Duplicate_endorsement of int (* `Branch *)
|
type error += Duplicate_endorsement of int (* `Branch *)
|
||||||
type error += Bad_contract_parameter of Contract.t * Script.expr option * Script.expr option (* `Permanent *)
|
type error += Bad_contract_parameter of Contract.t * Script.expr option * Script.expr option (* `Permanent *)
|
||||||
type error += Too_many_faucet
|
|
||||||
type error += Invalid_endorsement_level
|
type error += Invalid_endorsement_level
|
||||||
type error += Invalid_commitment of { expected: bool }
|
type error += Invalid_commitment of { expected: bool }
|
||||||
|
|
||||||
@ -87,17 +86,6 @@ let () =
|
|||||||
Data_encoding.(obj1 (req "slot" uint16))
|
Data_encoding.(obj1 (req "slot" uint16))
|
||||||
(function Duplicate_endorsement k -> Some k | _ -> None)
|
(function Duplicate_endorsement k -> Some k | _ -> None)
|
||||||
(fun k -> Duplicate_endorsement k);
|
(fun k -> Duplicate_endorsement k);
|
||||||
register_error_kind
|
|
||||||
`Temporary
|
|
||||||
~id:"operation.too_many_faucet"
|
|
||||||
~title:"Too many faucet"
|
|
||||||
~description:"Trying to include a faucet operation in a block \
|
|
||||||
\ with more than 5 faucet operations."
|
|
||||||
~pp:(fun ppf () ->
|
|
||||||
Format.fprintf ppf "Too many faucet operation.")
|
|
||||||
Data_encoding.unit
|
|
||||||
(function Too_many_faucet -> Some () | _ -> None)
|
|
||||||
(fun () -> Too_many_faucet) ;
|
|
||||||
register_error_kind
|
register_error_kind
|
||||||
`Temporary
|
`Temporary
|
||||||
~id:"operation.invalid_endorsement_level"
|
~id:"operation.invalid_endorsement_level"
|
||||||
@ -556,16 +544,11 @@ let apply_anonymous_operation ctxt delegate origination_nonce kind =
|
|||||||
| Error _ -> Tez.zero in
|
| Error _ -> Tez.zero in
|
||||||
return (ctxt, origination_nonce, Tez.zero, reward)
|
return (ctxt, origination_nonce, Tez.zero, reward)
|
||||||
| Faucet { id = manager ; _ } ->
|
| Faucet { id = manager ; _ } ->
|
||||||
(* Free tez for all! *)
|
Contract.originate ctxt
|
||||||
if Compare.Int.(faucet_count ctxt < 5) then
|
origination_nonce
|
||||||
let ctxt = incr_faucet_count ctxt in
|
~manager ~delegate ~balance:Constants.faucet_credit ?script:None
|
||||||
Contract.originate ctxt
|
~spendable:true ~delegatable:true >>=? fun (ctxt, _, origination_nonce) ->
|
||||||
origination_nonce
|
return (ctxt, origination_nonce, Tez.zero, Tez.zero)
|
||||||
~manager ~delegate ~balance:Constants.faucet_credit ?script:None
|
|
||||||
~spendable:true ~delegatable:true >>=? fun (ctxt, _, origination_nonce) ->
|
|
||||||
return (ctxt, origination_nonce, Tez.zero, Tez.zero)
|
|
||||||
else
|
|
||||||
fail Too_many_faucet
|
|
||||||
|
|
||||||
let apply_operation
|
let apply_operation
|
||||||
ctxt delegate pred_block block_prio hash operation =
|
ctxt delegate pred_block block_prio hash operation =
|
||||||
|
@ -16,7 +16,6 @@ type t = {
|
|||||||
level: Level_repr.t ;
|
level: Level_repr.t ;
|
||||||
timestamp: Time.t ;
|
timestamp: Time.t ;
|
||||||
fitness: Int64.t ;
|
fitness: Int64.t ;
|
||||||
faucet_count: int;
|
|
||||||
endorsements_received: Int_set.t;
|
endorsements_received: Int_set.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,14 +26,12 @@ let current_level ctxt = ctxt.level
|
|||||||
let current_timestamp ctxt = ctxt.timestamp
|
let current_timestamp ctxt = ctxt.timestamp
|
||||||
let current_fitness ctxt = ctxt.fitness
|
let current_fitness ctxt = ctxt.fitness
|
||||||
let first_level ctxt = ctxt.first_level
|
let first_level ctxt = ctxt.first_level
|
||||||
let faucet_count ctxt = ctxt.faucet_count
|
|
||||||
let constants ctxt = ctxt.constants
|
let constants ctxt = ctxt.constants
|
||||||
let recover ctxt = ctxt.context
|
let recover ctxt = ctxt.context
|
||||||
|
|
||||||
let record_endorsement ctxt k = { ctxt with endorsements_received = Int_set.add k ctxt.endorsements_received }
|
let record_endorsement ctxt k = { ctxt with endorsements_received = Int_set.add k ctxt.endorsements_received }
|
||||||
let endorsement_already_recorded ctxt k = Int_set.mem k ctxt.endorsements_received
|
let endorsement_already_recorded ctxt k = Int_set.mem k ctxt.endorsements_received
|
||||||
|
|
||||||
let incr_faucet_count ctxt = { ctxt with faucet_count = ctxt.faucet_count + 1 }
|
|
||||||
let set_current_fitness ctxt fitness = { ctxt with fitness }
|
let set_current_fitness ctxt fitness = { ctxt with fitness }
|
||||||
|
|
||||||
type storage_error =
|
type storage_error =
|
||||||
@ -211,8 +208,8 @@ let prepare ~level ~timestamp ~fitness ctxt =
|
|||||||
~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment
|
~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment
|
||||||
level in
|
level in
|
||||||
return ({ context = ctxt ; constants ; level ;
|
return ({ context = ctxt ; constants ; level ;
|
||||||
faucet_count = 0 ; endorsements_received = Int_set.empty ;
|
|
||||||
timestamp ; fitness ; first_level ;
|
timestamp ; fitness ; first_level ;
|
||||||
|
endorsements_received = Int_set.empty ;
|
||||||
},
|
},
|
||||||
first_block)
|
first_block)
|
||||||
|
|
||||||
@ -231,7 +228,6 @@ let register_resolvers enc resolve =
|
|||||||
level = Level_repr.root Raw_level_repr.root ;
|
level = Level_repr.root Raw_level_repr.root ;
|
||||||
timestamp = Time.of_seconds 0L ;
|
timestamp = Time.of_seconds 0L ;
|
||||||
fitness = 0L ;
|
fitness = 0L ;
|
||||||
faucet_count = 0 ;
|
|
||||||
endorsements_received = Int_set.empty ;
|
endorsements_received = Int_set.empty ;
|
||||||
} in
|
} in
|
||||||
resolve faked_context str in
|
resolve faked_context str in
|
||||||
|
@ -138,8 +138,3 @@ include T with type t := t and type context := context
|
|||||||
val record_endorsement: context -> int -> context
|
val record_endorsement: context -> int -> context
|
||||||
val endorsement_already_recorded: context -> int -> bool
|
val endorsement_already_recorded: context -> int -> bool
|
||||||
|
|
||||||
|
|
||||||
(** HACK alphanet *)
|
|
||||||
val double_roll_value: context -> int -> context tzresult Lwt.t
|
|
||||||
val faucet_count: context -> int
|
|
||||||
val incr_faucet_count: context -> context
|
|
||||||
|
@ -74,5 +74,3 @@ val delegate_pubkey:
|
|||||||
|
|
||||||
val get_contract_delegate:
|
val get_contract_delegate:
|
||||||
Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option tzresult Lwt.t
|
Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option tzresult Lwt.t
|
||||||
|
|
||||||
val value: Raw_context.t -> Tez_repr.t
|
|
||||||
|
Loading…
Reference in New Issue
Block a user