Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: resolve lint errors #1682

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/celestiaorg/celestia-app/badge)](https://www.gitpoap.io/gh/celestiaorg/celestia-app)

celestia-app is a blockchain application built using parts of the Cosmos stack. celestia-app uses

- [celestiaorg/cosmos-sdk](https://github.com/celestiaorg/cosmos-sdk) a fork of [cosmos/cosmos-sdk](https://github.com/cosmos/cosmos-sdk)
- [celestiaorg/celestia-core](https://github.com/celestiaorg/celestia-core) a fork of [cometbft/cometbft](https://github.com/cometbft/cometbft)

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace {

// RegisterAPIRoutes registers all application module routes with the provided
// API server.
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) {
clientCtx := apiSvr.ClientCtx
// Register new tx routes from grpc-gateway.
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
Expand Down
2 changes: 1 addition & 1 deletion app/parse_txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// separateTxs decodes raw tendermint txs into normal and blob txs.
func separateTxs(txcfg client.TxConfig, rawTxs [][]byte) ([][]byte, []core.BlobTx) {
func separateTxs(_ client.TxConfig, rawTxs [][]byte) ([][]byte, []core.BlobTx) {
normalTxs := make([][]byte, 0, len(rawTxs))
blobTxs := make([]core.BlobTx, 0, len(rawTxs))
for _, rawTx := range rawTxs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Block proposers need not know nor care about the internals of square constructio
[]Tx <=> []Share (ODS) <=> EDS
```

Validation in `ProcessProposal` is simplified to reconstructing the square given the transaction set and then evaluating whether the computed data root matches the proposed one.
Validation in `ProcessProposal` is simplified to reconstructing the square given the transaction set and then evaluating whether the computed data root matches the proposed one.

## Detailed Design

Expand All @@ -57,7 +57,7 @@ For sparse shares i.e. the blobs themselves, the `SparseShareCounter` estimates

With these two structs, we can safely guarantee that all staged transactions can be included in the square and from the estimation can formulate the minimum square size that will be used to calculate the share index for all the blobs. The construction of the square itself remains the same. Additionally, as the share index and square size can be deterministically calculated it no longer needs to be gossiped to all nodes in the consensus network. However, for verifiability purposes the square size should still remain in the `Data` struct.

Both `PrepareProposal` and `ProcessProposal` will as a result, call much the same methods. Verification is thus reduced to: did I create the same square as you, rather than is your version of the square valid. The main difference is that `PrepareProposal` will handle overflow of transactions by discarding them, while `ProcessProposal` will handle overflow by rejecting the block.
Both `PrepareProposal` and `ProcessProposal` will as a result, call much the same methods. Verification is thus reduced to: did I create the same square as you, rather than is your version of the square valid. The main difference is that `PrepareProposal` will handle overflow of transactions by discarding them, while `ProcessProposal` will handle overflow by rejecting the block.

The new algorithm will no longer need to check that the blobs are ordered by namespace and that the wrapped PFBs contain the corrext share index. `ProcessProposal` will still need to verify the `BlobTx` format (i.e that each blob has a matching PFB and that the PFBs are correctly signed)

Expand Down
2 changes: 1 addition & 1 deletion test/txsim/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (s *BlobSequence) Init(_ context.Context, _ grpc.ClientConn, allocateAccoun
s.account = allocateAccounts(1, fundsForGas)[0]
}

func (s *BlobSequence) Next(ctx context.Context, querier grpc.ClientConn, rand *rand.Rand) (Operation, error) {
func (s *BlobSequence) Next(_ context.Context, _ grpc.ClientConn, rand *rand.Rand) (Operation, error) {
numBlobs := s.blobsPerPFB.Rand(rand)
sizes := make([]int, numBlobs)
namespaces := make([]ns.Namespace, numBlobs)
Expand Down
10 changes: 5 additions & 5 deletions test/util/direct_tx_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
// provided configuration. The account info is queried directly from the
// application. One blob transaction is generated per account provided.
func RandBlobTxsWithAccounts(
t *testing.T,
_ *testing.T,
capp *app.App,
enc sdk.TxEncoder,
_ sdk.TxEncoder,
kr keyring.Keyring,
size int,
blobCount int,
Expand Down Expand Up @@ -108,8 +108,8 @@ func DirectQueryAccount(app *app.App, addr sdk.AccAddress) authtypes.AccountI {
// provided configuration. One blob transaction is generated per account
// provided. The sequence and account numbers are set manually using the provided values.
func RandBlobTxsWithManualSequence(
t *testing.T,
enc sdk.TxEncoder,
_ *testing.T,
_ sdk.TxEncoder,
kr keyring.Keyring,
size int,
blobCount int,
Expand Down Expand Up @@ -233,7 +233,7 @@ func SendTxsWithAccounts(
// account info must be provided.
func SendTxWithManualSequence(
t *testing.T,
enc sdk.TxEncoder,
_ sdk.TxEncoder,
kr keyring.Keyring,
fromAcc, toAcc string,
amount uint64,
Expand Down
2 changes: 1 addition & 1 deletion test/util/test_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var DefaultConsensusParams = &abci.ConsensusParams{
type emptyAppOptions struct{}

// Get implements AppOptions
func (ao emptyAppOptions) Get(o string) interface{} {
func (ao emptyAppOptions) Get(_ string) interface{} {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion test/util/testnode/node_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func collectGenFiles(tmCfg *config.Config, encCfg encoding.Config, pubKey crypto
func initGenFiles(
cparams *tmproto.ConsensusParams,
state map[string]json.RawMessage,
codec codec.Codec,
_ codec.Codec,
file,
chainID string,
) error {
Expand Down
2 changes: 1 addition & 1 deletion testing/e2e/pkg/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func WriteAddressBook(peers []string, file string) error {
return nil
}

func MakeAppConfig(node *Node) (*serverconfig.Config, error) {
func MakeAppConfig(_ *Node) (*serverconfig.Config, error) {
srvCfg := serverconfig.DefaultConfig()
srvCfg.MinGasPrices = fmt.Sprintf("0.001%s", app.BondDenom)
return srvCfg, srvCfg.ValidateBasic()
Expand Down
2 changes: 1 addition & 1 deletion x/blob/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// GetQueryCmd returns the CLI query commands for this module
func GetQueryCmd(queryRoute string) *cobra.Command {
func GetQueryCmd(_ string) *cobra.Command {
// Group blob queries under a subcommand
cmd := &cobra.Command{
Use: types.ModuleName,
Expand Down
8 changes: 4 additions & 4 deletions x/blob/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
}

// ValidateGenesis performs genesis state validation for the capability module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
Expand All @@ -71,11 +71,11 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod
}

// RegisterRESTRoutes registers the capability module's REST service handlers.
func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {
}

// GetTxCmd returns the capability module's root tx command.
Expand Down Expand Up @@ -120,7 +120,7 @@ func (am AppModule) Route() sdk.Route {
func (AppModule) QuerierRoute() string { return types.QuerierRoute }

// LegacyQuerierHandler returns the capability module's Querier.
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion x/qgb/client/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func VerifyShares(ctx context.Context, logger tmlog.Logger, config VerifyConfig,
}

func VerifyDataRootInclusion(
ctx context.Context,
_ context.Context,
qgbWrapper *wrapper.QuantumGravityBridge,
nonce uint64,
height uint64,
Expand Down
12 changes: 6 additions & 6 deletions x/qgb/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress,
return nil
}

func (h Hooks) BeforeDelegationCreated(_ sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error {
func (h Hooks) BeforeDelegationCreated(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error {
func (h Hooks) AfterValidatorCreated(_ sdk.Context, _ sdk.ValAddress) error {
return nil
}

Expand All @@ -53,18 +53,18 @@ func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.Va
return nil
}

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error {
func (h Hooks) AfterValidatorRemoved(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error {
return nil
}

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error {
func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec) error {
return nil
}

func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error {
func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}

func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error {
func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}
2 changes: 1 addition & 1 deletion x/qgb/keeper/query_attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (k Keeper) AttestationRequestByNonce(

func (k Keeper) LatestAttestationNonce(
ctx context.Context,
request *types.QueryLatestAttestationNonceRequest,
_ *types.QueryLatestAttestationNonceRequest,
) (*types.QueryLatestAttestationNonceResponse, error) {
if !k.CheckLatestAttestationNonce(sdk.UnwrapSDKContext(ctx)) {
return nil, types.ErrLatestAttestationNonceStillNotInitialized
Expand Down
4 changes: 2 additions & 2 deletions x/qgb/keeper/query_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
// LastUnbondingHeight queries the last unbonding height.
func (k Keeper) LastUnbondingHeight(
c context.Context,
req *types.QueryLastUnbondingHeightRequest,
_ *types.QueryLastUnbondingHeightRequest,
) (*types.QueryLastUnbondingHeightResponse, error) {
return &types.QueryLastUnbondingHeightResponse{
Height: k.GetLastUnBondingBlockHeight(sdk.UnwrapSDKContext(c)),
}, nil
}

func (k Keeper) Params(c context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
params := k.GetParams(sdk.UnwrapSDKContext(c))
return &types.QueryParamsResponse{
Params: params,
Expand Down
8 changes: 4 additions & 4 deletions x/qgb/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
}

// ValidateGenesis performs genesis state validation for the capability module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
Expand All @@ -70,11 +70,11 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod
}

// RegisterRESTRoutes registers the capability module's REST service handlers.
func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
}

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {
}

// GetTxCmd returns the capability module's root tx command.
Expand Down Expand Up @@ -119,7 +119,7 @@ func (am AppModule) Route() sdk.Route {
func (AppModule) QuerierRoute() string { return types.QuerierRoute }

// LegacyQuerierHandler returns the capability module's Querier.
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion x/qgb/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
)

func RegisterCodec(cdc *codec.LegacyAmino) {
func RegisterCodec(_ *codec.LegacyAmino) {
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
Expand Down
Loading