Protocol: remove half pkh in commitments
This commit is contained in:
parent
022944c662
commit
92bb69e744
@ -59,14 +59,12 @@ def genesis_commitments(wallets, blind):
|
|||||||
for pkh_b58, amount in wallets.iteritems():
|
for pkh_b58, amount in wallets.iteritems():
|
||||||
# Public key hash corresponding to this Tezos address.
|
# Public key hash corresponding to this Tezos address.
|
||||||
pkh = bitcoin.b58check_to_bin(pkh_b58)[2:]
|
pkh = bitcoin.b58check_to_bin(pkh_b58)[2:]
|
||||||
hpkh_b58 = bitcoin.bin_to_b58check((pkh[:10] + '\000' * 10), magicbyte=434591)
|
|
||||||
# The redemption code is unique to the public key hash and deterministically
|
# The redemption code is unique to the public key hash and deterministically
|
||||||
# constructed using a secret blinding value.
|
# constructed using a secret blinding value.
|
||||||
secret = secret_code(pkh, blind)
|
secret = secret_code(pkh, blind)
|
||||||
# The redemption code is used to blind the pkh
|
# The redemption code is used to blind the pkh
|
||||||
blinded_pkh = blake2b(pkh, 20, key=secret).digest()
|
blinded_pkh = blake2b(pkh, 20, key=secret).digest()
|
||||||
commitment = {
|
commitment = {
|
||||||
'half_pkh': hpkh_b58,
|
|
||||||
'blinded_pkh': bitcoin.bin_to_b58check(blinded_pkh, magicbyte=16921055),
|
'blinded_pkh': bitcoin.bin_to_b58check(blinded_pkh, magicbyte=16921055),
|
||||||
'amount': amount
|
'amount': amount
|
||||||
}
|
}
|
||||||
@ -114,7 +112,8 @@ if __name__ == '__main__':
|
|||||||
commitments = genesis_commitments(wallets, blind)
|
commitments = genesis_commitments(wallets, blind)
|
||||||
|
|
||||||
with open('commitments.json', 'w') as f:
|
with open('commitments.json', 'w') as f:
|
||||||
json.dump({ "bootstrap_accounts": [
|
json.dump({
|
||||||
|
"bootstrap_accounts": [
|
||||||
[ "edsk4X12XaKRPHgDkgvMe4UWEiygx8AVrt9rpktmhu1uT2GCPU4dp7",
|
[ "edsk4X12XaKRPHgDkgvMe4UWEiygx8AVrt9rpktmhu1uT2GCPU4dp7",
|
||||||
"12000000000000" ],
|
"12000000000000" ],
|
||||||
[ "edsk46ypB8PztxMDPMdVnEgjQmJhca7zMJvTMDrdwJaJ4mgm4qNmwE",
|
[ "edsk46ypB8PztxMDPMdVnEgjQmJhca7zMJvTMDrdwJaJ4mgm4qNmwE",
|
||||||
@ -126,11 +125,10 @@ if __name__ == '__main__':
|
|||||||
[ "edsk3T8CRr8YK2vnjsZK2vDzCjpcWpMEUXMAzjeR1GWjmyhGaDHTNV",
|
[ "edsk3T8CRr8YK2vnjsZK2vDzCjpcWpMEUXMAzjeR1GWjmyhGaDHTNV",
|
||||||
"12000000000000" ]
|
"12000000000000" ]
|
||||||
],
|
],
|
||||||
"commitments":
|
"commitments": [
|
||||||
[ (commitment['half_pkh'],
|
(commitment['blinded_pkh'], str(commitment['amount']))
|
||||||
commitment['blinded_pkh'],
|
for commitment in commitments if commitment['amount'] > 0
|
||||||
str(commitment['amount']))
|
],
|
||||||
for commitment in commitments if commitment['amount'] > 0]
|
"no_rewards_cycles": 7,
|
||||||
"no_rewards_cycles": 7,
|
"security_deposit_ramp_up_cycles": 64
|
||||||
"security_deposit_ramp_up_cycles": 64
|
|
||||||
}, f, indent=1)
|
}, f, indent=1)
|
||||||
|
@ -1,108 +0,0 @@
|
|||||||
# This file gives the commitments and the seeds used for parametrizing
|
|
||||||
# protocol alpha. This has been generated by the 'create_genesis.py'
|
|
||||||
# python script using the blind 'abc' as argument.
|
|
||||||
|
|
||||||
|
|
||||||
# Commitments
|
|
||||||
|
|
||||||
[ [ "tz1MawerETND6bqJqUe4cVBcDZn6Tiahrr2V", "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
|
||||||
[ "tz1X4maqF9tC1Yn4hzg1w5PLdeKm62qHS64V", "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
|
||||||
[ "tz1SWBY7rWMutEuWRziDhC72gTGdo29KZaRj", "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
|
||||||
[ "tz1amUjiZaevaxQy5w26LSf64bs77eNTJ8uY", "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
|
||||||
[ "tz1Zaee3QBtD4ErY1CpjigTYtX3VxWB6Ft9a", "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
|
||||||
[ "tz1geDUUhfXK1EMj7LZdP9wfcoAxR3q2QExR", "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
|
||||||
[ "tz1h3nY7jcZciJgAvgNvzgTnjuejEyiEqFGQ", "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
|
||||||
[ "tz1VzL4Xrb3fL3ckuPqw8u4H7feMAkF4cesJ", "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
|
||||||
[ "tz1RUHg536oRKhPLFHi9hit3MKbve91jWjPC", "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
|
||||||
[ "tz1M1LFbgctcPWxstKs21wgvSYBLUpaRwdx8", "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
|
||||||
]
|
|
||||||
|
|
||||||
# In order to test a contract activation in the sandbox node/client,
|
|
||||||
# one can copy one of the following seeds, store it into a json file
|
|
||||||
# and pass it to the approriate command (e.g. tezos-client claim
|
|
||||||
# commitment with <json_file>)
|
|
||||||
|
|
||||||
# Associated secret seeds
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"mnemonic": ["envelope", "hospital", "mind", "sunset", "cancel", "muscle", "leisure", "thumb", "wine", "market", "exit", "lucky", "style", "picnic", "success"],
|
|
||||||
"secret": "0f39ed0b656509c2ecec4771712d9cddefe2afac",
|
|
||||||
"amount": "23932454669343",
|
|
||||||
"pkh": "tz1MawerETND6bqJqx8GV3YHUrvMBCDasRBF",
|
|
||||||
"password": "z0eZHQQGKt",
|
|
||||||
"email": "cjgfoqmk.wpxnvnup@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["flag", "quote", "will", "valley", "mouse", "chat", "hold", "prosper", "silk", "tent", "cruel", "cause", "demise", "bottom", "practice"],
|
|
||||||
"secret": "41f98b15efc63fa893d61d7d6eee4a2ce9427ac4",
|
|
||||||
"amount": "72954577464032",
|
|
||||||
"pkh": "tz1X4maqF9tC1Yn4jULjHRAyzjAtc25Z68TX",
|
|
||||||
"password": "MHErskWPE6",
|
|
||||||
"email": "oklmcktr.ztljnpzc@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["library", "away", "inside", "paper", "wise", "focus", "sweet", "expose", "require", "change", "stove", "planet", "zone", "reflect", "finger"],
|
|
||||||
"secret": "411dfef031eeecc506de71c9df9f8e44297cf5ba",
|
|
||||||
"amount": "217487035428349",
|
|
||||||
"pkh": "tz1SWBY7rWMutEuWS54Pt33MkzAS6eWkUuTc",
|
|
||||||
"password": "0AO6BzQNfN",
|
|
||||||
"email": "ctgnkvqm.kvtiybky@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["cruel", "fluid", "damage", "demand", "mimic", "above", "village", "alpha", "vendor", "staff", "absent", "uniform", "fire", "asthma", "milk"],
|
|
||||||
"secret": "08d7d355bc3391d12d140780b39717d9f46fcf87",
|
|
||||||
"amount": "4092742372031",
|
|
||||||
"pkh": "tz1amUjiZaevaxQy5wKn4SSRvVoERCip3nZS",
|
|
||||||
"password": "9kbZ7fR6im",
|
|
||||||
"email": "bnyxxzqr.tdszcvqb@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["opera", "divorce", "easy", "myself", "idea", "aim", "dash", "scout", "case", "resource", "vote", "humor", "ticket", "client", "edge"],
|
|
||||||
"secret": "9b7cad042fba557618bdc4b62837c5f125b50e56",
|
|
||||||
"amount": "17590039016550",
|
|
||||||
"pkh": "tz1Zaee3QBtD4ErY1SzqUvyYTrENrExu6yQM",
|
|
||||||
"password": "suxT5H09yY",
|
|
||||||
"email": "iilkhohu.otnyuvna@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["token", "similar", "ginger", "tongue", "gun", "sort", "piano", "month", "hotel", "vote", "undo", "success", "hobby", "shell", "cart"],
|
|
||||||
"secret": "124c0ca217f11ffc6c7b76a743d867c8932e5afd",
|
|
||||||
"amount": "26322312350555",
|
|
||||||
"pkh": "tz1geDUUhfXK1EMj7VQdRjug1MoFe6gHWnCU",
|
|
||||||
"password": "4odVdLykaa",
|
|
||||||
"email": "kwhlglvr.slriitzy@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["shield", "warrior", "gorilla", "birth", "steak", "neither", "feel", "only", "liberty", "float", "oven", "extend", "pulse", "suffer", "vapor"],
|
|
||||||
"secret": "ac7a2125beea68caf5266a647f24dce9fea018a7",
|
|
||||||
"amount": "244951387881443",
|
|
||||||
"pkh": "tz1h3nY7jcZciJgAwRhWcrEwqfVp7VQoffur",
|
|
||||||
"password": "A6yeMqBFG8",
|
|
||||||
"email": "lvrmlbyj.yczltcxn@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["waste", "open", "scan", "tip", "subway", "dance", "rent", "copper", "garlic", "laundry", "defense", "clerk", "another", "staff", "liar"],
|
|
||||||
"secret": "2b3e94be133a960fa0ef87f6c0922c19f9d87ca2",
|
|
||||||
"amount": "80065050465525",
|
|
||||||
"pkh": "tz1VzL4Xrb3fL3ckvqCWy6bdGMzU2w9eoRqs",
|
|
||||||
"password": "oVZqpq60sk",
|
|
||||||
"email": "rfodmrha.zzdndvyk@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["fiber", "next", "property", "cradle", "silk", "obey", "gossip", "push", "key", "second", "across", "minimum", "nice", "boil", "age"],
|
|
||||||
"secret": "dac31640199f2babc157aadc0021cd71128ca9ea",
|
|
||||||
"amount": "3569618927693",
|
|
||||||
"pkh": "tz1RUHg536oRKhPLFfttcB5gSWAhh4E9TWjX",
|
|
||||||
"password": "FfytQTTVbu",
|
|
||||||
"email": "owecikdy.gxnyttya@tezos.example.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mnemonic": ["print", "labor", "budget", "speak", "poem", "diet", "chunk", "eternal", "book", "saddle", "pioneer", "ankle", "happy", "only", "exclude"],
|
|
||||||
"secret": "bb841227f250a066eb8429e56937ad504d7b34dd",
|
|
||||||
"amount": "9034781424478",
|
|
||||||
"pkh": "tz1M1LFbgctcPWxstrao9aLr2ECW1fV4pH5u",
|
|
||||||
"password": "zknAl3lrX2",
|
|
||||||
"email": "ettilrvh.zsrqrbud@tezos.example.org"
|
|
||||||
}
|
|
||||||
]
|
|
@ -7,16 +7,16 @@
|
|||||||
[ "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n", "4000000000000" ]
|
[ "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n", "4000000000000" ]
|
||||||
],
|
],
|
||||||
"commitments": [
|
"commitments": [
|
||||||
[ "tz1MawerETND6bqJqUe4cVBcDZn6Tiahrr2V", "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
[ "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
||||||
[ "tz1X4maqF9tC1Yn4hzg1w5PLdeKm62qHS64V", "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
[ "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
||||||
[ "tz1SWBY7rWMutEuWRziDhC72gTGdo29KZaRj", "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
[ "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
||||||
[ "tz1amUjiZaevaxQy5w26LSf64bs77eNTJ8uY", "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
[ "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
||||||
[ "tz1Zaee3QBtD4ErY1CpjigTYtX3VxWB6Ft9a", "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
[ "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
||||||
[ "tz1geDUUhfXK1EMj7LZdP9wfcoAxR3q2QExR", "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
[ "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
||||||
[ "tz1h3nY7jcZciJgAvgNvzgTnjuejEyiEqFGQ", "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
[ "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
||||||
[ "tz1VzL4Xrb3fL3ckuPqw8u4H7feMAkF4cesJ", "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
[ "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
||||||
[ "tz1RUHg536oRKhPLFHi9hit3MKbve91jWjPC", "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
[ "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
||||||
[ "tz1M1LFbgctcPWxstKs21wgvSYBLUpaRwdx8", "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
[ "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
||||||
],
|
],
|
||||||
"dictator_pubkey":
|
"dictator_pubkey":
|
||||||
"edpkuSLWfVU1Vq7Jg9FucPyKmma6otcMHac9zG4oU1KMHSTBpJuGQ2",
|
"edpkuSLWfVU1Vq7Jg9FucPyKmma6otcMHac9zG4oU1KMHSTBpJuGQ2",
|
||||||
|
@ -65,16 +65,16 @@ let protocol_parameters =
|
|||||||
[ "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n", "4000000000000" ]
|
[ "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n", "4000000000000" ]
|
||||||
],
|
],
|
||||||
"commitments": [
|
"commitments": [
|
||||||
[ "tz1MawerETND6bqJqUe4cVBcDZn6Tiahrr2V", "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
[ "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
||||||
[ "tz1X4maqF9tC1Yn4hzg1w5PLdeKm62qHS64V", "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
[ "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
||||||
[ "tz1SWBY7rWMutEuWRziDhC72gTGdo29KZaRj", "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
[ "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
||||||
[ "tz1amUjiZaevaxQy5w26LSf64bs77eNTJ8uY", "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
[ "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
||||||
[ "tz1Zaee3QBtD4ErY1CpjigTYtX3VxWB6Ft9a", "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
[ "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
||||||
[ "tz1geDUUhfXK1EMj7LZdP9wfcoAxR3q2QExR", "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
[ "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
||||||
[ "tz1h3nY7jcZciJgAvgNvzgTnjuejEyiEqFGQ", "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
[ "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
||||||
[ "tz1VzL4Xrb3fL3ckuPqw8u4H7feMAkF4cesJ", "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
[ "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
||||||
[ "tz1RUHg536oRKhPLFHi9hit3MKbve91jWjPC", "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
[ "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
||||||
[ "tz1M1LFbgctcPWxstKs21wgvSYBLUpaRwdx8", "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
[ "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
||||||
],
|
],
|
||||||
"time_between_blocks" : [ 1, 0 ],
|
"time_between_blocks" : [ 1, 0 ],
|
||||||
"blocks_per_cycle" : 4,
|
"blocks_per_cycle" : 4,
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
"Script_expr_hash",
|
"Script_expr_hash",
|
||||||
"Contract_hash",
|
"Contract_hash",
|
||||||
"Blinded_public_key_hash",
|
"Blinded_public_key_hash",
|
||||||
"Unclaimed_public_key_hash",
|
|
||||||
|
|
||||||
"Qty_repr",
|
"Qty_repr",
|
||||||
"Tez_repr",
|
"Tez_repr",
|
||||||
|
@ -870,9 +870,9 @@ module Commitment : sig
|
|||||||
amount : Tez.tez }
|
amount : Tez.tez }
|
||||||
|
|
||||||
val get_opt:
|
val get_opt:
|
||||||
context -> Unclaimed_public_key_hash.t -> t option tzresult Lwt.t
|
context -> Blinded_public_key_hash.t -> Tez.t option tzresult Lwt.t
|
||||||
val delete:
|
val delete:
|
||||||
context -> Unclaimed_public_key_hash.t -> context tzresult Lwt.t
|
context -> Blinded_public_key_hash.t -> context tzresult Lwt.t
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ type error += Too_early_double_baking_evidence
|
|||||||
type error += Outdated_double_baking_evidence
|
type error += Outdated_double_baking_evidence
|
||||||
of { level: Raw_level.t ; last: Raw_level.t } (* `Permanent *)
|
of { level: Raw_level.t ; last: Raw_level.t } (* `Permanent *)
|
||||||
type error += Invalid_activation of { pkh : Ed25519.Public_key_hash.t }
|
type error += Invalid_activation of { pkh : Ed25519.Public_key_hash.t }
|
||||||
type error += Wrong_activation_secret
|
|
||||||
type error += Multiple_revelation
|
type error += Multiple_revelation
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
@ -305,8 +304,8 @@ let () =
|
|||||||
`Permanent
|
`Permanent
|
||||||
~id:"operation.invalid_activation"
|
~id:"operation.invalid_activation"
|
||||||
~title:"Invalid activation"
|
~title:"Invalid activation"
|
||||||
~description:"The given key has already been activated or the given \
|
~description:"The given key and secret do not correspond to any \
|
||||||
key does not correspond to any preallocated contract"
|
existing preallocated contract"
|
||||||
~pp:(fun ppf pkh ->
|
~pp:(fun ppf pkh ->
|
||||||
Format.fprintf ppf "Invalid activation. The public key %a does \
|
Format.fprintf ppf "Invalid activation. The public key %a does \
|
||||||
not match any commitment."
|
not match any commitment."
|
||||||
@ -315,17 +314,6 @@ let () =
|
|||||||
Data_encoding.(obj1 (req "pkh" Ed25519.Public_key_hash.encoding))
|
Data_encoding.(obj1 (req "pkh" Ed25519.Public_key_hash.encoding))
|
||||||
(function Invalid_activation { pkh } -> Some pkh | _ -> None)
|
(function Invalid_activation { pkh } -> Some pkh | _ -> None)
|
||||||
(fun pkh -> Invalid_activation { pkh } ) ;
|
(fun pkh -> Invalid_activation { pkh } ) ;
|
||||||
register_error_kind
|
|
||||||
`Permanent
|
|
||||||
~id:"operation.wrong_activation_secret"
|
|
||||||
~title:"Wrong activation secret"
|
|
||||||
~description:"The submitted activation key does not match the \
|
|
||||||
registered key."
|
|
||||||
~pp:(fun ppf () ->
|
|
||||||
Format.fprintf ppf "Wrong activation secret.")
|
|
||||||
Data_encoding.unit
|
|
||||||
(function Wrong_activation_secret -> Some () | _ -> None)
|
|
||||||
(fun () -> Wrong_activation_secret) ;
|
|
||||||
register_error_kind
|
register_error_kind
|
||||||
`Permanent
|
`Permanent
|
||||||
~id:"block.multiple_revelation"
|
~id:"block.multiple_revelation"
|
||||||
@ -703,15 +691,11 @@ let apply_anonymous_operation ctxt kind =
|
|||||||
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 ; secret } ->
|
||||||
let h_pkh = Unclaimed_public_key_hash.of_ed25519_pkh pkh in
|
let blinded_pkh = Blinded_public_key_hash.of_ed25519_pkh secret pkh in
|
||||||
Commitment.get_opt ctxt h_pkh >>=? function
|
Commitment.get_opt ctxt blinded_pkh >>=? function
|
||||||
| None -> fail (Invalid_activation { pkh })
|
| None -> fail (Invalid_activation { pkh })
|
||||||
| Some { blinded_public_key_hash = blinded_pkh ; amount } ->
|
| Some amount ->
|
||||||
let submitted_bpkh = Blinded_public_key_hash.of_ed25519_pkh secret pkh in
|
Commitment.delete ctxt blinded_pkh >>=? fun ctxt ->
|
||||||
fail_unless
|
|
||||||
Blinded_public_key_hash.(blinded_pkh = submitted_bpkh)
|
|
||||||
Wrong_activation_secret >>=? fun () ->
|
|
||||||
Commitment.delete ctxt h_pkh >>=? fun ctxt ->
|
|
||||||
Contract.(credit ctxt (implicit_contract (Signature.Ed25519 pkh)) amount) >>=? fun ctxt ->
|
Contract.(credit ctxt (implicit_contract (Signature.Ed25519 pkh)) amount) >>=? fun ctxt ->
|
||||||
return (ctxt, Activation_result [(* FIXME *)])
|
return (ctxt, Activation_result [(* FIXME *)])
|
||||||
|
|
||||||
|
@ -29,3 +29,18 @@ let secret_of_hex h =
|
|||||||
if Compare.Int.(String.length h <> secret_size * 2) then
|
if Compare.Int.(String.length h <> secret_size * 2) then
|
||||||
invalid_arg "Blinded_public_key_hash.secret_of_hex" ;
|
invalid_arg "Blinded_public_key_hash.secret_of_hex" ;
|
||||||
MBytes.of_hex (`Hex h)
|
MBytes.of_hex (`Hex h)
|
||||||
|
|
||||||
|
module Index = struct
|
||||||
|
|
||||||
|
type nonrec t = t
|
||||||
|
let path_length = 2
|
||||||
|
|
||||||
|
let to_path bpkh l =
|
||||||
|
let `Hex h = MBytes.to_hex (to_bytes bpkh) in
|
||||||
|
String.sub h 0 2 :: String.sub h 2 (size - 2) :: l
|
||||||
|
|
||||||
|
let of_path = function
|
||||||
|
| [ h1 ; h2 ] -> of_bytes_opt (MBytes.of_hex (`Hex (h1 ^ h2)))
|
||||||
|
| _ -> None
|
||||||
|
|
||||||
|
end
|
||||||
|
@ -15,3 +15,10 @@ val secret_encoding : secret Data_encoding.t
|
|||||||
val of_ed25519_pkh : secret -> Ed25519.Public_key_hash.t -> t
|
val of_ed25519_pkh : secret -> Ed25519.Public_key_hash.t -> t
|
||||||
|
|
||||||
val secret_of_hex : string -> secret
|
val secret_of_hex : string -> secret
|
||||||
|
|
||||||
|
module Index : sig
|
||||||
|
type nonrec t = t
|
||||||
|
val path_length : int
|
||||||
|
val to_path : t -> string list -> string list
|
||||||
|
val of_path : string list -> t option
|
||||||
|
end
|
||||||
|
@ -11,7 +11,7 @@ let get_opt = Storage.Commitments.get_option
|
|||||||
let delete = Storage.Commitments.delete
|
let delete = Storage.Commitments.delete
|
||||||
|
|
||||||
let init ctxt commitments =
|
let init ctxt commitments =
|
||||||
let init_commitment ctxt ( hpkh, commitment ) =
|
let init_commitment ctxt Commitment_repr.{ blinded_public_key_hash ; amount } =
|
||||||
Storage.Commitments.init ctxt hpkh commitment in
|
Storage.Commitments.init ctxt blinded_public_key_hash amount in
|
||||||
fold_left_s init_commitment ctxt commitments >>=? fun ctxt ->
|
fold_left_s init_commitment ctxt commitments >>=? fun ctxt ->
|
||||||
return ctxt
|
return ctxt
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
val init:
|
val init:
|
||||||
Raw_context.t ->
|
Raw_context.t ->
|
||||||
(Unclaimed_public_key_hash.t * Commitment_repr.t) list ->
|
Commitment_repr.t list ->
|
||||||
Raw_context.t tzresult Lwt.t
|
Raw_context.t tzresult Lwt.t
|
||||||
|
|
||||||
val get_opt:
|
val get_opt:
|
||||||
Raw_context.t -> Unclaimed_public_key_hash.t ->
|
Raw_context.t -> Blinded_public_key_hash.t ->
|
||||||
Commitment_repr.t option tzresult Lwt.t
|
Tez_repr.t option tzresult Lwt.t
|
||||||
|
|
||||||
val delete:
|
val delete:
|
||||||
Raw_context.t -> Unclaimed_public_key_hash.t ->
|
Raw_context.t -> Blinded_public_key_hash.t ->
|
||||||
Raw_context.t tzresult Lwt.t
|
Raw_context.t tzresult Lwt.t
|
||||||
|
@ -14,7 +14,7 @@ type bootstrap_account = {
|
|||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
bootstrap_accounts : bootstrap_account list ;
|
bootstrap_accounts : bootstrap_account list ;
|
||||||
commitments : (Unclaimed_public_key_hash.t * Commitment_repr.t) list ;
|
commitments : Commitment_repr.t list ;
|
||||||
constants : Constants_repr.parametric ;
|
constants : Constants_repr.parametric ;
|
||||||
security_deposit_ramp_up_cycles : int option ;
|
security_deposit_ramp_up_cycles : int option ;
|
||||||
no_reward_cycles : int option ;
|
no_reward_cycles : int option ;
|
||||||
@ -258,10 +258,7 @@ let encoding =
|
|||||||
(merge_objs
|
(merge_objs
|
||||||
(obj4
|
(obj4
|
||||||
(req "bootstrap_accounts" (list bootstrap_account_encoding))
|
(req "bootstrap_accounts" (list bootstrap_account_encoding))
|
||||||
(dft "commitments"
|
(dft "commitments" (list Commitment_repr.encoding) [])
|
||||||
(list (merge_tups
|
|
||||||
(tup1 Unclaimed_public_key_hash.encoding)
|
|
||||||
Commitment_repr.encoding)) [])
|
|
||||||
(opt "security_deposit_ramp_up_cycles" int31)
|
(opt "security_deposit_ramp_up_cycles" int31)
|
||||||
(opt "no_reward_cycles" int31))
|
(opt "no_reward_cycles" int31))
|
||||||
constants_encoding)
|
constants_encoding)
|
||||||
|
@ -14,7 +14,7 @@ type bootstrap_account = {
|
|||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
bootstrap_accounts : bootstrap_account list ;
|
bootstrap_accounts : bootstrap_account list ;
|
||||||
commitments : (Unclaimed_public_key_hash.t * Commitment_repr.t) list ;
|
commitments : Commitment_repr.t list ;
|
||||||
constants : Constants_repr.parametric ;
|
constants : Constants_repr.parametric ;
|
||||||
security_deposit_ramp_up_cycles : int option ;
|
security_deposit_ramp_up_cycles : int option ;
|
||||||
no_reward_cycles : int option ;
|
no_reward_cycles : int option ;
|
||||||
|
@ -435,8 +435,8 @@ end
|
|||||||
module Commitments =
|
module Commitments =
|
||||||
Make_indexed_data_storage
|
Make_indexed_data_storage
|
||||||
(Make_subcontext(Raw_context)(struct let name = ["commitments"] end))
|
(Make_subcontext(Raw_context)(struct let name = ["commitments"] end))
|
||||||
(Unclaimed_public_key_hash.Index)
|
(Blinded_public_key_hash.Index)
|
||||||
(Make_value(Commitment_repr))
|
(Make_value(Tez_repr))
|
||||||
|
|
||||||
(** Ramp up security deposits... *)
|
(** Ramp up security deposits... *)
|
||||||
|
|
||||||
|
@ -269,8 +269,8 @@ end
|
|||||||
(** Commitments *)
|
(** Commitments *)
|
||||||
|
|
||||||
module Commitments : Indexed_data_storage
|
module Commitments : Indexed_data_storage
|
||||||
with type key = Unclaimed_public_key_hash.t
|
with type key = Blinded_public_key_hash.t
|
||||||
and type value = Commitment_repr.t
|
and type value = Tez_repr.t
|
||||||
and type t := Raw_context.t
|
and type t := Raw_context.t
|
||||||
|
|
||||||
(** Ramp up security deposits... *)
|
(** Ramp up security deposits... *)
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2018. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
type t = MBytes.t
|
|
||||||
|
|
||||||
let size = Ed25519.Public_key_hash.size / 2
|
|
||||||
|
|
||||||
let of_ed25519_pkh pkh =
|
|
||||||
MBytes.sub (Ed25519.Public_key_hash.to_bytes pkh) 0 size
|
|
||||||
|
|
||||||
let zero = MBytes.of_string (String.make size '\000')
|
|
||||||
|
|
||||||
let to_b58check s =
|
|
||||||
Ed25519.Public_key_hash.to_b58check
|
|
||||||
(Ed25519.Public_key_hash.of_bytes_exn
|
|
||||||
(MBytes.concat "" [s; zero]))
|
|
||||||
|
|
||||||
let of_b58check_exn s =
|
|
||||||
let pkh = Ed25519.Public_key_hash.of_b58check_exn s in
|
|
||||||
let padding = MBytes.sub (Ed25519.Public_key_hash.to_bytes pkh) size size in
|
|
||||||
if MBytes.(<>) zero padding then
|
|
||||||
failwith "invalid Base58Check-encoded unclaimed public-key hash" ;
|
|
||||||
of_ed25519_pkh pkh
|
|
||||||
|
|
||||||
let encoding =
|
|
||||||
let open Data_encoding in
|
|
||||||
splitted
|
|
||||||
~binary:(Fixed.bytes size)
|
|
||||||
~json:
|
|
||||||
(conv
|
|
||||||
to_b58check
|
|
||||||
of_b58check_exn
|
|
||||||
string)
|
|
||||||
|
|
||||||
module Index = struct
|
|
||||||
|
|
||||||
type t = MBytes.t
|
|
||||||
|
|
||||||
let path_length = 2
|
|
||||||
|
|
||||||
let to_path half_public_key_hash l =
|
|
||||||
let `Hex h = MBytes.to_hex half_public_key_hash in
|
|
||||||
String.sub h 0 2 :: String.sub h 2 (size - 2) :: l
|
|
||||||
|
|
||||||
let of_path = function
|
|
||||||
| [ h1 ; h2 ] -> Some (MBytes.of_hex (`Hex (h1 ^ h2)))
|
|
||||||
| _ -> None
|
|
||||||
|
|
||||||
end
|
|
@ -1,24 +0,0 @@
|
|||||||
(**************************************************************************)
|
|
||||||
(* *)
|
|
||||||
(* Copyright (c) 2014 - 2018. *)
|
|
||||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
||||||
(* *)
|
|
||||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
||||||
(* *)
|
|
||||||
(**************************************************************************)
|
|
||||||
|
|
||||||
type t
|
|
||||||
|
|
||||||
val encoding : t Data_encoding.t
|
|
||||||
|
|
||||||
val of_ed25519_pkh : Ed25519.Public_key_hash.t -> t
|
|
||||||
|
|
||||||
val to_b58check : t -> string
|
|
||||||
val of_b58check_exn : string -> t
|
|
||||||
|
|
||||||
module Index : sig
|
|
||||||
type nonrec t = t
|
|
||||||
val path_length : int
|
|
||||||
val to_path : t -> string list -> string list
|
|
||||||
val of_path : string list -> t option
|
|
||||||
end
|
|
@ -32,16 +32,16 @@ let protocol_parameters =
|
|||||||
[ "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n", "4000000000000" ]
|
[ "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n", "4000000000000" ]
|
||||||
],
|
],
|
||||||
"commitments": [
|
"commitments": [
|
||||||
[ "tz1MawerETND6bqJqUe4cVBcDZn6Tiahrr2V", "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
[ "btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa", "23932454669343" ],
|
||||||
[ "tz1X4maqF9tC1Yn4hzg1w5PLdeKm62qHS64V", "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
[ "btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv", "72954577464032" ],
|
||||||
[ "tz1SWBY7rWMutEuWRziDhC72gTGdo29KZaRj", "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
[ "btz1LtoNCjiW23txBTenALaf5H6NKF1L3c1gw", "217487035428348" ],
|
||||||
[ "tz1amUjiZaevaxQy5w26LSf64bs77eNTJ8uY", "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
[ "btz1SUd3mMhEBcWudrn8u361MVAec4WYCcFoy", "4092742372031" ],
|
||||||
[ "tz1Zaee3QBtD4ErY1CpjigTYtX3VxWB6Ft9a", "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
[ "btz1MvBXf4orko1tsGmzkjLbpYSgnwUjEe81r", "17590039016550" ],
|
||||||
[ "tz1geDUUhfXK1EMj7LZdP9wfcoAxR3q2QExR", "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
[ "btz1LoDZ3zsjgG3k3cqTpUMc9bsXbchu9qMXT", "26322312350555" ],
|
||||||
[ "tz1h3nY7jcZciJgAvgNvzgTnjuejEyiEqFGQ", "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
[ "btz1RMfq456hFV5AeDiZcQuZhoMv2dMpb9hpP", "244951387881443" ],
|
||||||
[ "tz1VzL4Xrb3fL3ckuPqw8u4H7feMAkF4cesJ", "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
[ "btz1Y9roTh4A7PsMBkp8AgdVFrqUDNaBE59y1", "80065050465525" ],
|
||||||
[ "tz1RUHg536oRKhPLFHi9hit3MKbve91jWjPC", "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
[ "btz1Q1N2ePwhVw5ED3aaRVek6EBzYs1GDkSVD", "3569618927693" ],
|
||||||
[ "tz1M1LFbgctcPWxstKs21wgvSYBLUpaRwdx8", "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
[ "btz1VFFVsVMYHd5WfaDTAt92BeQYGK8Ri4eLy", "9034781424478" ]
|
||||||
],
|
],
|
||||||
"time_between_blocks" : [ 1, 0 ],
|
"time_between_blocks" : [ 1, 0 ],
|
||||||
"blocks_per_cycle" : 4,
|
"blocks_per_cycle" : 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user