Skip to content

Instantly share code, notes, and snippets.

@phad
Created October 17, 2017 10:42
Show Gist options
  • Save phad/e201686c112928546b1f2bc6065f0074 to your computer and use it in GitHub Desktop.
Save phad/e201686c112928546b1f2bc6065f0074 to your computer and use it in GitHub Desktop.
Empty map transcript
1. Setup: make a new, empty map.
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianAdmin.CreateTree \
'tree<tree_state: ACTIVE tree_type: MAP hash_strategy: TEST_MAP_HASHER hash_algorithm: SHA256 \
signature_algorithm: ECDSA max_root_duration<seconds: 3600>> key_spec<ecdsa_params<curve: P256>>'
tree_id: 6052818873547722634
tree_state: ACTIVE
tree_type: MAP
hash_strategy: TEST_MAP_HASHER
hash_algorithm: SHA256
signature_algorithm: ECDSA
public_key {
der: "0Y0\023\006\007*\206H\316=\002\001\006\010*\206H\316=\003\001\007\003B\000\004\0173\026;\315\255\367\325\252\31791\2158S2\271\177\307\377=\210!\022[\356\347\233\251Vf\026FR\217P\256\355,\347\330h\000\316qL\342\373:\370\214\016\204\007\334\001\233\302\031\207\305\254[\000"
}
max_root_duration {
seconds: 3600
}
create_time {
seconds: 1508236681
nanos: 35000000
}
update_time {
seconds: 1508236681
nanos: 35000000
}
2. Try to retrieve the map root, specifying revision 0
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634'
Rpc failed with status code 5, error message: sql: no rows in result set
3. Try to retrieve the latest map root
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRoot \
'map_id:6052818873547722634'
map_root {
}
4. Try to retrieve map root specifying some other revision numbers; -1 (which means 'latest' in GetLeaves); 1.
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:-1'
Rpc failed with status code 5, error message: sql: no rows in result set
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:0'
Rpc failed with status code 5, error message: sql: no rows in result set
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:1'
Rpc failed with status code 5, error message: sql: no rows in result set
5. Now set some leaf values to force a new map head.
- TODO: confirm that this minimal call is OK - we don't actually specify any leaves here...
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.SetLeaves \
'map_id:6052818873547722634'
map_root {
timestamp_nanos: 1508235889834964600
root_hash: "\306h\237\020\201*\t\200\227m\2253\3308u(!f\025\225g\3545\025W\026\301A:\365=j"
signature {
hash_algorithm: SHA256
signature_algorithm: ECDSA
signature: "0F\002!\000\307b\255\223\353\23615&\022\263\323\341\342+\276\274$\rX?\366\014U\362\006\376\0269rcm\002!\000\241*\255\220\301\263D\033\275\374\340A\377\337\354\202\331%au\3179\000O\r9\237\302\021\r\363\263"
}
map_id: 6052818873547722634
map_revision: 1
}
6. OK now retrieve the Map Head at revision 1 via both APIs.
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRoot \
'map_id:6052818873547722634'
map_root {
timestamp_nanos: 1508235889834964600
root_hash: "\306h\237\020\201*\t\200\227m\2253\3308u(!f\025\225g\3545\025W\026\301A:\365=j"
signature {
hash_algorithm: SHA256
signature_algorithm: ECDSA
signature: "0F\002!\000\307b\255\223\353\23615&\022\263\323\341\342+\276\274$\rX?\366\014U\362\006\376\0269rcm\002!\000\241*\255\220\301\263D\033\275\374\340A\377\337\354\202\331%au\3179\000O\r9\237\302\021\r\363\263"
}
map_id: 6052818873547722634
map_revision: 1
}
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:1'
map_root {
timestamp_nanos: 1508235889834964600
root_hash: "\306h\237\020\201*\t\200\227m\2253\3308u(!f\025\225g\3545\025W\026\301A:\365=j"
signature {
hash_algorithm: SHA256
signature_algorithm: ECDSA
signature: "0F\002!\000\307b\255\223\353\23615&\022\263\323\341\342+\276\274$\rX?\366\014U\362\006\376\0269rcm\002!\000\241*\255\220\301\263D\033\275\374\340A\377\337\354\202\331%au\3179\000O\r9\237\302\021\r\363\263"
}
map_id: 6052818873547722634
map_revision: 1
}
7. Confirm that revisions 0 and -1 are _still_ not retrievable
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:0'
Rpc failed with status code 5, error message: sql: no rows in result set
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:-1'
Rpc failed with status code 5, error message: sql: no rows in result set
8. Revision 2 not created yet so that also is not retrievable.
$ grpc_cli -loas2=false call localhost:6962 trillian.TrillianMap.GetSignedMapRootByRevision \
'map_id:6052818873547722634 revision:2'
Rpc failed with status code 5, error message: sql: no rows in result set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment