18 Commits

Author SHA1 Message Date
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
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
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
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
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
Jürgen Eckel
f0ae4c96ba
Use GetConfig() to utilize the singleton (#168)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-07 18:09:54 +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
d4eed021c8
[go.mod] Switch module to github.com (#86)
This is the quasi-standard and fixes the error below:

```
$ go get -u github.com/planetmint/planetmint-go@v0.1.0
go: github.com/planetmint/planetmint-go@v0.1.0: parsing go.mod:
        module declares its path as: planetmint-go
                but was required as: github.com/planetmint/planetmint-go
```

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-09-21 17:37:57 +02:00
Jürgen Eckel
01ef2dbfd0
Improve communication to liquid issuance service (#58)
* added OSC response listener with logging

added Machine NFT issuance for each machine attestation process
added CID and Planetmint Issuer extPublicKey to the issuance process
removed type inconsistency

* added machine NFT creation criteria

* [toml] Parsing does not allow sub-structs

* made OSC listener port configurable

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-08-04 16:38:18 +02:00
Julian Strobl
4ba12f7b03
[config] Add planetmint section to app.toml
This patch extends `app.toml` and adds the following section with these
default values:

```
[planetmint]
watchmen-endpoint = "localhost"
watchmen-port = 7401
```

A global singleton `plmntConfig` is introduced to save and access the
values similar to how cosmos does it (see
vendor/github.com/cosmos/cosmos-sdk/types/config.go).

Different environments can be managed by changing the values in
`app.toml` and restarting the daemon.

// Closes #53

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-08-04 10:53:38 +02:00
Julian Strobl
459c0ae931
Make sure correct purpose and cointype are used (#60)
* Fix .gitignore

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

* [test] Make sure correct Purpose and CoinType are used

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

---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-08-03 10:03:13 +02:00
Julian Strobl
860847d269
[config] Set PLMNT coin type
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-07-26 12:41:28 +02:00
Julian Strobl
359cbbc5d9
[lint] Switch to golangci-lint and fix errors
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-07-19 16:34:42 +02:00
Julian Strobl
2a1a7bf6a6
Reduce cognitive complexity with help of ChatGPT
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-07-05 14:34:04 +02:00
Julian Strobl
7810d08780
Add initial generated code
```
$ ignite version
Ignite CLI version:             v0.27.1
Cosmos SDK version:             v0.47.3

$ ignite scaffold chain planetmint-go --address-prefix plmt --no-module
```

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-06-27 13:15:02 +02:00