Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec for proofs #89

Merged
merged 37 commits into from
Feb 22, 2023
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ae6cb3d
Add spec for proofs
MavenRain Jan 3, 2023
c5e173b
Refactoring to proof attribute
MavenRain Jan 3, 2023
e0b62bc
Proof response given number 3, proof network attribute given number 1…
MavenRain Jan 4, 2023
1c4f105
Add attribute-arg to proof attribute, and change key-value-pair repre…
MavenRain Jan 4, 2023
71e0c5b
Add example proof construction to adoc
MavenRain Jan 4, 2023
f67e687
Key-value-pair change
MavenRain Jan 4, 2023
c97b7ff
Reorganizing and creating hash scheme section
MavenRain Jan 4, 2023
c583207
Add text for hash scheme
MavenRain Jan 5, 2023
2b314cb
hash attribute id comment edit
MavenRain Jan 5, 2023
521b459
Add newlines at end of file adn move hash scheme doc to separate file
MavenRain Jan 5, 2023
a3331d9
Fix typo
MavenRain Jan 5, 2023
53abb81
More newlines in files
MavenRain Jan 5, 2023
e2fc0c3
Make clear the hash function used in the hash scheme for constructing…
MavenRain Jan 5, 2023
486a3eb
Swapping contents of network proof adoc and response proof adoc
MavenRain Jan 5, 2023
333f579
Add stub for proof request attribute adoc
MavenRain Jan 9, 2023
23c2995
Rearrange items in spec to fit the attribute pattern for proofs
MavenRain Jan 10, 2023
a8053cf
Set proof structure to the response attribute arg in response cddl an…
MavenRain Jan 12, 2023
1e952c2
Add root hash to response attribute
MavenRain Jan 12, 2023
aea2dc3
Add newline
MavenRain Jan 12, 2023
12d0bd4
Complete revisions according to last set of review comments
MavenRain Jan 13, 2023
09bf877
Added newline
MavenRain Jan 13, 2023
7bce59f
Another newline
MavenRain Jan 13, 2023
4326429
Fix response attribute error
MavenRain Jan 14, 2023
3d64512
proof rule duplicate, I think
MavenRain Jan 14, 2023
bfc1a28
Rename index in proof response attribute
MavenRain Jan 14, 2023
fa244ff
Addressing group entry
MavenRain Jan 14, 2023
088b8aa
Trying to fix compilation error
MavenRain Jan 17, 2023
4a069a1
Found compilation error,as response-attribute-arg was accidentally de…
MavenRain Jan 17, 2023
9ae4a15
Remove proof prefix
MavenRain Jan 17, 2023
c0d15ed
Fix map association typo
MavenRain Jan 17, 2023
72bff56
Appears that a separate entry for attribute-related-index is needed
MavenRain Jan 17, 2023
865c9d4
looks like profo prefix is needed
MavenRain Jan 17, 2023
fee322c
Split proof into proof and proof operation to avoid anonymous enum
MavenRain Jan 23, 2023
14fed5e
Misssing memo field?
MavenRain Jan 23, 2023
428dd5b
Update attributes/network/14_proof.adoc
MavenRain Feb 22, 2023
01a9054
Update attributes/network/14_proof.adoc
MavenRain Feb 22, 2023
051eb9b
Update attributes/network/14_proof.adoc
MavenRain Feb 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions spec/cddl/many.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ request = COSE_Sign<{
; Attributes. An optional list of request attributes defined in the spec. See
; the list of all attributes in this repo.
? 8 => [ * attribute ],

; Flag. When set, a proof of what was requested will be given, if possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an attribute here would be better, as:

  • Attributes are meant to be optionally implemented, with clear rules when implementation is missing (request handlers reject them, response handlers ignore them) which actually makes sense here,
  • Adding fields to messages is a bit like releasing a new version of HTTP. Attributes are the mechanism to enhance them (similar to HTTP headers[1]),
  • Servers can advertise which attributes they support, but with this ALL servers should implement proofs, which is unreasonable.

So I'd rather have a system similar to async support; a request attribute, a response attribute and a server attribute that indicates support for those. This way servers can advertise they support proofs, clients can ignore proofs, and if proof is requested the server should bail out as it cannot provide it, and client can then re-request without the attribute if it chooses so.

[1] there is an argument that HTTP headers are different as they are optional while attributes require handling or fail, but in this specific case it is actually beneficial.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged . . . will refactor this into a proof attribute

; Otherwise, an error will be returned. When not set, a response will be given
; without an associated proof and without error.
? 9 => bool
}>
; end::request[]

Expand Down Expand Up @@ -85,6 +90,12 @@ response = COSE_Sign<{
; Attributes. An optional list of response attributes defined in the spec. See
; the list of all attributes in this repo.
? 8 => [ * attribute ],

; Proof. If requested, this is the set of steps constituting a proof of existence
; of what was requested in the state of the Merkle tree.
; See https://github.com/liftedinit/merk/blob/develop/docs/algorithms.md#binary-format for
Copy link
Contributor

@hansl hansl Jan 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to put the thoughts of this document into a separate specification document and not rely on implementation specific documentation.

Note that using specific implementations is not something the spec should recommend or even mention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can put the binary structure into a separate adoc

; reference.
? 9 => [ + ( node-hash / key-value-hash / key-value-pair / parent / child ) ]
}>
; end::response[]

Expand Down Expand Up @@ -159,3 +170,44 @@ attribute-id-custom = nint

; An attribute contains an ID and arguments.
attribute = attribute-id / [attribute-id, * attribute-arg]

; Represents a parent operation in a proof
parent = h'10'

; Represents a child operation in a proof
child = h'11'

; The hash of a key-value pair
key-value-hash = bstr

; The hash of a node in a proof, containing, in order, the hash
; of the key-value pair, the hash of the left child, and the hash of
; the right child
node-hash = bstr

; A node key of a proof is a collection of bytes together with its length
node-key = {
; The length of the key
0 => uint,

; The value of the key
1 => bstr,
}

; A node value of a proof is a collection of bytes together with its length
node-value = {
; The length of the value
0 => uint,

; The value itself
1 => bstr
}

; The key-value pair of a proof
key-value-pair = {
; The key
0 => node-key,

; The value
1 => node-value
}