30 Commits

Author SHA1 Message Date
dependabot[bot]
bd16b0a151
chore(deps): Bump github.com/cosmos/ibc-go/v7 in /lib (#360)
Bumps [github.com/cosmos/ibc-go/v7](https://github.com/cosmos/ibc-go) from 7.1.0 to 7.4.0.
- [Release notes](https://github.com/cosmos/ibc-go/releases)
- [Changelog](https://github.com/cosmos/ibc-go/blob/v7.4.0/CHANGELOG.md)
- [Commits](https://github.com/cosmos/ibc-go/compare/v7.1.0...v7.4.0)

---
updated-dependencies:
- dependency-name: github.com/cosmos/ibc-go/v7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-26 11:24:00 +02:00
dependabot[bot]
640b34ceab
chore(deps): Bump google.golang.org/protobuf from 1.31.0 to 1.33.0 in /lib (#349)
* chore(deps): Bump google.golang.org/protobuf in /lib

Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed dep isue

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-26 00:16:56 +02:00
dependabot[bot]
95036475b4
chore(deps): Bump github.com/hashicorp/go-getter in /lib (#411)
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.7.1 to 1.7.5.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.7.1...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-25 23:50:44 +02:00
dependabot[bot]
48ef258ed6
chore(deps): Bump github.com/hashicorp/go-getter in /lib (#386)
Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.7.1 to 1.7.4.
- [Release notes](https://github.com/hashicorp/go-getter/releases)
- [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml)
- [Commits](https://github.com/hashicorp/go-getter/compare/v1.7.1...v1.7.4)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-getter
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-25 23:38:44 +02:00
dependabot[bot]
2d73110836
chore(deps): Bump golang.org/x/net from 0.17.0 to 0.23.0 in /lib (#374)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-25 23:38:16 +02:00
dependabot[bot]
b2c526941a
chore(deps): Bump github.com/btcsuite/btcd from 0.23.2 to 0.24.0 in /lib (#394)
Bumps [github.com/btcsuite/btcd](https://github.com/btcsuite/btcd) from 0.23.2 to 0.24.0.
- [Release notes](https://github.com/btcsuite/btcd/releases)
- [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES)
- [Commits](https://github.com/btcsuite/btcd/compare/v0.23.2...v0.24.0)

---
updated-dependencies:
- dependency-name: github.com/btcsuite/btcd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-25 23:13:43 +02:00
Lorenz Herzberger
5e2b307a70
368 make attestmachine msgtx with fee=zero (#372)
* no fee deduction in case of machineattestation messages
* no gas price for machineattestations in lib/tx
* test: add balance check to machine attestation e2e test

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-04-22 13:07:40 +02:00
Jürgen Eckel
1e1e19bb19
added more sync objects to avoid accidential data races (#345)
* 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>
2024-03-11 11:11:56 +01: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
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
Julian Strobl
23648927c3
feat: put sequence files into sub-directory (#308)
- aligns the folder structure in `planetmint-go/`
- makes sequence number clean up via systemd possible

// see https://github.com/rddl-network/issues/issues/61

* refactor: open sequence file into function
* refactor: get sequence number into utils

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-30 12:13:05 +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
Julian Strobl
ae161f11e5
refactor: let lib set client context's address and name (#261)
* fix: make a real copy of bytes.Buffer

* refactor: rename `address` for maximum clarity in lib

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-08 16:04:42 +01:00
Julian Strobl
99031fb857
lib: add initial e2e tests (#255)
* fix: only increase counter if broadcast was successful

Otherwise we will get account and sequence numbers mismatches.

* test: add initial e2e tests for `lib/`

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-01-03 13:08:13 +01:00
Julian Strobl
f957f540a1
Refactor lib (#254)
* 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>
2024-01-03 10:41:09 +01:00
dependabot[bot]
3ca729c15b
Bump github.com/dvsekhvalnov/jose2go from 1.5.0 to 1.6.0 in /lib (#252)
Bumps [github.com/dvsekhvalnov/jose2go](https://github.com/dvsekhvalnov/jose2go) from 1.5.0 to 1.6.0.
- [Commits](https://github.com/dvsekhvalnov/jose2go/compare/v1.5...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/dvsekhvalnov/jose2go
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 10:36:49 +01:00
dependabot[bot]
618f8835be
Bump golang.org/x/crypto from 0.14.0 to 0.17.0 in /lib (#240)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-19 08:27:52 +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
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
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
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
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
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
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
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
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>
2023-11-15 16:01:57 +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>
2023-11-15 14:16:21 +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