Skip to content

Commit

Permalink
cleanup: make tree_create create a non-blank node
Browse files Browse the repository at this point in the history
  • Loading branch information
TWal committed Nov 21, 2024
1 parent 6f93999 commit 4beb781
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions fstar/common/code/MLS.TreeCommon.fst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ open MLS.Tree
val tree_create:
#leaf_t:Type -> #node_t:Type ->
leaf_t ->
tree leaf_t node_t 0 0
tree (option leaf_t) node_t 0 0
let tree_create lp =
TLeaf lp
TLeaf (Some lp)

(*** Common tree operations ***)

Expand Down
2 changes: 1 addition & 1 deletion fstar/treekem/code/MLS.TreeKEM.API.Tree.fst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ val create:
let create #bytes #cb dec_key enc_key =
{
levels = 0;
tree = TLeaf (Some ({public_key = enc_key} <: treekem_leaf bytes));
tree = tree_create ({public_key = enc_key} <: treekem_leaf bytes);
priv = PLeaf dec_key
}

Expand Down
2 changes: 1 addition & 1 deletion fstar/treesync/code/MLS.TreeSync.API.fst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ let finalize_create #bytes #cb #tkt #asp #group_id #ln pend token =
({
levels = 0;
tree = tree_create ln;
tokens = MLS.TreeCommon.tree_create (Some token);
tokens = MLS.TreeCommon.tree_create token;
})

val finalize_create_valid:
Expand Down
2 changes: 1 addition & 1 deletion fstar/treesync/code/MLS.TreeSync.Refined.Operations.fst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let tree_create #bytes #cb #tkt #group_id ln =
unmerged_leaves_ok_tree_create ln;
parent_hash_invariant_tree_create ln;
valid_leaves_invariant_tree_create group_id ln;
tree_create (Some ln)
tree_create ln

val tree_add:
#bytes:Type0 -> {|crypto_bytes bytes|} -> #tkt:treekem_types bytes ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ val all_credentials_ok_tree_create:
ln:leaf_node_nt bytes tkt -> token:asp.token_t ->
Lemma
(requires asp.credential_ok (ln.data.signature_key, ln.data.credential) token)
(ensures all_credentials_ok (tree_create (Some ln)) (tree_create (Some token)))
(ensures all_credentials_ok (tree_create ln) (tree_create token))
let all_credentials_ok_tree_create #bytes #bl #tkt ln token = ()

val all_credentials_ok_tree_add:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ val parent_hash_invariant_tree_create:
#bytes:Type0 -> {|crypto_bytes bytes|} -> #tkt:treekem_types bytes ->
ln:leaf_node_nt bytes tkt ->
Lemma
(parent_hash_invariant (tree_create (Some ln)))
(parent_hash_invariant (tree_create ln))
let parent_hash_invariant_tree_create #bytes #cb #tkt ln = ()

val parent_hash_invariant_mk_blank_tree: #bytes:Type0 -> {|crypto_bytes bytes|} -> #tkt:treekem_types bytes -> l:nat -> i:tree_index l -> Lemma (parent_hash_invariant (mk_blank_tree l i <: treesync bytes tkt l i))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ val unmerged_leaves_ok_tree_create:
#bytes:Type0 -> {|bytes_like bytes|} -> #tkt:treekem_types bytes ->
ln:leaf_node_nt bytes tkt ->
Lemma
(unmerged_leaves_ok (tree_create (Some ln)))
(unmerged_leaves_ok (tree_create ln))
let unmerged_leaves_ok_tree_create #bytes #bl #tkt ln = ()

(*** Update/Remove ***)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ val valid_leaves_invariant_tree_create:
group_id:mls_bytes bytes -> ln:leaf_node_nt bytes tkt ->
Lemma
(requires leaf_is_valid ln group_id 0)
(ensures valid_leaves_invariant group_id (tree_create (Some ln)))
(ensures valid_leaves_invariant group_id (tree_create ln))
let valid_leaves_invariant_tree_create #bytes #cb #tkt group_id ln = ()

val valid_leaves_invariant_tree_add:
Expand Down

0 comments on commit 4beb781

Please sign in to comment.