37 Commits

Author SHA1 Message Date
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
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
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
363d82d344
[ci] Improve staticcheck setup (#221)
* [staticcheck] Fix comments on exported functions and structs

* [ci] Improve staticcheck setup

- Add global staticcheck.conf file
- Ignore: at least one file in a package should have a package comment (ST1000)
- Ignore deprecation warnings. They are reported by golangci-lint and
  there we have a proper way to exclude generated files.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-12-11 11:41:45 +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
7a3ccccc7a
119 create dao msg to mint plmnt on demand (#122)
* add mint address to config file
* ignite scaffold type mint-request beneficiary amount liquid-tx-hash --module dao
* add mintrequest stores
* rename mint_request.go
* add unit tests for mint request store
* ignite scaffold message mint-token mint-request:MintRequest --module dao
* add ante handler for mint address
* add msg validation for mint request
* fix staticcheck error
* ignite scaffold query get-mint-requests-by-hash hash --response mint-request:MintRequest --module dao
* add a query for mint request and additional validation for msg server
* add mock for mint unit testing
* add unit test for mint token msg server
* add unit tests for query mint requests by hash
* ignite scaffold query mint-requests-by-address address --response mint-requests:MintRequests --module dao
* implement query mint requests by address and unit tests
* add e2e test for token mint

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-10-05 15:38:53 +02:00
Lorenz Herzberger
94022e1102
100 set fees to be 1 plmnt for a tx (#114)
* replace DeductFeeDecorator and adjust e2e tests
* reorganize decorators and add comments

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-10-03 09:01:39 +02:00
Jürgen Eckel
8fd9f213f3
77 rename asset hash to asset cid (#97)
* initial asset notarization restructuring
* adjusted test cases, two are still failing
* removed obsolete data structures

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-09-27 16:35:31 +02:00
Lorenz Herzberger
86a85913cf
add GetMachineByAddress capabilities
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-09-25 16:42:26 +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
cb9f762675
Eckelj/fix store resolve issues (#79)
* added upper and lower case TA resolution testing

* added more detailed error reporting to the ValidateSignature method.
* extended test cases to test and verify these errs and their differences

* fixed CID attestation issue. CIDs are send in web compatible encoding that is not hex encoded and can be utilized without any further decoding on the server side.

* added checks and error handling for the Ta store object storage/loading

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-09-15 10:10:04 +02:00
Lorenz Herzberger
311a3596c2
replace byte cast with hex.DecodeString()
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-09-07 10:09:06 +02:00
Lorenz Herzberger
f74aae8e6e
fix machine test
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-09-06 16:05:46 +02:00
Jürgen Eckel
120d3fdd9d
fixed signing (tests) and signing verification of the machine ID Signature
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-09-06 15:41:39 +02:00
Lorenz Herzberger
e33452476f
adjust test suite for ta validation
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-09-06 15:13:06 +02:00
Lorenz Herzberger
8b072d3186
Merge pull request #71 from planetmint/70-add-ta-registry
70 add ta registry
2023-09-06 11:02:46 +02:00
Lorenz Herzberger
d5a75f128e
Merge pull request #69 from planetmint/3-gas-meter-definition-fee-handling
3 gas meter definition fee handling
2023-09-06 10:18:19 +02:00
Lorenz Herzberger
b0d4ffad7a
add unit test for msg_server_register_trust_anchor
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-09-05 19:51:06 +02:00
Lorenz Herzberger
05a484c8b9
implement e2e test scenario for fee distribution
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-08-31 16:33:22 +02:00
Jürgen Eckel
5763bd6a7c
Eckelj/adding machine types (#67)
* added machine-type definition and checks
* fixed staticcheck issues

---------
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-08-31 10:04:07 +02:00
Julian Strobl
3fe9c018cd
Introduce Liquid network parameters (#64)
Up to know we just use the Bitcoin mainnet parameters
`chaincfg.MainNetParams` for Liquid. That's okay, because we use them
for creating and verifying extended private and public keys. Those only
depend on `HDPrivateKeyID` and `HDPublicKeyID`, which are the same for
Bitcoin and Liquid networks.

The only real difference is the `HDCoinType` used for key derivation,
which we want to use in the future. So it is a good idea to introduce
this value now.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-08-11 12:05:58 +02:00
Julian Strobl
1383d0aaa6
Add extended public key as IssuerPlanetmint (#62)
* Fix package and domain name

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

* Add extended public key as `IssuerPlanetmint`

This patch introduces parts of the `chaincfg` for Planetmint and
especially the magic bytes that produces extended keys with the prefix
`pmpr` for a Planetmint extended private key and `pmpb` for a Planetmint
extended public key.

// Closes https://github.com/rddl-network/issues/issues/30

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

* Validate Planetmint extended public key during machine attestation

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

* [lint] Fix error return value is not checked

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

---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-08-11 09:14:52 +02:00
Jürgen Eckel
1a5d673a86
adjusted the default derivation path for the test cases to planetmint… (#59)
* adjusted the default derivation path for the test cases to planetmint cointype

* [test] Update sample.PubKey

Changed due to updated derivation path.

* [test] Set comment for DefaultDerivationPath

---------

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-03 09:48:03 +02:00
Lorenz Herzberger
722eb60bcf
add domain to machine proto
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-31 08:21:28 +02:00
Jürgen Eckel
34182773dc
Eckelj/removed hashing twice and decoding issue (#55)
removed not working hex.DecodeString(cid)

removed potential double hashing (hashing the hash with the same hash method)
removed the double hashing and the encoding issue from the serverside asset message verification code.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-07-31 08:12:30 +02:00
Lorenz Herzberger
053f38cf0d
add comment
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-25 13:52:37 +02:00
Lorenz Herzberger
017014317c
adjust msg_attest_machine validation
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-25 13:51:38 +02:00
Julian Strobl
fd136b6219
[test] Switch const PubKey to hex version
This aligns with the return values of `sample.KeyPair()`.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-07-20 10:43:42 +02:00
Lorenz Herzberger
dc17cf118c
resolve merge conflicts
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-19 17:47:39 +02:00
Julian Strobl
a97d1126f9
[tests] DRY
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-07-19 16:34:42 +02:00
Julian Strobl
18ce58f139
[tests] Use sample.Machine()
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-07-19 16:34:42 +02:00
Lorenz Herzberger
fbe1a475a7
adjust machine proto message and tests
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-19 16:09:15 +02:00
Lorenz Herzberger
cb96fe9679
asset e2e tests for raw log
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-18 16:15:59 +02:00
Lorenz Herzberger
5c82451c09
move sample asset to sample.go
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-12 17:11:12 +02:00
Lorenz Herzberger
81b8292994
added attest machine message handler
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-03 14:49:35 +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