414 Commits

Author SHA1 Message Date
Julian Strobl
ff2f2eb386
[test] Use elements RPC mock server (#232)
Fix `reissueasset` in tests.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-13 15:42:09 +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
804a8e5be6
Add AppLogger to test runs (#230)
* [log] Do not create a new object of `GetAppLogger()` every time

* [tests] Enable AppLogger during testing

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-12 13:39:37 +01:00
Jürgen Eckel
3c1a2fa776
fixed precsion issue within the distribution order (#229)
* fixed precision issue within the distribution order
* adjusted test cases: migrated from uint64 to float64
---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-12 13:15:14 +01:00
Julian Strobl
7b381f3313
Use elements RPC library (#225)
* Use elements RPC library

// Closes #218

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-12 12:14:19 +01:00
Jürgen Eckel
2b19b8194b
Fix distribution bugs (#228)
* fixed missing-proposer bug for asset distribution

* improved logging

reduced type conversions and potential errors

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-12 11:09:33 +01:00
Jürgen Eckel
73b0d1b4c8
Add GetDistribution query (#227)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-12 10:13:27 +01:00
Julian Strobl
ede70b073b
Replace call to external python program (#215)
* Split asset registry endpoint

Into scheme, domain and path. We need the domain in the liquid contract.

* Switch to pure Go implementation

This is a reimplementation of the `issue2liquid.py`.

See https://github.com/rddl-network/issuer_service

// Closes #196

* Move elements RPC URL into config

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-11 15:53:58 +01:00
Julian Strobl
363d82d344
[ci] Improve staticcheck setup (#221)
* [staticcheck] Fix comments on exported functions and structs

* [ci] Improve staticcheck setup

- Add global staticcheck.conf file
- Ignore: at least one file in a package should have a package comment (ST1000)
- Ignore deprecation warnings. They are reported by golangci-lint and
  there we have a proper way to exclude generated files.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-11 11:41:45 +01:00
Julian Strobl
df8ece2a30
Fix TestReissuance() E2E test (#214)
* [lib] Add fee denominator parameter

* [lib] Add client context parameter

e.g. the test cases create their own client context.

* [lib] Reset client context's output

Otherwise if the client context does not change, output gets appended
and gets un-parsable.

* [test] Set missing validator client context values

Necessary for sending transactions.

* [test] Configure RPC library

* [test] Fix `TestReissuance()`

// Closes #195

* Partially revert "[lib] Provide default encoding config (#209)"

This reverts commit 8a8a3aaaf2648f87c4052575bc1a60b23056463b.

Fix README example.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-07 09:57:33 +01:00
Jürgen Eckel
ff6aab33df
Fix error throwing bug that lead to block creation inconsistencies (#212)
* removed error throwing within the AttestMachine method
* add more extensive logging around that call

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-06 11:20:37 +01:00
Julian Strobl
0455176123
[ci] Pin ignite version to v0.27.1 (#213)
Version v28.0.0 was released and breaks the pipeline.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-06 11:13:04 +01:00
Lorenz Herzberger
94830df5fc
184 implement staged claim (#190)
* adjust issuePoPRewards to mint stagedCRDDL
* add GetChallengeRange
* add resolveStagedClaims on ReissueRDDLResult msg
* move claim resolve to distribution result
* add StagedDenom and ClaimDenom to config
* added the prepare4linting.sh script
* renamed PoPEpochs to PopEpochs
* renamed DistributionAddressPoP to DistributionAddressPop
* added config value ReIssuanceEpochs
* detached the re-issuance from the distribution process and schedule them independently
* changed logging messages
* added an explicit util/kv_serialize.go file to have all KV serialization done
* switched to Bigendian serialization of int64 to have the ordered list on the kvstore
* added ComputeReIssuanceValue to enable re-issuances once a day or defined by ReIssuanceEpoch
* integrated a ReIssuanceValue computation test case
* adjusted the challenges test cases to be epoch-dependent
* added ReIssuances per ReIssuanceEpoch
* extended the Reissue message
* checking ReIssuanceProposal in the ante handler
* added precision setter for the UINT to RDDL token converter (and test cases)
* add e2e test case for pop rewards


Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-05 10:51:06 +01:00
Julian Strobl
8a8a3aaaf2
[lib] Provide default encoding config (#209)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-05 10:35:52 +01:00
Jürgen Eckel
cefd22f448
Add the PoPCycle concept (#208)
* added reissuance details, the concept of popepochs and popcycles

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-29 14:14:29 +01:00
Jürgen Eckel
6a60b78b62
Added PoP Initialization and a Challenge Query (#207)
* added InitPoP message
* added getChallenge query to inspect challenges
* adjusted towards a unique block height identification unit: int64, not uint64
* added challenge param finished to identify challenges that weren't completed but will be part of re-issuance.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-29 13:33:25 +01:00
Julian Strobl
8c2e4704cd
[lib] Bump version to v0.2.1
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
v0.6.5 lib/v0.2.1
2023-11-29 08:13:54 +01:00
Jürgen Eckel
6ad235e847 Improve RPC command issuance (#206)
* removed error handling from util/issue_command.go methods
* integrated the complete error handling with context into util/issue_command.go: buildSignBroadcastTx
* setting the chainID of lib/tx dynamically
* removed obsolete timeout
* removed obsolete TODO message
* improved logging information and clarity of information
* improved readability and debugability of BroadcastTxWithFileLock
* fixed getClientContext bug for chains different from the testnet by removing a hard-coded value
* renamed setConfig to setRPCConfig

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-29 08:11:49 +01:00
Julian Strobl
d5339f331c
[ci] Add coverage report (#204)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-29 08:08:23 +01:00
Julian Strobl
55157301e5
[util] Make buildSignBroadcastTx() non-blocking (#205)
Otherwise the chain stop, because the call to the Tendermint RPC does
not return.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-28 15:40:34 +01:00
Julian Strobl
b55af9a1cf
[lib] Bump version to v0.2.0
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
v0.6.4 lib/v0.2.0
2023-11-28 11:02:33 +01:00
Julian Strobl
8bc221d476
[lib] Use AccountRetriever instead of calling API (#203)
This reduces complexity:

- Just use one endpoint
- No need for context.Context to be passed

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-28 10:58:53 +01:00
Julian Strobl
f18d4542e2
Merge release_0_5 branch (#202)
* Fix liuqid notarization (#191)

* Fix liuqid notarization - 2nd part (#193)

* fixed missing unmarshaling
* fixed message formatting issue

* fixed config parsing issue (#194)

* [util] Supply fees

But only where we want to see the transaction succeed. The other ones we
let in a broken state.

* Added logger a logger struct to log with a TAG (#198)

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
Co-authored-by: Jürgen Eckel <eckelj@users.noreply.github.com>
2023-11-28 10:22:39 +01:00
Julian Strobl
14f8749125
Synchronize sequence number across services and for offline mode (#199)
* [lib] Refactor `getClientContextAndTxFactory()`
So that we can pass the account number and sequence number from
outside.

* [lib] Add `BroadcastTxWithFileLock()`

This implements "offline mode" via RPC, but instead of keeping track of
the sequence numbers, we write them into a file and lock them. This way, we can synchronize multiple processes using the same address, trying to
send transactions simultaneously.

// Closes https://github.com/rddl-network/issues/issues/46

Signed-off-by: Julian Strobl <jmastr@mailbox.org>

* [lib] Introduce variable for error
* [lib] Improve error handling in `broadcastTx()`
* Use `BroadcastTxWithFileLock()`
// See https://github.com/rddl-network/issues/issues/46

---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-27 16:11:07 +01:00
Julian Strobl
ec6bd1f755
[lib] Use build and broadcast tx from cosmos-sdk (#189)
* [tests] Avoid potential data races

* Revert "[lib] Switch from RPC (REST) to gRPC (#183)"

This reverts commit db5f4fb3fe6899bcfdadf3471f826a6a97035440.

* [lib] DRY: Use build and broadcast tx from cosmos-sdk

This is in preparation for: https://github.com/rddl-network/issues/issues/46

Without this patch broadcasting a transaction in "offline mode" (setting
the sequence number manually) would not work consistently. Every so
often the endpoint would report back, that it got an unexpected sequence
number. Executing the request with the same sequence number couple of
seconds later would be successful.

I decided to better use the same source code, that the CLI uses, because
I know that offline mode works there.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-22 15:03:36 +01:00
Julian Strobl
c40394e8a8
[lib] Bump version to v0.1.2
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
lib/v0.1.2 v0.6.3
2023-11-17 11:04:10 +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
db5f4fb3fe
[lib] Switch from RPC (REST) to gRPC (#183)
* [lib] Add `SimulateTx()`

* [lib] Set `plmnt` as default bech32 account prefix

* [linter] Function should pass the context parameter (contextcheck)

// Closes #175

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-16 14:47:16 +01:00
Lorenz Herzberger
a5cea30e26
92 implement pop result handler (#101)
* ignite scaffold message report-pop-result challenge:Challenge --module dao

* add issuePoPRewards and fix typo

* add util validate struct and report pop test cases

* add TODOs

* replace depricated error

* fix broken import

* add error handler for failed pop issuance

* add placeholder for validator is issuer check

* added changed go.mod and go.sum

* generate docs

* reduce cognitive complexity

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-16 12:44:56 +01:00
Julian Strobl
6ef5e3c803
[ci] Create lib git tag for go get during release (#182)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-16 11:04:46 +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
dbd8e07a72
[lib] Run go mod tidy (#180)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
lib/v0.1.1 v0.6.2
2023-11-15 16:01:57 +01:00
Julian Strobl
f57d6375fe
[lib] Fix go.mod version string (#179)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
v0.6.1
2023-11-15 15:28:23 +01:00
Julian Strobl
5bc0097ae3
Use RPC instead of exec.Command(...) (#176)
* Move `encoding.go` to lib to avoid import cycle

* [lib] Add `SetEncodingConfig` to avoid import cycle

```
package github.com/planetmint/planetmint-go/app
        imports github.com/planetmint/planetmint-go/app/ante
        imports github.com/planetmint/planetmint-go/x/dao
        imports github.com/planetmint/planetmint-go/util
        imports github.com/planetmint/planetmint-go/app: import cycle not allowed
```

* Use RPC instead of `exec.Command(...)`

// Closes #152

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
v0.6.0
2023-11-15 14:16:21 +01:00
Julian Strobl
682796b3c8
Fix linter findings (#178)
* [linter] Fix unnecessary conversion (unconvert)

* [linter] Fix fmt.Sprintf can be replaced with faster strconv.FormatInt (perfsprint)

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-15 14:06:29 +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
Jürgen Eckel
a982abecf5
Distribute assets (#162)
* distributed & result msgs
* added DistributionResult
* added RDDL token conversion methods
* set proper validatoraddress within the testcases for e2e/dao
* set proper root dir for test cases
* fixed some wordings
---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-15 13:31:20 +01:00
Lorenz Herzberger
83d493dd94
139 implement mint address param (#174)
* add MintAddress to params.proto

* ignite scaffold message update-params params:Params --module dao

* add dao get and set params

* make dao.MsgUpdateParams.Params non-nullable

* use GetMintAddress in ante handler

* adjust dao e2e test suit for mint address param

* change msg creator to authority and set gov module as default in gov proposal

* fix staticcheck error

* remove depricated config param

* fix linter errors

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-11-15 10:46:01 +01:00
Julian Strobl
1ca7faec60
Library for RPC requests to Planetmint (#173)
* [lib] Add initial version

// See #152

* [lib] Add initial README.md

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-14 15:04:46 +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
Lorenz Herzberger
c8bfb861f1
add machine allowance e2e test (#166)
* add machine allowance e2e test

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fix linter errors

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-11-09 15:47:41 +01:00
Julian Strobl
8a2a05f2fb
Fix default validator address in app.toml (#169)
Copy&paste error.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-08 15:20:40 +01:00
Jürgen Eckel
f0ae4c96ba
Use GetConfig() to utilize the singleton (#168)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
v0.5.5
2023-11-07 18:09:54 +01:00
dependabot[bot]
3beab6624b
Bump google.golang.org/grpc from 1.56.2 to 1.56.3 (#163)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.56.2 to 1.56.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.56.2...v1.56.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-07 18:02:29 +01:00
Julian Strobl
0b6b1e120a
DRY: Use RootDir from main config (#155)
Usually passed by `--home`.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-23 10:45:10 +02: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
7d65bff35f
Switch BlockHeight to int64 (#158)
To align with cosmos-sdk and make interoperability easier.

* Fix typo: blockheight -> blockHeight

* Generate protobuf and openapi

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-20 13:43:44 +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
Julian Strobl
45504f4670
Replace fmt.PrintX calls by proper logging (#159)
// Closes #137

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-20 12:57:42 +02:00