Skip to content

Commit

Permalink
Merge branch 'main' into rename-qgb-to-blobstream
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Oct 17, 2023
2 parents deddb7b + 2bf9999 commit 478e397
Show file tree
Hide file tree
Showing 58 changed files with 2,557 additions and 429 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ jobs:
test:
uses: ./.github/workflows/test.yml

goreleaser-check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: check

# If this was a workflow dispatch event, we need to generate and push a tag
# for goreleaser to grab
version_bump:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/lint-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint-pull-request

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: conventional-commit-pr-title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ If you use a pre-built binary, you may also want to verify the checksums and sig
You should see output like this:
```shell
gpg: Signature made Thu Sep 21 14:39:26 2023 EDT
gpg: Signature made Tue Oct 10 13:25:06 2023 UTC
gpg: using EDDSA key BF02F32CC36864560B90B764D469F859693DC3FA
gpg: Good signature from "celestia-app-maintainers <celestia-app-maintainers@celestia.org>" [ultimate]
gpg: Good signature from "celestia-app-maintainers <celestia-app-maintainers@celestia.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: BF02 F32C C368 6456 0B90 B764 D469 F859 693D C3FA
```
### Ledger Support
Expand Down
4 changes: 2 additions & 2 deletions app/check_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package app
import (
"fmt"

"github.com/celestiaorg/celestia-app/pkg/blob"
blobtypes "github.com/celestiaorg/celestia-app/x/blob/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
abci "github.com/tendermint/tendermint/abci/types"
coretypes "github.com/tendermint/tendermint/types"
)

