16 Commits

Author SHA1 Message Date
Julian Strobl
8db682d994
feat(lint): replace deprecated exportloopref (#467)
with `copyloopvar`, which needs Go 1.22.

* chore(ci): bump go version to v1.22
* fix(ci): pin release pipeline to go v1.22

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-11-12 15:59:09 +01:00
Julian Strobl
72e36c11eb
fix(lint): remove inactivated execinquery (#468)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-11-12 11:27:04 +01:00
Lorenz Herzberger
605b6c73d6
415 add validator pop reward amount to chain params (#420)
* feat: add validator pop reward as chain param
* feat: add store for challenge initiator reward amount indexed by height
* feat: add validator PoP reward calculation between distributions
* fix: remove paralleltest lint rule due to data race
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-07-18 10:34:50 +02:00
Jürgen Eckel
1983890fb8
Adjusting to newest version of elements-rpc (#353)
* added tests (for the sake of on-demand local tests)
* added wrapping the first parameters of the calls into `"`
* using newest elements RPC from now on (>=1.0.0)
* removed print outputs
* removed parallel testing from util/elementsd_connector_test.go

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-04-09 13:49:51 +02:00
Jürgen Eckel
779b1edd48
Eckelj/mqtt monitoring (#359)
* added a MqttMonitor module with levelDB and periodic cleanup
* initialized in the app
* passed to dao keeper
* added conversion methods (string2unixtime, byte ToJSON)
* removed obsolete keeper code
* maded  RDDLToken.Factor public
* added explicit mqtt client to the monitor module
* restart mqtt connection in mqttmonitor on connection loss
* adjusted mqttmock structure to be compatible
* added some linter exclusions to let the monitor tool pass
* created a MockMqttMonitor interface and mock object
* used this to pass tests
* made the MockMqttMonitor a global object so that it can be easily mocked
* removed MockMqttMonitor from the app/keeper initialization
* adjusted test cases to register "active machines" to the mqttmonitor
* added mutex in mocks to protect against data races
* defined mocks for the dao tests
* clear separation between interface and mqtt-Monitor

* added another waiting block to ensure the tx went through (multi-threading issue, race condition) during tests this failed sometimes
* added memstorage to test instead of a file based DB


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-04-08 10:49:00 +02:00
Jürgen Eckel
31b304f232
added TermintionWaitGroup (#336)
* added TermintionWaitGroup
* added mutex to lib/tx
* removed machine attestation thread (to comply with testing-race conditions becoming apparent on the CI)
* renamed test suites to have a clear naming structure
* removed parallel-testing from e2e machine test suite
* improved test suite logging
* removed parallel tests of machine_nft_tests - this caused data races due to the mock overwrites
* reduced error check to "out of gas" due to multi-threading and locking  delays that result in different gas consumptions
* Added waiting blocks to pass the CI

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-03-06 10:52:22 +01:00
Jürgen Eckel
04e45a7fb2
275 refactor feedenom on e2e test suite (#312)
* extended AttestMachine FundAccount to support a given fee denominator
* renamed testutil/network/network.go to testutil/network/loader.go
* renamed new to Load
* integrated cosmos/testutil/network to planetmint-go/testutil/network
* changed to plmnt token tests only!
* removed obsolete variables
* fixed newest linter issues

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-14 12:15:40 +01:00
Lorenz Herzberger
0cab7d5878
217 pop participant election (#244)
* implemented SelectPopParticipants
* added check if enough participants to initiate PoP
* make use of lib for broadcasting tx

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-12-21 12:29:11 +01:00
Lorenz Herzberger
bb8e055e44
add challenges query (#231)
* add challenges query

* implement query reissuances paginated

* fix linter errors

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-12-13 11:47:32 +01:00
Julian Strobl
5b25d4cefc
Improve linter setup (#186)
* [linter] Add `musttag`

Enforce field tags in (un)marshaled structs.

* [linter] Add `nestif`

Reports deeply nested if statements.

* [linter] Add `noctx`

Finds sending http request without context.Context.

* [linter] Add `paralleltest`

Paralleltest detects missing usage of t.Parallel() method in your Go
test.

* [linter] Add `tagalign`

Check that struct tags are well aligned.

* [linter] Add `tagliatelle`

Checks the struct tags.

* [linter] Add `whitespace`

Tool for detection of leading and trailing whitespace.

* [paralleltest] Exclude files bc of data race in tests

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-17 10:56:25 +01:00
Julian Strobl
5470fc668b
Improve linter setup (#185)
* [linter] Remove unused exclusions

Linter `nosnakecase` was removed in 1e1138d0268a9896a1bd058e9b65b808eb20666e.

* [linter] Add tool for code clone detection

* [linter] Add `errorlint`

Find code that will cause problems with the error wrapping scheme
introduced in Go 1.13.

* [linter] Add `exhaustive`

Check exhaustiveness of enum switch statements.

* [linter] Add `forcetypeassert`

Finds type assertions which did forcely such as below:
```
func f() {
	var a interface{}
	_ = a.(int) // type assertion must be checked
}
```

* [linter] Add `gocritic`

Provides diagnostics that check for bugs, performance and style issues.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-16 17:44:38 +01:00
Julian Strobl
e36eb6c2a1
Add golangci-lint run to lib/ (#181)
* [lib] Add .golangci.yaml as symlink

https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories

* [golangci-lint] Change `nakedret` settings

* [linter] Can be replaced with faster hex.EncodeToString (perfsprint)

* [linter] Fix too many quotes

* [ci] Add `golangci-lint run` of `lib/`

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-16 09:16:56 +01:00
Julian Strobl
9662389446
[ci] Add all linters that don't affect the code (#177)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-15 13:37:20 +01:00
Julian Strobl
1e1138d026
Switch to revive and fix findings (#171)
* [ci] Switch from `nosnakecase` to `revive`

* [revive] Fix findings

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-13 12:42:52 +01:00
Julian Strobl
6472d7693f
[ci] Add nosnakecase to golangci-lint (#161)
Golang uses:

- Camel Case for variable names, e.g. `firstName`
- Camel Case for private function names, e.g. `getFirstName`
- Pascal Case for public function names, e.g. `GetFirstName`

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-20 14:09:07 +02:00
Julian Strobl
bed03197b5
[ci] Add forbidigo to golangci-lint (#160)
* Move setup into config file
* Add forbidigo to default linters

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-20 13:31:16 +02:00