Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Blockheight and Version #11

Merged
merged 7 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/light-client/event-listener/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ func (el *EventListener) ProcessLogs() {
continue
}

el.sampler.ProcessEvent(parsedURL.Host, uint(event.BlockHeight))
el.sampler.ProcessEvent(parsedURL.Host, uint64(event.BlockHeight))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockHeight is of type uint64, no need to use type conversion.

}
}
7 changes: 5 additions & 2 deletions internal/light-client/publisher/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"io"
"os"
"time"
"fmt"
"github.com/covalenthq/das-ipfs-pinner/common"
"cloud.google.com/go/pubsub"
"google.golang.org/api/option"
Expand All @@ -30,7 +31,7 @@
Commitment string `json:"commitment"`
Proof string `json:"proof"`
Cell string `json:"cell"`
BlockHeight uint `json:"block_height"`
BlockHeight uint64 `json:"block_height"`
Version string `json:"version"`
}

Expand Down Expand Up @@ -69,7 +70,7 @@
}

// Publish to Pubsub
func (p *Publisher) PublishToCS(cid string, rowIndex int, colIndex int, status bool, commitment []byte, proof []byte, cell []byte, blockHeight uint) error {
func (p *Publisher) PublishToCS(cid string, rowIndex int, colIndex int, status bool, commitment []byte, proof []byte, cell []byte, blockHeight uint64) error {
ctx := context.Background()

// Create a Pub/Sub client using the credentials
Expand All @@ -95,8 +96,10 @@
BlockHeight: blockHeight,
Version: common.Version,
Copy link
Collaborator

@tarassh tarassh Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version: fmt.Sprintf("%s-%s", common.Version, common.Commit)


}

Check failure on line 99 in internal/light-client/publisher/publisher.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

result of fmt.Sprintf call not used

fmt.Sprintf("%s-%s", common.Version, common.GitCommit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result should go to Version.


// Marshal the message into JSON.
messageData, err := json.Marshal(message)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/light-client/sampler/sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func NewSampler(ipfsAddr string, samplingDelay uint, pub *publisher.Publisher) (
}

// ProcessEvent handles events asynchronously by processing the provided CID.
func (s *Sampler) ProcessEvent(cidStr string, blockHeight uint) {
func (s *Sampler) ProcessEvent(cidStr string, blockHeight uint64) {
go func(cidStr string) {
rawCid, err := cid.Decode(cidStr)
if err != nil {
Expand Down
Loading