* added panic if there is no key pair that can be used for the node (keystore or trustwallet)
* renamed GetValidatorAddress to GetNodeAddress
* fixed lib/test/e2e failing test case. The issue is an internal race condition of the unit test network in case of 1 node. Moving to two nodes solves the issue with the test case. In case of 1 validator, the first chain interaction happens before the address environment variables are set
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
* refactor: IsValidatorBlockProposer no longer accepts proposerAddress because already given in ctx
* refactor: make use of ctx.BlockHeader().ProposerAddress to ensure correct Proposer
* fix: linter error because no longer in use* feat: add call logging to MQTT mock
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
* added a bit of logging
* added update messages to mqtt (every second with a timestamp)
* added isConnectionOpen to the interface and analysis this during execution
* added connection loss handler and status check
* put some global objects into an objects to avoid inter service testing issues
* TestingLocker Mutex to RWMutex (increase performance)
* termintationMutex became a sync.RWMutex
* added logging to the mqtt mock client
* made monitor Mutex a RWMutex
* added Mutex protection to the numberOfElements varialbe
* added another Waiting block to the machine attestation methods (CI tests)
* had to adjust the test cases to the impact of that change.
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
* 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>
* added TSL support for mqtt
* added configuration value mqtt-tls (bool) to support tls and non-tls connections (testing)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
* 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>
* 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>
* 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>
* Added more sync objects to avoid accidental data races
* made lib.config.Config variables are private, so they cannot be tampered with (multithreading).
Please introduce Get-methods to retrieve the varialbes outside of the package if you need it.
This way, the race conditions and unexpected change of the global object state can be protected
* added reverse takedown of the validators to avoid the following error
[app] PoP broadcast tx failed: node0.info: key not found
* moved util.TerminationWaitGroup.Wait()
to the central network cleanup method
* removed mappings for private variables
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
* * added creation of random machines to prepare a test case
* setting all the consensus timeout values at once (if changed)
* mutex protection of the elements tx crafting methods (sequential processing)
* Extending the TestMachineNFTIssuance test case to parallel threads and threading issues
* moving all elements-rpc usage to the elementd-connector.go file
* removed call to fatal
* added WaitForNextBlock to be out of sync with PoP to avoid the following error
PoP broadcast tx failed: node0.info: key not found
after the test
---------
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* the execution of Config code is not determinitic within init methods. That's why we apply lazy loading.
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
* 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>
* 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>
* refactor: remove unwanted function in `lib`
The `lib` shall always be used with file lock.
* refactor: log `txResponse` in `buildSignBroadcastTx`
- Move `GetTxResponseFromOut` from `testutil` to `lib`
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
* 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>
* 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>
* [log] Do not create a new object of `GetAppLogger()` every time
* [tests] Enable AppLogger during testing
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
* fixed missing-proposer bug for asset distribution
* improved logging
reduced type conversions and potential errors
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>