Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/golangci/golangci-…
Browse files Browse the repository at this point in the history
…lint-action-4.0.0
  • Loading branch information
ramin authored Jul 4, 2024
2 parents e21f64e + d5dfb56 commit 311a9fd
Show file tree
Hide file tree
Showing 42 changed files with 987 additions and 769 deletions.
25 changes: 13 additions & 12 deletions .github/auto_request_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@ reviewers:
- code-owners
groups:
code-owners:
- Nashqueue
- tzdybal
- gupadhyaya
rollkit:
- Manav-Aggarwal
- Bidon15
- Ferret-san
- distractedm1nd
- jcstein
- ramin
celestia:
- Wondertan
- S1nus
- tuxcanfly
- vgonkivs
- team:celestia
devops:
- smuu
- sysrex
- jrmanes
- Bidon15
celestia:
- team:celestia
ci:
- MSevey
files:
'**':
- code-owners
- rollkit
'**/*Dockerfile':
- devops
'.github/**':
- devops
- ci
options:
ignore_draft: true
ignored_keywords:
- WIP
number_of_reviewers: 3
number_of_reviewers: 2
8 changes: 7 additions & 1 deletion .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-rc(?:[0-9]+|\.[0-9]+)'
pull_request:
merge_group:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
Expand All @@ -23,6 +24,11 @@ on:
- major

jobs:
api-equivalence:
uses: ./.github/workflows/test-equivalence.yml
with:
GO_VERSION: "1.22"

lint:
uses: ./.github/workflows/lint.yml
with:
Expand All @@ -35,7 +41,7 @@ jobs:

# Make a release if this is a manually trigger job, i.e. workflow_dispatch
release:
needs: [lint, test]
needs: [lint, test, api-equivalence]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions: "write-all"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/housekeeping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
# ignore dependabot PRs
if: ${{ github.actor != 'dependabot[bot]' }}
name: Add issues and PRs to project and add grooming label
uses: rollkit/.github/.github/workflows/[email protected]
uses: celestiaorg/.github/.github/workflows/[email protected]
secrets: inherit
permissions:
issues: write
Expand All @@ -20,12 +20,12 @@ jobs:
run-labels: true
labels-to-add: "needs-grooming"
run-projects: true
project-url: https://github.com/orgs/rollkit/projects/7
project-url: https://github.com/orgs/celestiaorg/projects/7

auto-add-reviewer:
name: Auto add reviewer to PR
if: github.event.pull_request
uses: rollkit/.github/.github/workflows/[email protected]
uses: celestiaorg/.github/.github/workflows/[email protected]
secrets: inherit
permissions:
issues: write
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}
# This steps sets the GIT_DIFF environment variable to true
Expand All @@ -28,7 +28,8 @@ jobs:
**/**.go
go.mod
go.sum
- uses: golangci/[email protected]
- uses: golangci/[email protected]
with:
version: latest
args: --timeout 10m
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/test-equivalence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# api-equivalence workflow ensures that the API structs between the two repositories are consistent
# This workflow is triggered by ci_release.yml workflow
name: api-equivalence
on:
workflow_call:
inputs:
GO_VERSION:
description: "Go version to use"
type: string
required: true

jobs:
api-equivalence:
name: Test API Equivalence
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
repository: celestiaorg/node-api-conformance-test
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}

- name: Run Structs Equivalence Test
run: go test
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}
- run: go mod tidy
Expand All @@ -28,12 +28,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}
- name: Test & Coverage
run: make cover
- uses: codecov/codecov-action@v3.1.4
- uses: codecov/codecov-action@v4.3.0
with:
file: ./coverage.txt

Expand All @@ -43,7 +43,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}
- name: execute test run
Expand All @@ -55,7 +55,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}
- name: execute test run
Expand All @@ -67,7 +67,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: set up go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.GO_VERSION }}
- name: Integration Tests
Expand Down
10 changes: 1 addition & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
run:
timeout: 5m
modules-download-mode: readonly
# mempool and indexer code is borrowed from Tendermint
skip-dirs:
- mempool
- state/indexer
- state/txindex

linters:
enable:
- deadcode
- errcheck
- gofmt
- goimports
Expand All @@ -20,10 +14,8 @@ linters:
- misspell
- revive
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

issues:
exclude-use-default: false
Expand All @@ -34,4 +26,4 @@ linters-settings:
- name: package-comments
disabled: true
goimports:
local-prefixes: github.com/rollkit
local-prefixes: github.com/celestia
66 changes: 64 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
# celestia-openrpc

OpenRPC is a client of [celestia-node RPC](https://docs.celestia.org/developers/node-api/), without depenencies on celestia-node/celestia-app/cosmos-sdk.
`celestia-openrpc` is a golang client for [celestia-node RPC](https://docs.celestia.org/developers/node-api/), without depenencies on celestia-node/celestia-app/cosmos-sdk.

This is a temporary measure to resolve dependency issues when celestia-node is imported by rollkit.
This client library is useful for environments where dependencies on celestia-node/celestia-app/cosmos-sdk are not possible or desired.

## Examples

For a full tutorial on how to use this library, visit the official [guide](https://docs.celestia.org/developers/golang-client-tutorial).

For more examples, see the [examples](./examples) directory.

### Create a new client and submit and fetch a blob

```go
import (
"bytes"
"context"
"fmt"

client "github.com/celestiaorg/celestia-openrpc"
"github.com/celestiaorg/celestia-openrpc/types/blob"
"github.com/celestiaorg/celestia-openrpc/types/share"
"github.com/celestiaorg/rsmt2d"
)

func main() {
SubmitBlob(context.Background(), "ws://localhost:26658", "JWT_TOKEN")
}

// SubmitBlob submits a blob containing "Hello, World!" to the 0xDEADBEEF namespace. It uses the default signer on the running node.
func SubmitBlob(ctx context.Context, url string, token string) error {
client, err := client.NewClient(ctx, url, token)
if err != nil {
return err
}

// let's post to 0xDEADBEEF namespace
namespace, err := share.NewBlobNamespaceV0([]byte{0xDE, 0xAD, 0xBE, 0xEF})
if err != nil {
return err
}

// create a blob
helloWorldBlob, err := blob.NewBlobV0(namespace, []byte("Hello, World!"))
if err != nil {
return err
}

// submit the blob to the network
height, err := client.Blob.Submit(ctx, []*blob.Blob{helloWorldBlob}, blob.DefaultGasPrice())
if err != nil {
return err
}

fmt.Printf("Blob was included at height %d\n", height)

// fetch the blob back from the network
retrievedBlobs, err := client.Blob.GetAll(ctx, height, []share.Namespace{namespace})
if err != nil {
return err
}

fmt.Printf("Blobs are equal? %v\n", bytes.Equal(helloWorldBlob.Commitment, retrievedBlobs[0].Commitment))
return nil
}
```
Loading

0 comments on commit 311a9fd

Please sign in to comment.