Skip to content

Commit

Permalink
Update Observer tipset structure to include supplemental data.
Browse files Browse the repository at this point in the history
  • Loading branch information
masih committed Nov 18, 2024
1 parent 4914105 commit d3bfd33
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 10 additions & 6 deletions observer/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ type supplementalData struct {
}

type tipSet struct {
Epoch int64 `json:"Epoch"`
Key []byte `json:"Key"`
Epoch int64 `json:"Epoch"`
Key []byte `json:"Key"`
Commitments []byte `json:"Commitments"`
PowerTable string `json:"PowerTable"`
}

func newMessage(timestamp time.Time, nn string, msg gpbft.GMessage) (*message, error) {
Expand Down Expand Up @@ -85,10 +87,12 @@ func newPayload(gp gpbft.Payload) payload {
value := make([]tipSet, len(gp.Value))
for i, v := range gp.Value {
value[i] = tipSet{
// The TipSet Commitments and PowerTable CID always match the Payload's
// SupplementalData for valid messages. Therefore, dropped for brevity.
Epoch: v.Epoch,
Key: v.Key,
Epoch: v.Epoch,
Key: v.Key,
PowerTable: v.PowerTable.String(),
}
if v.Commitments != emptyCommitments {
value[i].Commitments = v.Commitments[:]
}

Check warning on line 96 in observer/model.go

View check run for this annotation

Codecov / codecov/patch

observer/model.go#L87-L96

Added lines #L87 - L96 were not covered by tests
}
return payload{
Expand Down
8 changes: 6 additions & 2 deletions observer/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ CREATE TABLE IF NOT EXISTS latest_messages (
),
Value STRUCT(
Epoch BIGINT,
Key BLOB
Key BLOB,
Commitments BLOB,
PowerTable VARCHAR
)[]
),
Signature BLOB,
Expand All @@ -49,7 +51,9 @@ CREATE TABLE IF NOT EXISTS latest_messages (
),
Value STRUCT(
Epoch BIGINT,
Key BLOB
Key BLOB,
Commitments BLOB,
PowerTable VARCHAR
)[]
),
Signers BIGINT[],
Expand Down

0 comments on commit d3bfd33

Please sign in to comment.