Add subtree signer support - #579
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #579 +/- ##
==========================================
+ Coverage 25.40% 27.40% +2.00%
==========================================
Files 28 28
Lines 2047 2189 +142
==========================================
+ Hits 520 600 +80
- Misses 1413 1461 +48
- Partials 114 128 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a14f500 to
edafca5
Compare
| } | ||
| var start, end uint64 | ||
| if n, err := fmt.Sscanf(string(rangeLine), "subtree %d %d", &start, &end); err != nil || n != 2 { | ||
| return 0, 0, nil, nil, nil, err |
There was a problem hiding this comment.
If err is nil and n != 2, the err returned will be nil. Would this cause any issue?
There was a problem hiding this comment.
Good catch, updated to ensure we return a non-nil error.
| name := s.Name() | ||
| hash := s.KeyHash() |
There was a problem hiding this comment.
In the signChkpt(), the following code is called to verify the signer name. I think we need to have the same validation here.
if !isValidSignerName(name) {
return nil, nil, errors.New("invalid signer")
}| return len(w.subtreeSigners) > 0 | ||
| } | ||
|
|
||
| func (w *Witness) subtreeVerifiers() []note.Verifier { |
There was a problem hiding this comment.
Are the verifiers the same for all requests in the same witness? If so, we can initialize them once and store it somewhere to reuse.
| } | ||
|
|
||
| // isSubtreeValid returns whether a subtree covers a valid range. | ||
| // A subtree is valid if there exist a parent tree node to: |
There was a problem hiding this comment.
| // A subtree is valid if there exist a parent tree node to: | |
| // A subtree is valid if there exists a parent tree node to: |
| return fmt.Errorf("start %d must be 0 when subtree length %d > 1<<63", start, l) | ||
| } | ||
| if bc := bitCeil(l); start&(bc-1) != 0 { | ||
| return fmt.Errorf("start %d not a multiple of bit_ceil(end - start) = %d", start, bc) |
There was a problem hiding this comment.
| return fmt.Errorf("start %d not a multiple of bit_ceil(end - start) = %d", start, bc) | |
| return fmt.Errorf("start %d not a multiple of bitCeil(end - start) = %d", start, bc) |
This PR adds support for the new sign-subtree API recently added to
tlog-witness.