// CheckTx implements the ABCI interface and executes a tx in CheckTx mode. This
Expand All @@ -15,7 +15,7 @@ import (
func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
tx := req.Tx
// check if the transaction contains blobs
btx, isBlob := coretypes.UnmarshalBlobTx(tx)
btx, isBlob := blob.UnmarshalBlobTx(tx)

if !isBlob {
// reject transactions that can't be decoded
Expand Down
1 change: 1 addition & 0 deletions app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func DefaultConsensusConfig() *tmcfg.Config {
// version. This acts as a first line of DoS protection
upperBoundBytes := appconsts.DefaultSquareSizeUpperBound * appconsts.DefaultSquareSizeUpperBound * appconsts.ContinuationSparseShareContentSize
cfg.Mempool.MaxTxBytes = upperBoundBytes
cfg.Mempool.MaxTxsBytes = int64(upperBoundBytes) * cfg.Mempool.TTLNumBlocks

cfg.Mempool.Version = "v1" // prioritized mempool
cfg.Consensus.TimeoutPropose = appconsts.TimeoutPropose
Expand Down
4 changes: 2 additions & 2 deletions app/process_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/celestiaorg/celestia-app/app/ante"
"github.com/celestiaorg/celestia-app/pkg/blob"
"github.com/celestiaorg/celestia-app/pkg/da"
"github.com/celestiaorg/celestia-app/pkg/shares"
"github.com/celestiaorg/celestia-app/pkg/square"
Expand All @@ -16,7 +17,6 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
coretypes "github.com/tendermint/tendermint/types"
)

const rejectedPropBlockLog = "Rejected proposal block:"
Expand Down Expand Up @@ -52,7 +52,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp
// blobTxs have no PFBs present
for idx, rawTx := range req.BlockData.Txs {
tx := rawTx
blobTx, isBlobTx := coretypes.UnmarshalBlobTx(rawTx)
blobTx, isBlobTx := blob.UnmarshalBlobTx(rawTx)
if isBlobTx {
tx = blobTx.Tx
}
Expand Down
5 changes: 3 additions & 2 deletions app/test/check_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/blob"
appns "github.com/celestiaorg/celestia-app/pkg/namespace"
"github.com/celestiaorg/celestia-app/pkg/user"
testutil "github.com/celestiaorg/celestia-app/test/util"
Expand Down Expand Up @@ -82,9 +83,9 @@ func TestCheckTx(t *testing.T) {
[]int{100},
)[0]

dtx, _ := coretypes.UnmarshalBlobTx(btx)
dtx, _ := blob.UnmarshalBlobTx(btx)
dtx.Blobs[0].NamespaceId = appns.RandomBlobNamespace().ID
bbtx, err := coretypes.MarshalBlobTx(dtx.Tx, dtx.Blobs[0])
bbtx, err := blob.MarshalBlobTx(dtx.Tx, dtx.Blobs[0])
require.NoError(t, err)
return bbtx
},
Expand Down
32 changes: 14 additions & 18 deletions app/test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/pkg/blob"
"github.com/celestiaorg/celestia-app/pkg/da"
appns "github.com/celestiaorg/celestia-app/pkg/namespace"
"github.com/celestiaorg/celestia-app/pkg/square"
Expand All @@ -32,7 +33,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
abci "github.com/tendermint/tendermint/abci/types"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
coretypes "github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -210,15 +210,13 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob() {
t := s.T()
ns1 := appns.MustNewV0(bytes.Repeat([]byte{1}, appns.NamespaceVersionZeroIDSize))

mustNewBlob := func(ns appns.Namespace, data []byte, shareVersion uint8) *blobtypes.Blob {
b, err := blobtypes.NewBlob(ns, data, shareVersion)
require.NoError(t, err)
return b
mustNewBlob := func(ns appns.Namespace, data []byte, shareVersion uint8) *blob.Blob {
return blob.New(ns, data, shareVersion)
}

type test struct {
name string
blob *blobtypes.Blob
blob *blob.Blob
opts []user.TxOption
}

Expand Down Expand Up @@ -265,7 +263,7 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob() {
addr := testfactory.GetAddress(s.cctx.Keyring, s.accounts[141])
signer, err := user.SetupSigner(s.cctx.GoContext(), s.cctx.Keyring, s.cctx.GRPCClient, addr, s.ecfg)
require.NoError(t, err)
res, err := signer.SubmitPayForBlob(context.TODO(), []*blobtypes.Blob{tc.blob, tc.blob}, tc.opts...)
res, err := signer.SubmitPayForBlob(context.TODO(), []*blob.Blob{tc.blob, tc.blob}, tc.opts...)
require.NoError(t, err)
require.NotNil(t, res)
require.Equal(t, abci.CodeTypeOK, res.Code, res.Logs)
Expand Down Expand Up @@ -391,34 +389,34 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob_blobSizes() {

type testCase struct {
name string
blob *tmproto.Blob
blob *blob.Blob
// txResponseCode is the expected tx response ABCI code.
txResponseCode uint32
}
testCases := []testCase{
{
name: "1,000 byte blob",
blob: mustNewBlob(t, 1_000),
blob: mustNewBlob(1_000),
txResponseCode: abci.CodeTypeOK,
},
{
name: "10,000 byte blob",
blob: mustNewBlob(t, 10_000),
blob: mustNewBlob(10_000),
txResponseCode: abci.CodeTypeOK,
},
{
name: "100,000 byte blob",
blob: mustNewBlob(t, 100_000),
blob: mustNewBlob(100_000),
txResponseCode: abci.CodeTypeOK,
},
{
name: "1,000,000 byte blob",
blob: mustNewBlob(t, 1_000_000),
blob: mustNewBlob(1_000_000),
txResponseCode: abci.CodeTypeOK,
},
{
name: "10,000,000 byte blob returns err tx too large",
blob: mustNewBlob(t, 10_000_000),
blob: mustNewBlob(10_000_000),
txResponseCode: errors.ErrTxTooLarge.ABCICode(),
},
}
Expand All @@ -427,7 +425,7 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob_blobSizes() {
s.Run(tc.name, func() {
subCtx, cancel := context.WithTimeout(s.cctx.GoContext(), 30*time.Second)
defer cancel()
res, err := signer.SubmitPayForBlob(subCtx, []*blobtypes.Blob{tc.blob}, user.SetGasLimit(1_000_000_000))
res, err := signer.SubmitPayForBlob(subCtx, []*blob.Blob{tc.blob}, user.SetGasLimit(1_000_000_000))
if tc.txResponseCode == abci.CodeTypeOK {
require.NoError(t, err)
} else {
Expand All @@ -439,10 +437,8 @@ func (s *IntegrationTestSuite) TestSubmitPayForBlob_blobSizes() {
}
}

func mustNewBlob(t *testing.T, blobSize int) *tmproto.Blob {
func mustNewBlob(blobSize int) *blob.Blob {
ns1 := appns.MustNewV0(bytes.Repeat([]byte{1}, appns.NamespaceVersionZeroIDSize))
data := tmrand.Bytes(blobSize)
result, err := blobtypes.NewBlob(ns1, data, appconsts.ShareVersionZero)
require.NoError(t, err)
return result
return blob.New(ns1, data, appconsts.ShareVersionZero)
}
12 changes: 6 additions & 6 deletions app/test/max_total_blob_size_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/pkg/blob"
"github.com/celestiaorg/celestia-app/pkg/square"
"github.com/celestiaorg/celestia-app/pkg/user"
"github.com/celestiaorg/celestia-app/test/util/testfactory"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

const (
Expand Down Expand Up @@ -70,24 +70,24 @@ func (s *MaxTotalBlobSizeSuite) TestSubmitPayForBlob_blobSizes() {

type testCase struct {
name string
blob *tmproto.Blob
blob *blob.Blob
// want is the expected tx response ABCI code.
want uint32
}
testCases := []testCase{
{
name: "1 byte blob",
blob: mustNewBlob(t, 1),
blob: mustNewBlob(1),
want: abci.CodeTypeOK,
},
{
name: "1 mebibyte blob",
blob: mustNewBlob(t, mebibyte),
blob: mustNewBlob(mebibyte),
want: abci.CodeTypeOK,
},
{
name: "2 mebibyte blob",
blob: mustNewBlob(t, 2*mebibyte),
blob: mustNewBlob(2 * mebibyte),
want: blobtypes.ErrTotalBlobSizeTooLarge.ABCICode(),
},
}
Expand All @@ -97,7 +97,7 @@ func (s *MaxTotalBlobSizeSuite) TestSubmitPayForBlob_blobSizes() {

for _, tc := range testCases {
s.Run(tc.name, func() {
blobTx, err := signer.CreatePayForBlob([]*tmproto.Blob{tc.blob}, user.SetGasLimit(1e9))
blobTx, err := signer.CreatePayForBlob([]*blob.Blob{tc.blob}, user.SetGasLimit(1e9))
require.NoError(t, err)
subCtx, cancel := context.WithTimeout(s.cctx.GoContext(), 30*time.Second)
defer cancel()
Expand Down
9 changes: 3 additions & 6 deletions app/test/prepare_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/pkg/blob"
appns "github.com/celestiaorg/celestia-app/pkg/namespace"
testutil "github.com/celestiaorg/celestia-app/test/util"
"github.com/celestiaorg/celestia-app/test/util/blobfactory"
Expand All @@ -36,12 +37,8 @@ func TestPrepareProposalPutsPFBsAtEnd(t *testing.T) {
testutil.ChainID,
accnts[:numBlobTxs],
infos[:numBlobTxs],
testfactory.Repeat([]*tmproto.Blob{
{
NamespaceId: appns.RandomBlobNamespace().ID,
Data: []byte{1},
ShareVersion: uint32(appconsts.DefaultShareVersion),
},
testfactory.Repeat([]*blob.Blob{
blob.New(appns.RandomBlobNamespace(), []byte{1}, appconsts.DefaultShareVersion),
}, numBlobTxs),
)

Expand Down
1 change: 0 additions & 1 deletion app/test/priority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func (s *PriorityTestSuite) TestPriorityByGasPrice() {
gasPrice := s.rand.Float64()
btx, err := signer.CreatePayForBlob(
blobfactory.ManyBlobs(
t,
s.rand,
[]namespace.Namespace{namespace.RandomBlobNamespace()},
[]int{100}),
Expand Down
Loading

0 comments on commit 478e397

Please sign in to comment.