143 Commits

Author SHA1 Message Date
Jürgen Eckel
3ca10dfff1
Verifying the availability of PoP participants (#274)
* feat: verify the availability of PoP participants

* simplified and improved logging
* added MQTT-based availability check for PoP participants
* extended MQTT mocking
* Only the block proposer will send out the MQTT messages to the pop participants
* Added a configuration value for the MQTT response timeout
* removed parallel execution of one test case
* added r/w locking to the MQTT response processing
* set MQTT timeout unit to ms

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-12 10:02:09 +01:00
Lorenz Herzberger
2534828fc6
feature: add ante handler to block non validators from sending restri… (#273)
* feature: add ante handler to block non validators from sending restricted txs

* fix: add missing msg types and linter errors

* fix: staticcheck error

* refactor: use fallthrough on ante handle switch

* fix: set val address on machine attest test
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-01-11 14:33:20 +01:00
Julian Strobl
001a472ef9
Refactoring and fixes (#272)
* refactor: switch log level for PoP messages

Needs to be the other way around, otherwise we receive up to 720
messages on info level.

* refactor: align spelling in comments and log messages

* fix: config key

Commit fc9e795bd0678746993806ac21c92a675ed7006f changed the reissuance
variable. The config key was forgotten to change.

* refactor: return early to reduce indentation

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-11 10:39:25 +01:00
Julian Strobl
7e3c0b719b
fix: distribution relative to the reissuance epoch (#270)
- reissuance   = 1 day
- distribution = 1 day + 30 min

expectation:
- reissuance:   1 day, 2 day, 3 day, ...
- distribution: 1 day + 30 min, 2 day + 30 min, 3 day + 30 min, ...

without patch:
- reissuance:   1 day, 2 day, 3 day, ...
- distribution: 1 day + 30 min, 2 day + 60 min, 3 day + 90 min, ...

Closes #260

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-11 10:27:57 +01:00
Julian Strobl
fc9e795bd0
refactor: fix casing for reissuance variable (#267)
Reissue and reissuance are standalone words and should not contain an
uppercase `I` in the variable name. This should only happen to connect
different word like: file name gets `fileName` resp. `FileName`.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-10 10:47:38 +01:00
Julian Strobl
2cf9bd4c43
refactor: replace raw tx by command in reissuance (#266)
In the beginning we wanted to send the raw transaction to elements, but
what we ended up doing is to send the command like:
```
"reissueasset assetID amount"
```
to elements-cli/elements-rpc.

Closes #226

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-10 10:30:58 +01:00
Julian Strobl
25649be550
fix: remove check from machine attestation request (#264)
`k.isNFTCreationRequest(msg.Machine)` was removed as it became obsolete
and we are not issuing generic tokens from within the machine
attestation process.

Closes #242

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-09 10:25:50 +01:00
Julian Strobl
6d05f85cbd
Use lib in rest e2e machine test (#263)
* refactor: align variable name with rest of the code

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-09 10:14:54 +01:00
Julian Strobl
fa05ec7fff
Fix test pop result (#258)
* chore: update elements-rpc to v0.5.2

* fix: logging output in dao keeper

* refactor: properly check broadcast tx output

* fix: use correct proposer address in test

Otherwise we get an error like:
```
[app] reissue: failed. valid result: true proposer: plmnt1gyg6lxcre5f8t4ef0uxcqen9jczwalzjvc25k8
  validator identity: fb7ecaf9584dfdc67265f599155571651c149207
```

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-05 09:49:40 +01:00
Julian Strobl
4599bc2c78
refactor: improve logging (#257)
* refactor: improve logging

- Introduce logger tags
- Log variable contents
- Fix testing logger to support string formatting

* refactor: set logging context

And move logging into function.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-04 12:50:34 +01:00
Julian Strobl
926fc76659
* fixed the cause for different results by different keepers during the processing of the distribution rewards. (#248)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-22 10:07:53 +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
Jürgen Eckel
c09aab8b38
Initializing the PoP process on the tasmota nodes (#243)
* added MQTT lib
* added MQTT config params: domain, port user, password
* sending PoPInit commands to devices par of the pop (after delivery of the PoPInit message)
* Added test case to verify the working of the MQTT connection (test is skipped and designed for manual tests (lack of credentials))
---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-12-20 10:01:28 +01:00
Julian Strobl
fd58362a42
Fix typo and align log messages (#241)
* Fix typo and align log messages
* Align some variable names with rest of the program
* [log] Fix log formatting and change log level
* Fix comment

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-19 14:28:15 +01:00
Jürgen Eckel
379cc761b2
adjusted re-issuance values and the corresponding test cases. (#238)
* adjusted re-issuance values and the corresponding test cases.
* [test] Fix `TestPoPResult`
* [test] Revert `TestReissuance`

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
Co-authored-by: Julian Strobl <jmastr@mailbox.org>
2023-12-19 09:02:35 +01:00
Julian Strobl
036ce7cbc1
Enable sequence file locking in tests (#236)
* [lib] Add `FeeGranter` to tx factory
* [lib] Align return value with test cases
* [test] Return error on tx response
* [test] Switch to sequence file locking via libRPC
* [test] Reintegrate `TestPoPResult`

Closes #234


Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-18 15:47:44 +01:00
Lorenz Herzberger
0d74b81ac9
210 make distribution dependent reissuance (#216)
* distribution now requires re-issuance
* change claim conversion to use fixed uint amounts
* change initialization of util variable
* move rpc conf init to app config init


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-15 09:39:02 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Julian Strobl
6aaa5399ef
Remove /planetmint-go from API paths (#157)
* Remove `/planetmint-go` from API paths

* Generate protobuf and openapi

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-19 10:39:23 +02:00
Julian Strobl
283eeb7c9a
Fix broken API paths (#154)
* Fix broken API paths

Partially revert d4eed021c8b16210e82dbaa7687fc671b6ea5a90

* Generate protobuf and openapi

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-18 08:48:33 +02:00
Jürgen Eckel
c6909a3e4a
hotfix: inconsistent logging of block-proposer results on the chain. … (#153)
* hotfix: inconsistent logging of block-proposer results on the chain. These results need to be consensed via an explicit message instead of an error output.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-17 11:49:54 +02:00
Jürgen Eckel
1927c4d472
Eckelj/support keyring (#136)
* added keyring option
* added Reissuance workflow logging

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-11 16:02:37 +02:00
Jürgen Eckel
5f834726b8
from float to satoshi (#134)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-10 15:15:10 +02:00
Lorenz Herzberger
267f4beb37
remove unused code
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-10-10 09:10:50 +02:00
Jürgen Eckel
6e3d5ec394
improved error handling
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-10 02:14:05 +02:00
Jürgen Eckel
5adaab3b14
fixed linter issues
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-10 01:54:09 +02:00
Jürgen Eckel
0835ab4b46
removed circular dependency
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-10 01:48:15 +02:00
Jürgen Eckel
b4ddc44044
* integrated ante-handler
* added two new config variables: reissuance-asset and validator-address

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-10-10 01:24:28 +02:00