Base48: encode the "data" before its "hash"
This commit is contained in:
parent
f7b149c9ed
commit
07ba685b8d
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
let protocol =
|
let protocol =
|
||||||
Protocol_hash.of_b48check
|
Protocol_hash.of_b48check
|
||||||
"TnrnfGHMCPAcxtMAHXdpfebbnn2XvPAxq7DHbpeJbKTkJQPgcgRGr"
|
"4prgmSgbaeMKbgLtLjpsHaDD9QvG2dbC2bLq2XBmyxd2RJgLFpcAg"
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
Client_version.register protocol @@
|
Client_version.register protocol @@
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
let protocol =
|
let protocol =
|
||||||
Protocol_hash.of_b48check
|
Protocol_hash.of_b48check
|
||||||
"JF7Fxgeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"2gagXCT66nmJ2mKh3a6Aeysy9CHaHsAJyDEGSyFNeFAxGCJehsKpK"
|
||||||
|
|
||||||
let demo () =
|
let demo () =
|
||||||
let block = Client_config.block () in
|
let block = Client_config.block () in
|
||||||
|
@ -330,7 +330,7 @@ module RPC = struct
|
|||||||
|
|
||||||
let prevalidation_hash =
|
let prevalidation_hash =
|
||||||
Block_hash.of_b48check
|
Block_hash.of_b48check
|
||||||
"Et22nEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"eeeeeeeeeeeeeegqJHARhSaNXggmMs8K3tvsgn4rBprkvpFAMVD5d"
|
||||||
|
|
||||||
let get_net node = function
|
let get_net node = function
|
||||||
| `Head _ | `Prevalidation -> node.global_validator, node.global_net
|
| `Head _ | `Prevalidation -> node.global_validator, node.global_net
|
||||||
|
@ -12,15 +12,15 @@ open Logging.Node.Main
|
|||||||
|
|
||||||
let genesis_block =
|
let genesis_block =
|
||||||
Block_hash.of_b48check
|
Block_hash.of_b48check
|
||||||
"qBeeesNtMrdyRDj6hSK2PxEN9R67brGSm64EFRjJSBTTqLcQCRHNR"
|
"eeHfgnr9QeDNvcMgSfATNeDeec4KG4CkHHkNNJt5B9xdVmsxhsHNR"
|
||||||
|
|
||||||
let genesis_protocol =
|
let genesis_protocol =
|
||||||
Protocol_hash.of_b48check
|
Protocol_hash.of_b48check
|
||||||
"TnrnfGHMCPAcxtMAHXdpfebbnn2XvPAxq7DHbpeJbKTkJQPgcgRGr"
|
"4prgmSgbaeMKbgLtLjpsHaDD9QvG2dbC2bLq2XBmyxd2RJgLFpcAg"
|
||||||
|
|
||||||
let test_protocol =
|
let test_protocol =
|
||||||
Some (Protocol_hash.of_b48check
|
Some (Protocol_hash.of_b48check
|
||||||
"JF7Fxgeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
|
"2gagXCT66nmJ2mKh3a6Aeysy9CHaHsAJyDEGSyFNeFAxGCJehsKpK")
|
||||||
|
|
||||||
let genesis_time =
|
let genesis_time =
|
||||||
Time.of_notation_exn "2016-08-01T00:00:00Z"
|
Time.of_notation_exn "2016-08-01T00:00:00Z"
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{
|
{
|
||||||
"hash": "TnrnfGHMCPAcxtMAHXdpfebbnn2XvPAxq7DHbpeJbKTkJQPgcgRGr",
|
"hash": "4prgmSgbaeMKbgLtLjpsHaDD9QvG2dbC2bLq2XBmyxd2RJgLFpcAg",
|
||||||
"modules": [
|
"modules": [
|
||||||
|
|
||||||
"Misc",
|
"Misc",
|
||||||
"Tezos_hash",
|
"Tezos_hash",
|
||||||
|
|
||||||
"Qty_repr",
|
"Qty_repr",
|
||||||
"Tez_repr",
|
"Tez_repr",
|
||||||
"Period_repr",
|
"Period_repr",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"hash": "JF7Fxgeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
"hash": "2gagXCT66nmJ2mKh3a6Aeysy9CHaHsAJyDEGSyFNeFAxGCJehsKpK",
|
||||||
"modules": ["Error", "Services", "Main"]
|
"modules": ["Error", "Services", "Main"]
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ let decode_alphabet alphabet =
|
|||||||
Bytes.to_string str
|
Bytes.to_string str
|
||||||
|
|
||||||
let default_alphabet =
|
let default_alphabet =
|
||||||
"eXMNE9qvHPQDdcFx5J86rT7VRm2atAypGhgLfbS3CKjnksB4"
|
"eE2NXaQvHPqDdTJxfF36jb7VRmp9tAyMgG4L5cS8CKrnksBh"
|
||||||
|
|
||||||
let default_decode_alphabet = decode_alphabet default_alphabet
|
let default_decode_alphabet = decode_alphabet default_alphabet
|
||||||
|
|
||||||
@ -85,13 +85,13 @@ let sha256 s =
|
|||||||
computed_hash
|
computed_hash
|
||||||
|
|
||||||
let safe_encode ?alphabet s =
|
let safe_encode ?alphabet s =
|
||||||
raw_encode ?alphabet (String.sub (sha256 (sha256 s)) 0 4 ^ s)
|
raw_encode ?alphabet (s ^ String.sub (sha256 (sha256 s)) 0 4)
|
||||||
|
|
||||||
let safe_decode ?alphabet s =
|
let safe_decode ?alphabet s =
|
||||||
let s = raw_decode ?alphabet s in
|
let s = raw_decode ?alphabet s in
|
||||||
let len = String.length s in
|
let len = String.length s in
|
||||||
let msg_hash = String.sub s 0 4 in
|
let msg = String.sub s 0 (len-4)
|
||||||
let msg = String.sub s 4 (len-4) in
|
and msg_hash = String.sub s (len-4) 4 in
|
||||||
if msg_hash <> String.sub (sha256 (sha256 msg)) 0 4 then
|
if msg_hash <> String.sub (sha256 (sha256 msg)) 0 4 then
|
||||||
invalid_arg "safe_decode" ;
|
invalid_arg "safe_decode" ;
|
||||||
msg
|
msg
|
||||||
|
@ -18,11 +18,11 @@ let (//) = Filename.concat
|
|||||||
|
|
||||||
let genesis_block =
|
let genesis_block =
|
||||||
Block_hash.of_b48check
|
Block_hash.of_b48check
|
||||||
"Et22nEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"eeeeeeeeeeeeeegqJHARhSaNXggmMs8K3tvsgn4rBprkvpFAMVD5d"
|
||||||
|
|
||||||
let genesis_protocol =
|
let genesis_protocol =
|
||||||
Protocol_hash.of_b48check
|
Protocol_hash.of_b48check
|
||||||
"JF7Fxgeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"2gagXCT66nmJ2mKh3a6Aeysy9CHaHsAJyDEGSyFNeFAxGCJehsKpK"
|
||||||
|
|
||||||
let genesis_time =
|
let genesis_time =
|
||||||
Time.of_seconds 0L
|
Time.of_seconds 0L
|
||||||
|
@ -16,11 +16,11 @@ let (//) = Filename.concat
|
|||||||
|
|
||||||
let genesis_block =
|
let genesis_block =
|
||||||
Block_hash.of_b48check
|
Block_hash.of_b48check
|
||||||
"Et22nEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"eeeeeeeeeeeeeegqJHARhSaNXggmMs8K3tvsgn4rBprkvpFAMVD5d"
|
||||||
|
|
||||||
let genesis_protocol =
|
let genesis_protocol =
|
||||||
Protocol_hash.of_b48check
|
Protocol_hash.of_b48check
|
||||||
"JF7Fxgeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"2gagXCT66nmJ2mKh3a6Aeysy9CHaHsAJyDEGSyFNeFAxGCJehsKpK"
|
||||||
|
|
||||||
let genesis_time =
|
let genesis_time =
|
||||||
Time.of_seconds 0L
|
Time.of_seconds 0L
|
||||||
|
@ -18,11 +18,11 @@ let (//) = Filename.concat
|
|||||||
|
|
||||||
let genesis_block =
|
let genesis_block =
|
||||||
Block_hash.of_b48check
|
Block_hash.of_b48check
|
||||||
"Et22nEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"eeeeeeeeeeeeeegqJHARhSaNXggmMs8K3tvsgn4rBprkvpFAMVD5d"
|
||||||
|
|
||||||
let genesis_protocol =
|
let genesis_protocol =
|
||||||
Protocol_hash.of_b48check
|
Protocol_hash.of_b48check
|
||||||
"JF7Fxgeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
"2gagXCT66nmJ2mKh3a6Aeysy9CHaHsAJyDEGSyFNeFAxGCJehsKpK"
|
||||||
|
|
||||||
let genesis_time =
|
let genesis_time =
|
||||||
Time.of_seconds 0L
|
Time.of_seconds 0L
|
||||||
|
Loading…
Reference in New Issue
Block a user