mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-23 22:15:47 +00:00
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:
parent
1dce252617
commit
ea76dc1e44
5
.github/workflows/audit.yaml
vendored
5
.github/workflows/audit.yaml
vendored
@ -173,8 +173,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: "1.22"
|
go-version: "1.22"
|
||||||
|
|
||||||
- name: Install golangci-lint
|
- name: Install golangci-lint v2
|
||||||
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
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
|
- name: Run golangci-lint
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
165
.golangci.yaml
165
.golangci.yaml
@ -1,6 +1,4 @@
|
|||||||
---
|
version: "2"
|
||||||
run:
|
|
||||||
timeout: 5m
|
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- asasalint
|
- asasalint
|
||||||
@ -15,7 +13,6 @@ linters:
|
|||||||
- dupl
|
- dupl
|
||||||
- dupword
|
- dupword
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- errcheck
|
|
||||||
- errchkjson
|
- errchkjson
|
||||||
- errname
|
- errname
|
||||||
- errorlint
|
- errorlint
|
||||||
@ -29,16 +26,12 @@ linters:
|
|||||||
- goconst
|
- goconst
|
||||||
- gocritic
|
- gocritic
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- gofmt
|
|
||||||
- goheader
|
- goheader
|
||||||
- gomodguard
|
- gomodguard
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosimple
|
|
||||||
- gosmopolitan
|
- gosmopolitan
|
||||||
- govet
|
|
||||||
- grouper
|
- grouper
|
||||||
- importas
|
- importas
|
||||||
- ineffassign
|
|
||||||
- interfacebloat
|
- interfacebloat
|
||||||
- loggercheck
|
- loggercheck
|
||||||
- makezero
|
- makezero
|
||||||
@ -63,83 +56,99 @@ linters:
|
|||||||
- sloglint
|
- sloglint
|
||||||
- sqlclosecheck
|
- sqlclosecheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- stylecheck
|
|
||||||
- tagalign
|
- tagalign
|
||||||
- tagliatelle
|
- tagliatelle
|
||||||
- tenv
|
|
||||||
- testableexamples
|
- testableexamples
|
||||||
- tparallel
|
- tparallel
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
- unused
|
|
||||||
- usestdlibvars
|
- usestdlibvars
|
||||||
- wastedassign
|
- wastedassign
|
||||||
- whitespace
|
- whitespace
|
||||||
- zerologlint
|
- zerologlint
|
||||||
linters-settings:
|
settings:
|
||||||
nakedret:
|
nakedret:
|
||||||
max-func-lines: 100
|
max-func-lines: 100
|
||||||
tagalign:
|
tagalign:
|
||||||
strict: true
|
strict: true
|
||||||
tagliatelle:
|
tagliatelle:
|
||||||
case:
|
case:
|
||||||
use-field-name: true
|
rules:
|
||||||
rules:
|
json: kebab
|
||||||
json: kebab
|
use-field-name: true
|
||||||
issues:
|
exclusions:
|
||||||
exclude-rules:
|
generated: lax
|
||||||
- path: x/.*/types/message.*\.go
|
presets:
|
||||||
linters:
|
- comments
|
||||||
- dupl
|
- common-false-positives
|
||||||
- path: x/dao/client/cli/query_.*\.go
|
- legacy
|
||||||
linters:
|
- std-error-handling
|
||||||
- dupl
|
rules:
|
||||||
- path: x/dao/client/cli/tx_reissue_rddl.*\.go
|
- linters:
|
||||||
linters:
|
- dupl
|
||||||
- dupl
|
path: x/.*/types/message.*\.go
|
||||||
- path: x/dao/client/cli/*\.go
|
- linters:
|
||||||
linters:
|
- dupl
|
||||||
- revive
|
path: x/dao/client/cli/query_.*\.go
|
||||||
- path: testutil/nullify/nullify\.go
|
- linters:
|
||||||
linters:
|
- dupl
|
||||||
- exhaustive
|
path: x/dao/client/cli/tx_reissue_rddl.*\.go
|
||||||
- path: x/.*/keeper/query.*\.go
|
- linters:
|
||||||
linters:
|
- revive
|
||||||
- dupl
|
path: x/dao/client/cli/*\.go
|
||||||
- paralleltest
|
- linters:
|
||||||
- path: tests/.*/*\.go
|
- exhaustive
|
||||||
linters:
|
path: testutil/nullify/nullify\.go
|
||||||
- paralleltest
|
- linters:
|
||||||
- path: util/machine_nft_test\.go
|
- dupl
|
||||||
linters:
|
- paralleltest
|
||||||
- paralleltest
|
path: x/.*/keeper/query.*\.go
|
||||||
- path: testutil/network/network.go
|
- linters:
|
||||||
linters:
|
- paralleltest
|
||||||
- gocognit
|
path: tests/.*/*\.go
|
||||||
- gocyclo
|
- linters:
|
||||||
- wastedassign
|
- paralleltest
|
||||||
- nestif
|
path: util/machine_nft_test\.go
|
||||||
- path: x/.*/simulation/.*\.go
|
- linters:
|
||||||
linters:
|
- gocognit
|
||||||
- revive
|
- gocyclo
|
||||||
- path: x/.*/module_simulation\.go
|
- nestif
|
||||||
linters:
|
- wastedassign
|
||||||
- revive
|
path: testutil/network/network.go
|
||||||
- path: x/.*/client/cli/query_params\.go
|
- linters:
|
||||||
linters:
|
- revive
|
||||||
- revive
|
path: x/.*/simulation/.*\.go
|
||||||
- path: x/.*/.*/cli/query_.*\.go
|
- linters:
|
||||||
linters:
|
- revive
|
||||||
- revive
|
path: x/.*/module_simulation\.go
|
||||||
- path: docs/docs\.go
|
- linters:
|
||||||
linters:
|
- revive
|
||||||
- revive
|
path: x/.*/client/cli/query_params\.go
|
||||||
- path: util/elementsd_connector_test\.go
|
- linters:
|
||||||
linters:
|
- revive
|
||||||
- paralleltest
|
path: x/.*/.*/cli/query_.*\.go
|
||||||
- path: monitor/mqtt_monitor_test\.go
|
- linters:
|
||||||
linters:
|
- revive
|
||||||
- paralleltest
|
path: docs/docs\.go
|
||||||
- path: monitor/.*\.go
|
- linters:
|
||||||
linters:
|
- paralleltest
|
||||||
- durationcheck
|
path: util/elementsd_connector_test\.go
|
||||||
|
- linters:
|
||||||
|
- paralleltest
|
||||||
|
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$
|
||||||
|
|||||||
@ -621,7 +621,7 @@ func New(
|
|||||||
genutil.NewAppModule(
|
genutil.NewAppModule(
|
||||||
app.AccountKeeper,
|
app.AccountKeeper,
|
||||||
app.StakingKeeper,
|
app.StakingKeeper,
|
||||||
app.BaseApp.DeliverTx,
|
app.DeliverTx,
|
||||||
encodingConfig.TxConfig,
|
encodingConfig.TxConfig,
|
||||||
),
|
),
|
||||||
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
|
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.
|
// RegisterTxService implements the Application.RegisterTxService method.
|
||||||
func (app *App) RegisterTxService(clientCtx client.Context) {
|
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.
|
// RegisterTendermintService implements the Application.RegisterTendermintService method.
|
||||||
func (app *App) RegisterTendermintService(clientCtx client.Context) {
|
func (app *App) RegisterTendermintService(clientCtx client.Context) {
|
||||||
tmservice.RegisterTendermintService(
|
tmservice.RegisterTendermintService(
|
||||||
clientCtx,
|
clientCtx,
|
||||||
app.BaseApp.GRPCQueryRouter(),
|
app.GRPCQueryRouter(),
|
||||||
app.interfaceRegistry,
|
app.interfaceRegistry,
|
||||||
app.Query,
|
app.Query,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -41,7 +41,7 @@ func (app *App) ExportAppStateAndValidators(
|
|||||||
AppState: appState,
|
AppState: appState,
|
||||||
Validators: validators,
|
Validators: validators,
|
||||||
Height: height,
|
Height: height,
|
||||||
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
|
ConsensusParams: app.GetConsensusParams(ctx),
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,13 +50,8 @@ func (app *App) ExportAppStateAndValidators(
|
|||||||
// NOTE zero height genesis is a temporary feature which will be deprecated
|
// NOTE zero height genesis is a temporary feature which will be deprecated
|
||||||
// in favour of export at a block height
|
// in favour of export at a block height
|
||||||
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
|
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
|
||||||
applyAllowedAddrs := false
|
|
||||||
|
|
||||||
// check if there is a allowed address list
|
// check if there is a allowed address list
|
||||||
if len(jailAllowedAddrs) > 0 {
|
applyAllowedAddrs := (len(jailAllowedAddrs) > 0)
|
||||||
applyAllowedAddrs = true
|
|
||||||
}
|
|
||||||
|
|
||||||
allowedAddrsMap := make(map[string]bool)
|
allowedAddrsMap := make(map[string]bool)
|
||||||
|
|
||||||
for _, addr := range jailAllowedAddrs {
|
for _, addr := range jailAllowedAddrs {
|
||||||
|
|||||||
4
go.mod
4
go.mod
@ -205,3 +205,7 @@ require (
|
|||||||
replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
|
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/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
4
go.sum
@ -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 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
|
||||||
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
|
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/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/mesh-sdk-go/types v1.0.0 h1:CQjX3SnIZvRClvSgjgNDLq342Wn9WNnGnpSfkmMu8nE=
|
||||||
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/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
|
||||||
github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0=
|
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 v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY=
|
||||||
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=
|
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=
|
||||||
|
|||||||
@ -200,3 +200,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/planetmint/planetmint-go => ../
|
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
|
||||||
|
|||||||
@ -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 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
|
||||||
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
|
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/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/mesh-sdk-go/types v1.0.0 h1:CQjX3SnIZvRClvSgjgNDLq342Wn9WNnGnpSfkmMu8nE=
|
||||||
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/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
|
||||||
github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0=
|
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 v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY=
|
||||||
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=
|
github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=
|
||||||
|
|||||||
@ -166,12 +166,15 @@ func (t *Connector) SignWithOptega(ctx int, dataToSign, pubkey string) (string,
|
|||||||
|
|
||||||
func (t *Connector) UnwrapPublicKey(publicKey string) (bool, string) {
|
func (t *Connector) UnwrapPublicKey(publicKey string) (bool, string) {
|
||||||
length := len(publicKey)
|
length := len(publicKey)
|
||||||
if length == 136 || length == 130 {
|
|
||||||
|
switch length {
|
||||||
|
case 130, 136:
|
||||||
return true, publicKey[len(publicKey)-128:]
|
return true, publicKey[len(publicKey)-128:]
|
||||||
} else if length == 128 {
|
case 128:
|
||||||
return true, publicKey
|
return true, publicKey
|
||||||
|
default:
|
||||||
|
return false, publicKey
|
||||||
}
|
}
|
||||||
return false, publicKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Connector) CalculateHash(dataToSign string) (string, error) {
|
func (t *Connector) CalculateHash(dataToSign string) (string, error) {
|
||||||
|
|||||||
@ -149,7 +149,8 @@ func (mms *MqttMonitor) SelectPoPParticipantsOutOfActiveActors() (challenger str
|
|||||||
found := 0
|
found := 0
|
||||||
var lastSeen LastSeenEvent
|
var lastSeen LastSeenEvent
|
||||||
for iter.Next() {
|
for iter.Next() {
|
||||||
if count == randomChallenger {
|
switch count {
|
||||||
|
case randomChallenger:
|
||||||
lastSeen, err = mms.getDataFromIter(iter)
|
lastSeen, err = mms.getDataFromIter(iter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Log("could not get Data from ID" + strconv.Itoa(randomChallenger))
|
Log("could not get Data from ID" + strconv.Itoa(randomChallenger))
|
||||||
@ -157,7 +158,7 @@ func (mms *MqttMonitor) SelectPoPParticipantsOutOfActiveActors() (challenger str
|
|||||||
}
|
}
|
||||||
challenger = lastSeen.Address
|
challenger = lastSeen.Address
|
||||||
found++
|
found++
|
||||||
} else if count == randomChallengee {
|
case randomChallengee:
|
||||||
lastSeen, err = mms.getDataFromIter(iter)
|
lastSeen, err = mms.getDataFromIter(iter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Log("could not get Data from ID" + strconv.Itoa(randomChallengee))
|
Log("could not get Data from ID" + strconv.Itoa(randomChallengee))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user