Documentation ¶
Overview ¶
nolint
nolint
nolint
nolint
nolint
nolint
nolint
nolint
Package wire is a generated GoMock package.
nolint
nolint
Index ¶
- func ActivationTxFromWireV1(atx *ActivationTxV1) *types.ActivationTx
- func NiPostFromWireV1(nipost *NIPostV1) *types.NIPost
- func PostFromWireV1(post *PostV1) *types.Post
- type ATXMetadataV1
- type ATXProof
- type ActivationTxV1
- func (atx *ActivationTxV1) Blob() types.AtxBlob
- func (t *ActivationTxV1) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *ActivationTxV1) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (atx *ActivationTxV1) HashInnerBytes() (result types.Hash32)
- func (atx *ActivationTxV1) ID() types.ATXID
- func (atx *ActivationTxV1) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (atx *ActivationTxV1) SetID(id types.ATXID)
- func (atx *ActivationTxV1) Sign(signer *signing.EdSigner)
- func (atx *ActivationTxV1) SignedBytes() []byte
- type ActivationTxV2
- func (atx *ActivationTxV2) Blob() types.AtxBlob
- func (atx *ActivationTxV2) CoinbaseProof() []types.Hash32
- func (t *ActivationTxV2) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *ActivationTxV2) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (atx *ActivationTxV2) ID() types.ATXID
- func (atx *ActivationTxV2) InitialPostRootProof() InitialPostRootProof
- func (atx *ActivationTxV2) MarriageATXProof() MarriageATXProof
- func (atx *ActivationTxV2) MarriagesRootProof() MarriageCertificatesRootProof
- func (atx *ActivationTxV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (atx *ActivationTxV2) NIPostsRootProof() NIPostsRootProof
- func (atx *ActivationTxV2) PositioningATXProof() []types.Hash32
- func (atx *ActivationTxV2) PreviousATXsRootProof() PrevATXsRootProof
- func (atx *ActivationTxV2) PublishEpochProof() PublishEpochProof
- func (atx *ActivationTxV2) Sign(signer *signing.EdSigner)
- func (atx *ActivationTxV2) TotalNumUnits() uint32
- func (atx *ActivationTxV2) VRFNonceProof() []types.Hash32
- type ChallengeProof
- type CommitmentATXProof
- type InitialAtxPartsV2
- func (parts *InitialAtxPartsV2) CommitmentATXProof() CommitmentATXProof
- func (t *InitialAtxPartsV2) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *InitialAtxPartsV2) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (parts *InitialAtxPartsV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (parts *InitialAtxPartsV2) PostProof() []types.Hash32
- func (parts *InitialAtxPartsV2) Root() InitialPostRoot
- type InitialPostRoot
- type InitialPostRootProof
- type InitialPostTreeIndex
- type InnerActivationTxV1
- type InvalidPostProof
- type InvalidPrevAtxProof
- type MalfeasanceValidator
- type MarriageATXProof
- type MarriageCertificate
- func (t *MarriageCertificate) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *MarriageCertificate) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (mc *MarriageCertificate) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (mc *MarriageCertificate) Root() (result types.Hash32)
- type MarriageCertificateIndex
- type MarriageCertificateProof
- type MarriageCertificates
- type MarriageCertificatesRoot
- type MarriageCertificatesRootProof
- type MarriageIndexProof
- type MarriageProof
- type MarryProof
- type MerkleProofV1
- type MerkleProofV2
- type MerkleTreeIndex
- type MockMalfeasanceValidator
- func (m *MockMalfeasanceValidator) EXPECT() *MockMalfeasanceValidatorMockRecorder
- func (m *MockMalfeasanceValidator) PostIndex(ctx context.Context, smesherID types.NodeID, commitment types.ATXID, ...) error
- func (m_2 *MockMalfeasanceValidator) Signature(d signing.Domain, nodeID types.NodeID, m []byte, sig types.EdSignature) bool
- type MockMalfeasanceValidatorMockRecorder
- type MockMalfeasanceValidatorPostIndexCall
- func (c *MockMalfeasanceValidatorPostIndexCall) Do(...) *MockMalfeasanceValidatorPostIndexCall
- func (c *MockMalfeasanceValidatorPostIndexCall) DoAndReturn(...) *MockMalfeasanceValidatorPostIndexCall
- func (c *MockMalfeasanceValidatorPostIndexCall) Return(arg0 error) *MockMalfeasanceValidatorPostIndexCall
- type MockMalfeasanceValidatorSignatureCall
- func (c *MockMalfeasanceValidatorSignatureCall) Do(f func(signing.Domain, types.NodeID, []byte, types.EdSignature) bool) *MockMalfeasanceValidatorSignatureCall
- func (c *MockMalfeasanceValidatorSignatureCall) DoAndReturn(f func(signing.Domain, types.NodeID, []byte, types.EdSignature) bool) *MockMalfeasanceValidatorSignatureCall
- func (c *MockMalfeasanceValidatorSignatureCall) Return(arg0 bool) *MockMalfeasanceValidatorSignatureCall
- type NIPostChallengeV1
- type NIPostChallengeV2
- type NIPostRoot
- type NIPostRootProof
- type NIPostTreeIndex
- type NIPostV1
- type NIPostV2
- func (np *NIPostV2) ChallengeProof(prevATXs []types.ATXID) []types.Hash32
- func (t *NIPostV2) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *NIPostV2) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (np *NIPostV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (np *NIPostV2) MembershipProof(prevATXs []types.ATXID) []types.Hash32
- func (np *NIPostV2) PostsRootProof(prevATXs []types.ATXID) SubPostsRootProof
- func (np *NIPostV2) Root(prevATXs []types.ATXID) NIPostRoot
- type NIPosts
- type NIPostsRoot
- type NIPostsRootProof
- type NumUnitsProof
- type PostMetadataV1
- type PostRoot
- type PostRootProof
- type PostV1
- type PrevATXProof
- type PrevATXs
- type PrevATXsProof
- type PrevATXsRoot
- type PrevATXsRootProof
- type Proof
- type ProofDoubleMarry
- type ProofDoubleMerge
- type ProofInvalidPost
- type ProofInvalidPrevAtxV1
- type ProofInvalidPrevAtxV2
- type ProofType
- type ProofVersion
- type PublishEpochProof
- type SubPostRoot
- type SubPostRootProof
- type SubPostTreeIndex
- type SubPostV2
- func (t *SubPostV2) DecodeScale(dec *scale.Decoder) (total int, err error)
- func (t *SubPostV2) EncodeScale(enc *scale.Encoder) (total int, err error)
- func (sp *SubPostV2) MarriageIndexProof(prevATXs []types.ATXID) MarriageIndexProof
- func (post *SubPostV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (sp *SubPostV2) MembershipLeafIndexProof(prevATXs []types.ATXID) []types.Hash32
- func (sp *SubPostV2) NumUnitsProof(prevATXs []types.ATXID) NumUnitsProof
- func (sp *SubPostV2) PostProof(prevATXs []types.ATXID) PostRootProof
- func (sp *SubPostV2) PrevATXIndexProof(prevATXs []types.ATXID) []types.Hash32
- func (sp *SubPostV2) PrevATXProof(prevATX types.ATXID) PrevATXProof
- func (sp *SubPostV2) Root(prevATXs []types.ATXID) SubPostRoot
- type SubPostsRoot
- type SubPostsRootProof
- type SubPostsV2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivationTxFromWireV1 ¶
func ActivationTxFromWireV1(atx *ActivationTxV1) *types.ActivationTx
func NiPostFromWireV1 ¶ added in v1.6.0
func PostFromWireV1 ¶ added in v1.6.0
Types ¶
type ATXMetadataV1 ¶
func (*ATXMetadataV1) DecodeScale ¶
func (t *ATXMetadataV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ATXMetadataV1) EncodeScale ¶
func (t *ATXMetadataV1) EncodeScale(enc *scale.Encoder) (total int, err error)
type ATXProof ¶ added in v1.7.0
type ATXProof struct { // Version is the version identifier of the proof. This can be used to extend the ATX proof in the future. Version ProofVersion // ProofType is the type of proof that is being provided. ProofType ProofType // Proof is the actual proof. Its type depends on the ProofType. Proof []byte `scale:"max=1048576"` // max size of proof is 1MiB }
func (*ATXProof) DecodeScale ¶ added in v1.7.0
func (*ATXProof) EncodeScale ¶ added in v1.7.0
type ActivationTxV1 ¶
type ActivationTxV1 struct { InnerActivationTxV1 SmesherID types.NodeID Signature types.EdSignature // contains filtered or unexported fields }
func DecodeAtxV1 ¶ added in v1.7.0
func DecodeAtxV1(blob []byte) (*ActivationTxV1, error)
func (*ActivationTxV1) Blob ¶ added in v1.7.0
func (atx *ActivationTxV1) Blob() types.AtxBlob
func (*ActivationTxV1) DecodeScale ¶
func (t *ActivationTxV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ActivationTxV1) EncodeScale ¶
func (t *ActivationTxV1) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*ActivationTxV1) HashInnerBytes ¶
func (atx *ActivationTxV1) HashInnerBytes() (result types.Hash32)
func (*ActivationTxV1) ID ¶ added in v1.5.3
func (atx *ActivationTxV1) ID() types.ATXID
func (*ActivationTxV1) MarshalLogObject ¶ added in v1.6.0
func (atx *ActivationTxV1) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*ActivationTxV1) SetID ¶ added in v1.6.0
func (atx *ActivationTxV1) SetID(id types.ATXID)
func (*ActivationTxV1) Sign ¶ added in v1.6.0
func (atx *ActivationTxV1) Sign(signer *signing.EdSigner)
func (*ActivationTxV1) SignedBytes ¶
func (atx *ActivationTxV1) SignedBytes() []byte
type ActivationTxV2 ¶ added in v1.6.0
type ActivationTxV2 struct { PublishEpoch types.EpochID PositioningATX types.ATXID Coinbase types.Address // only present in initial ATX Initial *InitialAtxPartsV2 PreviousATXs PrevATXs `scale:"max=256"` NIPosts NIPosts `scale:"max=4"` // The VRF nonce must be valid for the collected space of all included IDs. VRFNonce uint64 // The list of marriages with other IDs. // A marriage is permanent and cannot be revoked or repeated. // All new IDs that are married to this ID are added to the equivocation set // that this ID belongs to. // It must contain a self-marriage certificate (needed for malfeasance proofs). Marriages MarriageCertificates `scale:"max=256"` // The ID of the ATX containing marriage for the included IDs. // Only required when the ATX includes married IDs. MarriageATX *types.ATXID SmesherID types.NodeID Signature types.EdSignature // contains filtered or unexported fields }
func DecodeAtxV2 ¶ added in v1.7.0
func DecodeAtxV2(blob []byte) (*ActivationTxV2, error)
func (*ActivationTxV2) Blob ¶ added in v1.7.0
func (atx *ActivationTxV2) Blob() types.AtxBlob
func (*ActivationTxV2) CoinbaseProof ¶ added in v1.7.7
func (atx *ActivationTxV2) CoinbaseProof() []types.Hash32
func (*ActivationTxV2) DecodeScale ¶ added in v1.6.0
func (t *ActivationTxV2) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ActivationTxV2) EncodeScale ¶ added in v1.6.0
func (t *ActivationTxV2) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*ActivationTxV2) ID ¶ added in v1.6.0
func (atx *ActivationTxV2) ID() types.ATXID
ID returns the ATX ID. It is the root of the ATX merkle tree.
func (*ActivationTxV2) InitialPostRootProof ¶ added in v1.7.7
func (atx *ActivationTxV2) InitialPostRootProof() InitialPostRootProof
func (*ActivationTxV2) MarriageATXProof ¶ added in v1.7.7
func (atx *ActivationTxV2) MarriageATXProof() MarriageATXProof
func (*ActivationTxV2) MarriagesRootProof ¶ added in v1.7.7
func (atx *ActivationTxV2) MarriagesRootProof() MarriageCertificatesRootProof
func (*ActivationTxV2) MarshalLogObject ¶ added in v1.6.0
func (atx *ActivationTxV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*ActivationTxV2) NIPostsRootProof ¶ added in v1.7.7
func (atx *ActivationTxV2) NIPostsRootProof() NIPostsRootProof
func (*ActivationTxV2) PositioningATXProof ¶ added in v1.7.7
func (atx *ActivationTxV2) PositioningATXProof() []types.Hash32
func (*ActivationTxV2) PreviousATXsRootProof ¶ added in v1.7.7
func (atx *ActivationTxV2) PreviousATXsRootProof() PrevATXsRootProof
func (*ActivationTxV2) PublishEpochProof ¶ added in v1.7.7
func (atx *ActivationTxV2) PublishEpochProof() PublishEpochProof
func (*ActivationTxV2) Sign ¶ added in v1.6.0
func (atx *ActivationTxV2) Sign(signer *signing.EdSigner)
func (*ActivationTxV2) TotalNumUnits ¶ added in v1.6.0
func (atx *ActivationTxV2) TotalNumUnits() uint32
func (*ActivationTxV2) VRFNonceProof ¶ added in v1.7.7
func (atx *ActivationTxV2) VRFNonceProof() []types.Hash32
type ChallengeProof ¶ added in v1.7.7
func (ChallengeProof) Valid ¶ added in v1.7.7
func (p ChallengeProof) Valid(nipostRoot NIPostRoot, challenge types.Hash32) bool
type CommitmentATXProof ¶ added in v1.7.7
func (CommitmentATXProof) Valid ¶ added in v1.7.7
func (p CommitmentATXProof) Valid(initialPostRoot InitialPostRoot, commitmentATX types.ATXID) bool
type InitialAtxPartsV2 ¶ added in v1.6.0
func (*InitialAtxPartsV2) CommitmentATXProof ¶ added in v1.7.7
func (parts *InitialAtxPartsV2) CommitmentATXProof() CommitmentATXProof
func (*InitialAtxPartsV2) DecodeScale ¶ added in v1.6.0
func (t *InitialAtxPartsV2) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*InitialAtxPartsV2) EncodeScale ¶ added in v1.6.0
func (t *InitialAtxPartsV2) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*InitialAtxPartsV2) MarshalLogObject ¶ added in v1.6.0
func (parts *InitialAtxPartsV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*InitialAtxPartsV2) PostProof ¶ added in v1.7.7
func (parts *InitialAtxPartsV2) PostProof() []types.Hash32
func (*InitialAtxPartsV2) Root ¶ added in v1.6.0
func (parts *InitialAtxPartsV2) Root() InitialPostRoot
type InitialPostRoot ¶ added in v1.7.7
type InitialPostRootProof ¶ added in v1.7.7
func (InitialPostRootProof) Valid ¶ added in v1.7.7
func (p InitialPostRootProof) Valid(atxID types.ATXID, initialPostRoot InitialPostRoot) bool
type InitialPostTreeIndex ¶ added in v1.7.7
type InitialPostTreeIndex uint64
const ( CommitmentATXIndex InitialPostTreeIndex = iota InitialPostIndex )
type InnerActivationTxV1 ¶
type InnerActivationTxV1 struct { NIPostChallengeV1 Coinbase types.Address NumUnits uint32 NIPost *NIPostV1 NodeID *types.NodeID // only present in initial ATX to make hash of the first InnerActivationTxV2 unique VRFNonce *uint64 // only present when the nonce changed (or initial ATX) }
InnerActivationTxV1 is the set of all fields of an ATX that are used to calculate the ATX ID. It contains all fields besides the Signature and the Smesher ID.
func (*InnerActivationTxV1) DecodeScale ¶
func (t *InnerActivationTxV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*InnerActivationTxV1) EncodeScale ¶
func (t *InnerActivationTxV1) EncodeScale(enc *scale.Encoder) (total int, err error)
type InvalidPostProof ¶ added in v1.7.7
type InvalidPostProof struct { // NIPostsRoot and its proof that it is contained in the ATX. NIPostsRoot NIPostsRoot NIPostsRootProof NIPostsRootProof `scale:"max=32"` // NIPostRoot and its proof that it is contained at the given index in the NIPostsRoot. NIPostRoot NIPostRoot NIPostRootProof NIPostRootProof `scale:"max=32"` NIPostIndex uint16 // Challenge and its proof that it is contained in the NIPostRoot. Challenge types.Hash32 ChallengeProof ChallengeProof `scale:"max=32"` // SubPostsRoot and its proof that it is contained in the NIPostRoot. SubPostsRoot SubPostsRoot SubPostsRootProof SubPostsRootProof `scale:"max=32"` // SubPostRoot and its proof that is contained at the given index in the SubPostsRoot. SubPostRoot SubPostRoot SubPostRootProof SubPostRootProof `scale:"max=32"` SubPostRootIndex uint16 // MarriageIndexProof is the proof that the MarriageIndex (CertificateIndex from NodeIDMarryProof) is contained in // the SubPostRoot. MarriageIndexProof MarriageIndexProof `scale:"max=32"` // Post is the invalid PoST and its proof that it is contained in the SubPostRoot. Post PostV1 PostProof PostRootProof `scale:"max=32"` // NumUnits and its proof that it is contained in the SubPostRoot. NumUnits uint32 NumUnitsProof NumUnitsProof `scale:"max=32"` // CommitmentATX is the ATX that was used to initialize data for the invalid PoST. CommitmentATX types.ATXID // InvalidPostIndex is the index of the leaf that was identified to be invalid. InvalidPostIndex uint32 // ValidPostIndex is the index of a leaf that was identified to be valid. ValidPostIndex uint32 }
InvalidPostProof is a proof for an invalid PoST in an ATX. It contains the PoST and the merkle proofs to verify the PoST.
It contains both a valid and an invalid PoST index. This is required to proof that the commitment ATX was used to initialize the data for the invalid PoST. If a PoST contains no valid indices, then the ATX is syntactically invalid.
func (*InvalidPostProof) DecodeScale ¶ added in v1.7.7
func (t *InvalidPostProof) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*InvalidPostProof) EncodeScale ¶ added in v1.7.7
func (t *InvalidPostProof) EncodeScale(enc *scale.Encoder) (total int, err error)
func (InvalidPostProof) Valid ¶ added in v1.7.7
func (p InvalidPostProof) Valid( ctx context.Context, malValidator MalfeasanceValidator, atxID types.ATXID, nodeID types.NodeID, marriageIndex *uint32, ) error
Valid returns no error if the proof is valid. It verifies that the signature is valid, that the merkle proofs are and that the provided post is invalid.
type InvalidPrevAtxProof ¶ added in v1.7.7
type InvalidPrevAtxProof struct { // ATXID is the ID of the ATX being proven. ATXID types.ATXID // SmesherID is the ID of the smesher that published the ATX. SmesherID types.NodeID // Signature is the signature of the ATXID by the smesher. Signature types.EdSignature // NIPostsRoot and its proof that it is contained in the ATX. NIPostsRoot NIPostsRoot NIPostsRootProof NIPostsRootProof `scale:"max=32"` // NIPostRoot and its proof that it is contained at the given index in the NIPostsRoot. NIPostRoot NIPostRoot NIPostRootProof NIPostRootProof `scale:"max=32"` NIPostIndex uint16 // SubPostsRoot and its proof that it is contained in the NIPostRoot. SubPostsRoot SubPostsRoot SubPostsRootProof SubPostsRootProof `scale:"max=32"` // SubPostRoot and its proof that is contained at the given index in the SubPostsRoot. SubPostRoot SubPostRoot SubPostRootProof SubPostRootProof `scale:"max=32"` SubPostRootIndex uint16 // MarriageProof is the proof that NodeID and SmesherID are married. It is nil if NodeID == SmesherID. MarriageProof *MarriageProof // MarriageIndexProof is the proof that the MarriageIndex (CertificateIndex from NodeIDMarryProof) is contained in // the SubPostRoot. MarriageIndexProof MarriageIndexProof `scale:"max=32"` // PrevATXProof is the proof that the previous ATX is contained in the SubPostRoot. PrevATXProof PrevATXProof `scale:"max=32"` }
func (*InvalidPrevAtxProof) DecodeScale ¶ added in v1.7.7
func (t *InvalidPrevAtxProof) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*InvalidPrevAtxProof) EncodeScale ¶ added in v1.7.7
func (t *InvalidPrevAtxProof) EncodeScale(enc *scale.Encoder) (total int, err error)
func (InvalidPrevAtxProof) Valid ¶ added in v1.7.7
func (p InvalidPrevAtxProof) Valid(prevATX types.ATXID, nodeID types.NodeID, malValidator MalfeasanceValidator) error
type MalfeasanceValidator ¶ added in v1.7.7
type MalfeasanceValidator interface { // PostIndex validates the given post against for the provided index. // It returns an error if the post is invalid. PostIndex( ctx context.Context, smesherID types.NodeID, commitment types.ATXID, post *types.Post, challenge []byte, numUnits uint32, idx int, ) error // Signature validates the given signature against the given message and public key. Signature(d signing.Domain, nodeID types.NodeID, m []byte, sig types.EdSignature) bool }
type MarriageATXProof ¶ added in v1.7.7
type MarriageCertificate ¶ added in v1.6.0
type MarriageCertificate struct { // An ATX of the NodeID that marries. It proves that the NodeID exists. // Note: the reference ATX does not need to be from the previous epoch. // It only needs to prove the existence of the Identity. ReferenceAtx types.ATXID // Signature over the other ID that this ID marries with // If Alice marries Bob, then Alice signs Bob's ID // and Bob includes this certificate in his ATX. Signature types.EdSignature }
MarriageCertificate proves the will of ID to be married with the ID that includes this certificate. A marriage allows for publishing a merged ATX, which can contain PoST for all married IDs. Any ID from the marriage can publish a merged ATX on behalf of all married IDs.
func (*MarriageCertificate) DecodeScale ¶ added in v1.6.0
func (t *MarriageCertificate) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*MarriageCertificate) EncodeScale ¶ added in v1.6.0
func (t *MarriageCertificate) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*MarriageCertificate) MarshalLogObject ¶ added in v1.6.0
func (mc *MarriageCertificate) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*MarriageCertificate) Root ¶ added in v1.6.0
func (mc *MarriageCertificate) Root() (result types.Hash32)
type MarriageCertificateIndex ¶ added in v1.7.7
type MarriageCertificateIndex uint64
const ( ReferenceATXIndex MarriageCertificateIndex = iota SignatureIndex )
type MarriageCertificateProof ¶ added in v1.7.7
func (MarriageCertificateProof) Valid ¶ added in v1.7.7
func (p MarriageCertificateProof) Valid(marriageRoot MarriageCertificatesRoot, index int, mc MarriageCertificate) bool
type MarriageCertificates ¶ added in v1.7.0
type MarriageCertificates []MarriageCertificate
func (MarriageCertificates) Proof ¶ added in v1.7.7
func (mcs MarriageCertificates) Proof(index int) MarriageCertificateProof
func (MarriageCertificates) Root ¶ added in v1.7.0
func (mcs MarriageCertificates) Root() MarriageCertificatesRoot
type MarriageCertificatesRoot ¶ added in v1.7.7
type MarriageCertificatesRootProof ¶ added in v1.7.7
func (MarriageCertificatesRootProof) Valid ¶ added in v1.7.7
func (p MarriageCertificatesRootProof) Valid(atxID types.ATXID, marriagesRoot MarriageCertificatesRoot) bool
type MarriageIndexProof ¶ added in v1.7.7
func (MarriageIndexProof) Valid ¶ added in v1.7.7
func (p MarriageIndexProof) Valid(subPostRoot SubPostRoot, marriageIndex uint32) bool
type MarriageProof ¶ added in v1.7.7
type MarriageProof struct { // MarriageATX and its proof that it is contained in the ATX. MarriageATX types.ATXID MarriageATXProof MarriageATXProof `scale:"max=32"` // MarriageATXSmesherID is the ID of the smesher that published the marriage ATX. MarriageATXSmesherID types.NodeID // NodeIDMarryProof is the proof that NodeID married in MarriageATX. NodeIDMarryProof MarryProof // SmesherIDMarryProof is the proof that SmesherID married in MarriageATX. SmesherIDMarryProof MarryProof }
MarriageProof is a proof for two identities to be married via a marriage ATX.
func (*MarriageProof) DecodeScale ¶ added in v1.7.7
func (t *MarriageProof) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*MarriageProof) EncodeScale ¶ added in v1.7.7
func (t *MarriageProof) EncodeScale(enc *scale.Encoder) (total int, err error)
func (MarriageProof) Valid ¶ added in v1.7.7
func (p MarriageProof) Valid( malValidator MalfeasanceValidator, atxID types.ATXID, nodeID, smesherID types.NodeID, ) error
type MarryProof ¶ added in v1.7.0
type MarryProof struct { // MarriageCertificatesRoot and its proof that it is contained in the ATX. MarriageCertificatesRoot MarriageCertificatesRoot MarriageCertificatesProof MarriageCertificatesRootProof `scale:"max=32"` // The signature of the certificate and the proof that the certificate is contained in the MarriageRoot at // the given index. Certificate MarriageCertificate CertificateProof MarriageCertificateProof `scale:"max=32"` CertificateIndex uint32 }
MarryProof is a proof that a NodeID is married to another NodeID.
func (*MarryProof) DecodeScale ¶ added in v1.7.0
func (t *MarryProof) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*MarryProof) EncodeScale ¶ added in v1.7.0
func (t *MarryProof) EncodeScale(enc *scale.Encoder) (total int, err error)
func (MarryProof) Valid ¶ added in v1.7.0
func (p MarryProof) Valid( malValidator MalfeasanceValidator, atxID types.ATXID, smesherID types.NodeID, nodeID types.NodeID, ) error
Valid returns an error if the proof is invalid. It checks that `nodeID` signed a certificate to marry `smesherID` and it was included in the ATX with the given `atxID`.
type MerkleProofV1 ¶
type MerkleProofV1 struct { // Nodes on path from leaf to root (not including leaf) Nodes []types.Hash32 `scale:"max=32"` LeafIndex uint64 }
func (*MerkleProofV1) DecodeScale ¶
func (t *MerkleProofV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*MerkleProofV1) EncodeScale ¶
func (t *MerkleProofV1) EncodeScale(enc *scale.Encoder) (total int, err error)
type MerkleProofV2 ¶ added in v1.6.0
type MerkleProofV2 struct { // Nodes on path from leaf to root (not including leaf) Nodes []types.Hash32 `scale:"max=32"` }
MerkleProofV2 proves membership of multiple challenges in a PoET membership merkle tree.
func (*MerkleProofV2) DecodeScale ¶ added in v1.6.0
func (t *MerkleProofV2) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*MerkleProofV2) EncodeScale ¶ added in v1.6.0
func (t *MerkleProofV2) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*MerkleProofV2) Root ¶ added in v1.7.7
func (mp *MerkleProofV2) Root() (result types.Hash32)
type MerkleTreeIndex ¶ added in v1.7.0
type MerkleTreeIndex uint64
MerkleTreeIndex is the index of the leaf containing the given field in the merkle tree.
const ( PublishEpochIndex MerkleTreeIndex = iota PositioningATXIndex CoinbaseIndex InitialPostRootIndex PreviousATXsRootIndex NIPostsRootIndex VRFNonceIndex MarriagesRootIndex MarriageATXIndex )
type MockMalfeasanceValidator ¶ added in v1.7.7
type MockMalfeasanceValidator struct {
// contains filtered or unexported fields
}
MockMalfeasanceValidator is a mock of MalfeasanceValidator interface.
func NewMockMalfeasanceValidator ¶ added in v1.7.7
func NewMockMalfeasanceValidator(ctrl *gomock.Controller) *MockMalfeasanceValidator
NewMockMalfeasanceValidator creates a new mock instance.
func (*MockMalfeasanceValidator) EXPECT ¶ added in v1.7.7
func (m *MockMalfeasanceValidator) EXPECT() *MockMalfeasanceValidatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockMalfeasanceValidatorMockRecorder ¶ added in v1.7.7
type MockMalfeasanceValidatorMockRecorder struct {
// contains filtered or unexported fields
}
MockMalfeasanceValidatorMockRecorder is the mock recorder for MockMalfeasanceValidator.
func (*MockMalfeasanceValidatorMockRecorder) PostIndex ¶ added in v1.7.7
func (mr *MockMalfeasanceValidatorMockRecorder) PostIndex(ctx, smesherID, commitment, post, challenge, numUnits, idx any) *MockMalfeasanceValidatorPostIndexCall
PostIndex indicates an expected call of PostIndex.
func (*MockMalfeasanceValidatorMockRecorder) Signature ¶ added in v1.7.7
func (mr *MockMalfeasanceValidatorMockRecorder) Signature(d, nodeID, m, sig any) *MockMalfeasanceValidatorSignatureCall
Signature indicates an expected call of Signature.
type MockMalfeasanceValidatorPostIndexCall ¶ added in v1.7.7
MockMalfeasanceValidatorPostIndexCall wrap *gomock.Call
func (*MockMalfeasanceValidatorPostIndexCall) Do ¶ added in v1.7.7
func (c *MockMalfeasanceValidatorPostIndexCall) Do(f func(context.Context, types.NodeID, types.ATXID, *types.Post, []byte, uint32, int) error) *MockMalfeasanceValidatorPostIndexCall
Do rewrite *gomock.Call.Do
func (*MockMalfeasanceValidatorPostIndexCall) DoAndReturn ¶ added in v1.7.7
func (c *MockMalfeasanceValidatorPostIndexCall) DoAndReturn(f func(context.Context, types.NodeID, types.ATXID, *types.Post, []byte, uint32, int) error) *MockMalfeasanceValidatorPostIndexCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockMalfeasanceValidatorPostIndexCall) Return ¶ added in v1.7.7
func (c *MockMalfeasanceValidatorPostIndexCall) Return(arg0 error) *MockMalfeasanceValidatorPostIndexCall
Return rewrite *gomock.Call.Return
type MockMalfeasanceValidatorSignatureCall ¶ added in v1.7.7
MockMalfeasanceValidatorSignatureCall wrap *gomock.Call
func (*MockMalfeasanceValidatorSignatureCall) Do ¶ added in v1.7.7
func (c *MockMalfeasanceValidatorSignatureCall) Do(f func(signing.Domain, types.NodeID, []byte, types.EdSignature) bool) *MockMalfeasanceValidatorSignatureCall
Do rewrite *gomock.Call.Do
func (*MockMalfeasanceValidatorSignatureCall) DoAndReturn ¶ added in v1.7.7
func (c *MockMalfeasanceValidatorSignatureCall) DoAndReturn(f func(signing.Domain, types.NodeID, []byte, types.EdSignature) bool) *MockMalfeasanceValidatorSignatureCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockMalfeasanceValidatorSignatureCall) Return ¶ added in v1.7.7
func (c *MockMalfeasanceValidatorSignatureCall) Return(arg0 bool) *MockMalfeasanceValidatorSignatureCall
Return rewrite *gomock.Call.Return
type NIPostChallengeV1 ¶
type NIPostChallengeV1 struct { PublishEpoch types.EpochID // Sequence number counts the number of ancestors of the ATX. It sequentially increases for each ATX in the chain. // Two ATXs with the same sequence number from the same miner can be used as the proof of malfeasance against // that miner. Sequence uint64 // the previous ATX's ID (for all but the first in the sequence) PrevATXID types.ATXID PositioningATXID types.ATXID // CommitmentATXID is the ATX used in the commitment for initializing the PoST of the node. CommitmentATXID *types.ATXID InitialPost *PostV1 }
func NIPostChallengeToWireV1 ¶
func NIPostChallengeToWireV1(c *types.NIPostChallenge) *NIPostChallengeV1
func (*NIPostChallengeV1) DecodeScale ¶
func (t *NIPostChallengeV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*NIPostChallengeV1) EncodeScale ¶
func (t *NIPostChallengeV1) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*NIPostChallengeV1) Hash ¶
func (c *NIPostChallengeV1) Hash() types.Hash32
Hash serializes the NIPostChallenge and returns its hash. The serialized challenge is first prepended with a byte 0x00, and then hashed for second preimage resistance of poet membership merkle tree.
func (*NIPostChallengeV1) MarshalLogObject ¶ added in v1.6.0
func (c *NIPostChallengeV1) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type NIPostChallengeV2 ¶ added in v1.6.0
type NIPostChallengeV2 struct { PublishEpoch types.EpochID PrevATXID types.ATXID PositioningATXID types.ATXID InitialPost *PostV1 }
NIPostChallengeV2 collects information needed to generate a PoET challenge. It's hash is the challenge registered in the PoET.
func NIPostChallengeToWireV2 ¶ added in v1.6.0
func NIPostChallengeToWireV2(c *types.NIPostChallenge) *NIPostChallengeV2
func (*NIPostChallengeV2) DecodeScale ¶ added in v1.6.0
func (t *NIPostChallengeV2) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*NIPostChallengeV2) EncodeScale ¶ added in v1.6.0
func (t *NIPostChallengeV2) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*NIPostChallengeV2) Hash ¶ added in v1.6.0
func (c *NIPostChallengeV2) Hash() types.Hash32
Hash serializes the NIPostChallenge and returns its hash. The serialized challenge is first prepended with a byte 0x00, and then hashed for second preimage resistance of poet membership merkle tree.
func (*NIPostChallengeV2) MarshalLogObject ¶ added in v1.6.0
func (c *NIPostChallengeV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type NIPostRoot ¶ added in v1.7.7
type NIPostRootProof ¶ added in v1.7.7
func (NIPostRootProof) Valid ¶ added in v1.7.7
func (p NIPostRootProof) Valid(niPostsRoot NIPostsRoot, index int, nipostRoot NIPostRoot) bool
type NIPostTreeIndex ¶ added in v1.7.7
type NIPostTreeIndex uint64
const ( MembershipIndex NIPostTreeIndex = iota ChallengeIndex PostsRootIndex )
type NIPostV1 ¶
type NIPostV1 struct { // Membership proves that the challenge for the PoET, which is // constructed from fields in the activation transaction, // is a member of the poet's proof. // Proof.Root must match the Poet's POSW statement. Membership MerkleProofV1 // Post is the proof that the prover data is still stored (or was recomputed) at // the time he learned the challenge constructed from the PoET. Post *PostV1 // PostMetadata is the Post metadata, associated with the proof. // The proof should be verified upon the metadata during the syntactic validation, // while the metadata should be verified during the contextual validation. PostMetadata *PostMetadataV1 }
func NiPostToWireV1 ¶ added in v1.6.0
func (*NIPostV1) DecodeScale ¶
func (*NIPostV1) EncodeScale ¶
func (*NIPostV1) MarshalLogObject ¶ added in v1.6.0
func (nipost *NIPostV1) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type NIPostV2 ¶ added in v1.7.7
type NIPostV2 struct { // Single membership proof for all IDs in `Posts`. Membership MerkleProofV2 // The root of the PoET proof, that serves as the challenge for PoSTs. Challenge types.Hash32 Posts SubPostsV2 `scale:"max=256"` // support merging up to 256 IDs }
func (*NIPostV2) ChallengeProof ¶ added in v1.7.7
func (*NIPostV2) DecodeScale ¶ added in v1.7.7
func (*NIPostV2) EncodeScale ¶ added in v1.7.7
func (*NIPostV2) MarshalLogObject ¶ added in v1.7.7
func (np *NIPostV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*NIPostV2) MembershipProof ¶ added in v1.7.7
func (*NIPostV2) PostsRootProof ¶ added in v1.7.7
func (np *NIPostV2) PostsRootProof(prevATXs []types.ATXID) SubPostsRootProof
type NIPosts ¶ added in v1.7.7
type NIPosts []NIPostV2
type NIPostsRoot ¶ added in v1.7.7
type NIPostsRootProof ¶ added in v1.7.7
func (NIPostsRootProof) Valid ¶ added in v1.7.7
func (p NIPostsRootProof) Valid(atxID types.ATXID, niPostsRoot NIPostsRoot) bool
type NumUnitsProof ¶ added in v1.7.7
func (NumUnitsProof) Valid ¶ added in v1.7.7
func (p NumUnitsProof) Valid(subPostRoot SubPostRoot, numUnits uint32) bool
type PostMetadataV1 ¶
func (*PostMetadataV1) DecodeScale ¶
func (t *PostMetadataV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*PostMetadataV1) EncodeScale ¶
func (t *PostMetadataV1) EncodeScale(enc *scale.Encoder) (total int, err error)
type PostRootProof ¶ added in v1.7.7
func (PostRootProof) Valid ¶ added in v1.7.7
func (p PostRootProof) Valid(subPostRoot SubPostRoot, postRoot PostRoot) bool
type PostV1 ¶
func PostToWireV1 ¶ added in v1.6.0
func (*PostV1) DecodeScale ¶
func (*PostV1) EncodeScale ¶
func (*PostV1) MarshalLogObject ¶ added in v1.6.0
func (p *PostV1) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type PrevATXProof ¶ added in v1.7.7
func (PrevATXProof) Valid ¶ added in v1.7.7
func (p PrevATXProof) Valid(subPostRoot SubPostRoot, prevATX types.ATXID) bool
type PrevATXs ¶ added in v1.7.7
func (PrevATXs) Proof ¶ added in v1.7.7
func (prevATXs PrevATXs) Proof(index int) PrevATXsProof
func (PrevATXs) Root ¶ added in v1.7.7
func (prevATXs PrevATXs) Root() PrevATXsRoot
type PrevATXsProof ¶ added in v1.7.7
func (PrevATXsProof) Valid ¶ added in v1.7.7
func (p PrevATXsProof) Valid(prevATXsRoot PrevATXsRoot, index int, prevATX types.ATXID) bool
type PrevATXsRoot ¶ added in v1.7.7
type PrevATXsRootProof ¶ added in v1.7.7
func (PrevATXsRootProof) Valid ¶ added in v1.7.7
func (p PrevATXsRootProof) Valid(atxID types.ATXID, prevATXsRoot PrevATXsRoot) bool
type Proof ¶ added in v1.7.0
type Proof interface {
scale.Encodable
Valid(ctx context.Context, malHandler MalfeasanceValidator) (types.NodeID, error)
}
Proof is an interface for all types of proofs that can be provided in an ATXProof. Generally the proof should be able to validate itself and be scale encoded.
type ProofDoubleMarry ¶ added in v1.7.0
type ProofDoubleMarry struct { // NodeID is the node ID that married twice. NodeID types.NodeID // ATX1 is the ID of the ATX being proven to have the marriage certificate of interest. ATX1 types.ATXID // SmesherID1 is the ID of the smesher that published ATX1. SmesherID1 types.NodeID // Signature1 is the signature of the ATXID by the smesher. Signature1 types.EdSignature // Proof1 is the proof that the marriage certificate is contained in the ATX1. Proof1 MarryProof // ATX2 is the ID of the ATX being proven to have the marriage certificate of interest. ATX2 types.ATXID // SmesherID2 is the ID of the smesher that published ATX2. SmesherID2 types.NodeID // Signature2 is the signature of the ATXID by the smesher. Signature2 types.EdSignature // Proof2 is the proof that the marriage certificate is contained in the ATX2. Proof2 MarryProof }
ProofDoubleMarry is a proof that two distinct ATXs contain a marriage certificate signed by the same identity.
We are proving the following:
- The ATXs have different IDs.
- Both ATXs have a valid signature.
- Both ATXs contain a marriage certificate created by the same identity.
- Both marriage certificates have valid signatures.
func NewDoubleMarryProof ¶ added in v1.7.0
func NewDoubleMarryProof(db sql.Executor, atx1, atx2 *ActivationTxV2, nodeID types.NodeID) (*ProofDoubleMarry, error)
func (*ProofDoubleMarry) DecodeScale ¶ added in v1.7.0
func (t *ProofDoubleMarry) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ProofDoubleMarry) EncodeScale ¶ added in v1.7.0
func (t *ProofDoubleMarry) EncodeScale(enc *scale.Encoder) (total int, err error)
func (ProofDoubleMarry) Valid ¶ added in v1.7.0
func (p ProofDoubleMarry) Valid(_ context.Context, malValidator MalfeasanceValidator) (types.NodeID, error)
type ProofDoubleMerge ¶ added in v1.7.7
type ProofDoubleMerge struct { // PublishEpoch and its proof that it is contained in the ATX. PublishEpoch types.EpochID // MarriageATXID is the ID of the marriage ATX. MarriageATX types.ATXID // MarriageATXSmesherID is the ID of the smesher that published the marriage ATX. MarriageATXSmesherID types.NodeID // ATXID1 is the ID of the ATX being proven. ATXID1 types.ATXID // SmesherID1 is the ID of the smesher that published the ATX. SmesherID1 types.NodeID // Signature1 is the signature of the ATXID by the smesher. Signature1 types.EdSignature // PublishEpochProof1 is the proof that the publish epoch is contained in the ATX. PublishEpochProof1 PublishEpochProof `scale:"max=32"` // MarriageATXProof1 is the proof that MarriageATX is contained in the ATX. MarriageATXProof1 MarriageATXProof `scale:"max=32"` // SmesherID1MarryProof is the proof that they married in MarriageATX. SmesherID1MarryProof MarryProof // ATXID2 is the ID of the ATX being proven. ATXID2 types.ATXID // SmesherID is the ID of the smesher that published the ATX. SmesherID2 types.NodeID // Signature2 is the signature of the ATXID by the smesher. Signature2 types.EdSignature // PublishEpochProof2 is the proof that the publish epoch is contained in the ATX. PublishEpochProof2 PublishEpochProof `scale:"max=32"` // MarriageATXProof1 is the proof that MarriageATX is contained in the ATX. MarriageATXProof2 MarriageATXProof `scale:"max=32"` // SmesherID1MarryProof is the proof that they married in MarriageATX. SmesherID2MarryProof MarryProof }
ProofDoubleMerge is a proof that two distinct ATXs published in the same epoch contain the same marriage ATX.
We are proving the following:
- The ATXs have different IDs.
- Both ATXs have a valid signature.
- Both ATXs contain the same marriage ATX.
- Both ATXs were published in the same epoch.
- Signers of both ATXs are married - to prevent banning others by publishing an ATX with the same marriage ATX.
func NewDoubleMergeProof ¶ added in v1.7.7
func NewDoubleMergeProof(db sql.Executor, atx1, atx2 *ActivationTxV2) (*ProofDoubleMerge, error)
func (*ProofDoubleMerge) DecodeScale ¶ added in v1.7.7
func (t *ProofDoubleMerge) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ProofDoubleMerge) EncodeScale ¶ added in v1.7.7
func (t *ProofDoubleMerge) EncodeScale(enc *scale.Encoder) (total int, err error)
func (*ProofDoubleMerge) Valid ¶ added in v1.7.7
func (p *ProofDoubleMerge) Valid(_ context.Context, edVerifier MalfeasanceValidator) (types.NodeID, error)
type ProofInvalidPost ¶ added in v1.7.7
type ProofInvalidPost struct { // ATXID is the ID of the ATX containing the invalid PoST. ATXID types.ATXID // SmesherID is the ID of the smesher that published the ATX. SmesherID types.NodeID // Signature is the signature of the ATXID by the smesher. Signature types.EdSignature // NodeID is the node ID that created the invalid PoST. NodeID types.NodeID // MarriageProof is the proof that NodeID and SmesherID are married. It is nil if NodeID == SmesherID. MarriageProof *MarriageProof // InvalidPostProof is the proof for the invalid PoST of the ATX. It contains the PoST and the merkle proofs to // verify the PoST. InvalidPostProof InvalidPostProof }
ProofInvalidPost is a proof that a merged ATX with an invalid Post was published by a smesher.
We are proofing the following:
- The ATX has a valid signature.
- If NodeID is different from SmesherID, we prove that NodeID and SmesherID are married.
- The commitment ATX of NodeID used for the invalid PoST based on their initial ATX.
- The provided Post is invalid for the given NodeID.
func NewInvalidPostProof ¶ added in v1.7.7
func (*ProofInvalidPost) DecodeScale ¶ added in v1.7.7
func (t *ProofInvalidPost) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ProofInvalidPost) EncodeScale ¶ added in v1.7.7
func (t *ProofInvalidPost) EncodeScale(enc *scale.Encoder) (total int, err error)
func (ProofInvalidPost) Valid ¶ added in v1.7.7
func (p ProofInvalidPost) Valid(ctx context.Context, malValidator MalfeasanceValidator) (types.NodeID, error)
type ProofInvalidPrevAtxV1 ¶ added in v1.7.7
type ProofInvalidPrevAtxV1 struct { // NodeID is the node ID that referenced the same previous ATX twice. NodeID types.NodeID // PrevATX is the ATX that was referenced twice. PrevATX types.ATXID Proof InvalidPrevAtxProof ATXv1 ActivationTxV1 }
ProofInvalidPrevAtxV1 is a proof that two ATXs published by an identity reference the same previous ATX for an identity.
We are proving the following:
- Both ATXs have a valid signature.
- Both ATXs reference the same previous ATX for the same identity.
- If the signer of the ATXv2 is not the identity that referenced the same previous ATX, then the included marriage proof is valid.
- The ATXv1 has been signed by the identity that referenced the same previous ATX.
func NewInvalidPrevAtxProofV1 ¶ added in v1.7.7
func NewInvalidPrevAtxProofV1( db sql.Executor, atx1 *ActivationTxV2, atx2 *ActivationTxV1, nodeID types.NodeID, ) (*ProofInvalidPrevAtxV1, error)
func (*ProofInvalidPrevAtxV1) DecodeScale ¶ added in v1.7.7
func (t *ProofInvalidPrevAtxV1) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ProofInvalidPrevAtxV1) EncodeScale ¶ added in v1.7.7
func (t *ProofInvalidPrevAtxV1) EncodeScale(enc *scale.Encoder) (total int, err error)
func (ProofInvalidPrevAtxV1) Valid ¶ added in v1.7.7
func (p ProofInvalidPrevAtxV1) Valid(_ context.Context, malValidator MalfeasanceValidator) (types.NodeID, error)
type ProofInvalidPrevAtxV2 ¶ added in v1.7.7
type ProofInvalidPrevAtxV2 struct { // NodeID is the node ID that referenced the same previous ATX twice. NodeID types.NodeID // PrevATX is the ATX that was referenced twice. PrevATX types.ATXID Proofs [2]InvalidPrevAtxProof }
ProofInvalidPrevAtxV2 is a proof that two distinct ATXs reference the same previous ATX for one of the included identities.
We are proving the following:
- The ATXs have different IDs.
- Both ATXs have a valid signature.
- Both ATXs reference the same previous ATX for the same identity.
- If the signer of one of the two ATXs is not the identity that referenced the same previous ATX, then the identity that did is married to the signer via a valid marriage certificate in the referenced marriage ATX.
func NewInvalidPrevAtxProofV2 ¶ added in v1.7.7
func NewInvalidPrevAtxProofV2( db sql.Executor, atx1, atx2 *ActivationTxV2, nodeID types.NodeID, ) (*ProofInvalidPrevAtxV2, error)
func (*ProofInvalidPrevAtxV2) DecodeScale ¶ added in v1.7.7
func (t *ProofInvalidPrevAtxV2) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*ProofInvalidPrevAtxV2) EncodeScale ¶ added in v1.7.7
func (t *ProofInvalidPrevAtxV2) EncodeScale(enc *scale.Encoder) (total int, err error)
func (ProofInvalidPrevAtxV2) Valid ¶ added in v1.7.7
func (p ProofInvalidPrevAtxV2) Valid(_ context.Context, malValidator MalfeasanceValidator) (types.NodeID, error)
type ProofType ¶ added in v1.7.0
type ProofType byte
ProofType is an identifier for the type of proof that is encoded in the ATXProof.
const ( // TODO(mafa): legacy types for future migration to new malfeasance proofs. LegacyDoublePublish ProofType = 0x00 LegacyInvalidPost ProofType = 0x01 LegacyInvalidPrevATX ProofType = 0x02 DoubleMarry ProofType = 0x10 DoubleMerge ProofType = 0x11 InvalidPost ProofType = 0x12 InvalidPrevious ProofType = 0x13 )
type ProofVersion ¶ added in v1.7.0
type ProofVersion byte
ProofVersion is an identifier for the version of the proof that is encoded in the ATXProof.
type PublishEpochProof ¶ added in v1.7.7
type SubPostRoot ¶ added in v1.7.7
type SubPostRootProof ¶ added in v1.7.7
func (SubPostRootProof) Valid ¶ added in v1.7.7
func (p SubPostRootProof) Valid(subPostsRoot SubPostsRoot, index int, subPostRoot SubPostRoot) bool
type SubPostTreeIndex ¶ added in v1.7.7
type SubPostTreeIndex uint64
const ( MarriageIndex SubPostTreeIndex = iota PrevATXIndex MembershipLeafIndex PostIndex NumUnitsIndex )
type SubPostV2 ¶ added in v1.6.0
type SubPostV2 struct { // Index of marriage certificate for this ID in the 'Marriages' slice. Only valid for merged ATXs. // Can be used to extract the nodeID and verify if it is married with the smesher of the ATX. // Must be 0 for non-merged ATXs. MarriageIndex uint32 PrevATXIndex uint32 // Index of the previous ATX in the `InnerActivationTxV2.PreviousATXs` slice // Index of the leaf for this ID's challenge in the poet membership tree. // IDs might shared the same index if their nipost challenges are equal. // This happens when the IDs are continuously merged (they share the previous ATX). MembershipLeafIndex uint64 Post PostV1 NumUnits uint32 }
func (*SubPostV2) DecodeScale ¶ added in v1.6.0
func (*SubPostV2) EncodeScale ¶ added in v1.6.0
func (*SubPostV2) MarriageIndexProof ¶ added in v1.7.7
func (sp *SubPostV2) MarriageIndexProof(prevATXs []types.ATXID) MarriageIndexProof
func (*SubPostV2) MarshalLogObject ¶ added in v1.6.0
func (post *SubPostV2) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*SubPostV2) MembershipLeafIndexProof ¶ added in v1.7.7
func (*SubPostV2) NumUnitsProof ¶ added in v1.7.7
func (sp *SubPostV2) NumUnitsProof(prevATXs []types.ATXID) NumUnitsProof
func (*SubPostV2) PostProof ¶ added in v1.7.7
func (sp *SubPostV2) PostProof(prevATXs []types.ATXID) PostRootProof
func (*SubPostV2) PrevATXIndexProof ¶ added in v1.7.7
func (*SubPostV2) PrevATXProof ¶ added in v1.7.7
func (sp *SubPostV2) PrevATXProof(prevATX types.ATXID) PrevATXProof
type SubPostsRoot ¶ added in v1.7.7
type SubPostsRootProof ¶ added in v1.7.7
func (SubPostsRootProof) Valid ¶ added in v1.7.7
func (p SubPostsRootProof) Valid(nipostRoot NIPostRoot, postsRoot SubPostsRoot) bool
type SubPostsV2 ¶ added in v1.7.7
type SubPostsV2 []SubPostV2
func (SubPostsV2) Proof ¶ added in v1.7.7
func (sp SubPostsV2) Proof(index int, prevATXs []types.ATXID) SubPostRootProof
func (SubPostsV2) Root ¶ added in v1.7.7
func (sp SubPostsV2) Root(prevATXs []types.ATXID) SubPostsRoot
Source Files ¶
- challenge_v1.go
- challenge_v1_scale.go
- challenge_v2.go
- challenge_v2_scale.go
- interface.go
- malfeasance.go
- malfeasance_double_marry.go
- malfeasance_double_marry_scale.go
- malfeasance_double_merge.go
- malfeasance_double_merge_scale.go
- malfeasance_invalid_post.go
- malfeasance_invalid_post_scale.go
- malfeasance_invalid_prev_atx.go
- malfeasance_invalid_prev_atx_scale.go
- malfeasance_scale.go
- malfeasance_shared.go
- malfeasance_shared_scale.go
- mocks.go
- wire_v1.go
- wire_v1_scale.go
- wire_v2.go
- wire_v2_scale.go