Skip to content

Commit

Permalink
align collection guarantee with protobuf schema
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-malachyn committed Oct 15, 2024
1 parent 853e844 commit be6d7cc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions access/grpc/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ func MessageToFullCollection(m []*entities.Transaction) (flow.FullCollection, er

func CollectionGuaranteeToMessage(g flow.CollectionGuarantee) *entities.CollectionGuarantee {
return &entities.CollectionGuarantee{
CollectionId: g.CollectionID.Bytes(),
CollectionId: g.CollectionID.Bytes(),
Signatures: g.Signatures,
ReferenceBlockId: g.ReferenceBlockID.Bytes(),
Signature: g.Signature,
SignerIndices: g.SignerIndices,
}
}

Expand All @@ -344,7 +348,11 @@ func MessageToCollectionGuarantee(m *entities.CollectionGuarantee) (flow.Collect
}

return flow.CollectionGuarantee{
CollectionID: flow.HashToID(m.CollectionId),
CollectionID: flow.HashToID(m.CollectionId),
Signatures: m.Signatures,
ReferenceBlockID: flow.HashToID(m.ReferenceBlockId),
Signature: m.Signature,
SignerIndices: m.SignerIndices,
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion access/http/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func ToCollectionGuarantees(guarantees []models.CollectionGuarantee) []*flow.Col

for i, guarantee := range guarantees {
flowGuarantees[i] = &flow.CollectionGuarantee{
flow.HexToID(guarantee.CollectionId),
CollectionID: flow.HexToID(guarantee.CollectionId),
}
}

Expand Down
6 changes: 5 additions & 1 deletion collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ func (c Collection) Encode() []byte {

// A CollectionGuarantee is an attestation signed by the nodes that have guaranteed a collection.
type CollectionGuarantee struct {
CollectionID Identifier
CollectionID Identifier
Signatures [][]byte
ReferenceBlockID Identifier
Signature []byte
SignerIndices []byte
}

type FullCollection struct {
Expand Down
6 changes: 5 additions & 1 deletion test/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ func CollectionGuaranteeGenerator() *CollectionGuarantees {

func (g *CollectionGuarantees) New() *flow.CollectionGuarantee {
return &flow.CollectionGuarantee{
CollectionID: g.ids.New(),
CollectionID: g.ids.New(),
Signatures: [][]byte{[]byte("dummy")},
ReferenceBlockID: g.ids.New(),
Signature: []byte("dummy"),
SignerIndices: []byte("dummy"),
}
}

Expand Down

0 comments on commit be6d7cc

Please sign in to comment.