Skip to content

Commit b056780

Browse files
authored
deps: Bump SDK to version 0.50 and Celestia App to V4 (#4219)
1 parent 16ddbf8 commit b056780

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+772
-831
lines changed

api/docgen/examples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func init() {
9191
)
9292

9393
add(errors.New("error"))
94-
add(state.Balance{Amount: sdk.NewInt(42), Denom: "utia"})
94+
add(state.Balance{Amount: math.NewInt(42), Denom: "utia"})
9595
add(share.EmptyEDS())
9696
add(rsmt2d.Row)
9797
add(network.Connected)

api/rpc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"testing"
99
"time"
1010

11-
sdk "github.com/cosmos/cosmos-sdk/types"
11+
"cosmossdk.io/math"
1212
"github.com/cristalhq/jwt/v5"
1313
"github.com/golang/mock/gomock"
1414
"github.com/libp2p/go-libp2p/core/network"
@@ -78,7 +78,7 @@ func TestRPCCallsUnderlyingNode(t *testing.T) {
7878
require.NoError(t, err)
7979

8080
expectedBalance := &state.Balance{
81-
Amount: sdk.NewInt(100),
81+
Amount: math.NewInt(100),
8282
Denom: "utia",
8383
}
8484

blob/blob.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ import (
66
"errors"
77
"fmt"
88

9-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
9+
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
1010
"github.com/celestiaorg/go-square/merkle"
1111
"github.com/celestiaorg/go-square/v2/inclusion"
1212
libshare "github.com/celestiaorg/go-square/v2/share"
1313
"github.com/celestiaorg/nmt"
1414
)
1515

16-
// appVersion is the current application version of celestia-app.
17-
const appVersion = appconsts.LatestVersion
18-
1916
var errEmptyShares = errors.New("empty shares")
2017

21-
var subtreeRootThreshold = appconsts.SubtreeRootThreshold(appVersion)
18+
var subtreeRootThreshold = appconsts.SubtreeRootThreshold
2219

2320
// The Proof is a set of nmt proofs that can be verified only through
2421
// the included method (due to limitation of the nmt https://github.com/celestiaorg/nmt/issues/218).

blob/commitment_proof.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"errors"
66
"fmt"
77

8-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
9-
"github.com/celestiaorg/celestia-app/v3/pkg/proof"
8+
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
9+
"github.com/celestiaorg/celestia-app/v4/pkg/proof"
1010
"github.com/celestiaorg/go-square/v2/inclusion"
1111
libshare "github.com/celestiaorg/go-square/v2/share"
1212
"github.com/celestiaorg/nmt"

blob/repro_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package blob
33
import (
44
"testing"
55

6-
"github.com/celestiaorg/celestia-app/v3/pkg/proof"
6+
"github.com/celestiaorg/celestia-app/v4/pkg/proof"
77
"github.com/celestiaorg/nmt"
88
"github.com/celestiaorg/nmt/pb"
99
)

blob/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
"go.opentelemetry.io/otel/codes"
1717
"go.opentelemetry.io/otel/trace"
1818

19-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
20-
pkgproof "github.com/celestiaorg/celestia-app/v3/pkg/proof"
19+
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
20+
pkgproof "github.com/celestiaorg/celestia-app/v4/pkg/proof"
2121
"github.com/celestiaorg/go-square/v2/inclusion"
2222
libshare "github.com/celestiaorg/go-square/v2/share"
2323
"github.com/celestiaorg/nmt"

blob/service_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import (
1212
"testing"
1313
"time"
1414

15+
tmrand "github.com/cometbft/cometbft/libs/rand"
1516
"github.com/golang/mock/gomock"
1617
ds "github.com/ipfs/go-datastore"
1718
ds_sync "github.com/ipfs/go-datastore/sync"
1819
"github.com/stretchr/testify/assert"
1920
"github.com/stretchr/testify/require"
20-
tmrand "github.com/tendermint/tendermint/libs/rand"
2121

22-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
23-
pkgproof "github.com/celestiaorg/celestia-app/v3/pkg/proof"
24-
"github.com/celestiaorg/celestia-app/v3/pkg/wrapper"
22+
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
23+
pkgproof "github.com/celestiaorg/celestia-app/v4/pkg/proof"
24+
"github.com/celestiaorg/celestia-app/v4/pkg/wrapper"
2525
"github.com/celestiaorg/go-header/store"
2626
"github.com/celestiaorg/go-square/merkle"
2727
"github.com/celestiaorg/go-square/v2/inclusion"
@@ -977,7 +977,7 @@ func proveAndVerifyShareCommitments(t *testing.T, blobSize int) {
977977
require.NoError(t, actualCommitmentProof.Validate())
978978
valid, err := actualCommitmentProof.Verify(
979979
dataRoot,
980-
appconsts.DefaultSubtreeRootThreshold,
980+
appconsts.SubtreeRootThreshold,
981981
)
982982
require.NoError(t, err)
983983
require.True(t, valid)
@@ -987,7 +987,7 @@ func proveAndVerifyShareCommitments(t *testing.T, blobSize int) {
987987
require.NoError(t, expectedCommitmentProof.Validate())
988988
valid, err = expectedCommitmentProof.Verify(
989989
dataRoot,
990-
appconsts.DefaultSubtreeRootThreshold,
990+
appconsts.SubtreeRootThreshold,
991991
)
992992
require.NoError(t, err)
993993
require.True(t, valid)

cmd/cel-key/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/cosmos/cosmos-sdk/x/auth/types"
1313
"github.com/spf13/cobra"
1414

15-
"github.com/celestiaorg/celestia-app/v3/app"
16-
"github.com/celestiaorg/celestia-app/v3/app/encoding"
15+
"github.com/celestiaorg/celestia-app/v4/app"
16+
"github.com/celestiaorg/celestia-app/v4/app/encoding"
1717
)
1818

1919
var encodingConfig = encoding.MakeConfig(app.ModuleEncodingRegisters...)
@@ -25,11 +25,11 @@ var initClientCtx = client.Context{}.
2525
WithLegacyAmino(encodingConfig.Amino).
2626
WithInput(os.Stdin).
2727
WithAccountRetriever(types.AccountRetriever{}).
28-
WithBroadcastMode(flags.BroadcastBlock).
28+
WithBroadcastMode(flags.BroadcastSync).
2929
WithHomeDir(app.DefaultNodeHome).
3030
WithViper("CELESTIA")
3131

32-
var rootCmd = keys.Commands("~")
32+
var rootCmd = keys.Commands()
3333

3434
func init() {
3535
rootCmd.PersistentFlags().AddFlagSet(DirectoryFlags())

cmd/start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"github.com/cosmos/cosmos-sdk/crypto/keyring"
1111
"github.com/spf13/cobra"
1212

13-
"github.com/celestiaorg/celestia-app/v3/app"
14-
"github.com/celestiaorg/celestia-app/v3/app/encoding"
13+
"github.com/celestiaorg/celestia-app/v4/app"
14+
"github.com/celestiaorg/celestia-app/v4/app/encoding"
1515

1616
"github.com/celestiaorg/celestia-node/nodebuilder"
1717
)

core/client_test.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"testing"
66
"time"
77

8+
"github.com/cometbft/cometbft/types"
89
"github.com/stretchr/testify/require"
9-
"github.com/tendermint/tendermint/types"
1010
)
1111

1212
func TestRemoteClient_Status(t *testing.T) {
@@ -23,8 +23,16 @@ func TestRemoteClient_StartBlockSubscription_And_GetBlock(t *testing.T) {
2323
ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
2424
t.Cleanup(cancel)
2525

26-
client := StartTestNode(t).Client
27-
eventChan, err := client.Subscribe(ctx, newBlockSubscriber, newDataSignedBlockQuery)
26+
node, wsClient := StartTestNodeWithConfigAndClient(t)
27+
client := node.Client
28+
29+
err := wsClient.Start()
30+
require.NoError(t, err)
31+
t.Cleanup(func() {
32+
require.NoError(t, wsClient.Stop())
33+
})
34+
35+
eventChan, err := wsClient.Subscribe(ctx, newBlockSubscriber, newDataSignedBlockQuery)
2836
require.NoError(t, err)
2937

3038
for i := 1; i <= 3; i++ {
@@ -38,6 +46,5 @@ func TestRemoteClient_StartBlockSubscription_And_GetBlock(t *testing.T) {
3846
require.NoError(t, ctx.Err())
3947
}
4048
}
41-
// unsubscribe to event channel
42-
require.NoError(t, client.Unsubscribe(ctx, newBlockSubscriber, newDataSignedBlockQuery))
49+
require.NoError(t, wsClient.Unsubscribe(ctx, newBlockSubscriber, newDataSignedBlockQuery))
4350
}

core/eds.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
"fmt"
66
"time"
77

8-
"github.com/tendermint/tendermint/types"
8+
coretypes "github.com/cometbft/cometbft/types"
99

10-
"github.com/celestiaorg/celestia-app/v3/app"
11-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
12-
"github.com/celestiaorg/celestia-app/v3/pkg/wrapper"
10+
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
11+
"github.com/celestiaorg/celestia-app/v4/pkg/wrapper"
1312
libsquare "github.com/celestiaorg/go-square/v2"
1413
libshare "github.com/celestiaorg/go-square/v2/share"
1514
"github.com/celestiaorg/nmt"
@@ -21,19 +20,25 @@ import (
2120
"github.com/celestiaorg/celestia-node/store"
2221
)
2322

23+
// isEmptyBlockRef returns true if the application considers the given block data
24+
// empty at a given version.
25+
func isEmptyBlockRef(data *coretypes.Data) bool {
26+
return len(data.Txs) == 0
27+
}
28+
2429
// extendBlock extends the given block data, returning the resulting
2530
// ExtendedDataSquare (EDS). If there are no transactions in the block,
2631
// nil is returned in place of the eds.
27-
func extendBlock(data *types.Data, appVersion uint64, options ...nmt.Option) (*rsmt2d.ExtendedDataSquare, error) {
28-
if app.IsEmptyBlockRef(data, appVersion) {
32+
func extendBlock(data *coretypes.Data, options ...nmt.Option) (*rsmt2d.ExtendedDataSquare, error) {
33+
if isEmptyBlockRef(data) {
2934
return share.EmptyEDS(), nil
3035
}
3136

3237
// Construct the data square from the block's transactions
3338
square, err := libsquare.Construct(
3439
data.Txs.ToSliceOfBytes(),
35-
appconsts.SquareSizeUpperBound(appVersion),
36-
appconsts.SubtreeRootThreshold(appVersion),
40+
appconsts.SquareSizeUpperBound,
41+
appconsts.SubtreeRootThreshold,
3742
)
3843
if err != nil {
3944
return nil, err

core/eds_test.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ package core
33
import (
44
"testing"
55

6-
"github.com/stretchr/testify/assert"
6+
"github.com/cometbft/cometbft/types"
77
"github.com/stretchr/testify/require"
8-
"github.com/tendermint/tendermint/types"
98

10-
"github.com/celestiaorg/celestia-app/v3/app"
11-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
9+
"github.com/celestiaorg/celestia-app/v4/pkg/da"
10+
libshare "github.com/celestiaorg/go-square/v2/share"
1211

1312
"github.com/celestiaorg/celestia-node/share"
1413
)
@@ -22,7 +21,7 @@ func TestTrulyEmptySquare(t *testing.T) {
2221
SquareSize: 1,
2322
}
2423

25-
eds, err := extendBlock(&data, appconsts.LatestVersion)
24+
eds, err := extendBlock(&data)
2625
require.NoError(t, err)
2726
require.True(t, eds.Equals(share.EmptyEDS()))
2827
}
@@ -38,15 +37,23 @@ func TestEmptySquareWithZeroTxs(t *testing.T) {
3837
Txs: []types.Tx{},
3938
}
4039

41-
eds, err := extendBlock(&data, appconsts.LatestVersion)
40+
eds, err := extendBlock(&data)
4241
require.NoError(t, err)
4342
require.True(t, eds.Equals(share.EmptyEDS()))
4443

45-
// force extend the square using an empty block and compare with the min DAH
46-
eds, err = app.ExtendBlock(data, appconsts.LatestVersion)
44+
// create empty shares and extend them manually
45+
emptyShares := libshare.TailPaddingShares(libshare.MinShareCount)
46+
rawEmptyShares := libshare.ToBytes(emptyShares)
47+
48+
// extend the empty shares
49+
manualEds, err := da.ExtendShares(rawEmptyShares)
4750
require.NoError(t, err)
4851

49-
roots, err := share.NewAxisRoots(eds)
52+
// verify the manually extended EDS equals the empty EDS
53+
require.True(t, manualEds.Equals(share.EmptyEDS()))
54+
55+
// verify the roots hash matches the empty EDS roots hash
56+
manualRoots, err := share.NewAxisRoots(manualEds)
5057
require.NoError(t, err)
51-
assert.Equal(t, share.EmptyEDSRoots().Hash(), roots.Hash())
58+
require.Equal(t, share.EmptyEDSRoots().Hash(), manualRoots.Hash())
5259
}

core/exchange.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func (ce *Exchange) Get(ctx context.Context, hash libhead.Hash) (*header.Extende
132132
return nil, fmt.Errorf("fetching block info for height %d: %w", &block.Height, err)
133133
}
134134

135-
eds, err := extendBlock(&block.Data, block.Header.Version.App)
135+
eds, err := extendBlock(&block.Data)
136136
if err != nil {
137137
return nil, fmt.Errorf("extending block data for height %d: %w", &block.Height, err)
138138
}
@@ -170,7 +170,7 @@ func (ce *Exchange) getExtendedHeaderByHeight(ctx context.Context, height int64)
170170
}
171171
log.Debugw("fetched signed block from core", "height", b.Header.Height)
172172

173-
eds, err := extendBlock(b.Data, b.Header.Version.App)
173+
eds, err := extendBlock(b.Data)
174174
if err != nil {
175175
return nil, fmt.Errorf("extending block data for height %d: %w", b.Header.Height, err)
176176
}

core/exchange_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/stretchr/testify/assert"
1212
"github.com/stretchr/testify/require"
1313

14-
"github.com/celestiaorg/celestia-app/v3/test/util/testnode"
14+
"github.com/celestiaorg/celestia-app/v4/test/util/testnode"
1515

1616
"github.com/celestiaorg/celestia-node/header"
1717
"github.com/celestiaorg/celestia-node/share"
@@ -44,6 +44,7 @@ func TestCoreExchange_RequestHeaders(t *testing.T) {
4444
expectedLastHeightInRange := to - 1
4545
expectedLenHeaders := to - expectedFirstHeightInRange
4646

47+
// request headers from height 1 to 20 [2:30)
4748
_, err = cctx.WaitForHeightWithTimeout(int64(to), 10*time.Second)
4849
require.NoError(t, err)
4950

core/fetcher.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66
"io"
77
"time"
88

9+
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
10+
coregrpc "github.com/cometbft/cometbft/rpc/grpc"
11+
"github.com/cometbft/cometbft/types"
912
"github.com/gogo/protobuf/proto"
1013
logging "github.com/ipfs/go-log/v2"
11-
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
12-
coregrpc "github.com/tendermint/tendermint/rpc/grpc"
13-
"github.com/tendermint/tendermint/types"
1414
"google.golang.org/grpc"
1515

1616
libhead "github.com/celestiaorg/go-header"

core/fetcher_no_race_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"testing"
99
"time"
1010

11+
"github.com/cometbft/cometbft/types"
1112
"github.com/stretchr/testify/assert"
1213
"github.com/stretchr/testify/require"
13-
"github.com/tendermint/tendermint/types"
1414
)
1515

1616
// TestBlockFetcherHeaderValues tests that both the Commit and ValidatorSet

core/header_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66
"net"
77
"testing"
88

9+
"github.com/cometbft/cometbft/libs/rand"
910
"github.com/stretchr/testify/assert"
1011
"github.com/stretchr/testify/require"
11-
"github.com/tendermint/tendermint/libs/rand"
1212

13-
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
13+
"github.com/celestiaorg/celestia-app/v4/pkg/appconsts"
1414

1515
"github.com/celestiaorg/celestia-node/header"
1616
"github.com/celestiaorg/celestia-node/header/headertest"
@@ -37,7 +37,7 @@ func TestMakeExtendedHeaderForEmptyBlock(t *testing.T) {
3737
comm, val, err := fetcher.GetBlockInfo(ctx, height)
3838
require.NoError(t, err)
3939

40-
eds, err := extendBlock(b.Data, b.Header.Version.App)
40+
eds, err := extendBlock(b.Data)
4141
require.NoError(t, err)
4242

4343
headerExt, err := header.MakeExtendedHeader(b.Header, comm, val, eds)

core/listener.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"fmt"
77
"time"
88

9+
"github.com/cometbft/cometbft/types"
910
pubsub "github.com/libp2p/go-libp2p-pubsub"
10-
"github.com/tendermint/tendermint/types"
1111
"go.opentelemetry.io/otel"
1212
"go.opentelemetry.io/otel/attribute"
1313

@@ -173,7 +173,7 @@ func (cl *Listener) handleNewSignedBlock(ctx context.Context, b types.EventDataS
173173
attribute.Int64("height", b.Header.Height),
174174
)
175175

176-
eds, err := extendBlock(&b.Data, b.Header.Version.App)
176+
eds, err := extendBlock(&b.Data)
177177
if err != nil {
178178
return fmt.Errorf("extending block data: %w", err)
179179
}

0 commit comments

Comments
 (0)