diff --git a/app/app.go b/app/app.go index 71c519305e..d31d33fcbf 100644 --- a/app/app.go +++ b/app/app.go @@ -12,6 +12,7 @@ import ( "github.com/celestiaorg/celestia-app/v3/app/posthandler" appv1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1" appv2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" + appv3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3" "github.com/celestiaorg/celestia-app/v3/pkg/proof" blobkeeper "github.com/celestiaorg/celestia-app/v3/x/blob/keeper" blobtypes "github.com/celestiaorg/celestia-app/v3/x/blob/types" @@ -108,6 +109,7 @@ var maccPerms = map[string][]string{ const ( v1 = appv1.Version v2 = appv2.Version + v3 = appv3.Version DefaultInitialVersion = v1 ) @@ -340,11 +342,11 @@ func New( packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout ) - // PacketForwardMiddleware is used only for version 2. - transferStack = module.NewVersionedIBCModule(packetForwardMiddleware, transferStack, v2, v2) + // PacketForwardMiddleware is used only for version >= 2. + transferStack = module.NewVersionedIBCModule(packetForwardMiddleware, transferStack, v2, v3) // Token filter wraps packet forward middleware and is thus the first module in the transfer stack. tokenFilterMiddelware := tokenfilter.NewIBCMiddleware(transferStack) - transferStack = module.NewVersionedIBCModule(tokenFilterMiddelware, transferStack, v1, v2) + transferStack = module.NewVersionedIBCModule(tokenFilterMiddelware, transferStack, v1, v3) app.EvidenceKeeper = *evidencekeeper.NewKeeper( appCodec, @@ -541,17 +543,8 @@ func (app *App) Info(req abci.RequestInfo) abci.ResponseInfo { // // Side-effect: calls baseapp.Init() func (app *App) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain) { - // genesis must always contain the consensus params. The validator set however is derived from the - // initial genesis state. The genesis must always contain a non zero app version which is the initial - // version that the chain starts on - if req.ConsensusParams == nil || req.ConsensusParams.Version == nil { - panic("no consensus params set") - } - if req.ConsensusParams.Version.AppVersion == 0 { - panic("app version 0 is not accepted. Please set an app version in the genesis") - } + req = setDefaultAppVersion(req) appVersion := req.ConsensusParams.Version.AppVersion - // mount the stores for the provided app version if it has not already been mounted if app.AppVersion() == 0 && !app.IsSealed() { app.mountKeysAndInit(appVersion) @@ -567,10 +560,26 @@ func (app *App) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain return res } +// setDefaultAppVersion sets the default app version in the consensus params if +// it was 0. This is needed because chains (e.x. mocha-4) did not explicitly set +// an app version in genesis.json. +func setDefaultAppVersion(req abci.RequestInitChain) abci.RequestInitChain { + if req.ConsensusParams == nil { + panic("no consensus params set") + } + if req.ConsensusParams.Version == nil { + panic("no version set in consensus params") + } + if req.ConsensusParams.Version.AppVersion == 0 { + req.ConsensusParams.Version.AppVersion = v1 + } + return req +} + // mountKeysAndInit mounts the keys for the provided app version and then // invokes baseapp.Init(). func (app *App) mountKeysAndInit(appVersion uint64) { - app.BaseApp.Logger().Debug(fmt.Sprintf("mounting KV stores for app version %v", appVersion)) + app.BaseApp.Logger().Info(fmt.Sprintf("mounting KV stores for app version %v", appVersion)) app.MountKVStores(app.versionedKeys(appVersion)) // Invoke load latest version for its side-effect of invoking baseapp.Init() @@ -585,9 +594,9 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.manager.GetVersionMap(req.ConsensusParams.Version.AppVersion)) - return app.manager.InitGenesis(ctx, app.appCodec, genesisState, req.ConsensusParams.Version.AppVersion) + appVersion := req.ConsensusParams.Version.AppVersion + app.UpgradeKeeper.SetModuleVersionMap(ctx, app.manager.GetVersionMap(appVersion)) + return app.manager.InitGenesis(ctx, app.appCodec, genesisState, appVersion) } // LoadHeight loads a particular height diff --git a/app/app_test.go b/app/app_test.go index 5e99ec522c..16bca43ec7 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -1,10 +1,13 @@ package app_test import ( + "encoding/json" "testing" "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" + "github.com/celestiaorg/celestia-app/v3/test/util" + "github.com/celestiaorg/celestia-app/v3/test/util/testnode" "github.com/celestiaorg/celestia-app/v3/x/minfee" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/snapshots" @@ -13,6 +16,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" ) @@ -52,6 +56,61 @@ func TestNew(t *testing.T) { }) } +func TestInitChain(t *testing.T) { + logger := log.NewNopLogger() + db := tmdb.NewMemDB() + traceStore := &NoopWriter{} + invCheckPeriod := uint(1) + encodingConfig := encoding.MakeConfig(app.ModuleEncodingRegisters...) + upgradeHeight := int64(0) + appOptions := NoopAppOptions{} + testApp := app.New(logger, db, traceStore, invCheckPeriod, encodingConfig, upgradeHeight, appOptions) + genesisState, _, _ := util.GenesisStateWithSingleValidator(testApp, "account") + appStateBytes, err := json.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) + genesis := testnode.DefaultConfig().Genesis + + type testCase struct { + name string + request abci.RequestInitChain + wantPanic bool + } + testCases := []testCase{ + { + name: "should panic if consensus params not set", + request: abci.RequestInitChain{}, + wantPanic: true, + }, + { + name: "should not panic on a genesis that does not contain an app version", + request: abci.RequestInitChain{ + Time: genesis.GenesisTime, + ChainId: genesis.ChainID, + ConsensusParams: &abci.ConsensusParams{ + Block: &abci.BlockParams{}, + Evidence: &genesis.ConsensusParams.Evidence, + Validator: &genesis.ConsensusParams.Validator, + Version: &tmproto.VersionParams{}, // explicitly set to empty to remove app version., + }, + AppStateBytes: appStateBytes, + InitialHeight: 0, + }, + wantPanic: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + application := app.New(logger, db, traceStore, invCheckPeriod, encodingConfig, upgradeHeight, appOptions) + if tc.wantPanic { + assert.Panics(t, func() { application.InitChain(tc.request) }) + } else { + assert.NotPanics(t, func() { application.InitChain(tc.request) }) + } + }) + } +} + func TestOfferSnapshot(t *testing.T) { logger := log.NewNopLogger() db := tmdb.NewMemDB() diff --git a/app/check_tx.go b/app/check_tx.go index 0867cd2436..f76b37880f 100644 --- a/app/check_tx.go +++ b/app/check_tx.go @@ -41,9 +41,8 @@ func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx { switch req.Type { // new transactions must be checked in their entirety case abci.CheckTxType_New: - // FIXME: we have a hardcoded subtree root threshold here. This is because we can't access - // the app version because the context is not initialized - err := blobtypes.ValidateBlobTx(app.txConfig, btx, appconsts.DefaultSubtreeRootThreshold) + appVersion := app.AppVersion() + err := blobtypes.ValidateBlobTx(app.txConfig, btx, appconsts.SubtreeRootThreshold(appVersion), appVersion) if err != nil { return sdkerrors.ResponseCheckTxWithEvents(err, 0, 0, []abci.Event{}, false) } diff --git a/app/module/versioned_ibc_module_test.go b/app/module/versioned_ibc_module_test.go index 8d2fb23d0e..57f94ec9f9 100644 --- a/app/module/versioned_ibc_module_test.go +++ b/app/module/versioned_ibc_module_test.go @@ -23,7 +23,7 @@ func TestVersionedIBCModule(t *testing.T) { mockWrappedModule := mocks.NewMockIBCModule(ctrl) mockNextModule := mocks.NewMockIBCModule(ctrl) - versionedModule := module.NewVersionedIBCModule(mockWrappedModule, mockNextModule, 2, 2) + versionedModule := module.NewVersionedIBCModule(mockWrappedModule, mockNextModule, 2, 3) testCases := []struct { name string diff --git a/app/modules.go b/app/modules.go index a89f418205..d629a99073 100644 --- a/app/modules.go +++ b/app/modules.go @@ -96,75 +96,75 @@ func (app *App) setupModuleManager(skipGenesisInvariants bool) error { app.manager, err = module.NewManager([]module.VersionedModule{ { Module: genutil.NewAppModule(app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx, app.txConfig), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: auth.NewAppModule(app.appCodec, app.AccountKeeper, nil), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: bank.NewAppModule(app.appCodec, app.BankKeeper, app.AccountKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: capability.NewAppModule(app.appCodec, *app.CapabilityKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: feegrantmodule.NewAppModule(app.appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: gov.NewAppModule(app.appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: mint.NewAppModule(app.appCodec, app.MintKeeper, app.AccountKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: slashing.NewAppModule(app.appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: distr.NewAppModule(app.appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: staking.NewAppModule(app.appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: evidence.NewAppModule(app.EvidenceKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: authzmodule.NewAppModule(app.appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: ibc.NewAppModule(app.IBCKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: params.NewAppModule(app.ParamsKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: transfer.NewAppModule(app.TransferKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: blob.NewAppModule(app.appCodec, app.BlobKeeper), - FromVersion: v1, ToVersion: v2, + FromVersion: v1, ToVersion: v3, }, { Module: blobstream.NewAppModule(app.appCodec, app.BlobstreamKeeper), @@ -172,19 +172,19 @@ func (app *App) setupModuleManager(skipGenesisInvariants bool) error { }, { Module: signal.NewAppModule(app.SignalKeeper), - FromVersion: v2, ToVersion: v2, + FromVersion: v2, ToVersion: v3, }, { Module: minfee.NewAppModule(app.ParamsKeeper), - FromVersion: v2, ToVersion: v2, + FromVersion: v2, ToVersion: v3, }, { Module: packetforward.NewAppModule(app.PacketForwardKeeper), - FromVersion: v2, ToVersion: v2, + FromVersion: v2, ToVersion: v3, }, { Module: ica.NewAppModule(nil, &app.ICAHostKeeper), - FromVersion: v2, ToVersion: v2, + FromVersion: v2, ToVersion: v3, }, }) if err != nil { @@ -303,7 +303,7 @@ func allStoreKeys() []string { // versionedStoreKeys returns the store keys for each app version. func versionedStoreKeys() map[uint64][]string { return map[uint64][]string{ - 1: { + v1: { authtypes.StoreKey, authzkeeper.StoreKey, banktypes.StoreKey, @@ -321,7 +321,7 @@ func versionedStoreKeys() map[uint64][]string { stakingtypes.StoreKey, upgradetypes.StoreKey, }, - 2: { + v2: { authtypes.StoreKey, authzkeeper.StoreKey, banktypes.StoreKey, @@ -341,6 +341,26 @@ func versionedStoreKeys() map[uint64][]string { stakingtypes.StoreKey, upgradetypes.StoreKey, }, + v3: { // same as v2 + authtypes.StoreKey, + authzkeeper.StoreKey, + banktypes.StoreKey, + blobtypes.StoreKey, + capabilitytypes.StoreKey, + distrtypes.StoreKey, + evidencetypes.StoreKey, + feegrant.StoreKey, + govtypes.StoreKey, + ibchost.StoreKey, + ibctransfertypes.StoreKey, + icahosttypes.StoreKey, + minttypes.StoreKey, + packetforwardtypes.StoreKey, + signaltypes.StoreKey, + slashingtypes.StoreKey, + stakingtypes.StoreKey, + upgradetypes.StoreKey, + }, } } diff --git a/app/prepare_proposal.go b/app/prepare_proposal.go index 78049a1ad4..a34c64bd7d 100644 --- a/app/prepare_proposal.go +++ b/app/prepare_proposal.go @@ -1,13 +1,16 @@ package app import ( + "fmt" "time" "github.com/celestiaorg/celestia-app/v3/app/ante" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" "github.com/celestiaorg/celestia-app/v3/pkg/da" - square "github.com/celestiaorg/go-square/v2" - "github.com/celestiaorg/go-square/v2/share" + shares "github.com/celestiaorg/go-square/shares" + square "github.com/celestiaorg/go-square/square" + squarev2 "github.com/celestiaorg/go-square/v2" + sharev2 "github.com/celestiaorg/go-square/v2/share" "github.com/cosmos/cosmos-sdk/telemetry" abci "github.com/tendermint/tendermint/abci/types" core "github.com/tendermint/tendermint/proto/tendermint/types" @@ -27,7 +30,7 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr Height: req.Height, Time: req.Time, Version: version.Consensus{ - App: app.BaseApp.AppVersion(), + App: app.AppVersion(), }, }) handler := ante.NewAnteHandler( @@ -47,10 +50,31 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr // Build the square from the set of valid and prioritised transactions. // The txs returned are the ones used in the square and block. - dataSquare, txs, err := square.Build(txs, - app.MaxEffectiveSquareSize(sdkCtx), - appconsts.SubtreeRootThreshold(app.GetBaseApp().AppVersion()), + var ( + dataSquareBytes [][]byte + err error + size uint64 ) + switch app.AppVersion() { + case v3: + var dataSquare squarev2.Square + dataSquare, txs, err = squarev2.Build(txs, + app.MaxEffectiveSquareSize(sdkCtx), + appconsts.SubtreeRootThreshold(app.GetBaseApp().AppVersion()), + ) + dataSquareBytes = sharev2.ToBytes(dataSquare) + size = uint64(dataSquare.Size()) + case v2, v1: + var dataSquare square.Square + dataSquare, txs, err = square.Build(txs, + app.MaxEffectiveSquareSize(sdkCtx), + appconsts.SubtreeRootThreshold(app.GetBaseApp().AppVersion()), + ) + dataSquareBytes = shares.ToBytes(dataSquare) + size = uint64(dataSquare.Size()) + default: + err = fmt.Errorf("unsupported app version: %d", app.AppVersion()) + } if err != nil { panic(err) } @@ -58,7 +82,7 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr // Erasure encode the data square to create the extended data square (eds). // Note: uses the nmt wrapper to construct the tree. See // pkg/wrapper/nmt_wrapper.go for more information. - eds, err := da.ExtendShares(share.ToBytes(dataSquare)) + eds, err := da.ExtendShares(dataSquareBytes) if err != nil { app.Logger().Error( "failure to erasure the data square while creating a proposal block", @@ -84,7 +108,7 @@ func (app *App) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePr return abci.ResponsePrepareProposal{ BlockData: &core.Data{ Txs: txs, - SquareSize: uint64(dataSquare.Size()), + SquareSize: size, Hash: dah.Hash(), // also known as the data root }, } diff --git a/app/process_proposal.go b/app/process_proposal.go index d1b367179c..fc10bb88e2 100644 --- a/app/process_proposal.go +++ b/app/process_proposal.go @@ -9,8 +9,10 @@ import ( "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" "github.com/celestiaorg/celestia-app/v3/pkg/da" blobtypes "github.com/celestiaorg/celestia-app/v3/x/blob/types" - "github.com/celestiaorg/go-square/v2" - "github.com/celestiaorg/go-square/v2/share" + shares "github.com/celestiaorg/go-square/shares" + square "github.com/celestiaorg/go-square/square" + squarev2 "github.com/celestiaorg/go-square/v2" + sharev2 "github.com/celestiaorg/go-square/v2/share" blobtx "github.com/celestiaorg/go-square/v2/tx" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" @@ -108,7 +110,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp // - that the sizes match // - that the namespaces match between blob and PFB // - that the share commitment is correct - if err := blobtypes.ValidateBlobTx(app.txConfig, blobTx, subtreeRootThreshold); err != nil { + if err := blobtypes.ValidateBlobTx(app.txConfig, blobTx, subtreeRootThreshold, app.AppVersion()); err != nil { logInvalidPropBlockError(app.Logger(), req.Header, fmt.Sprintf("invalid blob tx %d", idx), err) return reject() } @@ -122,24 +124,40 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp } - // Construct the data square from the block's transactions - dataSquare, err := square.Construct( - req.BlockData.Txs, - app.MaxEffectiveSquareSize(sdkCtx), - subtreeRootThreshold, + var ( + dataSquareBytes [][]byte + err error ) - if err != nil { - logInvalidPropBlockError(app.Logger(), req.Header, "failure to compute data square from transactions:", err) + + switch app.AppVersion() { + case v3: + var dataSquare squarev2.Square + dataSquare, err = squarev2.Construct(req.BlockData.Txs, app.MaxEffectiveSquareSize(sdkCtx), subtreeRootThreshold) + dataSquareBytes = sharev2.ToBytes(dataSquare) + // Assert that the square size stated by the proposer is correct + if uint64(dataSquare.Size()) != req.BlockData.SquareSize { + logInvalidPropBlock(app.Logger(), req.Header, "proposed square size differs from calculated square size") + return reject() + } + case v2, v1: + var dataSquare square.Square + dataSquare, err = square.Construct(req.BlockData.Txs, app.MaxEffectiveSquareSize(sdkCtx), subtreeRootThreshold) + dataSquareBytes = shares.ToBytes(dataSquare) + // Assert that the square size stated by the proposer is correct + if uint64(dataSquare.Size()) != req.BlockData.SquareSize { + logInvalidPropBlock(app.Logger(), req.Header, "proposed square size differs from calculated square size") + return reject() + } + default: + logInvalidPropBlock(app.Logger(), req.Header, "unsupported app version") return reject() } - - // Assert that the square size stated by the proposer is correct - if uint64(dataSquare.Size()) != req.BlockData.SquareSize { - logInvalidPropBlock(app.Logger(), req.Header, "proposed square size differs from calculated square size") + if err != nil { + logInvalidPropBlockError(app.Logger(), req.Header, "failure to compute data square from transactions:", err) return reject() } - eds, err := da.ExtendShares(share.ToBytes(dataSquare)) + eds, err := da.ExtendShares(dataSquareBytes) if err != nil { logInvalidPropBlockError(app.Logger(), req.Header, "failure to erasure the data square", err) return reject() diff --git a/app/test/std_sdk_test.go b/app/test/std_sdk_test.go index 75eb932b3f..cddb02c9a8 100644 --- a/app/test/std_sdk_test.go +++ b/app/test/std_sdk_test.go @@ -8,6 +8,7 @@ import ( "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/app/grpc/tx" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" "github.com/celestiaorg/celestia-app/v3/pkg/user" "github.com/celestiaorg/celestia-app/v3/test/util/blobfactory" @@ -307,7 +308,7 @@ func (s *StandardSDKIntegrationTestSuite) TestStandardSDK() { name: "signal a version change", msgFunc: func() (msgs []sdk.Msg, signer string) { valAccount := s.getValidatorAccount() - msg := signal.NewMsgSignalVersion(valAccount, 2) + msg := signal.NewMsgSignalVersion(valAccount, appconsts.LatestVersion+1) return []sdk.Msg{msg}, s.getValidatorName() }, expectedCode: abci.CodeTypeOK, diff --git a/app/test/upgrade_test.go b/app/test/upgrade_test.go index 55de8fc486..3180de8c4e 100644 --- a/app/test/upgrade_test.go +++ b/app/test/upgrade_test.go @@ -1,21 +1,28 @@ package app_test import ( - "encoding/json" "fmt" "strings" "testing" - "time" app "github.com/celestiaorg/celestia-app/v3/app" "github.com/celestiaorg/celestia-app/v3/app/encoding" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1" v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" + v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3" + "github.com/celestiaorg/celestia-app/v3/pkg/user" "github.com/celestiaorg/celestia-app/v3/test/util" + "github.com/celestiaorg/celestia-app/v3/test/util/genesis" + "github.com/celestiaorg/celestia-app/v3/test/util/testnode" blobstreamtypes "github.com/celestiaorg/celestia-app/v3/x/blobstream/types" "github.com/celestiaorg/celestia-app/v3/x/minfee" - "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/celestiaorg/celestia-app/v3/x/signal" + signaltypes "github.com/celestiaorg/celestia-app/v3/x/signal/types" + "github.com/celestiaorg/go-square/v2/share" + "github.com/celestiaorg/go-square/v2/tx" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/types" icahosttypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types" @@ -27,9 +34,118 @@ import ( dbm "github.com/tendermint/tm-db" ) -// TestAppUpgrades verifies that the all module's params are overridden during an +func TestAppUpgradeV3(t *testing.T) { + if testing.Short() { + t.Skip("skipping TestAppUpgradeV3 in short mode") + } + testApp, genesis := SetupTestAppWithUpgradeHeight(t, 3) + upgradeFromV1ToV2(t, testApp) + + ctx := testApp.NewContext(true, tmproto.Header{}) + validators := testApp.StakingKeeper.GetAllValidators(ctx) + valAddr, err := sdk.ValAddressFromBech32(validators[0].OperatorAddress) + require.NoError(t, err) + record, err := genesis.Keyring().Key(testnode.DefaultValidatorAccountName) + require.NoError(t, err) + accAddr, err := record.GetAddress() + require.NoError(t, err) + encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) + resp, err := testApp.AccountKeeper.Account(ctx, &authtypes.QueryAccountRequest{ + Address: accAddr.String(), + }) + require.NoError(t, err) + var account authtypes.AccountI + err = encCfg.InterfaceRegistry.UnpackAny(resp.Account, &account) + require.NoError(t, err) + + signer, err := user.NewSigner( + genesis.Keyring(), encCfg.TxConfig, testApp.GetChainID(), v3.Version, + user.NewAccount(testnode.DefaultValidatorAccountName, account.GetAccountNumber(), account.GetSequence()), + ) + require.NoError(t, err) + + upgradeTx, err := signer.CreateTx( + []sdk.Msg{ + signaltypes.NewMsgSignalVersion(valAddr, 3), + signaltypes.NewMsgTryUpgrade(accAddr), + }, + user.SetGasLimitAndGasPrice(100_000, appconsts.DefaultMinGasPrice), + ) + require.NoError(t, err) + testApp.BeginBlock(abci.RequestBeginBlock{ + Header: tmproto.Header{ + ChainID: genesis.ChainID, + Height: 3, + Version: tmversion.Consensus{App: 2}, + }, + }) + + deliverTxResp := testApp.DeliverTx(abci.RequestDeliverTx{ + Tx: upgradeTx, + }) + require.Equal(t, abci.CodeTypeOK, deliverTxResp.Code, deliverTxResp.Log) + + endBlockResp := testApp.EndBlock(abci.RequestEndBlock{ + Height: 3, + }) + require.Equal(t, v2.Version, endBlockResp.ConsensusParamUpdates.Version.AppVersion) + testApp.Commit() + require.NoError(t, signer.IncrementSequence(testnode.DefaultValidatorAccountName)) + + ctx = testApp.NewContext(true, tmproto.Header{}) + getUpgradeResp, err := testApp.SignalKeeper.GetUpgrade(ctx, &signaltypes.QueryGetUpgradeRequest{}) + require.NoError(t, err) + require.Equal(t, v3.Version, getUpgradeResp.Upgrade.AppVersion) + + // brace yourselfs, this part may take a while + initialHeight := int64(4) + for height := initialHeight; height < initialHeight+signal.DefaultUpgradeHeightDelay; height++ { + _ = testApp.BeginBlock(abci.RequestBeginBlock{ + Header: tmproto.Header{ + Height: height, + Version: tmversion.Consensus{App: 2}, + }, + }) + + endBlockResp = testApp.EndBlock(abci.RequestEndBlock{ + Height: 3 + signal.DefaultUpgradeHeightDelay, + }) + + _ = testApp.Commit() + } + require.Equal(t, v3.Version, endBlockResp.ConsensusParamUpdates.Version.AppVersion) + + // confirm that an authored blob tx works + blob, err := share.NewV1Blob(share.RandomBlobNamespace(), []byte("hello world"), accAddr.Bytes()) + require.NoError(t, err) + blobTxBytes, _, err := signer.CreatePayForBlobs( + testnode.DefaultValidatorAccountName, + []*share.Blob{blob}, + user.SetGasLimitAndGasPrice(200_000, appconsts.DefaultMinGasPrice), + ) + require.NoError(t, err) + blobTx, _, err := tx.UnmarshalBlobTx(blobTxBytes) + require.NoError(t, err) + + _ = testApp.BeginBlock(abci.RequestBeginBlock{ + Header: tmproto.Header{ + ChainID: genesis.ChainID, + Height: initialHeight + signal.DefaultUpgradeHeightDelay, + Version: tmversion.Consensus{App: 3}, + }, + }) + + deliverTxResp = testApp.DeliverTx(abci.RequestDeliverTx{ + Tx: blobTx.Tx, + }) + require.Equal(t, abci.CodeTypeOK, deliverTxResp.Code, deliverTxResp.Log) + + _ = testApp.EndBlock(abci.RequestEndBlock{}) +} + +// TestAppUpgradeV2 verifies that the all module's params are overridden during an // upgrade from v1 -> v2 and the app version changes correctly. -func TestAppUpgrades(t *testing.T) { +func TestAppUpgradeV2(t *testing.T) { NetworkMinGasPriceDec, err := sdk.NewDecFromStr(fmt.Sprintf("%f", v2.NetworkMinGasPrice)) require.NoError(t, err) @@ -122,19 +238,18 @@ func TestBlobstreamRemovedInV2(t *testing.T) { require.Error(t, err) } -func SetupTestAppWithUpgradeHeight(t *testing.T, upgradeHeight int64) (*app.App, keyring.Keyring) { +func SetupTestAppWithUpgradeHeight(t *testing.T, upgradeHeight int64) (*app.App, *genesis.Genesis) { t.Helper() db := dbm.NewMemDB() - chainID := "test_chain" encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...) testApp := app.New(log.NewNopLogger(), db, nil, 0, encCfg, upgradeHeight, util.EmptyAppOptions{}) - genesisState, _, kr := util.GenesisStateWithSingleValidator(testApp, "account") - stateBytes, err := json.MarshalIndent(genesisState, "", " ") + genesis := genesis.NewDefaultGenesis(). + WithValidators(genesis.NewDefaultValidator(testnode.DefaultValidatorAccountName)). + WithConsensusParams(app.DefaultInitialConsensusParams()) + genDoc, err := genesis.Export() require.NoError(t, err) - infoResp := testApp.Info(abci.RequestInfo{}) - require.EqualValues(t, 0, infoResp.AppVersion) - cp := app.DefaultInitialConsensusParams() + cp := genDoc.ConsensusParams abciParams := &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: cp.Block.MaxBytes, @@ -147,23 +262,23 @@ func SetupTestAppWithUpgradeHeight(t *testing.T, upgradeHeight int64) (*app.App, _ = testApp.InitChain( abci.RequestInitChain{ - Time: time.Now(), + Time: genDoc.GenesisTime, Validators: []abci.ValidatorUpdate{}, ConsensusParams: abciParams, - AppStateBytes: stateBytes, - ChainId: chainID, + AppStateBytes: genDoc.AppState, + ChainId: genDoc.ChainID, }, ) // assert that the chain starts with version provided in genesis - infoResp = testApp.Info(abci.RequestInfo{}) + infoResp := testApp.Info(abci.RequestInfo{}) require.EqualValues(t, app.DefaultInitialConsensusParams().Version.AppVersion, infoResp.AppVersion) - supportedVersions := []uint64{v1.Version, v2.Version} + supportedVersions := []uint64{v1.Version, v2.Version, v3.Version} require.Equal(t, supportedVersions, testApp.SupportedVersions()) _ = testApp.Commit() - return testApp, kr + return testApp, genesis } func upgradeFromV1ToV2(t *testing.T, testApp *app.App) { diff --git a/go.mod b/go.mod index 1de8165f96..bf9aaa9178 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,9 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 - github.com/celestiaorg/go-square/v2 v2.0.0-rc2 - github.com/celestiaorg/knuu v0.14.0 + github.com/celestiaorg/go-square v1.0.0 + github.com/celestiaorg/go-square/v2 v2.0.0 + github.com/celestiaorg/knuu v0.15.2 github.com/celestiaorg/nmt v0.22.1 github.com/celestiaorg/rsmt2d v0.14.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 @@ -31,9 +32,10 @@ require ( github.com/tendermint/tm-db v0.6.7 golang.org/x/exp v0.0.0-20240213143201-ec583247a57a google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 - google.golang.org/grpc v1.66.0 + google.golang.org/grpc v1.66.2 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 v2.4.0 + k8s.io/apimachinery v0.30.2 ) require ( @@ -83,16 +85,13 @@ require ( github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/distribution/reference v0.5.0 // indirect - github.com/docker/docker v26.1.5+incompatible // indirect - github.com/docker/go-connections v0.4.1-0.20210727194412-58542c764a11 // indirect - github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect @@ -103,7 +102,7 @@ require ( github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect github.com/go-playground/validator/v10 v10.11.2 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/goccy/go-json v0.10.3 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect github.com/golang/glog v1.2.1 // indirect @@ -143,11 +142,10 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/joho/godotenv v1.5.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.8 // indirect - github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/klauspost/reedsolomon v1.12.1 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -160,20 +158,18 @@ require ( github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/minio/minio-go/v7 v7.0.70 // indirect + github.com/minio/minio-go/v7 v7.0.74 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect - github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/onsi/ginkgo v1.16.5 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -210,21 +206,19 @@ require ( go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.26.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 // indirect go.opentelemetry.io/otel/metric v1.26.0 // indirect go.opentelemetry.io/otel/sdk v1.26.0 // indirect go.opentelemetry.io/otel/trace v1.26.0 // indirect - go.opentelemetry.io/proto/otlp v1.1.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/net v0.28.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.169.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect @@ -232,9 +226,8 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.28.2 // indirect - k8s.io/apimachinery v0.28.2 // indirect - k8s.io/client-go v0.28.2 // indirect + k8s.io/api v0.30.2 // indirect + k8s.io/client-go v0.30.2 // indirect k8s.io/klog/v2 v2.120.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect @@ -252,5 +245,5 @@ replace ( github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 + github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.41.0-tm-v0.34.29 ) diff --git a/go.sum b/go.sum index b8775d02cd..b0c0f27e3d 100644 --- a/go.sum +++ b/go.sum @@ -213,7 +213,6 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.5.0 h1:+K/VEwIAaPcHiMtQvpLD4lqW7f0Gk3xdYZmI1hD+CXo= github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= @@ -318,14 +317,16 @@ github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7 h1:nxplQi8w github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7/go.mod h1:1EF5MfOxVf0WC51Gb7pJ6bcZxnXKNAf9pqWtjgPBAYc= github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw= github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ= -github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 h1:J79TAjizxwIvm7/k+WI3PPH1aFj4AjOSjajoq5UzAwI= -github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29/go.mod h1:5jJ5magtH7gQOwSYfS/m5fliIS7irKunLV7kLNaD8o0= +github.com/celestiaorg/celestia-core v1.41.0-tm-v0.34.29 h1:hRdTxe+Dz6kiqifRZCC9qYQiTJME7CzAZodrTHlhhnk= +github.com/celestiaorg/celestia-core v1.41.0-tm-v0.34.29/go.mod h1:H6vjzdoqTt4qmbf11z1Lnc9YLUp/B8ITEQLhU92ghqQ= github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16 h1:SeQ7Y/CyOcUMKo7mQiexaj/pZ/xIgyuZFIwYZwpSkWE= github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0= -github.com/celestiaorg/go-square/v2 v2.0.0-rc2 h1:4D+ASgZGYVCsffc2uhPagACrvNiLZu9/CqNYvnlHCgg= -github.com/celestiaorg/go-square/v2 v2.0.0-rc2/go.mod h1:eeaU8f8jBpk3ZS/gaDZIlTesJR2F51QAmveNzWH6aEU= -github.com/celestiaorg/knuu v0.14.0 h1:96uaDHTzlTfhDLrAiygq9Ewow7UzOzGAbUvMwws1S4A= -github.com/celestiaorg/knuu v0.14.0/go.mod h1:5x/+tlLebBSfLmmSBm2ps6aLjnKLn5bOaZpUfI5FpsA= +github.com/celestiaorg/go-square v1.0.0 h1:pb1leaUi2WWSpri6ubNJOCUWdAoPr6AYGlT19F/Y/4k= +github.com/celestiaorg/go-square v1.0.0/go.mod h1:XMv5SGCeGSkynW2OOsedugaW/rQlvzxGzWGxTKsyYOU= +github.com/celestiaorg/go-square/v2 v2.0.0 h1:U5QV8/de5lc7glosfgyHhcxbFwNuwU4+6aYZ2RgjM04= +github.com/celestiaorg/go-square/v2 v2.0.0/go.mod h1:y0BolG0tRM7UN1sAQyDDUkT+aMJPwFIjviVvnCB62C0= +github.com/celestiaorg/knuu v0.15.2 h1:l6MrFTfDfrNtbvOLSjD/YzRpaaBFIIvlWIYXRNNL1/s= +github.com/celestiaorg/knuu v0.15.2/go.mod h1:hTKu4uGH/Dx7eaYgT26coKx/vbALEQdLdYOwNxkAIG0= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= github.com/celestiaorg/nmt v0.22.1 h1:t7fqoP5MJ8mBns5DB2XjfcPxQpS3CKMkY+v+BEkDxYc= @@ -404,8 +405,6 @@ github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJ github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= -github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -478,14 +477,10 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= -github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v26.1.5+incompatible h1:NEAxTwEjxV6VbBMBoGG3zPqbiJosIApZjxlbrG9q3/g= -github.com/docker/docker v26.1.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.1-0.20210727194412-58542c764a11 h1:IPrmumsT9t5BS7XcPhgsCTlkWbYg80SEXUzDpReaU6Y= github.com/docker/go-connections v0.4.1-0.20210727194412-58542c764a11/go.mod h1:a6bNUGTbQBsY6VRHTr4h/rkOXjl244DyRD0tx3fgq4Q= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -567,6 +562,8 @@ github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -620,8 +617,8 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= +github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -793,8 +790,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -894,8 +889,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= -github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= @@ -925,12 +918,12 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= -github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= +github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/reedsolomon v1.12.1 h1:NhWgum1efX1x58daOBGCFWcxtEhOhXKKl1HAPQUp03Q= @@ -1008,8 +1001,8 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.70 h1:1u9NtMgfK1U42kUxcsl5v0yj6TEOPR497OAQxpJnn2g= -github.com/minio/minio-go/v7 v7.0.70/go.mod h1:4yBA8v80xGA30cfM3fz0DKYMXunWl/AV/6tWEs9ryzo= +github.com/minio/minio-go/v7 v7.0.74 h1:fTo/XlPBTSpo3BAMshlwKL5RspXRv9us5UeHEGYCFe0= +github.com/minio/minio-go/v7 v7.0.74/go.mod h1:qydcVzV8Hqtj1VtEocfxbmVFa2siu6HGa+LDEPogjD8= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -1030,12 +1023,8 @@ github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8oh github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= -github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= -github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -1044,8 +1033,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= @@ -1055,6 +1042,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= @@ -1087,8 +1076,8 @@ github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5 github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= +github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -1197,8 +1186,8 @@ github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1216,7 +1205,6 @@ github.com/shirou/gopsutil v3.21.6+incompatible h1:mmZtAlWSd8U2HeRTjswbnDLPxqsEo github.com/shirou/gopsutil v3.21.6+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -1375,10 +1363,6 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1: go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 h1:1wp/gyxsuYtuE/JFxsQRtcCDtMrO2qMvlfXALU5wkzI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0/go.mod h1:gbTHmghkGgqxMomVQQMur1Nba4M0MQ8AYThXDUjsJ38= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 h1:hSWWvDjXHVLq9DkmB+77fl8v7+t+yYiS+eNkiplDK54= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0/go.mod h1:zG7KQql1WjZCaUJd+L/ReSYx4bjbYJxg5ws9ws+mYes= go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= @@ -1391,8 +1375,6 @@ go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+ go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= -go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1432,8 +1414,8 @@ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1541,8 +1523,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1584,8 +1566,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1698,14 +1680,14 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1716,8 +1698,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1790,8 +1772,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2023,8 +2005,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= -google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2082,10 +2064,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -2095,12 +2074,12 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -k8s.io/api v0.28.2 h1:9mpl5mOb6vXZvqbQmankOfPIGiudghwCoLl1EYfUZbw= -k8s.io/api v0.28.2/go.mod h1:RVnJBsjU8tcMq7C3iaRSGMeaKt2TWEUXcpIt/90fjEg= -k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ= -k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU= -k8s.io/client-go v0.28.2 h1:DNoYI1vGq0slMBN/SWKMZMw0Rq+0EQW6/AK4v9+3VeY= -k8s.io/client-go v0.28.2/go.mod h1:sMkApowspLuc7omj1FOSUxSoqjr+d5Q0Yc0LOFnYFJY= +k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI= +k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50= +k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= diff --git a/pkg/appconsts/v3/app_consts.go b/pkg/appconsts/v3/app_consts.go new file mode 100644 index 0000000000..504360864a --- /dev/null +++ b/pkg/appconsts/v3/app_consts.go @@ -0,0 +1,7 @@ +package v3 + +const ( + Version uint64 = 3 + SquareSizeUpperBound int = 128 + SubtreeRootThreshold int = 64 +) diff --git a/pkg/appconsts/versioned_consts.go b/pkg/appconsts/versioned_consts.go index 67c3c8a8f2..a8d01fdedf 100644 --- a/pkg/appconsts/versioned_consts.go +++ b/pkg/appconsts/versioned_consts.go @@ -2,11 +2,11 @@ package appconsts import ( v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1" - v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" + v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3" ) const ( - LatestVersion = v2.Version + LatestVersion = v3.Version ) // SubtreeRootThreshold works as a target upper bound for the number of subtree diff --git a/pkg/wrapper/README.md b/pkg/wrapper/README.md index e58188bd7a..cacbd55dda 100644 --- a/pkg/wrapper/README.md +++ b/pkg/wrapper/README.md @@ -76,9 +76,9 @@ One namespace ID is located in the first `NamespaceIDSize` bytes, while the othe ## References - Namespaced Merkle tree specifications: -- Celestia original data square specification: -- Celestia constants: -- Celestia reserved namespace IDs: +- Celestia original data square specification: +- Celestia constants: +- Celestia reserved namespace IDs: [nmtlink]: https://github.com/celestiaorg/nmt/blob/master/docs/spec/nmt.md [nmtwrapper-link]: https://github.com/celestiaorg/celestia-app/blob/main/pkg/wrapper/nmt_wrapper.go diff --git a/scripts/arabica-block-sync.sh b/scripts/arabica-block-sync.sh new file mode 100755 index 0000000000..1b911ccdfb --- /dev/null +++ b/scripts/arabica-block-sync.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# This script starts a consensus node on Arabica and block syncs from genesis to +# the tip of the chain. + +# Stop script execution if an error is encountered +set -o errexit +# Stop script execution if an undefined variable is used +set -o nounset + +CHAIN_ID="arabica-11" +NODE_NAME="node-name" +SEEDS="827583022cc6ce65cf762115642258f937c954cd@validator-1.celestia-arabica-11.com:26656,74e42b39f512f844492ff09e30af23d54579b7bc@validator-2.celestia-arabica-11.com:26656,00d577159b2eb1f524ef9c37cb389c020a2c38d2@validator-3.celestia-arabica-11.com:26656,b2871b6dc2e18916d07264af0e87c456c2bba04f@validator-4.celestia-arabica-11.com:26656" + +CELESTIA_APP_HOME="${HOME}/.celestia-app" +CELESTIA_APP_VERSION=$(celestia-appd version 2>&1) + +echo "celestia-app home: ${CELESTIA_APP_HOME}" +echo "celestia-app version: ${CELESTIA_APP_VERSION}" +echo "" + +# Ask the user for confirmation before deleting the existing celestia-app home +# directory. +read -p "Are you sure you want to delete: $CELESTIA_APP_HOME? [y/n] " response + +# Check the user's response +if [ "$response" != "y" ]; then + # Exit if the user did not respond with "y" + echo "You must delete $CELESTIA_APP_HOME to continue." + exit 1 +fi + +echo "Deleting $CELESTIA_APP_HOME..." +rm -r "$CELESTIA_APP_HOME" + +echo "Initializing config files..." +celestia-appd init ${NODE_NAME} --chain-id ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise + +echo "Settings seeds in config.toml..." +sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $CELESTIA_APP_HOME/config/config.toml + +echo "Downloading genesis file..." +celestia-appd download-genesis ${CHAIN_ID} + +echo "Starting celestia-appd..." +celestia-appd start --v2-upgrade-height 1751707 --force-no-bbr diff --git a/scripts/arabica.sh b/scripts/arabica.sh index fe88e26c89..d09b9d8441 100755 --- a/scripts/arabica.sh +++ b/scripts/arabica.sh @@ -57,4 +57,4 @@ echo "Downloading genesis file..." celestia-appd download-genesis ${CHAIN_ID} echo "Starting celestia-appd..." -celestia-appd start --v2-upgrade-height 1751707 +celestia-appd start --v2-upgrade-height 1751707 --force-no-bbr diff --git a/scripts/mocha-block-sync.sh b/scripts/mocha-block-sync.sh new file mode 100755 index 0000000000..3f8795dd6e --- /dev/null +++ b/scripts/mocha-block-sync.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# This script starts a consensus node on Mocha and block syncs from genesis to +# the tip of the chain. This is expected to take a few weeks. + +# Stop script execution if an error is encountered +set -o errexit +# Stop script execution if an undefined variable is used +set -o nounset + +CHAIN_ID="mocha-4" +NODE_NAME="node-name" +SEEDS="ee9f90974f85c59d3861fc7f7edb10894f6ac3c8@seed-mocha.pops.one:26656,258f523c96efde50d5fe0a9faeea8a3e83be22ca@seed.mocha-4.celestia.aviaone.com:20279,5d0bf034d6e6a8b5ee31a2f42f753f1107b3a00e@celestia-testnet-seed.itrocket.net:11656,7da0fb48d6ef0823bc9770c0c8068dd7c89ed4ee@celest-test-seed.theamsolutions.info:443" + +CELESTIA_APP_HOME="${HOME}/.celestia-app" +CELESTIA_APP_VERSION=$(celestia-appd version 2>&1) + +echo "celestia-app home: ${CELESTIA_APP_HOME}" +echo "celestia-app version: ${CELESTIA_APP_VERSION}" +echo "" + +# Ask the user for confirmation before deleting the existing celestia-app home +# directory. +read -p "Are you sure you want to delete: $CELESTIA_APP_HOME? [y/n] " response + +# Check the user's response +if [ "$response" != "y" ]; then + # Exit if the user did not respond with "y" + echo "You must delete $CELESTIA_APP_HOME to continue." + exit 1 +fi + +echo "Deleting $CELESTIA_APP_HOME..." +rm -r "$CELESTIA_APP_HOME" + +echo "Initializing config files..." +celestia-appd init ${NODE_NAME} --chain-id ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise + +echo "Settings seeds in config.toml..." +sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $CELESTIA_APP_HOME/config/config.toml + +echo "Downloading genesis file..." +celestia-appd download-genesis ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise + +echo "Starting celestia-appd..." +celestia-appd start --v2-upgrade-height 2585031 --force-no-bbr diff --git a/scripts/mocha.sh b/scripts/mocha.sh index 5447eb9e3b..56c0e89480 100755 --- a/scripts/mocha.sh +++ b/scripts/mocha.sh @@ -57,4 +57,4 @@ echo "Downloading genesis file..." celestia-appd download-genesis ${CHAIN_ID} > /dev/null 2>&1 # Hide output to reduce terminal noise echo "Starting celestia-appd..." -celestia-appd start --v2-upgrade-height 2585031 +celestia-appd start --v2-upgrade-height 2585031 --force-no-bbr diff --git a/test/e2e/benchmark/benchmark.go b/test/e2e/benchmark/benchmark.go index e34d322bb8..81b2748cb1 100644 --- a/test/e2e/benchmark/benchmark.go +++ b/test/e2e/benchmark/benchmark.go @@ -7,10 +7,11 @@ import ( "log" "time" + "github.com/tendermint/tendermint/pkg/trace" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" "github.com/celestiaorg/celestia-app/v3/test/e2e/testnet" "github.com/celestiaorg/celestia-app/v3/test/util/testnode" - "github.com/tendermint/tendermint/pkg/trace" ) type BenchmarkTest struct { @@ -20,7 +21,7 @@ type BenchmarkTest struct { func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) { // create a new testnet - testNet, err := testnet.New(name, seed, + testNet, err := testnet.New(context.Background(), name, seed, testnet.GetGrafanaInfoFromEnvVar(), manifest.ChainID, manifest.GetGenesisModifiers()...) if err != nil { @@ -35,28 +36,27 @@ func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) { // There will be manifest.Validators validators and manifest.TxClients tx clients. // Each tx client connects to one validator. If TxClients are fewer than Validators, some validators will not have a tx client. func (b *BenchmarkTest) SetupNodes() error { + ctx := context.Background() testnet.NoError("failed to create genesis nodes", - b.CreateGenesisNodes(b.manifest.Validators, + b.CreateGenesisNodes(ctx, b.manifest.Validators, b.manifest.CelestiaAppVersion, b.manifest.SelfDelegation, b.manifest.UpgradeHeight, b.manifest.ValidatorResource, b.manifest.DisableBBR)) // enable latency if specified in the manifest if b.manifest.EnableLatency { for _, node := range b.Nodes() { - if err := node.Instance.EnableBitTwister(); err != nil { - return fmt.Errorf("failed to enable bit twister: %v", err) - } + node.EnableNetShaper() } } // obtain the GRPC endpoints of the validators - gRPCEndpoints, err := b.RemoteGRPCEndpoints() + gRPCEndpoints, err := b.RemoteGRPCEndpoints(ctx) testnet.NoError("failed to get validators GRPC endpoints", err) log.Println("validators GRPC endpoints", gRPCEndpoints) // create tx clients and point them to the validators log.Println("Creating tx clients") - err = b.CreateTxClients(b.manifest.TxClientVersion, + err = b.CreateTxClients(ctx, b.manifest.TxClientVersion, b.manifest.BlobSequences, b.manifest.BlobSizes, b.manifest.BlobsPerSeq, @@ -64,7 +64,7 @@ func (b *BenchmarkTest) SetupNodes() error { testnet.NoError("failed to create tx clients", err) log.Println("Setting up testnet") - testnet.NoError("failed to setup testnet", b.Setup( + testnet.NoError("failed to setup testnet", b.Setup(ctx, testnet.WithPerPeerBandwidth(b.manifest.PerPeerBandwidth), testnet.WithTimeoutPropose(b.manifest.TimeoutPropose), testnet.WithTimeoutCommit(b.manifest.TimeoutCommit), @@ -78,21 +78,18 @@ func (b *BenchmarkTest) SetupNodes() error { log.Println("reading trace push config") if pushConfig, err := trace.GetPushConfigFromEnv(); err == nil { log.Print("Setting up trace push config") + envVars := map[string]string{ + trace.PushBucketName: pushConfig.BucketName, + trace.PushRegion: pushConfig.Region, + trace.PushAccessKey: pushConfig.AccessKey, + trace.PushKey: pushConfig.SecretKey, + trace.PushDelay: fmt.Sprintf("%d", pushConfig.PushDelay), + } for _, node := range b.Nodes() { - if err = node.Instance.SetEnvironmentVariable(trace.PushBucketName, pushConfig.BucketName); err != nil { - return fmt.Errorf("failed to set TRACE_PUSH_BUCKET_NAME: %v", err) - } - if err = node.Instance.SetEnvironmentVariable(trace.PushRegion, pushConfig.Region); err != nil { - return fmt.Errorf("failed to set TRACE_PUSH_REGION: %v", err) - } - if err = node.Instance.SetEnvironmentVariable(trace.PushAccessKey, pushConfig.AccessKey); err != nil { - return fmt.Errorf("failed to set TRACE_PUSH_ACCESS_KEY: %v", err) - } - if err = node.Instance.SetEnvironmentVariable(trace.PushKey, pushConfig.SecretKey); err != nil { - return fmt.Errorf("failed to set TRACE_PUSH_SECRET_KEY: %v", err) - } - if err = node.Instance.SetEnvironmentVariable(trace.PushDelay, fmt.Sprintf("%d", pushConfig.PushDelay)); err != nil { - return fmt.Errorf("failed to set TRACE_PUSH_DELAY: %v", err) + for key, value := range envVars { + if err = node.Instance.Build().SetEnvironmentVariable(key, value); err != nil { + return fmt.Errorf("failed to set %s: %v", key, err) + } } } } @@ -101,20 +98,22 @@ func (b *BenchmarkTest) SetupNodes() error { } // Run runs the benchmark test for the specified duration in the manifest. -func (b *BenchmarkTest) Run() error { +func (b *BenchmarkTest) Run(ctx context.Context) error { log.Println("Starting benchmark testnet") log.Println("Starting nodes") - err := b.StartNodes() - if err != nil { + if err := b.StartNodes(ctx); err != nil { return fmt.Errorf("failed to start testnet: %v", err) } // add latency if specified in the manifest if b.manifest.EnableLatency { for _, node := range b.Nodes() { - if err = node.Instance.SetLatencyAndJitter(b.manifest.LatencyParams. - Latency, b.manifest.LatencyParams.Jitter); err != nil { + err := node.SetLatencyAndJitter( + b.manifest.LatencyParams.Latency, + b.manifest.LatencyParams.Jitter, + ) + if err != nil { return fmt.Errorf("failed to set latency and jitter: %v", err) } } @@ -122,15 +121,13 @@ func (b *BenchmarkTest) Run() error { // wait for the nodes to sync log.Println("Waiting for nodes to sync") - err = b.WaitToSync() - if err != nil { + if err := b.WaitToSync(ctx); err != nil { return err } // start tx clients log.Println("Starting tx clients") - err = b.StartTxClients() - if err != nil { + if err := b.StartTxClients(ctx); err != nil { return fmt.Errorf("failed to start tx clients: %v", err) } diff --git a/test/e2e/benchmark/throughput.go b/test/e2e/benchmark/throughput.go index 5af7284d41..9aeaca6715 100644 --- a/test/e2e/benchmark/throughput.go +++ b/test/e2e/benchmark/throughput.go @@ -1,11 +1,13 @@ package main import ( + "context" "log" "time" "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" "github.com/celestiaorg/celestia-app/v3/test/e2e/testnet" + "k8s.io/apimachinery/pkg/api/resource" ) const ( @@ -22,17 +24,17 @@ func getBigBlockManifest() (Manifest, error) { Validators: 2, TxClients: 2, ValidatorResource: testnet.Resources{ - MemoryRequest: "12Gi", - MemoryLimit: "12Gi", - CPU: "8", - Volume: "20Gi", - }, - TxClientsResource: testnet.Resources{ - MemoryRequest: "1Gi", - MemoryLimit: "3Gi", - CPU: "2", - Volume: "1Gi", - }, + MemoryRequest: resource.MustParse("12Gi"), + MemoryLimit: resource.MustParse("12Gi"), + CPU: resource.MustParse("8"), + Volume: resource.MustParse("20Gi"), + }, + TxClientsResource: testnet.Resources{ + MemoryRequest: resource.MustParse("1Gi"), + MemoryLimit: resource.MustParse("3Gi"), + CPU: resource.MustParse("2"), + Volume: resource.MustParse("1Gi"), + }, SelfDelegation: 10000000, CelestiaAppVersion: latestVersion, TxClientVersion: latestVersion, @@ -100,14 +102,17 @@ func TwoNodeSimple(logger *log.Logger) error { benchTest, err := NewBenchmarkTest(testName, &manifest) testnet.NoError("failed to create benchmark test", err) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + defer func() { log.Print("Cleaning up testnet") - benchTest.Cleanup() + benchTest.Cleanup(ctx) }() testnet.NoError("failed to setup nodes", benchTest.SetupNodes()) - testnet.NoError("failed to run the benchmark test", benchTest.Run()) + testnet.NoError("failed to run the benchmark test", benchTest.Run(ctx)) testnet.NoError("failed to check results", benchTest.CheckResults(1*testnet.MB)) @@ -121,13 +126,16 @@ func runBenchmarkTest(logger *log.Logger, testName string, manifest Manifest) er benchTest, err := NewBenchmarkTest(testName, &manifest) testnet.NoError("failed to create benchmark test", err) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + defer func() { log.Print("Cleaning up testnet") - benchTest.Cleanup() + benchTest.Cleanup(ctx) }() testnet.NoError("failed to setup nodes", benchTest.SetupNodes()) - testnet.NoError("failed to run the benchmark test", benchTest.Run()) + testnet.NoError("failed to run the benchmark test", benchTest.Run(ctx)) expectedBlockSize := int64(0.90 * float64(manifest.MaxBlockBytes)) testnet.NoError("failed to check results", benchTest.CheckResults(expectedBlockSize)) diff --git a/test/e2e/main.go b/test/e2e/main.go index c133e00a6d..0928779dbb 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -10,7 +10,7 @@ const ( seed = 42 ) -type TestFunc func(*log.Logger) error +type TestFunc func(logger *log.Logger) error type Test struct { Name string diff --git a/test/e2e/major_upgrade_v2.go b/test/e2e/major_upgrade_v2.go index 9797aa9c26..db21d65306 100644 --- a/test/e2e/major_upgrade_v2.go +++ b/test/e2e/major_upgrade_v2.go @@ -12,52 +12,50 @@ import ( v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1" v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" "github.com/celestiaorg/celestia-app/v3/test/e2e/testnet" - "github.com/celestiaorg/knuu/pkg/knuu" "github.com/tendermint/tendermint/rpc/client/http" ) func MajorUpgradeToV2(logger *log.Logger) error { - latestVersion, err := testnet.GetLatestVersion() - testnet.NoError("failed to get latest version", err) - - logger.Println("Running major upgrade to v2 test", "version", latestVersion) - numNodes := 4 upgradeHeight := int64(10) ctx, cancel := context.WithCancel(context.Background()) defer cancel() logger.Println("Creating testnet") - testNet, err := testnet.New("runMajorUpgradeToV2", seed, nil, "test") + testNet, err := testnet.New(ctx, "runMajorUpgradeToV2", seed, nil, "test") testnet.NoError("failed to create testnet", err) - defer testNet.Cleanup() + defer testNet.Cleanup(ctx) + + latestVersion, err := testnet.GetLatestVersion() + testnet.NoError("failed to get latest version", err) + + logger.Println("Running major upgrade to v2 test", "version", latestVersion) testNet.SetConsensusParams(app.DefaultInitialConsensusParams()) - preloader, err := knuu.NewPreloader() + preloader, err := testNet.NewPreloader() testnet.NoError("failed to create preloader", err) - defer func() { _ = preloader.EmptyImages() }() - testnet.NoError("failed to add image", preloader.AddImage(testnet.DockerImageName(latestVersion))) + defer func() { _ = preloader.EmptyImages(ctx) }() + testnet.NoError("failed to add image", preloader.AddImage(ctx, testnet.DockerImageName(latestVersion))) logger.Println("Creating genesis nodes") for i := 0; i < numNodes; i++ { - err := testNet.CreateGenesisNode(latestVersion, 10000000, - upgradeHeight, testnet.DefaultResources, true) + err := testNet.CreateGenesisNode(ctx, latestVersion, 10000000, upgradeHeight, testnet.DefaultResources, true) testnet.NoError("failed to create genesis node", err) } logger.Println("Creating txsim") - endpoints, err := testNet.RemoteGRPCEndpoints() + endpoints, err := testNet.RemoteGRPCEndpoints(ctx) testnet.NoError("failed to get remote gRPC endpoints", err) - err = testNet.CreateTxClient("txsim", testnet.TxsimVersion, 1, "100-2000", 100, testnet.DefaultResources, endpoints[0]) + err = testNet.CreateTxClient(ctx, "txsim", testnet.TxsimVersion, 1, "100-2000", 100, testnet.DefaultResources, endpoints[0]) testnet.NoError("failed to create tx client", err) logger.Println("Setting up testnet") - testnet.NoError("Failed to setup testnet", testNet.Setup()) + testnet.NoError("Failed to setup testnet", testNet.Setup(ctx)) logger.Println("Starting testnet") - testnet.NoError("Failed to start testnet", testNet.Start()) + testnet.NoError("Failed to start testnet", testNet.Start(ctx)) heightBefore := upgradeHeight - 1 for i := 0; i < numNodes; i++ { @@ -91,7 +89,7 @@ func MajorUpgradeToV2(logger *log.Logger) error { return fmt.Errorf("failed to get height: %w", err) } - if err := node.Upgrade(latestVersion); err != nil { + if err := node.Upgrade(ctx, latestVersion); err != nil { return fmt.Errorf("failed to restart node: %w", err) } diff --git a/test/e2e/minor_version_compatibility.go b/test/e2e/minor_version_compatibility.go index 9c09b57895..c13d93f23c 100644 --- a/test/e2e/minor_version_compatibility.go +++ b/test/e2e/minor_version_compatibility.go @@ -15,7 +15,6 @@ import ( v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1" v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" "github.com/celestiaorg/celestia-app/v3/test/e2e/testnet" - "github.com/celestiaorg/knuu/pkg/knuu" ) func MinorVersionCompatibility(logger *log.Logger) error { @@ -32,45 +31,45 @@ func MinorVersionCompatibility(logger *log.Logger) error { r := rand.New(rand.NewSource(seed)) logger.Println("Running minor version compatibility test", "versions", versions) - testNet, err := testnet.New("runMinorVersionCompatibility", seed, nil, "test") - testnet.NoError("failed to create testnet", err) - ctx, cancel := context.WithCancel(context.Background()) defer cancel() - defer testNet.Cleanup() + testNet, err := testnet.New(ctx, "runMinorVersionCompatibility", seed, nil, "test") + testnet.NoError("failed to create testnet", err) + + defer testNet.Cleanup(ctx) testNet.SetConsensusParams(app.DefaultInitialConsensusParams()) // preload all docker images - preloader, err := knuu.NewPreloader() + preloader, err := testNet.NewPreloader() testnet.NoError("failed to create preloader", err) - defer func() { _ = preloader.EmptyImages() }() + defer func() { _ = preloader.EmptyImages(ctx) }() for _, v := range versions { - testnet.NoError("failed to add image", preloader.AddImage(testnet.DockerImageName(v.String()))) + testnet.NoError("failed to add image", preloader.AddImage(ctx, testnet.DockerImageName(v.String()))) } for i := 0; i < numNodes; i++ { // each node begins with a random version within the same major version set v := versions.Random(r).String() logger.Println("Starting node", "node", i, "version", v) + testnet.NoError("failed to create genesis node", - testNet.CreateGenesisNode(v, 10000000, 0, - testnet.DefaultResources, false)) + testNet.CreateGenesisNode(ctx, v, 10000000, 0, testnet.DefaultResources, false)) } logger.Println("Creating txsim") - endpoints, err := testNet.RemoteGRPCEndpoints() + endpoints, err := testNet.RemoteGRPCEndpoints(ctx) testnet.NoError("failed to get remote gRPC endpoints", err) - err = testNet.CreateTxClient("txsim", testnet.TxsimVersion, 1, "100-2000", 100, testnet.DefaultResources, endpoints[0]) + err = testNet.CreateTxClient(ctx, "txsim", testnet.TxsimVersion, 1, "100-2000", 100, testnet.DefaultResources, endpoints[0]) testnet.NoError("failed to create tx client", err) // start the testnet logger.Println("Setting up testnet") - testnet.NoError("Failed to setup testnet", testNet.Setup()) + testnet.NoError("Failed to setup testnet", testNet.Setup(ctx)) logger.Println("Starting testnet") - testnet.NoError("Failed to start testnet", testNet.Start()) + testnet.NoError("Failed to start testnet", testNet.Start(ctx)) for i := 0; i < len(versions)*2; i++ { // FIXME: skip the first node because we need them available to @@ -86,10 +85,10 @@ func MinorVersionCompatibility(logger *log.Logger) error { newVersion := versions.Random(r).String() logger.Println("Upgrading node", "node", i%numNodes+1, "version", newVersion) - testnet.NoError("failed to upgrade node", testNet.Node(i%numNodes).Upgrade(newVersion)) + testnet.NoError("failed to upgrade node", testNet.Node(i%numNodes).Upgrade(ctx, newVersion)) time.Sleep(10 * time.Second) // wait for the node to reach two more heights - testnet.NoError("failed to wait for height", waitForHeight(ctx, client, heightBefore+2, 30*time.Second)) + testnet.NoError("failed to wait for height", waitForHeight(ctx, client, heightBefore+2, time.Minute)) } heights := make([]int64, 4) diff --git a/test/e2e/simple.go b/test/e2e/simple.go index 12e493de49..7999c726a0 100644 --- a/test/e2e/simple.go +++ b/test/e2e/simple.go @@ -15,39 +15,39 @@ import ( // and MsgSends over 30 seconds and then asserts that at least 10 transactions were // committed. func E2ESimple(logger *log.Logger) error { - latestVersion, err := testnet.GetLatestVersion() - testnet.NoError("failed to get latest version", err) + ctx := context.Background() + testNet, err := testnet.New(ctx, "E2ESimple", seed, nil, "test") + testnet.NoError("failed to create testnet", err) - logger.Println("Running simple e2e test", "version", latestVersion) + defer testNet.Cleanup(ctx) - testNet, err := testnet.New("E2ESimple", seed, nil, "test") - testnet.NoError("failed to create testnet", err) + latestVersion, err := testnet.GetLatestVersion() + testnet.NoError("failed to get latest version", err) - defer testNet.Cleanup() + logger.Println("Running E2ESimple test", "version", latestVersion) logger.Println("Creating testnet validators") testnet.NoError("failed to create genesis nodes", - testNet.CreateGenesisNodes(4, latestVersion, 10000000, 0, - testnet.DefaultResources, true)) + testNet.CreateGenesisNodes(ctx, 4, latestVersion, 10000000, 0, testnet.DefaultResources, true)) logger.Println("Creating txsim") - endpoints, err := testNet.RemoteGRPCEndpoints() + endpoints, err := testNet.RemoteGRPCEndpoints(ctx) testnet.NoError("failed to get remote gRPC endpoints", err) - err = testNet.CreateTxClient("txsim", testnet.TxsimVersion, 10, + err = testNet.CreateTxClient(ctx, "txsim", testnet.TxsimVersion, 10, "100-2000", 100, testnet.DefaultResources, endpoints[0]) testnet.NoError("failed to create tx client", err) logger.Println("Setting up testnets") - testnet.NoError("failed to setup testnets", testNet.Setup()) + testnet.NoError("failed to setup testnets", testNet.Setup(ctx)) logger.Println("Starting testnets") - testnet.NoError("failed to start testnets", testNet.Start()) + testnet.NoError("failed to start testnets", testNet.Start(ctx)) logger.Println("Waiting for 30 seconds to produce blocks") time.Sleep(30 * time.Second) logger.Println("Reading blockchain headers") - blockchain, err := testnode.ReadBlockchainHeaders(context.Background(), testNet.Node(0).AddressRPC()) + blockchain, err := testnode.ReadBlockchainHeaders(ctx, testNet.Node(0).AddressRPC()) testnet.NoError("failed to read blockchain headers", err) totalTxs := 0 diff --git a/test/e2e/testnet/defaults.go b/test/e2e/testnet/defaults.go index 1ea4bbb585..6c6da2cbf9 100644 --- a/test/e2e/testnet/defaults.go +++ b/test/e2e/testnet/defaults.go @@ -1,10 +1,12 @@ package testnet +import "k8s.io/apimachinery/pkg/api/resource" + var DefaultResources = Resources{ - MemoryRequest: "400Mi", - MemoryLimit: "400Mi", - CPU: "300m", - Volume: "1Gi", + MemoryRequest: resource.MustParse("400Mi"), + MemoryLimit: resource.MustParse("400Mi"), + CPU: resource.MustParse("300m"), + Volume: resource.MustParse("1Gi"), } const ( diff --git a/test/e2e/testnet/node.go b/test/e2e/testnet/node.go index 270cd545b7..14293da5fc 100644 --- a/test/e2e/testnet/node.go +++ b/test/e2e/testnet/node.go @@ -2,12 +2,11 @@ package testnet import ( + "context" "fmt" "os" "path/filepath" - "github.com/celestiaorg/celestia-app/v3/test/util/genesis" - "github.com/celestiaorg/knuu/pkg/knuu" serverconfig "github.com/cosmos/cosmos-sdk/server/config" "github.com/rs/zerolog/log" "github.com/tendermint/tendermint/config" @@ -18,6 +17,13 @@ import ( "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/rpc/client/http" "github.com/tendermint/tendermint/types" + "k8s.io/apimachinery/pkg/api/resource" + + "github.com/celestiaorg/celestia-app/v3/test/util/genesis" + "github.com/celestiaorg/knuu/pkg/instance" + "github.com/celestiaorg/knuu/pkg/knuu" + "github.com/celestiaorg/knuu/pkg/sidecars/netshaper" + "github.com/celestiaorg/knuu/pkg/sidecars/observability" ) const ( @@ -41,7 +47,9 @@ type Node struct { SignerKey crypto.PrivKey NetworkKey crypto.PrivKey SelfDelegation int64 - Instance *knuu.Instance + Instance *instance.Instance + sidecars []instance.SidecarManager + netShaper *netshaper.NetShaper // a reference to the netshaper sidecar rpcProxyHost string // FIXME: This does not work currently with the reverse proxy @@ -80,16 +88,17 @@ func (n *Node) PullBlockSummaryTraces(path string) ([]trace.Event[schema.BlockSu // Resources defines the resource requirements for a Node. type Resources struct { // MemoryRequest specifies the initial memory allocation for the Node. - MemoryRequest string + MemoryRequest resource.Quantity // MemoryLimit specifies the maximum memory allocation for the Node. - MemoryLimit string + MemoryLimit resource.Quantity // CPU specifies the CPU allocation for the Node. - CPU string + CPU resource.Quantity // Volume specifies the storage volume allocation for the Node. - Volume string + Volume resource.Quantity } func NewNode( + ctx context.Context, name, version string, startHeight, selfDelegation int64, peers []string, @@ -97,54 +106,52 @@ func NewNode( upgradeHeight int64, resources Resources, grafana *GrafanaInfo, + kn *knuu.Knuu, disableBBR bool, ) (*Node, error) { - instance, err := knuu.NewInstance(name) + knInstance, err := kn.NewInstance(name) if err != nil { return nil, err } - err = instance.SetImage(DockerImageName(version)) + err = knInstance.Build().SetImage(ctx, DockerImageName(version)) if err != nil { return nil, err } - if err := instance.AddPortTCP(rpcPort); err != nil { - return nil, err - } - if err := instance.AddPortTCP(p2pPort); err != nil { - return nil, err - } - if err := instance.AddPortTCP(grpcPort); err != nil { - return nil, err - } - if err := instance.AddPortTCP(tracingPort); err != nil { - return nil, err + for _, port := range []int{rpcPort, p2pPort, grpcPort, tracingPort} { + if err := knInstance.Network().AddPortTCP(port); err != nil { + return nil, err + } } + var sidecars []instance.SidecarManager if grafana != nil { + obsySc := observability.New() + // add support for metrics - if err := instance.SetPrometheusEndpoint(prometheusPort, fmt.Sprintf("knuu-%s", knuu.Scope()), "1m"); err != nil { + if err := obsySc.SetPrometheusEndpoint(prometheusPort, fmt.Sprintf("knuu-%s", kn.Scope), "1m"); err != nil { return nil, fmt.Errorf("setting prometheus endpoint: %w", err) } - if err := instance.SetJaegerEndpoint(14250, 6831, 14268); err != nil { + if err := obsySc.SetJaegerEndpoint(14250, 6831, 14268); err != nil { return nil, fmt.Errorf("error setting jaeger endpoint: %v", err) } - if err := instance.SetOtlpExporter(grafana.Endpoint, grafana.Username, grafana.Token); err != nil { + if err := obsySc.SetOtlpExporter(grafana.Endpoint, grafana.Username, grafana.Token); err != nil { return nil, fmt.Errorf("error setting otlp exporter: %v", err) } - if err := instance.SetJaegerExporter("jaeger-collector.jaeger-cluster.svc.cluster.local:14250"); err != nil { + if err := obsySc.SetJaegerExporter("jaeger-collector.jaeger-cluster.svc.cluster.local:14250"); err != nil { return nil, fmt.Errorf("error setting jaeger exporter: %v", err) } + sidecars = append(sidecars, obsySc) } - err = instance.SetMemory(resources.MemoryRequest, resources.MemoryLimit) + err = knInstance.Resources().SetMemory(resources.MemoryRequest, resources.MemoryLimit) if err != nil { return nil, err } - err = instance.SetCPU(resources.CPU) + err = knInstance.Resources().SetCPU(resources.CPU) if err != nil { return nil, err } - err = instance.AddVolumeWithOwner(remoteRootDir, resources.Volume, 10001) + err = knInstance.Storage().AddVolumeWithOwner(remoteRootDir, resources.Volume, 10001) if err != nil { return nil, err } @@ -156,24 +163,36 @@ func NewNode( args = append(args, fmt.Sprintf("--v2-upgrade-height=%d", upgradeHeight)) } - err = instance.SetArgs(args...) - if err != nil { + if err := knInstance.Build().SetArgs(args...); err != nil { return nil, err } return &Node{ Name: name, - Instance: instance, + Instance: knInstance, Version: version, StartHeight: startHeight, InitialPeers: peers, SignerKey: signerKey, NetworkKey: networkKey, SelfDelegation: selfDelegation, + sidecars: sidecars, }, nil } -func (n *Node) Init(genesis *types.GenesisDoc, peers []string, configOptions ...Option) error { +func (n *Node) EnableNetShaper() { + n.netShaper = netshaper.New() + n.sidecars = append(n.sidecars, n.netShaper) +} + +func (n *Node) SetLatencyAndJitter(latency, jitter int64) error { + if n.netShaper == nil { + return fmt.Errorf("netshaper is not enabled") + } + return n.netShaper.SetLatencyAndJitter(latency, jitter) +} + +func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []string, configOptions ...Option) error { if len(peers) == 0 { return fmt.Errorf("no peers provided") } @@ -194,7 +213,7 @@ func (n *Node) Init(genesis *types.GenesisDoc, peers []string, configOptions ... } // Create and write the config file - cfg, err := MakeConfig(n, configOptions...) + cfg, err := MakeConfig(ctx, n, configOptions...) if err != nil { return fmt.Errorf("making config: %w", err) } @@ -239,12 +258,17 @@ func (n *Node) Init(genesis *types.GenesisDoc, peers []string, configOptions ... return fmt.Errorf("writing address book: %w", err) } - err = n.Instance.Commit() - if err != nil { + if err := n.Instance.Build().Commit(ctx); err != nil { return fmt.Errorf("committing instance: %w", err) } - if err = n.Instance.AddFolder(nodeDir, remoteRootDir, "10001:10001"); err != nil { + for _, sc := range n.sidecars { + if err := n.Instance.Sidecars().Add(ctx, sc); err != nil { + return fmt.Errorf("adding sidecar: %w", err) + } + } + + if err = n.Instance.Storage().AddFolder(nodeDir, remoteRootDir, "10001:10001"); err != nil { return fmt.Errorf("copying over node %s directory: %w", n.Name, err) } return nil @@ -253,8 +277,8 @@ func (n *Node) Init(genesis *types.GenesisDoc, peers []string, configOptions ... // AddressP2P returns a P2P endpoint address for the node. This is used for // populating the address book. This will look something like: // 3314051954fc072a0678ec0cbac690ad8676ab98@61.108.66.220:26656 -func (n Node) AddressP2P(withID bool) string { - ip, err := n.Instance.GetIP() +func (n Node) AddressP2P(ctx context.Context, withID bool) string { + ip, err := n.Instance.Network().GetIP(ctx) if err != nil { panic(err) } @@ -279,8 +303,8 @@ func (n Node) AddressRPC() string { // } // RemoteAddressGRPC retrieves the gRPC endpoint address of a node within the cluster. -func (n Node) RemoteAddressGRPC() (string, error) { - ip, err := n.Instance.GetIP() +func (n Node) RemoteAddressGRPC(ctx context.Context) (string, error) { + ip, err := n.Instance.Network().GetIP(ctx) if err != nil { return "", err } @@ -288,8 +312,8 @@ func (n Node) RemoteAddressGRPC() (string, error) { } // RemoteAddressRPC retrieves the RPC endpoint address of a node within the cluster. -func (n Node) RemoteAddressRPC() (string, error) { - ip, err := n.Instance.GetIP() +func (n Node) RemoteAddressRPC(ctx context.Context) (string, error) { + ip, err := n.Instance.Network().GetIP(ctx) if err != nil { return "", err } @@ -300,8 +324,8 @@ func (n Node) AddressTracing() string { return n.traceProxyHost } -func (n Node) RemoteAddressTracing() (string, error) { - ip, err := n.Instance.GetIP() +func (n Node) RemoteAddressTracing(ctx context.Context) (string, error) { + ip, err := n.Instance.Network().GetIP(ctx) if err != nil { return "", err } @@ -317,24 +341,25 @@ func (n Node) Client() (*http.HTTP, error) { return http.New(n.AddressRPC(), "/websocket") } -func (n *Node) Start() error { - if err := n.StartAsync(); err != nil { +func (n *Node) Start(ctx context.Context) error { + if err := n.StartAsync(ctx); err != nil { return err } - return n.WaitUntilStartedAndForwardPorts() + return n.WaitUntilStartedAndCreateProxy(ctx) } -func (n *Node) StartAsync() error { - return n.Instance.StartAsync() +func (n *Node) StartAsync(ctx context.Context) error { + return n.Instance.Execution().StartAsync(ctx) } -func (n *Node) WaitUntilStartedAndForwardPorts() error { - if err := n.Instance.WaitInstanceIsRunning(); err != nil { +func (n *Node) WaitUntilStartedAndCreateProxy(ctx context.Context) error { + if err := n.Instance.Execution().WaitInstanceIsRunning(ctx); err != nil { return err } - err, rpcProxyHost := n.Instance.AddHost(rpcPort) + // TODO: It is recommended to use AddHostWithReadyCheck for the proxy + rpcProxyHost, err := n.Instance.Network().AddHost(ctx, rpcPort) if err != nil { return err } @@ -347,7 +372,8 @@ func (n *Node) WaitUntilStartedAndForwardPorts() error { // } // n.grpcProxyHost = grpcProxyHost - err, traceProxyHost := n.Instance.AddHost(tracingPort) + // TODO: It is recommended to use AddHostWithReadyCheck for the proxy + traceProxyHost, err := n.Instance.Network().AddHost(ctx, tracingPort) if err != nil { return err } @@ -368,12 +394,12 @@ func (n *Node) GenesisValidator() genesis.Validator { } } -func (n *Node) Upgrade(version string) error { - if err := n.Instance.SetImageInstant(DockerImageName(version)); err != nil { +func (n *Node) Upgrade(ctx context.Context, version string) error { + if err := n.Instance.Execution().UpgradeImage(ctx, DockerImageName(version)); err != nil { return err } - return n.Instance.WaitInstanceIsRunning() + return n.Instance.Execution().WaitInstanceIsRunning(ctx) } func DockerImageName(version string) string { diff --git a/test/e2e/testnet/setup.go b/test/e2e/testnet/setup.go index 620b46cb66..d7db215c34 100644 --- a/test/e2e/testnet/setup.go +++ b/test/e2e/testnet/setup.go @@ -1,6 +1,7 @@ package testnet import ( + "context" "fmt" "strings" "time" @@ -12,14 +13,14 @@ import ( "github.com/tendermint/tendermint/p2p/pex" ) -func MakeConfig(node *Node, opts ...Option) (*config.Config, error) { +func MakeConfig(ctx context.Context, node *Node, opts ...Option) (*config.Config, error) { cfg := app.DefaultConsensusConfig() cfg.TxIndex.Indexer = "kv" cfg.Consensus.TimeoutPropose = config.DefaultConsensusConfig().TimeoutPropose cfg.Consensus.TimeoutCommit = config.DefaultConsensusConfig().TimeoutCommit cfg.Moniker = node.Name cfg.RPC.ListenAddress = "tcp://0.0.0.0:26657" - cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(false)) + cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(ctx, false)) cfg.P2P.PersistentPeers = strings.Join(node.InitialPeers, ",") cfg.Instrumentation.Prometheus = true diff --git a/test/e2e/testnet/testnet.go b/test/e2e/testnet/testnet.go index 76d0bc15df..6b4ff136ed 100644 --- a/test/e2e/testnet/testnet.go +++ b/test/e2e/testnet/testnet.go @@ -13,6 +13,7 @@ import ( "github.com/celestiaorg/celestia-app/v3/app/encoding" "github.com/celestiaorg/celestia-app/v3/test/util/genesis" "github.com/celestiaorg/knuu/pkg/knuu" + "github.com/celestiaorg/knuu/pkg/preloader" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/rs/zerolog/log" @@ -26,26 +27,43 @@ type Testnet struct { keygen *keyGenerator grafana *GrafanaInfo txClients []*TxSim + knuu *knuu.Knuu } -func New(name string, seed int64, grafana *GrafanaInfo, chainID string, +func New(ctx context.Context, name string, seed int64, grafana *GrafanaInfo, chainID string, genesisModifiers ...genesis.Modifier) ( *Testnet, error, ) { identifier := fmt.Sprintf("%s_%s", name, time.Now().Format("20060102_150405")) - if err := knuu.InitializeWithScope(identifier); err != nil { + kn, err := knuu.New(ctx, knuu.Options{ + Scope: identifier, + ProxyEnabled: true, + // if the tests timeout, pass the timeout option + // Timeout: 120 * time.Minute, + }) + if err != nil { return nil, err } + log.Info().Str("scope", kn.Scope).Msg("Knuu initialized") + return &Testnet{ seed: seed, nodes: make([]*Node, 0), genesis: genesis.NewDefaultGenesis().WithChainID(chainID).WithModifiers(genesisModifiers...), keygen: newKeyGenerator(seed), grafana: grafana, + knuu: kn, }, nil } +func (t *Testnet) NewPreloader() (*preloader.Preloader, error) { + if t.knuu == nil { + return nil, errors.New("knuu is not initialized") + } + return preloader.New(t.knuu.SystemDependencies) +} + func (t *Testnet) SetConsensusParams(params *tmproto.ConsensusParams) { t.genesis.WithConsensusParams(params) } @@ -54,12 +72,14 @@ func (t *Testnet) SetConsensusMaxBlockSize(size int64) { t.genesis.ConsensusParams.Block.MaxBytes = size } -func (t *Testnet) CreateGenesisNode(version string, selfDelegation, upgradeHeight int64, resources Resources, disableBBR bool) error { +func (t *Testnet) CreateGenesisNode(ctx context.Context, version string, selfDelegation, upgradeHeight int64, resources Resources, disableBBR bool) error { signerKey := t.keygen.Generate(ed25519Type) networkKey := t.keygen.Generate(ed25519Type) - node, err := NewNode(fmt.Sprintf("val%d", len(t.nodes)), version, 0, - selfDelegation, nil, signerKey, networkKey, upgradeHeight, resources, - t.grafana, disableBBR) + node, err := NewNode(ctx, + fmt.Sprintf("val%d", len(t.nodes)), version, 0, + selfDelegation, nil, signerKey, networkKey, + upgradeHeight, resources, t.grafana, t.knuu, disableBBR, + ) if err != nil { return err } @@ -70,16 +90,17 @@ func (t *Testnet) CreateGenesisNode(version string, selfDelegation, upgradeHeigh return nil } -func (t *Testnet) CreateGenesisNodes(num int, version string, selfDelegation, upgradeHeight int64, resources Resources, disableBBR bool) error { +func (t *Testnet) CreateGenesisNodes(ctx context.Context, num int, version string, selfDelegation, upgradeHeight int64, resources Resources, disableBBR bool) error { for i := 0; i < num; i++ { - if err := t.CreateGenesisNode(version, selfDelegation, upgradeHeight, resources, disableBBR); err != nil { + if err := t.CreateGenesisNode(ctx, version, selfDelegation, upgradeHeight, resources, disableBBR); err != nil { return err } } return nil } -func (t *Testnet) CreateTxClients(version string, +func (t *Testnet) CreateTxClients(ctx context.Context, + version string, sequences int, blobRange string, blobPerSequence int, @@ -88,7 +109,7 @@ func (t *Testnet) CreateTxClients(version string, ) error { for i, grpcEndpoint := range grpcEndpoints { name := fmt.Sprintf("txsim%d", i) - err := t.CreateTxClient(name, version, sequences, + err := t.CreateTxClient(ctx, name, version, sequences, blobRange, blobPerSequence, resources, grpcEndpoint) if err != nil { log.Err(err).Str("name", name). @@ -114,8 +135,9 @@ func (t *Testnet) CreateTxClients(version string, // pollTime: time in seconds between each sequence // resources: resources to be allocated to the txsim // grpcEndpoint: grpc endpoint of the node to which the txsim will connect and send transactions -func (t *Testnet) CreateTxClient(name, - version string, +func (t *Testnet) CreateTxClient( + ctx context.Context, + name, version string, sequences int, blobRange string, blobPerSequence int, @@ -135,15 +157,15 @@ func (t *Testnet) CreateTxClient(name, } // Create a txsim node using the key stored in the txsimKeyringDir - txsim, err := CreateTxClient(name, version, grpcEndpoint, t.seed, - sequences, blobRange, blobPerSequence, 1, resources, txsimRootDir) + txsim, err := CreateTxClient(ctx, name, version, grpcEndpoint, t.seed, + sequences, blobRange, blobPerSequence, 1, resources, txsimRootDir, t.knuu) if err != nil { log.Err(err). Str("name", name). Msg("error creating txsim") return err } - err = txsim.Instance.Commit() + err = txsim.Instance.Build().Commit(ctx) if err != nil { log.Err(err). Str("name", name). @@ -152,7 +174,7 @@ func (t *Testnet) CreateTxClient(name, } // copy over the keyring directory to the txsim instance - err = txsim.Instance.AddFolder(txsimKeyringDir, txsimRootDir, "10001:10001") + err = txsim.Instance.Storage().AddFolder(txsimKeyringDir, txsimRootDir, "10001:10001") if err != nil { log.Err(err). Str("directory", txsimKeyringDir). @@ -165,9 +187,9 @@ func (t *Testnet) CreateTxClient(name, return nil } -func (t *Testnet) StartTxClients() error { +func (t *Testnet) StartTxClients(ctx context.Context) error { for _, txsim := range t.txClients { - err := txsim.Instance.StartWithoutWait() + err := txsim.Instance.Execution().StartAsync(ctx) if err != nil { log.Err(err). Str("name", txsim.Name). @@ -180,7 +202,7 @@ func (t *Testnet) StartTxClients() error { } // wait for txsims to start for _, txsim := range t.txClients { - err := txsim.Instance.WaitInstanceIsRunning() + err := txsim.Instance.Execution().WaitInstanceIsRunning(ctx) if err != nil { return fmt.Errorf("txsim %s failed to run: %w", txsim.Name, err) } @@ -232,12 +254,14 @@ func (t *Testnet) CreateAccount(name string, tokens int64, txsimKeyringDir strin return kr, nil } -func (t *Testnet) CreateNode(version string, startHeight, upgradeHeight int64, resources Resources, disableBBR bool) error { +func (t *Testnet) CreateNode(ctx context.Context, version string, startHeight, upgradeHeight int64, resources Resources, disableBBR bool) error { signerKey := t.keygen.Generate(ed25519Type) networkKey := t.keygen.Generate(ed25519Type) - node, err := NewNode(fmt.Sprintf("val%d", len(t.nodes)), version, - startHeight, 0, nil, signerKey, networkKey, upgradeHeight, resources, - t.grafana, disableBBR) + node, err := NewNode(ctx, + fmt.Sprintf("val%d", len(t.nodes)), version, + startHeight, 0, nil, signerKey, networkKey, + upgradeHeight, resources, t.grafana, t.knuu, disableBBR, + ) if err != nil { return err } @@ -245,7 +269,7 @@ func (t *Testnet) CreateNode(version string, startHeight, upgradeHeight int64, r return nil } -func (t *Testnet) Setup(configOpts ...Option) error { +func (t *Testnet) Setup(ctx context.Context, configOpts ...Option) error { genesis, err := t.genesis.Export() if err != nil { return err @@ -257,11 +281,11 @@ func (t *Testnet) Setup(configOpts ...Option) error { peers := make([]string, 0, len(t.nodes)-1) for _, peer := range t.nodes { if peer.Name != node.Name { - peers = append(peers, peer.AddressP2P(true)) + peers = append(peers, peer.AddressP2P(ctx, true)) } } - err := node.Init(genesis, peers, configOpts...) + err := node.Init(ctx, genesis, peers, configOpts...) if err != nil { return err } @@ -289,10 +313,10 @@ func (t *Testnet) RPCEndpoints() []string { // RemoteGRPCEndpoints retrieves the gRPC endpoint addresses of the // testnet's validator nodes. -func (t *Testnet) RemoteGRPCEndpoints() ([]string, error) { +func (t *Testnet) RemoteGRPCEndpoints(ctx context.Context) ([]string, error) { grpcEndpoints := make([]string, len(t.nodes)) for idx, node := range t.nodes { - grpcEP, err := node.RemoteAddressGRPC() + grpcEP, err := node.RemoteAddressGRPC(ctx) if err != nil { return nil, err } @@ -311,10 +335,10 @@ func (t *Testnet) GetGenesisValidators() []genesis.Validator { // RemoteRPCEndpoints retrieves the RPC endpoint addresses of the testnet's // validator nodes. -func (t *Testnet) RemoteRPCEndpoints() ([]string, error) { +func (t *Testnet) RemoteRPCEndpoints(ctx context.Context) ([]string, error) { rpcEndpoints := make([]string, len(t.nodes)) for idx, node := range t.nodes { - grpcEP, err := node.RemoteAddressRPC() + grpcEP, err := node.RemoteAddressRPC(ctx) if err != nil { return nil, err } @@ -325,7 +349,7 @@ func (t *Testnet) RemoteRPCEndpoints() ([]string, error) { // WaitToSync waits for the started nodes to sync with the network and move // past the genesis block. -func (t *Testnet) WaitToSync() error { +func (t *Testnet) WaitToSync(ctx context.Context) error { genesisNodes := make([]*Node, 0) for _, node := range t.nodes { if node.StartHeight == 0 { @@ -340,7 +364,7 @@ func (t *Testnet) WaitToSync() error { return fmt.Errorf("failed to initialize client for node %s: %w", node.Name, err) } for i := 0; i < 10; i++ { - resp, err := client.Status(context.Background()) + resp, err := client.Status(ctx) if err == nil { if resp.SyncInfo.LatestBlockHeight > 0 { log.Info().Int("attempts", i).Str("name", node.Name).Msg( @@ -361,10 +385,10 @@ func (t *Testnet) WaitToSync() error { return nil } -// StartNodes starts the testnet nodes and forwards the ports. +// StartNodes starts the testnet nodes and setup proxies. // It does not wait for the nodes to produce blocks. // For that, use WaitToSync. -func (t *Testnet) StartNodes() error { +func (t *Testnet) StartNodes(ctx context.Context) error { genesisNodes := make([]*Node, 0) for _, node := range t.nodes { if node.StartHeight == 0 { @@ -373,15 +397,15 @@ func (t *Testnet) StartNodes() error { } // start genesis nodes asynchronously for _, node := range genesisNodes { - err := node.StartAsync() + err := node.StartAsync(ctx) if err != nil { return fmt.Errorf("node %s failed to start: %w", node.Name, err) } } - log.Info().Msg("forwarding ports for genesis nodes") + log.Info().Msg("create endpoint proxies for genesis nodes") // wait for instances to be running for _, node := range genesisNodes { - err := node.WaitUntilStartedAndForwardPorts() + err := node.WaitUntilStartedAndCreateProxy(ctx) if err != nil { log.Err(err).Str("name", node.Name).Str("version", node.Version).Msg("failed to start and forward ports") @@ -393,40 +417,25 @@ func (t *Testnet) StartNodes() error { return nil } -func (t *Testnet) Start() error { - // start nodes and forward ports - err := t.StartNodes() +func (t *Testnet) Start(ctx context.Context) error { + // start nodes and setup proxies + err := t.StartNodes(ctx) if err != nil { return err } // wait for nodes to sync log.Info().Msg("waiting for genesis nodes to sync") - err = t.WaitToSync() + err = t.WaitToSync(ctx) if err != nil { return err } - return t.StartTxClients() + return t.StartTxClients(ctx) } -func (t *Testnet) Cleanup() { - // cleanup txsim - for _, txsim := range t.txClients { - err := txsim.Instance.Destroy() - if err != nil { - log.Err(err). - Str("name", txsim.Name). - Msg("txsim failed to cleanup") - } - } - // cleanup nodes - for _, node := range t.nodes { - err := node.Instance.Destroy() - if err != nil { - log.Err(err). - Str("name", node.Name). - Msg("node failed to cleanup") - } +func (t *Testnet) Cleanup(ctx context.Context) { + if err := t.knuu.CleanUp(ctx); err != nil { + log.Err(err).Msg("failed to cleanup knuu") } } diff --git a/test/e2e/testnet/txsimNode.go b/test/e2e/testnet/txsimNode.go index 994d87a831..66bd005f3e 100644 --- a/test/e2e/testnet/txsimNode.go +++ b/test/e2e/testnet/txsimNode.go @@ -2,8 +2,10 @@ package testnet import ( + "context" "fmt" + "github.com/celestiaorg/knuu/pkg/instance" "github.com/celestiaorg/knuu/pkg/knuu" "github.com/rs/zerolog/log" ) @@ -18,10 +20,11 @@ func txsimDockerImageName(version string) string { type TxSim struct { Name string - Instance *knuu.Instance + Instance *instance.Instance } func CreateTxClient( + ctx context.Context, name, version string, endpoint string, seed int64, @@ -31,8 +34,9 @@ func CreateTxClient( pollTime int, resources Resources, volumePath string, + knuu *knuu.Knuu, ) (*TxSim, error) { - instance, err := knuu.NewInstance(name) + txIns, err := knuu.NewInstance(name) if err != nil { return nil, err } @@ -41,7 +45,7 @@ func CreateTxClient( Str("name", name). Str("image", image). Msg("setting image for tx client") - err = instance.SetImage(image) + err = txIns.Build().SetImage(ctx, image) if err != nil { log.Err(err). Str("name", name). @@ -49,15 +53,15 @@ func CreateTxClient( Msg("failed to set image for tx client") return nil, err } - err = instance.SetMemory(resources.MemoryRequest, resources.MemoryLimit) + err = txIns.Resources().SetMemory(resources.MemoryRequest, resources.MemoryLimit) if err != nil { return nil, err } - err = instance.SetCPU(resources.CPU) + err = txIns.Resources().SetCPU(resources.CPU) if err != nil { return nil, err } - err = instance.AddVolumeWithOwner(volumePath, resources.Volume, 10001) + err = txIns.Storage().AddVolumeWithOwner(volumePath, resources.Volume, 10001) if err != nil { return nil, err } @@ -71,13 +75,12 @@ func CreateTxClient( fmt.Sprintf("-s %s ", blobRange), } - err = instance.SetArgs(args...) - if err != nil { + if err := txIns.Build().SetArgs(args...); err != nil { return nil, err } return &TxSim{ Name: name, - Instance: instance, + Instance: txIns, }, nil } diff --git a/x/blob/types/blob_tx.go b/x/blob/types/blob_tx.go index 1f6273f10c..8089e247ef 100644 --- a/x/blob/types/blob_tx.go +++ b/x/blob/types/blob_tx.go @@ -3,6 +3,7 @@ package types import ( "bytes" + v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3" "github.com/celestiaorg/go-square/v2/inclusion" "github.com/celestiaorg/go-square/v2/share" "github.com/celestiaorg/go-square/v2/tx" @@ -35,7 +36,7 @@ func NewV1Blob(ns share.Namespace, data []byte, signer sdk.AccAddress) (*share.B // ValidateBlobTx performs stateless checks on the BlobTx to ensure that the // blobs attached to the transaction are valid. -func ValidateBlobTx(txcfg client.TxEncodingConfig, bTx *tx.BlobTx, subtreeRootThreshold int) error { +func ValidateBlobTx(txcfg client.TxEncodingConfig, bTx *tx.BlobTx, subtreeRootThreshold int, appVersion uint64) error { if bTx == nil { return ErrNoBlobs } @@ -79,6 +80,9 @@ func ValidateBlobTx(txcfg client.TxEncodingConfig, bTx *tx.BlobTx, subtreeRootTh // If share version is 1, assert that the signer in the blob // matches the signer in the msgPFB. if blob.ShareVersion() == share.ShareVersionOne { + if appVersion < v3.Version { + return ErrUnsupportedShareVersion.Wrapf("share version %d is not supported in %d. Supported from v3 onwards", blob.ShareVersion(), appVersion) + } if !bytes.Equal(blob.Signer(), signer) { return ErrInvalidBlobSigner.Wrapf("blob signer %s does not match msgPFB signer %s", sdk.AccAddress(blob.Signer()).String(), msgPFB.Signer) } diff --git a/x/blob/types/blob_tx_test.go b/x/blob/types/blob_tx_test.go index 1a2d8295dc..a1867e2d92 100644 --- a/x/blob/types/blob_tx_test.go +++ b/x/blob/types/blob_tx_test.go @@ -251,7 +251,7 @@ func TestValidateBlobTx(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := types.ValidateBlobTx(encCfg.TxConfig, tt.getTx(), appconsts.DefaultSubtreeRootThreshold) + err := types.ValidateBlobTx(encCfg.TxConfig, tt.getTx(), appconsts.DefaultSubtreeRootThreshold, appconsts.LatestVersion) if tt.expectedErr != nil { assert.ErrorIs(t, err, tt.expectedErr, tt.name) } diff --git a/x/signal/integration_test.go b/x/signal/integration_test.go index 434b9cf882..fb016e0813 100644 --- a/x/signal/integration_test.go +++ b/x/signal/integration_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/celestiaorg/celestia-app/v3/app" + v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" testutil "github.com/celestiaorg/celestia-app/v3/test/util" "github.com/celestiaorg/celestia-app/v3/x/signal" "github.com/celestiaorg/celestia-app/v3/x/signal/types" @@ -19,17 +20,19 @@ import ( // simulates an upgrade scenario with a single validator which signals for the version change, checks the quorum // has been reached and then calls TryUpgrade, asserting that the upgrade module returns the new app version func TestUpgradeIntegration(t *testing.T) { - app, _ := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams()) + cp := app.DefaultConsensusParams() + cp.Version.AppVersion = v2.Version + app, _ := testutil.SetupTestAppWithGenesisValSet(cp) ctx := sdk.NewContext(app.CommitMultiStore(), tmtypes.Header{ Version: tmversion.Consensus{ - App: 1, + App: v2.Version, }, }, false, tmlog.NewNopLogger()) goCtx := sdk.WrapSDKContext(ctx) ctx = sdk.UnwrapSDKContext(goCtx) res, err := app.SignalKeeper.VersionTally(goCtx, &types.QueryVersionTallyRequest{ - Version: 2, + Version: 3, }) require.NoError(t, err) require.EqualValues(t, 0, res.VotingPower) @@ -40,12 +43,12 @@ func TestUpgradeIntegration(t *testing.T) { _, err = app.SignalKeeper.SignalVersion(ctx, &types.MsgSignalVersion{ ValidatorAddress: valAddr.String(), - Version: 2, + Version: 3, }) require.NoError(t, err) res, err = app.SignalKeeper.VersionTally(goCtx, &types.QueryVersionTallyRequest{ - Version: 2, + Version: 3, }) require.NoError(t, err) require.EqualValues(t, 1, res.VotingPower) @@ -65,7 +68,7 @@ func TestUpgradeIntegration(t *testing.T) { // returns an error because an upgrade is pending. _, err = app.SignalKeeper.SignalVersion(ctx, &types.MsgSignalVersion{ ValidatorAddress: valAddr.String(), - Version: 3, + Version: 4, }) require.Error(t, err) require.ErrorIs(t, err, types.ErrUpgradePending) @@ -78,5 +81,5 @@ func TestUpgradeIntegration(t *testing.T) { shouldUpgrade, version = app.SignalKeeper.ShouldUpgrade(ctx) require.True(t, shouldUpgrade) - require.EqualValues(t, 2, version) + require.EqualValues(t, 3, version) }