Faucet: rename secret
into activation_code
This commit is contained in:
parent
92bb69e744
commit
367cc4e916
@ -104,7 +104,7 @@ if __name__ == '__main__':
|
|||||||
"email" : email,
|
"email" : email,
|
||||||
"password" : password,
|
"password" : password,
|
||||||
"amount" : str(amount),
|
"amount" : str(amount),
|
||||||
"secret" : secret }
|
"activation_code" : secret }
|
||||||
for pkh, (mnemonic, email, password, amount, secret) in secrets.iteritems()], f, indent=1)
|
for pkh, (mnemonic, email, password, amount, secret) in secrets.iteritems()], f, indent=1)
|
||||||
else:
|
else:
|
||||||
wallets = get_wallets( sys.argv[1] )
|
wallets = get_wallets( sys.argv[1] )
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"mnemonic": ["flag", "quote", "will", "valley", "mouse", "chat", "hold", "prosper", "silk", "tent", "cruel", "cause", "demise", "bottom", "practice"],
|
"mnemonic": ["flag", "quote", "will", "valley", "mouse", "chat", "hold", "prosper", "silk", "tent", "cruel", "cause", "demise", "bottom", "practice"],
|
||||||
"secret": "41f98b15efc63fa893d61d7d6eee4a2ce9427ac4",
|
"activation_code": "41f98b15efc63fa893d61d7d6eee4a2ce9427ac4",
|
||||||
"amount": "72954577464032",
|
"amount": "72954577464032",
|
||||||
"pkh": "tz1X4maqF9tC1Yn4jULjHRAyzjAtc25Z68TX",
|
"pkh": "tz1X4maqF9tC1Yn4jULjHRAyzjAtc25Z68TX",
|
||||||
"password": "MHErskWPE6",
|
"password": "MHErskWPE6",
|
||||||
|
@ -237,26 +237,49 @@ let originate_contract
|
|||||||
type activation_key =
|
type activation_key =
|
||||||
{ pkh : Ed25519.Public_key_hash.t ;
|
{ pkh : Ed25519.Public_key_hash.t ;
|
||||||
amount : Tez.t ;
|
amount : Tez.t ;
|
||||||
secret : Blinded_public_key_hash.secret ;
|
activation_code : Blinded_public_key_hash.activation_code ;
|
||||||
mnemonic : string list ;
|
mnemonic : string list ;
|
||||||
password : string ;
|
password : string ;
|
||||||
email : string ;
|
email : string ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let raw_activation_key_encoding =
|
||||||
|
let open Data_encoding in
|
||||||
|
obj6
|
||||||
|
(req "pkh" Ed25519.Public_key_hash.encoding)
|
||||||
|
(req "amount" Tez.encoding)
|
||||||
|
(req "activation_code" Blinded_public_key_hash.activation_code_encoding)
|
||||||
|
(req "mnemonic" (list string))
|
||||||
|
(req "password" string)
|
||||||
|
(req "email" string)
|
||||||
|
|
||||||
let activation_key_encoding =
|
let activation_key_encoding =
|
||||||
|
(* Hack: allow compatibility with older encoding *)
|
||||||
let open Data_encoding in
|
let open Data_encoding in
|
||||||
conv
|
conv
|
||||||
(fun { pkh ; amount ; secret ; mnemonic ; password ; email } ->
|
(fun { pkh ; amount ; activation_code ; mnemonic ; password ; email } ->
|
||||||
( pkh, amount, secret, mnemonic, password, email ))
|
( pkh, amount, activation_code, mnemonic, password, email ))
|
||||||
(fun ( pkh, amount, secret, mnemonic, password, email ) ->
|
(fun ( pkh, amount, activation_code, mnemonic, password, email ) ->
|
||||||
{ pkh ; amount ; secret ; mnemonic ; password ; email })
|
{ pkh ; amount ; activation_code ; mnemonic ; password ; email }) @@
|
||||||
(obj6
|
splitted
|
||||||
(req "pkh" Ed25519.Public_key_hash.encoding)
|
~binary:raw_activation_key_encoding
|
||||||
(req "amount" Tez.encoding)
|
~json:
|
||||||
(req "secret" Blinded_public_key_hash.secret_encoding)
|
(union [
|
||||||
(req "mnemonic" (list string))
|
case Json_only
|
||||||
(req "password" string)
|
raw_activation_key_encoding
|
||||||
(req "email" string))
|
(fun x -> Some x)
|
||||||
|
(fun x -> x) ;
|
||||||
|
case Json_only
|
||||||
|
(obj6
|
||||||
|
(req "pkh" Ed25519.Public_key_hash.encoding)
|
||||||
|
(req "amount" Tez.encoding)
|
||||||
|
(req "secret" Blinded_public_key_hash.activation_code_encoding)
|
||||||
|
(req "mnemonic" (list string))
|
||||||
|
(req "password" string)
|
||||||
|
(req "email" string))
|
||||||
|
(fun _ -> None)
|
||||||
|
(fun x -> x) ;
|
||||||
|
])
|
||||||
|
|
||||||
let read_key key =
|
let read_key key =
|
||||||
match Bip39.of_words key.mnemonic with
|
match Bip39.of_words key.mnemonic with
|
||||||
@ -283,7 +306,7 @@ let claim_commitment (cctxt : #Proto_alpha.full)
|
|||||||
Ed25519.Public_key_hash.pp key.pkh) >>=? fun () ->
|
Ed25519.Public_key_hash.pp key.pkh) >>=? fun () ->
|
||||||
let contents =
|
let contents =
|
||||||
Anonymous_operations
|
Anonymous_operations
|
||||||
[ Activation { id = key.pkh ; secret = key.secret } ] in
|
[ Activation { id = key.pkh ; activation_code = key.activation_code } ] in
|
||||||
Injection.inject_operation cctxt ?confirmations block contents >>=? fun (_oph, _op, _result as res) ->
|
Injection.inject_operation cctxt ?confirmations block contents >>=? fun (_oph, _op, _result as res) ->
|
||||||
let pk_uri = Tezos_signer_backends.Unencrypted.make_pk pk in
|
let pk_uri = Tezos_signer_backends.Unencrypted.make_pk pk in
|
||||||
begin
|
begin
|
||||||
|
@ -141,7 +141,7 @@ val dictate :
|
|||||||
type activation_key =
|
type activation_key =
|
||||||
{ pkh : Ed25519.Public_key_hash.t ;
|
{ pkh : Ed25519.Public_key_hash.t ;
|
||||||
amount : Tez.t ;
|
amount : Tez.t ;
|
||||||
secret : Blinded_public_key_hash.secret ;
|
activation_code : Blinded_public_key_hash.activation_code ;
|
||||||
mnemonic : string list ;
|
mnemonic : string list ;
|
||||||
password : string ;
|
password : string ;
|
||||||
email : string ;
|
email : string ;
|
||||||
|
@ -745,7 +745,7 @@ and anonymous_operation =
|
|||||||
}
|
}
|
||||||
| Activation of {
|
| Activation of {
|
||||||
id: Ed25519.Public_key_hash.t ;
|
id: Ed25519.Public_key_hash.t ;
|
||||||
secret: Blinded_public_key_hash.secret ;
|
activation_code: Blinded_public_key_hash.activation_code ;
|
||||||
}
|
}
|
||||||
|
|
||||||
and sourced_operation =
|
and sourced_operation =
|
||||||
|
@ -690,8 +690,9 @@ let apply_anonymous_operation ctxt kind =
|
|||||||
| Error _ -> Tez.zero in
|
| Error _ -> Tez.zero in
|
||||||
add_rewards ctxt reward >>=? fun ctxt ->
|
add_rewards ctxt reward >>=? fun ctxt ->
|
||||||
return (ctxt, Double_baking_evidence_result [(* FIXME *)])
|
return (ctxt, Double_baking_evidence_result [(* FIXME *)])
|
||||||
| Activation { id = pkh ; secret } ->
|
| Activation { id = pkh ; activation_code } ->
|
||||||
let blinded_pkh = Blinded_public_key_hash.of_ed25519_pkh secret pkh in
|
let blinded_pkh =
|
||||||
|
Blinded_public_key_hash.of_ed25519_pkh activation_code pkh in
|
||||||
Commitment.get_opt ctxt blinded_pkh >>=? function
|
Commitment.get_opt ctxt blinded_pkh >>=? function
|
||||||
| None -> fail (Invalid_activation { pkh })
|
| None -> fail (Invalid_activation { pkh })
|
||||||
| Some amount ->
|
| Some amount ->
|
||||||
|
@ -17,17 +17,17 @@ include Blake2B.Make(Base58)(struct
|
|||||||
let () =
|
let () =
|
||||||
Base58.check_encoded_prefix b58check_encoding "btz1" 37
|
Base58.check_encoded_prefix b58check_encoding "btz1" 37
|
||||||
|
|
||||||
let of_ed25519_pkh secret pkh =
|
let of_ed25519_pkh activation_code pkh =
|
||||||
hash_bytes ~key:secret [ Ed25519.Public_key_hash.to_bytes pkh ]
|
hash_bytes ~key:activation_code [ Ed25519.Public_key_hash.to_bytes pkh ]
|
||||||
|
|
||||||
type secret = MBytes.t
|
type activation_code = MBytes.t
|
||||||
|
|
||||||
let secret_size = Ed25519.Public_key_hash.size
|
let activation_code_size = Ed25519.Public_key_hash.size
|
||||||
let secret_encoding = Data_encoding.Fixed.bytes secret_size
|
let activation_code_encoding = Data_encoding.Fixed.bytes activation_code_size
|
||||||
|
|
||||||
let secret_of_hex h =
|
let activation_code_of_hex h =
|
||||||
if Compare.Int.(String.length h <> secret_size * 2) then
|
if Compare.Int.(String.length h <> activation_code_size * 2) then
|
||||||
invalid_arg "Blinded_public_key_hash.secret_of_hex" ;
|
invalid_arg "Blinded_public_key_hash.activation_code_of_hex" ;
|
||||||
MBytes.of_hex (`Hex h)
|
MBytes.of_hex (`Hex h)
|
||||||
|
|
||||||
module Index = struct
|
module Index = struct
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
include S.HASH
|
include S.HASH
|
||||||
|
|
||||||
type secret
|
type activation_code
|
||||||
val secret_encoding : secret Data_encoding.t
|
val activation_code_encoding : activation_code Data_encoding.t
|
||||||
|
|
||||||
val of_ed25519_pkh : secret -> Ed25519.Public_key_hash.t -> t
|
val of_ed25519_pkh : activation_code -> Ed25519.Public_key_hash.t -> t
|
||||||
|
|
||||||
val secret_of_hex : string -> secret
|
val activation_code_of_hex : string -> activation_code
|
||||||
|
|
||||||
module Index : sig
|
module Index : sig
|
||||||
type nonrec t = t
|
type nonrec t = t
|
||||||
|
@ -45,7 +45,7 @@ and anonymous_operation =
|
|||||||
}
|
}
|
||||||
| Activation of {
|
| Activation of {
|
||||||
id: Ed25519.Public_key_hash.t ;
|
id: Ed25519.Public_key_hash.t ;
|
||||||
secret: Blinded_public_key_hash.secret ;
|
activation_code: Blinded_public_key_hash.activation_code ;
|
||||||
}
|
}
|
||||||
|
|
||||||
and sourced_operation =
|
and sourced_operation =
|
||||||
@ -368,15 +368,15 @@ module Encoding = struct
|
|||||||
(obj3
|
(obj3
|
||||||
(req "kind" (constant "activation"))
|
(req "kind" (constant "activation"))
|
||||||
(req "pkh" Ed25519.Public_key_hash.encoding)
|
(req "pkh" Ed25519.Public_key_hash.encoding)
|
||||||
(req "secret" Blinded_public_key_hash.secret_encoding))
|
(req "activation_code" Blinded_public_key_hash.activation_code_encoding))
|
||||||
|
|
||||||
let activation_case tag =
|
let activation_case tag =
|
||||||
case tag activation_encoding
|
case tag activation_encoding
|
||||||
(function
|
(function
|
||||||
| Activation { id ; secret } -> Some ((), id, secret)
|
| Activation { id ; activation_code } -> Some ((), id, activation_code)
|
||||||
| _ -> None
|
| _ -> None
|
||||||
)
|
)
|
||||||
(fun ((), id, secret) -> Activation { id ; secret })
|
(fun ((), id, activation_code) -> Activation { id ; activation_code })
|
||||||
|
|
||||||
let anonymous_operations_case tag op_encoding =
|
let anonymous_operations_case tag op_encoding =
|
||||||
case tag
|
case tag
|
||||||
|
@ -45,7 +45,7 @@ and anonymous_operation =
|
|||||||
}
|
}
|
||||||
| Activation of {
|
| Activation of {
|
||||||
id: Ed25519.Public_key_hash.t ;
|
id: Ed25519.Public_key_hash.t ;
|
||||||
secret: Blinded_public_key_hash.secret ;
|
activation_code: Blinded_public_key_hash.activation_code ;
|
||||||
}
|
}
|
||||||
|
|
||||||
and sourced_operation =
|
and sourced_operation =
|
||||||
|
Loading…
Reference in New Issue
Block a user