Skip to content

Commit

Permalink
Validate node ID, sequence ID and timestamp on synced payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhuaaa committed Dec 6, 2024
1 parent d1212c2 commit 2d898bd
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 301 deletions.
9 changes: 5 additions & 4 deletions pkg/db/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ DELETE FROM staged_originator_envelopes
WHERE id = @id;

-- name: SelectVectorClock :many
SELECT
SELECT DISTINCT ON (originator_node_id)
originator_node_id,
max(originator_sequence_id)::BIGINT AS originator_sequence_id
originator_sequence_id,
originator_envelope
FROM
gateway_envelopes
GROUP BY
originator_node_id;
ORDER BY
originator_sequence_id DESC;

-- name: GetAddressLogs :many
SELECT
Expand Down
12 changes: 7 additions & 5 deletions pkg/db/queries/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/envelopes/originator.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func (o *OriginatorEnvelope) OriginatorSequenceID() uint64 {
return o.UnsignedOriginatorEnvelope.OriginatorSequenceID()
}

func (o *OriginatorEnvelope) OriginatorNs() int64 {
return o.UnsignedOriginatorEnvelope.OriginatorNs()
}

func (o *OriginatorEnvelope) TargetTopic() topic.Topic {
return o.UnsignedOriginatorEnvelope.TargetTopic()
}
Loading

0 comments on commit 2d898bd

Please sign in to comment.