176 Commits

Author SHA1 Message Date
Jürgen Eckel
1f2b1702ea
Eckelj/mqtt monitoring fix (#398)
* set keepalive ping
* made mutex more granular
* avoid using app.Logger to have a consistent log from the beginning
* made lazyLoading local to the module
* fixed ticker bug so that the tasks are executed in an endless loop
* fixed timezone bug of Add Participant. only validator local time is used not the timestamp from the mqtt messages as these might come from a different time zone (resulted in delayed deletion from the activeActors DB)
* improved connection management for the monitor
* added a watchdog task to restart the monitor in case of connection loss (every 2 min)
* removed obsolete SetContext function/interface
* removed obsolete time conversion method

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-05-15 13:23:06 +02:00
Jürgen Eckel
ccf491d658
added uncompressed trust anchor pub key processing (#396)
* added uncompressed trust anchor pub key processing
* added a nother waiting block to pass CI test cases - these are a bit slower

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-05-14 10:32:52 +02:00
Jürgen Eckel
af1483a8ec
added secp256r1 machine ID Sig verification (#395)
* added secp256r1 machineIDSignature verification
* to go-utils v0.1.1
---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-05-10 10:57:55 +02:00
Lorenz Herzberger
b0f8516cd6
379 create redeem claim does not call service (#383)
* feat: add rddl-claim-service/client
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
Co-authored-by: Julian Strobl <jmastr@mailbox.org>
2024-04-25 14:38:58 +02:00
Jürgen Eckel
43d152fcf6
Donate tokens to attested machines so that these are able to run after their attestation (#375)
* added donation of tokens/denom to the just attestet machine
* extended the machine module to have two additional parameters: amount of tokens to be distributed and their denominator

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-04-23 12:00:31 +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
Lorenz Herzberger
7d4ec9d56c
change: CreateRedeemClaim consumes entire claim for reduced complexity (#352)
* change: CreateRedeemClaim consumes entire claim for reduced complexity

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-03-19 14:29:29 +01:00
Julian Strobl
26457a7a6f
refactor: goify function (#337)
* chore: log in case of error

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-03-06 14:51:27 +01:00
Jürgen Eckel
f13c54f582
fixed mqtt URI bug (#334)
* adjusted to refactored path

* removed go routine from attest machine msg server

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-03-05 15:29:24 +01:00
Lorenz Herzberger
caa795e5f7
relocate redeem claim and reissuance proposal ante decorator to respe… (#331)
* relocate redeem claim and reissuance proposal ante decorator to respective msg servers

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-03-05 15:03:27 +01:00
Jürgen Eckel
4f5b1e5777
Multi validator setup in test cases (#333)
* Initializing rootDir of dao and machine keeper with the home path of the validator key material
* added Block height logging of context decorator
* removed SetRoot usage
* fixed data races of the attest machine go-routine
* reproduction of the issue
* fixed testing URL issue
* refactored the machine-nft functions/mock
* fixed keeper.param read-bug that increased the gas prices in an inconsistent way
* increased the validator number to 3 for all e2e tests
* added go routine to attest machine workflow

---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Co-authored-by: Julian Strobl <jmastr@mailbox.org>
Co-authored-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-03-05 11:37:01 +01:00
Julian Strobl
838c887a91
Revert "Revert "Revert unnecessary config patch (#323)" (#324)" (#332)
This reverts commit b205c5ff29df25bad6b923bae327b88bdad89518.

This needs to be removed so that the parameters are read from chain.
2024-03-01 12:42:44 +01:00
Jürgen Eckel
55b7065744
Eckelj/remove the smell (#326)
* removed some more code smell/error message aggregation
* removed obsolete/duplicate tests/code
* excluded TODOs (simulation) from being processed by sonarqube
* removed TODO code

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-26 18:06:43 +01:00
Jürgen Eckel
75ed13b357
Eckelj/reducing code smell (#325)
* aggregating error messages
* removed duplicate err msgs
* removed obsolete test (two times equal behaviour )
* added global error msg module
* refactored test utils to have sample types and sample objects by keepers separated
* excluded auto-generated code from sonarcube analysis


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-26 16:44:00 +01:00
Julian Strobl
b205c5ff29
Revert "Revert unnecessary config patch (#323)" (#324)
This reverts commit b1c4d11ccf3e98bd46a13d7fb54b6b5c0aefbf29.
2024-02-26 13:04:41 +01:00
Julian Strobl
b1c4d11ccf
Revert unnecessary config patch (#323)
* Revert "feat: bring back config parameters"

This reverts commit 4ab279033cae5e351cd13c348a21e4717705f341.

Unnecessary because cosmos sdk handles chain upgrades properly: it holds
the chain and waits for a new binary version.

* refactor: use testnet parameters as default in x/dao
---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-02-26 12:25:12 +01:00
Jürgen Eckel
ec697840de
Eckelj/machine update params (#322)
* added signing authority (dao) to the keeper to enable dao signing checks
* added UpdateParam message for the machine module

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-26 12:00:37 +01:00
Julian Strobl
412e15449b feat: add migration to v0.8.0
Take x/dao and x/machine default parameters and store them into the
respective module state.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-02-26 08:30:10 +01:00
Julian Strobl
4ab279033c feat: bring back config parameters
Needed for migration as interim solution.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-02-26 08:30:10 +01:00
Jürgen Eckel
951d854891
311 review test case ssendpopresultoutbytes true todo bug (#313)
* added PoP report validation to the ReportPoPResult msg server
* removed two obsolete pop report deliveries
* added challenger is the PoPreport msg creator (new restriction)
* extended msg server test cases

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-15 14:41:05 +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
Jürgen Eckel
f6a7a56704
* added default params for x/machine/params (#310)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-01 15:24:41 +01:00
Jürgen Eckel
373614e1b2
269 set a chain wide upper gas limit for transactions (#309)
* set global tx gas limit
* extend lib/tx to process multiple messages
* extend lib/tx to configure tx gas limit
* added global gas limit tests
* increased account funding to support needs of testcases

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-01 10:23:38 +01:00
Lorenz Herzberger
a38fe781ba
187 implement rddl claim (#298)
* ignite scaffold map redeem-claim amount issued:bool --module dao --index beneficiary,liquid-tx-hash

* revert: remove autogenerated delete redeem claim logic

* fix: replace deprecated autogenerated sdkerrors with errorsmod

* refactor: rename issued to confirmed on redeem claim

* feat: add claim address param

* test: add test for restricted msg UpdateRedeemClaim

* refactor: update redeem claim key creation and messages

* feat: add SendUpdateRedeemCLaim to util

* feat: add RedeemClaimDecorator for ante package

* ignite scaffold message confirm-redeem-claim id:uint beneficiary:string --module dao

* feat: add handleConfirmRedeemClaim to ante handler

* feat: add handleUpdateRedeemClaim to ante handler

* feat: implement ConfirmRedeemClaim msg handler

* test: add redeem claim test and adjust e2e test suite

* fix: make use of uint to rddl string util in CreateRedeemClaim

* fix: linter and staticcheck errors

* ignite scaffold query redeem-claim-by-liquid-tx-hash liquid-tx-hash --response redeem-claim:RedeemClaim --module dao

* feat: add RedeemClaimByLiquidTXHash store capabilities

* test: add QueryRedeemClaimByLiquidTxHash to e2e test suite

* feat: add RedeemClaimDecorator to ante handler chain

* fix: remove redundant planetmint-go from service path

* fix: linter and staticcheck errors

* fix: go vet errors

* fix: remove unused autogenerated simulation

* fix: broken simulation

* fix: openapi.yml

* revert: remove autogenerated redundant test file that causes data race on pipeline

* feat: burn claim on CreateRedeemClaim

* fix: linter error

* test: fix mock bankkeeper for msg server test

* fix: reissuance test if statement

* chore: removed TODO comment

* fix: typo in redeem claim error msg

* revert: remove autogenerated genesis state

* fix: dao module simulation

* revert: remove unused function

* fix: linter errors

* fix: linter error

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-02-01 09:57:58 +01:00
Jürgen Eckel
a29f394bc4
192 migrate config params to on chain module params (#307)
* initial refactoring commit
* added config passing to network creation for some test suits
* fixed refactoring issues
* adjusted params

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-01-30 16:12:04 +01:00
Jürgen Eckel
bfbe9584a1
296 change distribution (#306)
* updated planetmint-go dependency in lib/tx
* added two additional distribution addresses. splitted up the previous investor pool of 31% into three pools:
* early investors 19%
* investors 10%
* strategic 2%

* adjusted distribution request message
* adjusted distribution result
* adjusted distribution order
* refactored reissuance and distribution msg methods to be more readable

* fixed token distribution test case

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-01-29 14:33:40 +01:00
Jürgen Eckel
f6509cfa64
removed StakeDenom and it's related code (#299)
* removed StakeDenom and it's related code
* fixed PoP, reissuance & distribution tests

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-01-25 15:10:07 +01:00
Julian Strobl
0e0637a04b
fix: refactor forgotten asset endpoints (#290)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-18 14:36:21 +01:00
Lorenz Herzberger
8d0e189593
fix: challangee rewards stay in dao module if challenge is not sucessful (#286)
* fix: challangee rewards stay in dao module if challenge is not sucessful

* refactor: split up coin conversion functions

* fix: add dao module coin conversion

* test: adjust test case for updated behavior

* chore: fix typo

* fix: do not mint claims for dao

* refactor: remove redundant statement

* fix: error handling on claim converstion fail

* fix: linter error

* chore: add comment to test case
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-01-18 13:56:16 +01:00
Julian Strobl
cb230f1615
refactor: cli queries (#288)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-18 12:06:21 +01:00
Jürgen Eckel
5d3cd51ba3
281 implement pop corner cases (#282)
* ensure PoP is always initialized even without a defined challenger and challengee
* send the MQTT PoPInit if challenger and challengee are defined
* store the challenge in any case without regarding the minting of the rewards
* structured the added test and their staging
* fixed SelectPopParticipants bug
* restore the previous pop epoch after running dao/suite.go
* avoid popInit during machine attestations (within test cases)
---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-01-17 15:37:38 +01:00
Julian Strobl
ee4089f847
Remove planetmint-go from API endpoints (#287)
* feat: let the ci check if there are malformed api endpoints

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-16 10:39:32 +01:00
Julian Strobl
525d6a8da6
Improve get-distribution CLI output and error handling (#279)
* refactor: rename variable

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-16 09:11:44 +01:00
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