fixed rosetta-sdk origin (#498)

* fixed rosetta-sdk origin

* fixed /lib references, too

* switch to golanglint v2 in the ci

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2025-05-02 13:39:53 +02:00 committed by GitHub
parent 1dce252617
commit ea76dc1e44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 116 additions and 99 deletions

View File

@ -173,8 +173,9 @@ jobs:
with:
go-version: "1.22"
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Install golangci-lint v2
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.5 # Replace with the desired v2 version
- name: Run golangci-lint
run: |

View File

@ -1,6 +1,4 @@
---
run:
timeout: 5m
version: "2"
linters:
enable:
- asasalint
@ -15,7 +13,6 @@ linters:
- dupl
- dupword
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
@ -29,16 +26,12 @@ linters:
- goconst
- gocritic
- gocyclo
- gofmt
- goheader
- gomodguard
- goprintffuncname
- gosimple
- gosmopolitan
- govet
- grouper
- importas
- ineffassign
- interfacebloat
- loggercheck
- makezero
@ -63,83 +56,99 @@ linters:
- sloglint
- sqlclosecheck
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- zerologlint
linters-settings:
settings:
nakedret:
max-func-lines: 100
tagalign:
strict: true
tagliatelle:
case:
use-field-name: true
rules:
json: kebab
issues:
exclude-rules:
- path: x/.*/types/message.*\.go
linters:
use-field-name: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- dupl
- path: x/dao/client/cli/query_.*\.go
linters:
path: x/.*/types/message.*\.go
- linters:
- dupl
- path: x/dao/client/cli/tx_reissue_rddl.*\.go
linters:
path: x/dao/client/cli/query_.*\.go
- linters:
- dupl
- path: x/dao/client/cli/*\.go
linters:
path: x/dao/client/cli/tx_reissue_rddl.*\.go
- linters:
- revive
- path: testutil/nullify/nullify\.go
linters:
path: x/dao/client/cli/*\.go
- linters:
- exhaustive
- path: x/.*/keeper/query.*\.go
linters:
path: testutil/nullify/nullify\.go
- linters:
- dupl
- paralleltest
- path: tests/.*/*\.go
linters:
path: x/.*/keeper/query.*\.go
- linters:
- paralleltest
- path: util/machine_nft_test\.go
linters:
path: tests/.*/*\.go
- linters:
- paralleltest
- path: testutil/network/network.go
linters:
path: util/machine_nft_test\.go
- linters:
- gocognit
- gocyclo
- wastedassign
- nestif
- path: x/.*/simulation/.*\.go
linters:
- wastedassign
path: testutil/network/network.go
- linters:
- revive
- path: x/.*/module_simulation\.go
linters:
path: x/.*/simulation/.*\.go
- linters:
- revive
- path: x/.*/client/cli/query_params\.go
linters:
path: x/.*/module_simulation\.go
- linters:
- revive
- path: x/.*/.*/cli/query_.*\.go
linters:
path: x/.*/client/cli/query_params\.go
- linters:
- revive
- path: docs/docs\.go
linters:
path: x/.*/.*/cli/query_.*\.go
- linters:
- revive
- path: util/elementsd_connector_test\.go
linters:
path: docs/docs\.go
- linters:
- paralleltest
- path: monitor/mqtt_monitor_test\.go
linters:
path: util/elementsd_connector_test\.go
- linters:
- paralleltest
- path: monitor/.*\.go
linters:
path: monitor/mqtt_monitor_test\.go
- linters:
- durationcheck
path: monitor/.*\.go
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@ -621,7 +621,7 @@ func New(
genutil.NewAppModule(
app.AccountKeeper,
app.StakingKeeper,
app.BaseApp.DeliverTx,
app.DeliverTx,
encodingConfig.TxConfig,
),
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
@ -939,14 +939,14 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) {
// RegisterTxService implements the Application.RegisterTxService method.
func (app *App) RegisterTxService(clientCtx client.Context) {
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
authtx.RegisterTxService(app.GRPCQueryRouter(), clientCtx, app.Simulate, app.interfaceRegistry)
}
// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *App) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(
clientCtx,
app.BaseApp.GRPCQueryRouter(),
app.GRPCQueryRouter(),
app.interfaceRegistry,
app.Query,
)

View File

@ -41,7 +41,7 @@ func (app *App) ExportAppStateAndValidators(
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
ConsensusParams: app.GetConsensusParams(ctx),
}, err
}
@ -50,13 +50,8 @@ func (app *App) ExportAppStateAndValidators(
// NOTE zero height genesis is a temporary feature which will be deprecated
// in favour of export at a block height
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false
// check if there is a allowed address list
if len(jailAllowedAddrs) > 0 {
applyAllowedAddrs = true
}
applyAllowedAddrs := (len(jailAllowedAddrs) > 0)
allowedAddrsMap := make(map[string]bool)
for _, addr := range jailAllowedAddrs {

4
go.mod
View File

@ -205,3 +205,7 @@ require (
replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
replace github.com/planetmint/planetmint-go/lib => ./lib
replace github.com/coinbase/rosetta-sdk-go => github.com/tkachoff/rosetta-sdk-go v0.0.0-20200409123456-b90b71783ca14a994cb092b2429be4b9fcdfdddf
replace github.com/coinbase/rosetta-sdk-go/types => github.com/coinbase/mesh-sdk-go/types v1.0.0

4
go.sum
View File

@ -338,8 +338,8 @@ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9D
github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA=
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/coinbase/mesh-sdk-go/types v1.0.0 h1:CQjX3SnIZvRClvSgjgNDLq342Wn9WNnGnpSfkmMu8nE=
github.com/coinbase/mesh-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0=
github.com/cometbft/cometbft v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY=
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=

View File

@ -200,3 +200,7 @@ require (
)
replace github.com/planetmint/planetmint-go => ../
replace github.com/coinbase/rosetta-sdk-go => github.com/tkachoff/rosetta-sdk-go v0.0.0-20200409123456-b90b71783ca14a994cb092b2429be4b9fcdfdddf
replace github.com/coinbase/rosetta-sdk-go/types => github.com/coinbase/mesh-sdk-go/types v1.0.0

View File

@ -338,8 +338,8 @@ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9D
github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA=
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/coinbase/mesh-sdk-go/types v1.0.0 h1:CQjX3SnIZvRClvSgjgNDLq342Wn9WNnGnpSfkmMu8nE=
github.com/coinbase/mesh-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0=
github.com/cometbft/cometbft v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY=
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=

View File

@ -166,12 +166,15 @@ func (t *Connector) SignWithOptega(ctx int, dataToSign, pubkey string) (string,
func (t *Connector) UnwrapPublicKey(publicKey string) (bool, string) {
length := len(publicKey)
if length == 136 || length == 130 {
switch length {
case 130, 136:
return true, publicKey[len(publicKey)-128:]
} else if length == 128 {
case 128:
return true, publicKey
}
default:
return false, publicKey
}
}
func (t *Connector) CalculateHash(dataToSign string) (string, error) {

View File

@ -149,7 +149,8 @@ func (mms *MqttMonitor) SelectPoPParticipantsOutOfActiveActors() (challenger str
found := 0
var lastSeen LastSeenEvent
for iter.Next() {
if count == randomChallenger {
switch count {
case randomChallenger:
lastSeen, err = mms.getDataFromIter(iter)
if err != nil {
Log("could not get Data from ID" + strconv.Itoa(randomChallenger))
@ -157,7 +158,7 @@ func (mms *MqttMonitor) SelectPoPParticipantsOutOfActiveActors() (challenger str
}
challenger = lastSeen.Address
found++
} else if count == randomChallengee {
case randomChallengee:
lastSeen, err = mms.getDataFromIter(iter)
if err != nil {
Log("could not get Data from ID" + strconv.Itoa(randomChallengee))