mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
ownership: a lookup starts from a node, so Subject is a function too
The verifier looks up an attestation by node before it holds any claim, so the subject encoding has to be reachable without one. Exporting it keeps a single definition instead of every caller re-deriving the same 20-into-32 copy. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -128,12 +128,18 @@ func (c Claim) Root() [32]byte {
|
||||
// attestations in this domain with the same subject and epoch but different
|
||||
// roots are two conflicting ownership facts about one node, which is exactly the
|
||||
// condition mpcvm's DetectEquivocation slashes.
|
||||
func (c Claim) Subject() [32]byte {
|
||||
//
|
||||
// It is a package function as well as a method because a lookup starts from a
|
||||
// node, before any claim is in hand. One encoding, both directions.
|
||||
func Subject(node [20]byte) [32]byte {
|
||||
var out [32]byte
|
||||
copy(out[:], c.Node[:])
|
||||
copy(out[:], node[:])
|
||||
return out
|
||||
}
|
||||
|
||||
// Subject is this claim's SubjectID. See the package-level Subject.
|
||||
func (c Claim) Subject() [32]byte { return Subject(c.Node) }
|
||||
|
||||
// Payload is the preimage a quorum signs. It MUST stay byte-identical to
|
||||
// mpcvm.ComputeAttestationPayload for this domain — that function hashes the
|
||||
// domain separator, then the subject, then the commitment root, then the epoch
|
||||
|
||||
Reference in New Issue
Block a user