Author SHA1 Message Date
roysc d130608f67 patch system test
Build / build (pull_request) Failing after 1m40s
Protobuf / lint (pull_request) Failing after 1m30s
E2E Tests / test-e2e (pull_request) Failing after 1m45s
Integration Tests / test-integration (pull_request) Failing after 1m52s
Unit Tests / test-unit (pull_request) Failing after 1m8s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 3m10s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 3m21s
SDK Tests / sdk_tests (pull_request) Failing after 2m25s
2025-12-04 14:58:14 +08:00
roysc 33574a8f89 doc 2025-12-04 14:58:14 +08:00
roysc 5aa2594073 Integrate go-nitro
- Add nitro server and x/nitro module
    - wire go-nitro p2p through cometbft

- Add distsig server, currently WIP
    - integrate DKG and DSS schemes into ABCI methods

- Remove deprecated features
    - crisis module
    - module invariants

- Update to use newer SDK patterns
    - upgrade sdk to v0.53.x
    - custom address codec
    - expand use of depinject
    - migrate e2e tests to system tests
    - use depinject to set up integration tests
    - change reserved protobuf field name `cerc.registry.v1.Record.type`

- Revise & add documentation
    - TransferCoinsToModuleAccount: clarify function

- Update init.sh script
2025-09-21 11:44:44 +08:00
nabarun a8ebc0aceb Update distribution JSON structure in add-genesis-lockup-account cmd (#75)
Integration Tests / test-integration (push) Successful in 55s
E2E Tests / test-e2e (push) Successful in 2m8s
Unit Tests / test-unit (push) Successful in 50s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 5m0s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 10m41s
SDK Tests / sdk_tests (push) Successful in 14m28s
Publish on release / Run docker build and publish (release) Successful in 1m21s
Reviewed-on: #75
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-06-18 19:12:53 +00:00
prathamesh e02d221dea Update e2e and integration tests for new tokens setup (#73)
Protobuf / lint (pull_request) Successful in 6s
Integration Tests / test-integration (pull_request) Successful in 1m25s
Build / build (pull_request) Successful in 1m27s
E2E Tests / test-e2e (pull_request) Successful in 2m29s
Unit Tests / test-unit (pull_request) Successful in 1m11s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 5m26s
SDK Tests / sdk_tests_authority_auctions (pull_request) Successful in 11m16s
Integration Tests / test-integration (push) Successful in 1m13s
E2E Tests / test-e2e (push) Successful in 2m16s
Unit Tests / test-unit (push) Successful in 1m4s
Publish on release / Run docker build and publish (release) Successful in 1m29s
SDK Tests / sdk_tests (pull_request) Successful in 14m57s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 5m27s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 11m1s
SDK Tests / sdk_tests (push) Successful in 14m47s
Part of https://www.notion.so/Multiple-tokens-support-1f2a6b22d47280269f87df3fe03e8d64

Reviewed-on: #73
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-19 10:10:54 +00:00
prathamesh 59236e5ce6 Add a custom lockup account to hold locked tokens (#72)
Part of https://www.notion.so/Lockup-LPS-tokens-into-a-module-account-1f2a6b22d472802cbb35e8ce052d22ca

- Added a command to create the custom lockup account in genesis:
  ```bash
  laconicd genesis add-genesis-lockup-account <account_name> <distribution-json-file> <coin>[,<coin>...]
  ```

Reviewed-on: #72
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-16 09:26:10 +00:00
prathamesh 7af9e9d496 Add evidence module (#71)
Part of https://www.notion.so/Add-evidence-module-for-double-signing-slashing-1f2a6b22d472805b8609e2122c5b0328

Reviewed-on: #71
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-14 06:24:55 +00:00
prathamesh 31ef3afb9a Add a new token and only allow fees in alnt (#68)
Part of https://www.notion.so/Multiple-tokens-support-and-disable-transfers-for-LSTAKE-1f2a6b22d47280269f87df3fe03e8d64
- Add base token with denoms `alps` and `lps` (`1 lps = 10^18 alps`)
- Keep `alnt` as the staking token and for laconic module ops
- Accept tx fees only in `alnt`

Reviewed-on: #68
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2025-05-13 18:17:38 +05:30
nabarun f4cf8ac744 Disable staking rewards (#70)
Integration Tests / test-integration (push) Successful in 1m32s
Unit Tests / test-unit (push) Successful in 1m41s
E2E Tests / test-e2e (push) Successful in 2m41s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 5m37s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 11m10s
SDK Tests / sdk_tests (push) Successful in 15m6s
Part of https://www.notion.so/Disable-staking-reward-1f2a6b22d47280c68d11ee179f5b894d
Staking rewards is disabled by performing the following
- Redirect all fee to community pool
- Increase threshold for accepting gov proposals so that it becomes difficult to spend funds from community pool

Reviewed-on: #70
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-05-13 12:35:15 +00:00
nabarun c14f1d3b00 Set graphiql package version in GQL playground (#67)
E2E Tests / test-e2e (push) Successful in 1m55s
Unit Tests / test-unit (push) Successful in 1m12s
SDK Tests / sdk_tests (push) Successful in 13m58s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 10m21s
Integration Tests / test-integration (push) Successful in 46s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 4m34s
Publish on release / Run docker build and publish (release) Successful in 1m27s
Part of https://www.notion.so/Laconic-Mainnet-Plan-1eca6b22d47280569cd0d1e6d711d949

Reviewed-on: #67
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-05-09 09:49:28 +00:00
zramsay 07297a27d1 Merge pull request 'Bump Cosmos SDK and other dependency versions' (#64) from bump-iavl into main
E2E Tests / test-e2e (push) Successful in 4m24s
Unit Tests / test-unit (push) Successful in 2m30s
Integration Tests / test-integration (push) Successful in 2m50s
Publish on release / Run docker build and publish (release) Successful in 2m46s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m30s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 15m18s
SDK Tests / sdk_tests (push) Successful in 19m9s
Reviewed-on: #64
2024-11-28 16:15:54 +00:00
zramsay d3a06319ce go mod tidy
Integration Tests / test-integration (pull_request) Successful in 3m30s
Build / build (pull_request) Successful in 3m53s
E2E Tests / test-e2e (pull_request) Successful in 4m57s
Unit Tests / test-unit (pull_request) Successful in 2m11s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 9m50s
SDK Tests / sdk_tests_authority_auctions (pull_request) Successful in 15m35s
SDK Tests / sdk_tests (pull_request) Successful in 20m36s
2024-11-28 10:52:09 -05:00
zramsay 973bf51573 bump cosmos sdk to latest
Integration Tests / test-integration (pull_request) Failing after 47s
E2E Tests / test-e2e (pull_request) Failing after 48s
Build / build (pull_request) Failing after 49s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 1m15s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 1m16s
Unit Tests / test-unit (pull_request) Failing after 44s
SDK Tests / sdk_tests (pull_request) Failing after 1m0s
2024-11-28 10:48:41 -05:00
zramsay aee4758538 bump cosmossdk.io/store
Build / build (pull_request) Failing after 42s
Integration Tests / test-integration (pull_request) Failing after 42s
E2E Tests / test-e2e (pull_request) Failing after 42s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 1m9s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 1m7s
SDK Tests / sdk_tests (pull_request) Failing after 1m9s
Unit Tests / test-unit (pull_request) Failing after 41s
2024-11-28 10:44:05 -05:00
zramsay c3854c30cf bump iavl version, fix for consensus failure
Build / build (pull_request) Failing after 1m29s
E2E Tests / test-e2e (pull_request) Failing after 1m28s
Integration Tests / test-integration (pull_request) Failing after 1m31s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 1m37s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Failing after 1m44s
SDK Tests / sdk_tests (pull_request) Failing after 1m42s
Unit Tests / test-unit (pull_request) Failing after 1m19s
2024-11-28 10:27:29 -05:00
prathamesh 65957d6199 Remove stale auctions after a year (#63)
Integration Tests / test-integration (push) Successful in 2m52s
Unit Tests / test-unit (push) Successful in 3m28s
E2E Tests / test-e2e (push) Successful in 4m21s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m42s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 15m26s
SDK Tests / sdk_tests (push) Successful in 20m49s
Publish on release / Run docker build and publish (release) Successful in 2m40s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Reviewed-on: #63
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-29 04:04:49 +00:00
prathamesh c807a9db80 Make min-gas-price configurable in node initialization script (#62)
E2E Tests / test-e2e (push) Successful in 2m52s
Integration Tests / test-integration (push) Successful in 1m44s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 13m3s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m18s
SDK Tests / sdk_tests (push) Successful in 19m0s
Unit Tests / test-unit (push) Successful in 1m56s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Reviewed-on: #62
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-28 04:22:56 +00:00
prathamesh 3a551bce99 Reset block height for imported authorities (#61)
Integration Tests / test-integration (push) Successful in 2m31s
E2E Tests / test-e2e (push) Successful in 3m56s
Unit Tests / test-unit (push) Successful in 2m5s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m13s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 14m55s
SDK Tests / sdk_tests (push) Successful in 19m16s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

- Reset block height for authorities being imported from genesis, same is being done for name records

Reviewed-on: #61
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-24 05:25:24 +00:00
prathamesh 6f75370b17 Updates for stage2 setup (#60)
Integration Tests / test-integration (push) Successful in 2m0s
E2E Tests / test-e2e (push) Successful in 3m26s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m19s
SDK Tests / sdk_tests_authority_auctions (push) Successful in 13m22s
Unit Tests / test-unit (push) Successful in 1m52s
SDK Tests / sdk_tests (push) Successful in 19m16s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

- Add `bc` installation in Dockerfile (required for stage1 to stage2 testnet migration)
- Populate attributes map index when importing records from genesis to allow fetching records with filters from a chain with imported state

Reviewed-on: #60
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-22 09:54:33 +00:00
52e8d322fa Add service provider auctions (#59)
Integration Tests / test-integration (push) Successful in 2m29s
E2E Tests / test-e2e (push) Successful in 4m6s
Unit Tests / test-unit (push) Successful in 2m3s
SDK Tests / sdk_tests_authority_auctions (push) Failing after 6m31s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m11s
SDK Tests / sdk_tests (push) Failing after 10m14s
Part of [Service provider auctions](https://www.notion.so/Service-provider-auctions-a7b63697d818479493ec145ea6ea3c1c)

- Add a new type of auction for service providers
  - Add a command to release provider auction funds
- Remove unused auction module params

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Co-authored-by: Isha Venikar <ishavenikar@Ishas-MacBook-Air.local>
Reviewed-on: #59
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-25 12:38:49 +00:00
prathameshandIshaVenikar df43322ef3 Add pagination for query to get records (#58)
Integration Tests / test-integration (push) Successful in 2m57s
E2E Tests / test-e2e (push) Successful in 4m25s
Unit Tests / test-unit (push) Successful in 2m53s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m50s
SDK Tests / sdk_tests_auctions (push) Successful in 15m1s
SDK Tests / sdk_tests (push) Successful in 8m43s
Publish on release / Run docker build and publish (release) Successful in 2m31s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)
Handles cerc-io/laconic-console#59

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #58
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-05 07:33:48 +00:00
prathameshandIshaVenikar 94ba057807 Add methods to update laconic module params (#57)
Integration Tests / test-integration (push) Successful in 2m42s
E2E Tests / test-e2e (push) Successful in 4m23s
Unit Tests / test-unit (push) Successful in 2m39s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 10m14s
SDK Tests / sdk_tests (push) Failing after 11m55s
SDK Tests / sdk_tests_auctions (push) Successful in 15m48s
Part of [Add gov module to laconicd](https://www.notion.so/Add-gov-module-to-laconicd-938c9f5f87634b4fbd7896d3907fb89e)

- Add methods to update params for `bond`, `registry` and `auction` modules

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #57
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-05 07:07:54 +00:00
prathameshandIshaVenikar a01a5d24d1 Add gov module to the chain (#56)
Integration Tests / test-integration (push) Successful in 2m36s
E2E Tests / test-e2e (push) Successful in 3m48s
Unit Tests / test-unit (push) Successful in 2m39s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 11m11s
SDK Tests / sdk_tests (push) Failing after 13m14s
SDK Tests / sdk_tests_auctions (push) Successful in 16m0s
Part of [Add gov module to laconicd](https://www.notion.so/Add-gov-module-to-laconicd-938c9f5f87634b4fbd7896d3907fb89e)

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #56
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-05 04:15:42 +00:00
prathamesh debfb82205 Integrate slashing module in the app (#53)
SDK Tests / sdk_tests (push) Successful in 10m32s
SDK Tests / sdk_tests_auctions (push) Successful in 14m45s
Integration Tests / test-integration (push) Successful in 2m55s
E2E Tests / test-e2e (push) Successful in 4m7s
Unit Tests / test-unit (push) Successful in 2m48s
Publish on release / Run docker build and publish (release) Successful in 3m11s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m33s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Add `slashing` module for penalizing / jailing offline validators
Reference: https://docs.cosmos.network/main/build/modules/slashing#liveness-tracking

Note: Breaking change, an existing chain cannot be run with the updated binary

Reviewed-on: #53
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-08-16 06:23:56 +00:00
prathamesh 3c5cd002e1 Add env variables to configure authority auctions in initialization script (#50)
Integration Tests / test-integration (push) Successful in 3m18s
Unit Tests / test-unit (push) Successful in 3m23s
E2E Tests / test-e2e (push) Successful in 4m30s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m14s
SDK Tests / sdk_tests (push) Successful in 10m32s
SDK Tests / sdk_tests_auctions (push) Successful in 14m23s
Publish on release / Run docker build and publish (release) Successful in 2m34s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Reviewed-on: #50
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-08-08 07:14:36 +00:00
prathamesh b5a76a920e Update node initialization script (#49)
Integration Tests / test-integration (push) Successful in 2m33s
E2E Tests / test-e2e (push) Successful in 4m11s
Unit Tests / test-unit (push) Successful in 2m37s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m20s
SDK Tests / sdk_tests (push) Successful in 10m32s
SDK Tests / sdk_tests_auctions (push) Successful in 14m33s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Reviewed-on: #49
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-08-07 11:25:01 +00:00
nabarunandIshaVenikar f176a5889e Implement GQL query for listing authorities (#48)
Integration Tests / test-integration (push) Successful in 2m42s
Unit Tests / test-unit (push) Successful in 2m54s
E2E Tests / test-e2e (push) Successful in 4m31s
SDK Tests / sdk_tests (push) Successful in 10m49s
SDK Tests / sdk_tests_auctions (push) Successful in 14m42s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m10s
Publish on release / Run docker build and publish (release) Successful in 2m37s
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #48
2024-08-02 09:15:08 +00:00
nabarunandAdw8 5e7d5fc47c Update init script to use existing genesis file (#47)
Integration Tests / test-integration (push) Successful in 3m10s
E2E Tests / test-e2e (push) Successful in 3m55s
Unit Tests / test-unit (push) Successful in 2m1s
SDK Tests / sdk_tests (push) Successful in 10m27s
SDK Tests / sdk_tests_auctions (push) Successful in 14m19s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m13s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Co-authored-by: Adw8 <adwaitgharpure@gmail.com>
Reviewed-on: #47
2024-08-01 11:52:47 +00:00
prathameshandzramsay c162396298 Change token denom from photon to lnt and alnt (#46)
Integration Tests / test-integration (push) Successful in 2m43s
Unit Tests / test-unit (push) Successful in 3m27s
E2E Tests / test-e2e (push) Successful in 2m48s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 7m57s
SDK Tests / sdk_tests (push) Successful in 8m59s
SDK Tests / sdk_tests_auctions (push) Successful in 13m4s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Co-authored-by: zramsay <zach@bluecollarcoding.ca>
Reviewed-on: #46
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-30 11:05:58 +00:00
prathameshandIshaVenikar 7a88c82816 Add queries to get participant by laconic or nitro address (#44)
Integration Tests / test-integration (push) Successful in 3m5s
E2E Tests / test-e2e (push) Successful in 4m20s
Unit Tests / test-unit (push) Successful in 3m6s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m18s
SDK Tests / sdk_tests (push) Successful in 10m33s
SDK Tests / sdk_tests_auctions (push) Successful in 14m29s
Publish on release / Run docker build and publish (release) Successful in 3m11s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #44
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-29 10:28:30 +00:00
prathamesh 9fab3f8326 Add fields for role and KYC ID for onboarded participants (#43)
Integration Tests / test-integration (push) Successful in 2m32s
Unit Tests / test-unit (push) Successful in 2m34s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 8m34s
SDK Tests / sdk_tests_auctions (push) Successful in 14m15s
E2E Tests / test-e2e (push) Successful in 2m47s
SDK Tests / sdk_tests (push) Successful in 7m54s
Part of [Sumsub KYC integration in onboarding app](https://www.notion.so/Sumsub-KYC-integration-in-onboarding-app-607b598c9c1d4d12adc71725e2ab5e7e)

Reviewed-on: #43
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-26 14:42:40 +00:00
prathamesh ec6e2f3776 Add a query to list authorities (#42)
Integration Tests / test-integration (push) Successful in 2m40s
E2E Tests / test-e2e (push) Successful in 3m59s
Unit Tests / test-unit (push) Successful in 2m8s
Publish on release / Run docker build and publish (release) Successful in 2m51s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 8m38s
SDK Tests / sdk_tests (push) Successful in 8m37s
SDK Tests / sdk_tests_auctions (push) Successful in 13m48s
Part of [Add a CLI query to list all authorities with owner filter](#41)

Usage:
```bash
$ laconicd query registry list-authorities -h
List authorities (optionally by owner)
Usage:
  laconicd query registry list-authorities [flags]
Flags:
      --grpc-addr string   the gRPC endpoint to use for this chain
      --grpc-insecure      allow gRPC over insecure channels, if not the server must use TLS
      --height int         Use a specific height to query state at (this can error if the node is pruning state)
  -h, --help               help for list-authorities
      --no-indent          Do not indent JSON output
      --node string        <host>:<port> to CometBFT RPC interface for this chain (default "tcp://localhost:26657")
  -o, --output string      Output format (text|json) (default "text")
      --owner string       Owner to get the authorities for
```

Example:
```bash
# Without owner filter
$ laconicd query registry list-authorities
authorities:
- entry:
    expiry_time: "2024-07-26T06:54:28.491158167Z"
    height: "247"
    owner_address: laconic1e23vfttpvk045pqeydr4mujmlemx8hf9zjm7h2
    owner_public_key: A6RlTGLIpyA8nnEQN4V3sz3uaLMY0fHtB7aS7u1zTOdD
    status: active
  name: cerc
- entry:
    expiry_time: "2024-07-26T06:47:58.971429925Z"
    height: "118"
    owner_address: laconic10ztdu07xn7rracvzvehelgwvsytqlrvj6pvput
    owner_public_key: AvBxGIXBFmWCF+OHFwydqEtp2bfP+aimObO3teunbve7
    status: active
  name: laconic

# With owner filter
$ laconicd query registry list-authorities --owner laconic1e23vfttpvk045pqeydr4mujmlemx8hf9zjm7h2
authorities:
- entry:
    expiry_time: "2024-07-26T06:54:28.491158167Z"
    height: "247"
    owner_address: laconic1e23vfttpvk045pqeydr4mujmlemx8hf9zjm7h2
    owner_public_key: A6RlTGLIpyA8nnEQN4V3sz3uaLMY0fHtB7aS7u1zTOdD
    status: active
  name: cerc
```

Reviewed-on: #42
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-24 09:14:39 +00:00
prathamesh eb20f77e83 Fixes for handling authority expiry queue (#40)
Integration Tests / test-integration (push) Successful in 3m2s
E2E Tests / test-e2e (push) Successful in 4m29s
Unit Tests / test-unit (push) Successful in 2m8s
Publish on release / Run docker build and publish (release) Successful in 2m50s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 8m52s
SDK Tests / sdk_tests (push) Successful in 10m7s
SDK Tests / sdk_tests_auctions (push) Successful in 14m13s
Part of #38

Reviewed-on: cerc-io/laconic2d#40
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-22 05:40:45 +00:00
prathamesh 43b675cc0a Ignore error on not finding an authority expiry queue entry (#39)
Integration Tests / test-integration (push) Successful in 2m23s
E2E Tests / test-e2e (push) Successful in 3m57s
Unit Tests / test-unit (push) Successful in 2m5s
Publish on release / Run docker build and publish (release) Successful in 2m35s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 8m27s
SDK Tests / sdk_tests (push) Successful in 9m17s
SDK Tests / sdk_tests_auctions (push) Successful in 14m11s
Part of cerc-io/laconic2d#38

This is a hot fix for the issue, cause yet to be investigated.

Reviewed-on: cerc-io/laconic2d#39
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-19 11:30:15 +00:00
prathameshandadwait b2be09e0e4 Allow requests from any origin (#37)
Integration Tests / test-integration (push) Successful in 3m35s
Unit Tests / test-unit (push) Successful in 3m36s
E2E Tests / test-e2e (push) Successful in 5m15s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m6s
SDK Tests / sdk_tests (push) Successful in 10m12s
SDK Tests / sdk_tests_auctions (push) Successful in 14m18s
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

Co-authored-by: Adw8 <adwait@deepstacksoft.com>
Reviewed-on: cerc-io/laconic2d#37
Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
2024-07-17 09:59:59 +00:00
prathamesh 456491a4f2 Comment lint workflow
Protobuf / lint (pull_request) Successful in 25s
Build / build (pull_request) Successful in 2m25s
E2E Tests / test-e2e (push) Successful in 3m59s
Unit Tests / test-unit (push) Successful in 1m57s
SDK Tests / sdk_tests (push) Successful in 8m26s
Integration Tests / test-integration (pull_request) Successful in 2m9s
E2E Tests / test-e2e (pull_request) Successful in 3m31s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m12s
Unit Tests / test-unit (pull_request) Successful in 1m58s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 12m36s
Integration Tests / test-integration (push) Successful in 2m44s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 8m13s
SDK Tests / sdk_tests_auctions (push) Successful in 13m31s
SDK Tests / sdk_tests (pull_request) Successful in 8m28s
2024-07-16 12:49:31 +05:30
prathamesh d36f54543d Pin golangci-lint version in lint workflow
Build / build (pull_request) Successful in 1m58s
Protobuf / lint (pull_request) Successful in 13s
Integration Tests / test-integration (pull_request) Successful in 2m33s
E2E Tests / test-e2e (pull_request) Successful in 3m56s
Lint / Run golangci-lint (pull_request) Failing after 9m57s
Unit Tests / test-unit (pull_request) Successful in 1m50s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 8m13s
SDK Tests / sdk_tests (pull_request) Failing after 8m58s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 13m53s
2024-07-16 12:01:44 +05:30
nabarunandIshaVenikar a8a59ad0c1 Rename ethereum_address to nitro_address in onboarding module (#8)
Lint / Run golangci-lint (pull_request) Failing after 5m56s
Unit Tests / test-unit (pull_request) Successful in 2m4s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m57s
SDK Tests / sdk_tests (pull_request) Failing after 8m51s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 13m26s
Protobuf / lint (pull_request) Successful in 24s
Build / build (pull_request) Successful in 2m49s
Integration Tests / test-integration (pull_request) Successful in 2m33s
E2E Tests / test-e2e (pull_request) Successful in 3m50s
* Rename ethereum_address to nitro_address

* Use camel case for variables in gql schema

* Fix indentation in proto files

* Fix proto lint errors

---------

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
2024-07-16 09:25:39 +05:30
Isha Venikarandprathamesh f23f691646 Add lint config and fix lint errors (#7)
* Add config file for linter

* Fix lint errors

* Fix gofumpt errors

* Fix pre-allocate slices lint error

* Remove unused lint rule

* Disable style check ID error

* Add gomodguard section in yml file

* Remove trailing white spaces

* Remove unnecessary comments

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-16 09:25:39 +05:30
Isha Venikar 8c14d578f7 Add flag to enable/disable onboarding of validators (#6)
* Add gql implementation for getParticipant query

* Add onboarding enable/disable flag

* Remove unnecessary message field from onboardParticipant message

* Add instructions to generate gql bindings
2024-07-16 09:25:39 +05:30
Isha Venikar 582c83543c Implement query in onboarding module to list the registered participants (#4)
* Implement query to list participants

* Remove unnecessary comments
2024-07-16 09:25:39 +05:30
Isha Venikarandprathamesh a21e9ea387 Implement onboarding module for testnet validator enrollment (#3)
* Add proto files for onboarding module

* Add generated proto bindings

* Define onboarding object

* Define the participants state in keeper

* Update genesis file to initialize and export module state to/from genesis

* Add msg to onboard participant

* Register command to enroll participant

* Add functionality to decode ethereum address from signature

* Add comments for messages and fields

* Fix lint errors in proto files

* Add message validation and events in msg_server

* Reuse crypto utils from go-nitro

* Sign entire eth_payload object

* Use google API for rpc method

* Regenerate proto bindings

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-16 09:25:39 +05:30
Isha Venikar 7369264f0a Create skeleton for onboarding module (#2)
* Add proto files for onboarding module

* Add general files for onboarding module

* Add keeper files for onboarding module

* Add module files for onboarding module

* Update proto files

* Add generated proto bindings

* Use Keeper pointer in depinject

* Fix lint errors
2024-07-16 09:25:39 +05:30
235 changed files with 43096 additions and 5754 deletions
+19 -17
View File
@@ -8,20 +8,22 @@ on:
branches:
- main
jobs:
golangci:
name: Run golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3.3.1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
args: --timeout 10m
github-token: ${{ secrets.github_token }}
# TODO: Handle CI error: "::error::golangci-lint exit with code 137" and uncomment lint job
# golangci:
# name: Run golangci-lint
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# # Required: setup-go, for all versions v3.0.0+ of golangci-lint
# - uses: actions/setup-go@v3
# with:
# go-version: 1.21
# check-latest: true
# - uses: actions/checkout@v3
# - uses: golangci/golangci-lint-action@v3.3.1
# with:
# # Required: the version of golangci-lint is required and must be specified without patch version
# version: v1.51
# args: --timeout 10m
# github-token: ${{ secrets.github_token }}
@@ -7,7 +7,7 @@ on:
- release/**
jobs:
sdk_tests_auctions:
sdk_tests_authority_auctions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -35,6 +35,6 @@ jobs:
TEST_AUCTION_ENABLED: true
run: docker compose up -d
- name: Run auction tests
- name: Run authority auction tests
working-directory: tests/sdk_tests
run: ./run-tests.sh test:auctions
run: ./run-tests.sh test:authority-auctions
+69
View File
@@ -0,0 +1,69 @@
run:
tests: false
# timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m
linters:
enable:
- bodyclose
- dogsled
- errcheck
- goconst
- gocritic
# - revive # overly sensitive var-naming detection
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- exportloopref
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- asciicheck
- exportloopref
- gofumpt
- gomodguard
- whitespace
issues:
exclude-rules:
- path: _test\.go
linters:
- gosec
- linters:
- lll
source: "https://"
- linters:
- stylecheck
text: "ST1003:"
max-same-issues: 50
linters-settings:
lll:
line-length: 150
dogsled:
max-blank-identifiers: 3
golint:
min-confidence: 0
maligned:
suggest-new: true
misspell:
locale: US
gofumpt:
lang-version: "1.21"
gomodguard:
blocked:
versions: # List of blocked module version constraints
- https://github.com/etcd-io/etcd: # Blocked module with version constraint
version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)
+13 -7
View File
@@ -1,4 +1,4 @@
FROM golang:1.21-bullseye AS builder
FROM golang:1.23.6-bookworm AS builder
# Set working directory for the build
WORKDIR /go/src/git.vdb.to/cerc-io/laconicd
@@ -14,18 +14,24 @@ COPY . .
RUN make build
# Final image
FROM ubuntu:22.04
# DEV golang image
FROM golang:1.23.6-bookworm AS base
# Install ca-certificates, jq, curl, bash, and other necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
jq curl netcat bash \
jq curl netcat-openbsd bash bc yq \
&& rm -rf /var/lib/apt/lists/*
# Copy over binary from the builder
COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/build/laconicd /usr/bin/laconicd
# FROM base
WORKDIR /
# # Copy over binary from the builder
# COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/build/laconicd /usr/bin/laconicd
# # Copy over init script from builder
# COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/scripts/init.sh scripts/init.sh
# WORKDIR /
# Run laconicd by default
CMD ["laconicd"]
ENTRYPOINT ["laconicd"]
+14 -9
View File
@@ -12,7 +12,7 @@ ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
VERSION := $(BRANCH)-$(COMMIT)
endif
endif
@@ -31,7 +31,7 @@ BUILDDIR ?= $(CURDIR)/build
###########
go.sum: go.mod
echo "Ensure dependencies have not been modified ..." >&2
@echo "Ensure dependencies have not been modified ..." >&2
go mod verify
go mod tidy
@@ -42,8 +42,8 @@ build-linux:
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
@echo "--> installing laconicd"
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./...
@echo "--> $@ing laconicd"
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./cmd/laconicd
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
@@ -56,22 +56,23 @@ all: install
### Protobuf ###
##################
protoVer=0.14.0
protoVer=0.17.1
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
protoVolumes=-v $(shell readlink -f ..):/mod
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoVolumes) $(protoImageName)
proto-all: proto-format proto-lint proto-gen
proto-gen:
@echo "Generating protobuf files..."
@$(protoImage) sh ./scripts/protocgen.sh
@$(protoRun) sh ./scripts/protocgen.sh
@go mod tidy
proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
@$(protoRun) find ./ -name "*.proto" -exec clang-format -i {} \;
proto-lint:
@$(protoImage) buf lint proto/ --error-format=json
@$(protoRun) buf lint proto/ --error-format=json
.PHONY: proto-all proto-gen proto-format proto-lint
@@ -106,3 +107,7 @@ test-e2e:
test-unit:
go test ./utils/... ./cmd/... -mod=readonly -test.v
test-system: build
test -d ./tests/system/binaries || ln -sf $(BUILDDIR) ./tests/system/binaries
go test ./tests/system -v
+4 -2
View File
@@ -27,6 +27,8 @@ Run with a single node fixture:
./scripts/init.sh clean
```
See [lockup.md](./lockup.md) for lockup account usage.
## Tests
Run tests:
@@ -35,8 +37,8 @@ Run tests:
# integration tests
make test-integration
# e2e tests
make test-e2e
# system tests
make test-system
```
## Community
+97 -20
View File
@@ -14,12 +14,14 @@ import (
)
var (
md_Module protoreflect.MessageDescriptor
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_auction_module_v1_module_proto_init()
md_Module = File_cerc_auction_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.auction.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.auction.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.auction.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.module.v1.Module"))
@@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_auction_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_auction_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_auction_module_v1_module_proto_rawDesc = []byte{
@@ -419,25 +494,27 @@ var file_cerc_auction_module_v1_module_proto_rawDesc = []byte{
0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x37, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x2d, 0xba, 0xc0, 0x96, 0xda, 0x01,
0x27, 0x0a, 0x25, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65,
0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78,
0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xe5, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d,
0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e,
0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e,
0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x4d, 0xaa, 0x02, 0x16,
0x43, 0x65, 0x72, 0x63, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2,
0x02, 0x22, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x41, 0x75, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x55, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74,
0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2d, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x27, 0x0a,
0x25, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x61,
0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xe5, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f,
0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63,
0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x4d, 0xaa, 0x02, 0x16, 0x43, 0x65,
0x72, 0x63, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x16, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x22,
0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x41, 0x75, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
File diff suppressed because it is too large Load Diff
+38 -15
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/auction/v1/query.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Params_FullMethodName = "/cerc.auction.v1.Query/Params"
@@ -32,6 +32,8 @@ const (
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query defines the gRPC querier interface for the auction module
type QueryClient interface {
// Params queries auction module params
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
@@ -60,8 +62,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -69,8 +72,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
}
func (c *queryClient) Auctions(ctx context.Context, in *QueryAuctionsRequest, opts ...grpc.CallOption) (*QueryAuctionsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuctionsResponse)
err := c.cc.Invoke(ctx, Query_Auctions_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Auctions_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -78,8 +82,9 @@ func (c *queryClient) Auctions(ctx context.Context, in *QueryAuctionsRequest, op
}
func (c *queryClient) GetAuction(ctx context.Context, in *QueryGetAuctionRequest, opts ...grpc.CallOption) (*QueryGetAuctionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetAuctionResponse)
err := c.cc.Invoke(ctx, Query_GetAuction_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetAuction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -87,8 +92,9 @@ func (c *queryClient) GetAuction(ctx context.Context, in *QueryGetAuctionRequest
}
func (c *queryClient) GetBid(ctx context.Context, in *QueryGetBidRequest, opts ...grpc.CallOption) (*QueryGetBidResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBidResponse)
err := c.cc.Invoke(ctx, Query_GetBid_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBid_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -96,8 +102,9 @@ func (c *queryClient) GetBid(ctx context.Context, in *QueryGetBidRequest, opts .
}
func (c *queryClient) GetBids(ctx context.Context, in *QueryGetBidsRequest, opts ...grpc.CallOption) (*QueryGetBidsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBidsResponse)
err := c.cc.Invoke(ctx, Query_GetBids_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBids_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -105,8 +112,9 @@ func (c *queryClient) GetBids(ctx context.Context, in *QueryGetBidsRequest, opts
}
func (c *queryClient) AuctionsByBidder(ctx context.Context, in *QueryAuctionsByBidderRequest, opts ...grpc.CallOption) (*QueryAuctionsByBidderResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuctionsByBidderResponse)
err := c.cc.Invoke(ctx, Query_AuctionsByBidder_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_AuctionsByBidder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -114,8 +122,9 @@ func (c *queryClient) AuctionsByBidder(ctx context.Context, in *QueryAuctionsByB
}
func (c *queryClient) AuctionsByOwner(ctx context.Context, in *QueryAuctionsByOwnerRequest, opts ...grpc.CallOption) (*QueryAuctionsByOwnerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuctionsByOwnerResponse)
err := c.cc.Invoke(ctx, Query_AuctionsByOwner_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_AuctionsByOwner_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -123,8 +132,9 @@ func (c *queryClient) AuctionsByOwner(ctx context.Context, in *QueryAuctionsByOw
}
func (c *queryClient) GetAuctionModuleBalance(ctx context.Context, in *QueryGetAuctionModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetAuctionModuleBalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetAuctionModuleBalanceResponse)
err := c.cc.Invoke(ctx, Query_GetAuctionModuleBalance_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetAuctionModuleBalance_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -133,7 +143,9 @@ func (c *queryClient) GetAuctionModuleBalance(ctx context.Context, in *QueryGetA
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier interface for the auction module
type QueryServer interface {
// Params queries auction module params
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
@@ -154,9 +166,12 @@ type QueryServer interface {
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
@@ -183,6 +198,7 @@ func (UnimplementedQueryServer) GetAuctionModuleBalance(context.Context, *QueryG
return nil, status.Errorf(codes.Unimplemented, "method GetAuctionModuleBalance not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@@ -192,6 +208,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
File diff suppressed because it is too large Load Diff
+110 -10
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/auction/v1/tx.proto
@@ -15,18 +15,22 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_CreateAuction_FullMethodName = "/cerc.auction.v1.Msg/CreateAuction"
Msg_CommitBid_FullMethodName = "/cerc.auction.v1.Msg/CommitBid"
Msg_RevealBid_FullMethodName = "/cerc.auction.v1.Msg/RevealBid"
Msg_UpdateParams_FullMethodName = "/cerc.auction.v1.Msg/UpdateParams"
Msg_ReleaseFunds_FullMethodName = "/cerc.auction.v1.Msg/ReleaseFunds"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Tx defines the gRPC tx interface
type MsgClient interface {
// CreateAuction is the command for creating an auction
CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error)
@@ -34,6 +38,11 @@ type MsgClient interface {
CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error)
// RevealBid is the command for revealing a bid
RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// ReleaseFunds is the command for paying the winners of provider auctions
ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error)
}
type msgClient struct {
@@ -45,8 +54,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCreateAuctionResponse)
err := c.cc.Invoke(ctx, Msg_CreateAuction_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CreateAuction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -54,8 +64,9 @@ func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opt
}
func (c *msgClient) CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCommitBidResponse)
err := c.cc.Invoke(ctx, Msg_CommitBid_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CommitBid_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -63,8 +74,29 @@ func (c *msgClient) CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grp
}
func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRevealBidResponse)
err := c.cc.Invoke(ctx, Msg_RevealBid_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_RevealBid_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgReleaseFundsResponse)
err := c.cc.Invoke(ctx, Msg_ReleaseFunds_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -73,7 +105,9 @@ func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grp
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Tx defines the gRPC tx interface
type MsgServer interface {
// CreateAuction is the command for creating an auction
CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error)
@@ -81,12 +115,20 @@ type MsgServer interface {
CommitBid(context.Context, *MsgCommitBid) (*MsgCommitBidResponse, error)
// RevealBid is the command for revealing a bid
RevealBid(context.Context, *MsgRevealBid) (*MsgRevealBidResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// ReleaseFunds is the command for paying the winners of provider auctions
ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateAuction not implemented")
@@ -97,7 +139,14 @@ func (UnimplementedMsgServer) CommitBid(context.Context, *MsgCommitBid) (*MsgCom
func (UnimplementedMsgServer) RevealBid(context.Context, *MsgRevealBid) (*MsgRevealBidResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RevealBid not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReleaseFunds not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@@ -107,6 +156,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
@@ -164,6 +220,42 @@ func _Msg_RevealBid_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ReleaseFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgReleaseFunds)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ReleaseFunds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ReleaseFunds_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ReleaseFunds(ctx, req.(*MsgReleaseFunds))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -183,6 +275,14 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "RevealBid",
Handler: _Msg_RevealBid_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "ReleaseFunds",
Handler: _Msg_ReleaseFunds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/auction/v1/tx.proto",
+96 -19
View File
@@ -14,12 +14,14 @@ import (
)
var (
md_Module protoreflect.MessageDescriptor
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_bond_module_v1_module_proto_init()
md_Module = File_cerc_bond_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.bond.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.bond.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_bond_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_bond_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_bond_module_v1_module_proto_rawDesc = []byte{
@@ -418,24 +493,26 @@ var file_cerc_bond_module_v1_module_proto_rawDesc = []byte{
0x74, 0x6f, 0x12, 0x13, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f,
0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x06, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74,
0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f,
0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x42,
0xd3, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e,
0x64, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e,
0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c,
0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x4d, 0xaa, 0x02,
0x13, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64,
0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x65, 0x72,
0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43,
0x65, 0x72, 0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x06, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74,
0x79, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74, 0x2e, 0x76,
0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61,
0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x42, 0xd3, 0x01,
0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64,
0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63,
0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62,
0x6f, 0x6e, 0x64, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x4d, 0xaa, 0x02, 0x13, 0x43,
0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e,
0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x65, 0x72, 0x63, 0x5c,
0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x65, 0x72,
0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
+32 -12
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/bond/v1/query.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Params_FullMethodName = "/cerc.bond.v1.Query/Params"
@@ -29,6 +29,8 @@ const (
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query defines the gRPC querier service for bond module
type QueryClient interface {
// Params queries bonds module params.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
@@ -51,8 +53,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -60,8 +63,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
}
func (c *queryClient) Bonds(ctx context.Context, in *QueryBondsRequest, opts ...grpc.CallOption) (*QueryBondsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryBondsResponse)
err := c.cc.Invoke(ctx, Query_Bonds_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Bonds_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -69,8 +73,9 @@ func (c *queryClient) Bonds(ctx context.Context, in *QueryBondsRequest, opts ...
}
func (c *queryClient) GetBondById(ctx context.Context, in *QueryGetBondByIdRequest, opts ...grpc.CallOption) (*QueryGetBondByIdResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBondByIdResponse)
err := c.cc.Invoke(ctx, Query_GetBondById_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBondById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -78,8 +83,9 @@ func (c *queryClient) GetBondById(ctx context.Context, in *QueryGetBondByIdReque
}
func (c *queryClient) GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOwnerRequest, opts ...grpc.CallOption) (*QueryGetBondsByOwnerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBondsByOwnerResponse)
err := c.cc.Invoke(ctx, Query_GetBondsByOwner_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBondsByOwner_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -87,8 +93,9 @@ func (c *queryClient) GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOw
}
func (c *queryClient) GetBondModuleBalance(ctx context.Context, in *QueryGetBondModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetBondModuleBalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetBondModuleBalanceResponse)
err := c.cc.Invoke(ctx, Query_GetBondModuleBalance_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetBondModuleBalance_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -97,7 +104,9 @@ func (c *queryClient) GetBondModuleBalance(ctx context.Context, in *QueryGetBond
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier service for bond module
type QueryServer interface {
// Params queries bonds module params.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
@@ -112,9 +121,12 @@ type QueryServer interface {
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
@@ -132,6 +144,7 @@ func (UnimplementedQueryServer) GetBondModuleBalance(context.Context, *QueryGetB
return nil, status.Errorf(codes.Unimplemented, "method GetBondModuleBalance not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@@ -141,6 +154,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
File diff suppressed because it is too large Load Diff
+72 -11
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/bond/v1/tx.proto
@@ -15,19 +15,22 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_CreateBond_FullMethodName = "/cerc.bond.v1.Msg/CreateBond"
Msg_RefillBond_FullMethodName = "/cerc.bond.v1.Msg/RefillBond"
Msg_WithdrawBond_FullMethodName = "/cerc.bond.v1.Msg/WithdrawBond"
Msg_CancelBond_FullMethodName = "/cerc.bond.v1.Msg/CancelBond"
Msg_UpdateParams_FullMethodName = "/cerc.bond.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Msg defines the bond Msg service.
type MsgClient interface {
// CreateBond defines a method for creating a new bond.
CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error)
@@ -37,6 +40,9 @@ type MsgClient interface {
WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@@ -48,8 +54,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCreateBondResponse)
err := c.cc.Invoke(ctx, Msg_CreateBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CreateBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -57,8 +64,9 @@ func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...g
}
func (c *msgClient) RefillBond(ctx context.Context, in *MsgRefillBond, opts ...grpc.CallOption) (*MsgRefillBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRefillBondResponse)
err := c.cc.Invoke(ctx, Msg_RefillBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_RefillBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -66,8 +74,9 @@ func (c *msgClient) RefillBond(ctx context.Context, in *MsgRefillBond, opts ...g
}
func (c *msgClient) WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgWithdrawBondResponse)
err := c.cc.Invoke(ctx, Msg_WithdrawBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_WithdrawBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -75,8 +84,19 @@ func (c *msgClient) WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts
}
func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgCancelBondResponse)
err := c.cc.Invoke(ctx, Msg_CancelBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_CancelBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -85,7 +105,9 @@ func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...g
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Msg defines the bond Msg service.
type MsgServer interface {
// CreateBond defines a method for creating a new bond.
CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error)
@@ -95,12 +117,18 @@ type MsgServer interface {
WithdrawBond(context.Context, *MsgWithdrawBond) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateBond not implemented")
@@ -114,7 +142,11 @@ func (UnimplementedMsgServer) WithdrawBond(context.Context, *MsgWithdrawBond) (*
func (UnimplementedMsgServer) CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelBond not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@@ -124,6 +156,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
@@ -199,6 +238,24 @@ func _Msg_CancelBond_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -222,6 +279,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "CancelBond",
Handler: _Msg_CancelBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/bond/v1/tx.proto",
@@ -0,0 +1,581 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package modulev1
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_onboarding_module_v1_module_proto_init()
md_Module = File_cerc_onboarding_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
type fastReflection_Module Module
func (x *Module) ProtoReflect() protoreflect.Message {
return (*fastReflection_Module)(x)
}
func (x *Module) slowProtoReflect() protoreflect.Message {
mi := &file_cerc_onboarding_module_v1_module_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_Module_messageType fastReflection_Module_messageType
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
type fastReflection_Module_messageType struct{}
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
return (*fastReflection_Module)(nil)
}
func (x fastReflection_Module_messageType) New() protoreflect.Message {
return new(fastReflection_Module)
}
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_Module) Type() protoreflect.MessageType {
return _fastReflection_Module_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_Module) New() protoreflect.Message {
return new(fastReflection_Module)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
return (*Module)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.onboarding.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.module.v1.Module"))
}
panic(fmt.Errorf("message cerc.onboarding.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.onboarding.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.module.v1.Module"))
}
panic(fmt.Errorf("message cerc.onboarding.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.onboarding.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.module.v1.Module"))
}
panic(fmt.Errorf("message cerc.onboarding.module.v1.Module does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.onboarding.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.module.v1.Module"))
}
panic(fmt.Errorf("message cerc.onboarding.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.onboarding.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.onboarding.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.module.v1.Module"))
}
panic(fmt.Errorf("message cerc.onboarding.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.onboarding.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.module.v1.Module"))
}
panic(fmt.Errorf("message cerc.onboarding.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cerc.onboarding.module.v1.Module", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_Module) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cerc/onboarding/module/v1/module.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
*x = Module{}
if protoimpl.UnsafeEnabled {
mi := &file_cerc_onboarding_module_v1_module_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Module) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Module) ProtoMessage() {}
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_onboarding_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_onboarding_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_onboarding_module_v1_module_proto_rawDesc = []byte{
0x0a, 0x26, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e,
0x67, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x6f,
0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f,
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12,
0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x30, 0xba,
0xc0, 0x96, 0xda, 0x01, 0x2a, 0x0a, 0x28, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74,
0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69,
0x63, 0x64, 0x2f, 0x78, 0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x42,
0xf7, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x6f, 0x6e, 0x62,
0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76,
0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
0x5a, 0x42, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72,
0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e,
0x67, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x4f, 0x4d, 0xaa, 0x02, 0x19, 0x43, 0x65, 0x72,
0x63, 0x2e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x4f, 0x6e,
0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c,
0x56, 0x31, 0xe2, 0x02, 0x25, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x69, 0x6e, 0x67, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x43, 0x65, 0x72,
0x63, 0x3a, 0x3a, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_cerc_onboarding_module_v1_module_proto_rawDescOnce sync.Once
file_cerc_onboarding_module_v1_module_proto_rawDescData = file_cerc_onboarding_module_v1_module_proto_rawDesc
)
func file_cerc_onboarding_module_v1_module_proto_rawDescGZIP() []byte {
file_cerc_onboarding_module_v1_module_proto_rawDescOnce.Do(func() {
file_cerc_onboarding_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_onboarding_module_v1_module_proto_rawDescData)
})
return file_cerc_onboarding_module_v1_module_proto_rawDescData
}
var file_cerc_onboarding_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cerc_onboarding_module_v1_module_proto_goTypes = []interface{}{
(*Module)(nil), // 0: cerc.onboarding.module.v1.Module
}
var file_cerc_onboarding_module_v1_module_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_cerc_onboarding_module_v1_module_proto_init() }
func file_cerc_onboarding_module_v1_module_proto_init() {
if File_cerc_onboarding_module_v1_module_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cerc_onboarding_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Module); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cerc_onboarding_module_v1_module_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cerc_onboarding_module_v1_module_proto_goTypes,
DependencyIndexes: file_cerc_onboarding_module_v1_module_proto_depIdxs,
MessageInfos: file_cerc_onboarding_module_v1_module_proto_msgTypes,
}.Build()
File_cerc_onboarding_module_v1_module_proto = out.File
file_cerc_onboarding_module_v1_module_proto_rawDesc = nil
file_cerc_onboarding_module_v1_module_proto_goTypes = nil
file_cerc_onboarding_module_v1_module_proto_depIdxs = nil
}
+750
View File
@@ -0,0 +1,750 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package onboardingv1
import (
fmt "fmt"
runtime "github.com/cosmos/cosmos-proto/runtime"
_ "github.com/cosmos/gogoproto/gogoproto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var _ protoreflect.List = (*_GenesisState_2_list)(nil)
type _GenesisState_2_list struct {
list *[]*Participant
}
func (x *_GenesisState_2_list) Len() int {
if x.list == nil {
return 0
}
return len(*x.list)
}
func (x *_GenesisState_2_list) Get(i int) protoreflect.Value {
return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect())
}
func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) {
valueUnwrapped := value.Message()
concreteValue := valueUnwrapped.Interface().(*Participant)
(*x.list)[i] = concreteValue
}
func (x *_GenesisState_2_list) Append(value protoreflect.Value) {
valueUnwrapped := value.Message()
concreteValue := valueUnwrapped.Interface().(*Participant)
*x.list = append(*x.list, concreteValue)
}
func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value {
v := new(Participant)
*x.list = append(*x.list, v)
return protoreflect.ValueOfMessage(v.ProtoReflect())
}
func (x *_GenesisState_2_list) Truncate(n int) {
for i := n; i < len(*x.list); i++ {
(*x.list)[i] = nil
}
*x.list = (*x.list)[:n]
}
func (x *_GenesisState_2_list) NewElement() protoreflect.Value {
v := new(Participant)
return protoreflect.ValueOfMessage(v.ProtoReflect())
}
func (x *_GenesisState_2_list) IsValid() bool {
return x.list != nil
}
var (
md_GenesisState protoreflect.MessageDescriptor
fd_GenesisState_params protoreflect.FieldDescriptor
fd_GenesisState_participants protoreflect.FieldDescriptor
)
func init() {
file_cerc_onboarding_v1_genesis_proto_init()
md_GenesisState = File_cerc_onboarding_v1_genesis_proto.Messages().ByName("GenesisState")
fd_GenesisState_params = md_GenesisState.Fields().ByName("params")
fd_GenesisState_participants = md_GenesisState.Fields().ByName("participants")
}
var _ protoreflect.Message = (*fastReflection_GenesisState)(nil)
type fastReflection_GenesisState GenesisState
func (x *GenesisState) ProtoReflect() protoreflect.Message {
return (*fastReflection_GenesisState)(x)
}
func (x *GenesisState) slowProtoReflect() protoreflect.Message {
mi := &file_cerc_onboarding_v1_genesis_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType
var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{}
type fastReflection_GenesisState_messageType struct{}
func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message {
return (*fastReflection_GenesisState)(nil)
}
func (x fastReflection_GenesisState_messageType) New() protoreflect.Message {
return new(fastReflection_GenesisState)
}
func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_GenesisState
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {
return md_GenesisState
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_GenesisState) Type() protoreflect.MessageType {
return _fastReflection_GenesisState_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_GenesisState) New() protoreflect.Message {
return new(fastReflection_GenesisState)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage {
return (*GenesisState)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Params != nil {
value := protoreflect.ValueOfMessage(x.Params.ProtoReflect())
if !f(fd_GenesisState_params, value) {
return
}
}
if len(x.Participants) != 0 {
value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Participants})
if !f(fd_GenesisState_participants, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.onboarding.v1.GenesisState.params":
return x.Params != nil
case "cerc.onboarding.v1.GenesisState.participants":
return len(x.Participants) != 0
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.v1.GenesisState"))
}
panic(fmt.Errorf("message cerc.onboarding.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.onboarding.v1.GenesisState.params":
x.Params = nil
case "cerc.onboarding.v1.GenesisState.participants":
x.Participants = nil
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.v1.GenesisState"))
}
panic(fmt.Errorf("message cerc.onboarding.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.onboarding.v1.GenesisState.params":
value := x.Params
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "cerc.onboarding.v1.GenesisState.participants":
if len(x.Participants) == 0 {
return protoreflect.ValueOfList(&_GenesisState_2_list{})
}
listValue := &_GenesisState_2_list{list: &x.Participants}
return protoreflect.ValueOfList(listValue)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.v1.GenesisState"))
}
panic(fmt.Errorf("message cerc.onboarding.v1.GenesisState does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.onboarding.v1.GenesisState.params":
x.Params = value.Message().Interface().(*Params)
case "cerc.onboarding.v1.GenesisState.participants":
lv := value.List()
clv := lv.(*_GenesisState_2_list)
x.Participants = *clv.list
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.v1.GenesisState"))
}
panic(fmt.Errorf("message cerc.onboarding.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.onboarding.v1.GenesisState.params":
if x.Params == nil {
x.Params = new(Params)
}
return protoreflect.ValueOfMessage(x.Params.ProtoReflect())
case "cerc.onboarding.v1.GenesisState.participants":
if x.Participants == nil {
x.Participants = []*Participant{}
}
value := &_GenesisState_2_list{list: &x.Participants}
return protoreflect.ValueOfList(value)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.v1.GenesisState"))
}
panic(fmt.Errorf("message cerc.onboarding.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.onboarding.v1.GenesisState.params":
m := new(Params)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "cerc.onboarding.v1.GenesisState.participants":
list := []*Participant{}
return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list})
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.onboarding.v1.GenesisState"))
}
panic(fmt.Errorf("message cerc.onboarding.v1.GenesisState does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cerc.onboarding.v1.GenesisState", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_GenesisState) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*GenesisState)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.Params != nil {
l = options.Size(x.Params)
n += 1 + l + runtime.Sov(uint64(l))
}
if len(x.Participants) > 0 {
for _, e := range x.Participants {
l = options.Size(e)
n += 1 + l + runtime.Sov(uint64(l))
}
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*GenesisState)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Participants) > 0 {
for iNdEx := len(x.Participants) - 1; iNdEx >= 0; iNdEx-- {
encoded, err := options.Marshal(x.Participants[iNdEx])
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0x12
}
}
if x.Params != nil {
encoded, err := options.Marshal(x.Params)
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*GenesisState)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if x.Params == nil {
x.Params = &Params{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Participants", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Participants = append(x.Participants, &Participant{})
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Participants[len(x.Participants)-1]); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cerc/onboarding/v1/genesis.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// GenesisState defines the onboarding module's genesis state.
type GenesisState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// params defines all the parameters of the module.
Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"`
// participants defines all the participants
Participants []*Participant `protobuf:"bytes,2,rep,name=participants,proto3" json:"participants,omitempty"`
}
func (x *GenesisState) Reset() {
*x = GenesisState{}
if protoimpl.UnsafeEnabled {
mi := &file_cerc_onboarding_v1_genesis_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenesisState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenesisState) ProtoMessage() {}
// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead.
func (*GenesisState) Descriptor() ([]byte, []int) {
return file_cerc_onboarding_v1_genesis_proto_rawDescGZIP(), []int{0}
}
func (x *GenesisState) GetParams() *Params {
if x != nil {
return x.Params
}
return nil
}
func (x *GenesisState) GetParticipants() []*Participant {
if x != nil {
return x.Participants
}
return nil
}
var File_cerc_onboarding_v1_genesis_proto protoreflect.FileDescriptor
var file_cerc_onboarding_v1_genesis_proto_rawDesc = []byte{
0x0a, 0x20, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e,
0x67, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x12, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x63, 0x65,
0x72, 0x63, 0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31,
0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x93, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04,
0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x49, 0x0a, 0x0c,
0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70,
0x61, 0x6e, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69,
0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x42, 0xd1, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e,
0x63, 0x65, 0x72, 0x63, 0x2e, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63,
0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e,
0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x4f, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x65, 0x72, 0x63,
0x2e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02,
0x12, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67,
0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x4f, 0x6e, 0x62, 0x6f, 0x61,
0x72, 0x64, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x4f, 0x6e, 0x62,
0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_cerc_onboarding_v1_genesis_proto_rawDescOnce sync.Once
file_cerc_onboarding_v1_genesis_proto_rawDescData = file_cerc_onboarding_v1_genesis_proto_rawDesc
)
func file_cerc_onboarding_v1_genesis_proto_rawDescGZIP() []byte {
file_cerc_onboarding_v1_genesis_proto_rawDescOnce.Do(func() {
file_cerc_onboarding_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_onboarding_v1_genesis_proto_rawDescData)
})
return file_cerc_onboarding_v1_genesis_proto_rawDescData
}
var file_cerc_onboarding_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cerc_onboarding_v1_genesis_proto_goTypes = []interface{}{
(*GenesisState)(nil), // 0: cerc.onboarding.v1.GenesisState
(*Params)(nil), // 1: cerc.onboarding.v1.Params
(*Participant)(nil), // 2: cerc.onboarding.v1.Participant
}
var file_cerc_onboarding_v1_genesis_proto_depIdxs = []int32{
1, // 0: cerc.onboarding.v1.GenesisState.params:type_name -> cerc.onboarding.v1.Params
2, // 1: cerc.onboarding.v1.GenesisState.participants:type_name -> cerc.onboarding.v1.Participant
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_cerc_onboarding_v1_genesis_proto_init() }
func file_cerc_onboarding_v1_genesis_proto_init() {
if File_cerc_onboarding_v1_genesis_proto != nil {
return
}
file_cerc_onboarding_v1_onboarding_proto_init()
if !protoimpl.UnsafeEnabled {
file_cerc_onboarding_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GenesisState); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cerc_onboarding_v1_genesis_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cerc_onboarding_v1_genesis_proto_goTypes,
DependencyIndexes: file_cerc_onboarding_v1_genesis_proto_depIdxs,
MessageInfos: file_cerc_onboarding_v1_genesis_proto_msgTypes,
}.Build()
File_cerc_onboarding_v1_genesis_proto = out.File
file_cerc_onboarding_v1_genesis_proto_rawDesc = nil
file_cerc_onboarding_v1_genesis_proto_goTypes = nil
file_cerc_onboarding_v1_genesis_proto_depIdxs = nil
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+207
View File
@@ -0,0 +1,207 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/onboarding/v1/query.proto
package onboardingv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Participants_FullMethodName = "/cerc.onboarding.v1.Query/Participants"
Query_GetParticipantByAddress_FullMethodName = "/cerc.onboarding.v1.Query/GetParticipantByAddress"
Query_GetParticipantByNitroAddress_FullMethodName = "/cerc.onboarding.v1.Query/GetParticipantByNitroAddress"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query defines the gRPC querier service for onboarding module
type QueryClient interface {
// Participants queries Participants list
Participants(ctx context.Context, in *QueryParticipantsRequest, opts ...grpc.CallOption) (*QueryParticipantsResponse, error)
// GetParticipantByAddress queries a participant by cosmos (laconic) address
GetParticipantByAddress(ctx context.Context, in *QueryGetParticipantByAddressRequest, opts ...grpc.CallOption) (*QueryGetParticipantByAddressResponse, error)
// GetParticipantByNitroAddress queries a participant by nitro address
GetParticipantByNitroAddress(ctx context.Context, in *QueryGetParticipantByNitroAddressRequest, opts ...grpc.CallOption) (*QueryGetParticipantByNitroAddressResponse, error)
}
type queryClient struct {
cc grpc.ClientConnInterface
}
func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Participants(ctx context.Context, in *QueryParticipantsRequest, opts ...grpc.CallOption) (*QueryParticipantsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParticipantsResponse)
err := c.cc.Invoke(ctx, Query_Participants_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetParticipantByAddress(ctx context.Context, in *QueryGetParticipantByAddressRequest, opts ...grpc.CallOption) (*QueryGetParticipantByAddressResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetParticipantByAddressResponse)
err := c.cc.Invoke(ctx, Query_GetParticipantByAddress_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetParticipantByNitroAddress(ctx context.Context, in *QueryGetParticipantByNitroAddressRequest, opts ...grpc.CallOption) (*QueryGetParticipantByNitroAddressResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetParticipantByNitroAddressResponse)
err := c.cc.Invoke(ctx, Query_GetParticipantByNitroAddress_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility.
//
// Query defines the gRPC querier service for onboarding module
type QueryServer interface {
// Participants queries Participants list
Participants(context.Context, *QueryParticipantsRequest) (*QueryParticipantsResponse, error)
// GetParticipantByAddress queries a participant by cosmos (laconic) address
GetParticipantByAddress(context.Context, *QueryGetParticipantByAddressRequest) (*QueryGetParticipantByAddressResponse, error)
// GetParticipantByNitroAddress queries a participant by nitro address
GetParticipantByNitroAddress(context.Context, *QueryGetParticipantByNitroAddressRequest) (*QueryGetParticipantByNitroAddressResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Participants(context.Context, *QueryParticipantsRequest) (*QueryParticipantsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Participants not implemented")
}
func (UnimplementedQueryServer) GetParticipantByAddress(context.Context, *QueryGetParticipantByAddressRequest) (*QueryGetParticipantByAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetParticipantByAddress not implemented")
}
func (UnimplementedQueryServer) GetParticipantByNitroAddress(context.Context, *QueryGetParticipantByNitroAddressRequest) (*QueryGetParticipantByNitroAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetParticipantByNitroAddress not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
// result in compilation errors.
type UnsafeQueryServer interface {
mustEmbedUnimplementedQueryServer()
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
func _Query_Participants_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParticipantsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Participants(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Participants_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Participants(ctx, req.(*QueryParticipantsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetParticipantByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetParticipantByAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetParticipantByAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetParticipantByAddress_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetParticipantByAddress(ctx, req.(*QueryGetParticipantByAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetParticipantByNitroAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetParticipantByNitroAddressRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetParticipantByNitroAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetParticipantByNitroAddress_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetParticipantByNitroAddress(ctx, req.(*QueryGetParticipantByNitroAddressRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Query_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cerc.onboarding.v1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Participants",
Handler: _Query_Participants_Handler,
},
{
MethodName: "GetParticipantByAddress",
Handler: _Query_GetParticipantByAddress_Handler,
},
{
MethodName: "GetParticipantByNitroAddress",
Handler: _Query_GetParticipantByNitroAddress_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/onboarding/v1/query.proto",
}
File diff suppressed because it is too large Load Diff
+127
View File
@@ -0,0 +1,127 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/onboarding/v1/tx.proto
package onboardingv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_OnboardParticipant_FullMethodName = "/cerc.onboarding.v1.Msg/OnboardParticipant"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Msg defines the onboarding Msg service.
type MsgClient interface {
// OnboardParticipant defines a method for enrolling a new validator.
OnboardParticipant(ctx context.Context, in *MsgOnboardParticipant, opts ...grpc.CallOption) (*MsgOnboardParticipantResponse, error)
}
type msgClient struct {
cc grpc.ClientConnInterface
}
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) OnboardParticipant(ctx context.Context, in *MsgOnboardParticipant, opts ...grpc.CallOption) (*MsgOnboardParticipantResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgOnboardParticipantResponse)
err := c.cc.Invoke(ctx, Msg_OnboardParticipant_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility.
//
// Msg defines the onboarding Msg service.
type MsgServer interface {
// OnboardParticipant defines a method for enrolling a new validator.
OnboardParticipant(context.Context, *MsgOnboardParticipant) (*MsgOnboardParticipantResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) OnboardParticipant(context.Context, *MsgOnboardParticipant) (*MsgOnboardParticipantResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnboardParticipant not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
// result in compilation errors.
type UnsafeMsgServer interface {
mustEmbedUnimplementedMsgServer()
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
func _Msg_OnboardParticipant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgOnboardParticipant)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).OnboardParticipant(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_OnboardParticipant_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).OnboardParticipant(ctx, req.(*MsgOnboardParticipant))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cerc.onboarding.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "OnboardParticipant",
Handler: _Msg_OnboardParticipant_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/onboarding/v1/tx.proto",
}
+97 -21
View File
@@ -14,12 +14,14 @@ import (
)
var (
md_Module protoreflect.MessageDescriptor
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_registry_module_v1_module_proto_init()
md_Module = File_cerc_registry_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.registry.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.registry.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.registry.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.module.v1.Module"))
@@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_registry_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_registry_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_registry_module_v1_module_proto_rawDesc = []byte{
@@ -419,26 +494,27 @@ var file_cerc_registry_module_v1_module_proto_rawDesc = []byte{
0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a,
0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c,
0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x38, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x2e, 0xba, 0xc0, 0x96,
0xda, 0x01, 0x28, 0x0a, 0x26, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f,
0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64,
0x2f, 0x78, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0xeb, 0x01, 0x0a, 0x1b,
0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72,
0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x2e,
0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c,
0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43,
0x52, 0x4d, 0xaa, 0x02, 0x17, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x72, 0x79, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x43,
0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x43,
0x65, 0x72, 0x63, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x6f, 0x22, 0x56, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2e, 0xba, 0xc0, 0x96, 0xda, 0x01,
0x28, 0x0a, 0x26, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65,
0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78,
0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0xeb, 0x01, 0x0a, 0x1b, 0x63, 0x6f,
0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64,
0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63,
0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x72,
0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76,
0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x52, 0x4d,
0xaa, 0x02, 0x17, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x43, 0x65, 0x72,
0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69,
0x73, 0x74, 0x72, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x43, 0x65, 0x72,
0x63, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
File diff suppressed because it is too large Load Diff
+80 -16
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/registry/v1/query.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Query_Params_FullMethodName = "/cerc.registry.v1.Query/Params"
@@ -28,11 +28,14 @@ const (
Query_LookupLrn_FullMethodName = "/cerc.registry.v1.Query/LookupLrn"
Query_ResolveLrn_FullMethodName = "/cerc.registry.v1.Query/ResolveLrn"
Query_GetRegistryModuleBalance_FullMethodName = "/cerc.registry.v1.Query/GetRegistryModuleBalance"
Query_Authorities_FullMethodName = "/cerc.registry.v1.Query/Authorities"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query defines the gRPC querier service for registry module
type QueryClient interface {
// Params queries the registry module params.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
@@ -52,6 +55,8 @@ type QueryClient interface {
ResolveLrn(ctx context.Context, in *QueryResolveLrnRequest, opts ...grpc.CallOption) (*QueryResolveLrnResponse, error)
// Get registry module balance
GetRegistryModuleBalance(ctx context.Context, in *QueryGetRegistryModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetRegistryModuleBalanceResponse, error)
// Authorities queries all authorities
Authorities(ctx context.Context, in *QueryAuthoritiesRequest, opts ...grpc.CallOption) (*QueryAuthoritiesResponse, error)
}
type queryClient struct {
@@ -63,8 +68,9 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -72,8 +78,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
}
func (c *queryClient) Records(ctx context.Context, in *QueryRecordsRequest, opts ...grpc.CallOption) (*QueryRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryRecordsResponse)
err := c.cc.Invoke(ctx, Query_Records_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Records_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -81,8 +88,9 @@ func (c *queryClient) Records(ctx context.Context, in *QueryRecordsRequest, opts
}
func (c *queryClient) GetRecord(ctx context.Context, in *QueryGetRecordRequest, opts ...grpc.CallOption) (*QueryGetRecordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetRecordResponse)
err := c.cc.Invoke(ctx, Query_GetRecord_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -90,8 +98,9 @@ func (c *queryClient) GetRecord(ctx context.Context, in *QueryGetRecordRequest,
}
func (c *queryClient) GetRecordsByBondId(ctx context.Context, in *QueryGetRecordsByBondIdRequest, opts ...grpc.CallOption) (*QueryGetRecordsByBondIdResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetRecordsByBondIdResponse)
err := c.cc.Invoke(ctx, Query_GetRecordsByBondId_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetRecordsByBondId_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -99,8 +108,9 @@ func (c *queryClient) GetRecordsByBondId(ctx context.Context, in *QueryGetRecord
}
func (c *queryClient) NameRecords(ctx context.Context, in *QueryNameRecordsRequest, opts ...grpc.CallOption) (*QueryNameRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryNameRecordsResponse)
err := c.cc.Invoke(ctx, Query_NameRecords_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_NameRecords_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -108,8 +118,9 @@ func (c *queryClient) NameRecords(ctx context.Context, in *QueryNameRecordsReque
}
func (c *queryClient) Whois(ctx context.Context, in *QueryWhoisRequest, opts ...grpc.CallOption) (*QueryWhoisResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryWhoisResponse)
err := c.cc.Invoke(ctx, Query_Whois_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_Whois_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -117,8 +128,9 @@ func (c *queryClient) Whois(ctx context.Context, in *QueryWhoisRequest, opts ...
}
func (c *queryClient) LookupLrn(ctx context.Context, in *QueryLookupLrnRequest, opts ...grpc.CallOption) (*QueryLookupLrnResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryLookupLrnResponse)
err := c.cc.Invoke(ctx, Query_LookupLrn_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_LookupLrn_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -126,8 +138,9 @@ func (c *queryClient) LookupLrn(ctx context.Context, in *QueryLookupLrnRequest,
}
func (c *queryClient) ResolveLrn(ctx context.Context, in *QueryResolveLrnRequest, opts ...grpc.CallOption) (*QueryResolveLrnResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryResolveLrnResponse)
err := c.cc.Invoke(ctx, Query_ResolveLrn_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_ResolveLrn_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -135,8 +148,19 @@ func (c *queryClient) ResolveLrn(ctx context.Context, in *QueryResolveLrnRequest
}
func (c *queryClient) GetRegistryModuleBalance(ctx context.Context, in *QueryGetRegistryModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetRegistryModuleBalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryGetRegistryModuleBalanceResponse)
err := c.cc.Invoke(ctx, Query_GetRegistryModuleBalance_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Query_GetRegistryModuleBalance_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Authorities(ctx context.Context, in *QueryAuthoritiesRequest, opts ...grpc.CallOption) (*QueryAuthoritiesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAuthoritiesResponse)
err := c.cc.Invoke(ctx, Query_Authorities_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -145,7 +169,9 @@ func (c *queryClient) GetRegistryModuleBalance(ctx context.Context, in *QueryGet
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
// for forward compatibility.
//
// Query defines the gRPC querier service for registry module
type QueryServer interface {
// Params queries the registry module params.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
@@ -165,12 +191,17 @@ type QueryServer interface {
ResolveLrn(context.Context, *QueryResolveLrnRequest) (*QueryResolveLrnResponse, error)
// Get registry module balance
GetRegistryModuleBalance(context.Context, *QueryGetRegistryModuleBalanceRequest) (*QueryGetRegistryModuleBalanceResponse, error)
// Authorities queries all authorities
Authorities(context.Context, *QueryAuthoritiesRequest) (*QueryAuthoritiesResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
@@ -199,7 +230,11 @@ func (UnimplementedQueryServer) ResolveLrn(context.Context, *QueryResolveLrnRequ
func (UnimplementedQueryServer) GetRegistryModuleBalance(context.Context, *QueryGetRegistryModuleBalanceRequest) (*QueryGetRegistryModuleBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetRegistryModuleBalance not implemented")
}
func (UnimplementedQueryServer) Authorities(context.Context, *QueryAuthoritiesRequest) (*QueryAuthoritiesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Authorities not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@@ -209,6 +244,13 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
@@ -374,6 +416,24 @@ func _Query_GetRegistryModuleBalance_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler)
}
func _Query_Authorities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAuthoritiesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Authorities(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Authorities_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Authorities(ctx, req.(*QueryAuthoritiesRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -417,6 +477,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetRegistryModuleBalance",
Handler: _Query_GetRegistryModuleBalance_Handler,
},
{
MethodName: "Authorities",
Handler: _Query_Authorities_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/registry/v1/query.proto",
+111 -111
View File
@@ -1318,7 +1318,7 @@ var (
fd_Record_owners protoreflect.FieldDescriptor
fd_Record_attributes protoreflect.FieldDescriptor
fd_Record_names protoreflect.FieldDescriptor
fd_Record_type protoreflect.FieldDescriptor
fd_Record_types protoreflect.FieldDescriptor
)
func init() {
@@ -1332,7 +1332,7 @@ func init() {
fd_Record_owners = md_Record.Fields().ByName("owners")
fd_Record_attributes = md_Record.Fields().ByName("attributes")
fd_Record_names = md_Record.Fields().ByName("names")
fd_Record_type = md_Record.Fields().ByName("type")
fd_Record_types = md_Record.Fields().ByName("types")
}
var _ protoreflect.Message = (*fastReflection_Record)(nil)
@@ -1448,9 +1448,9 @@ func (x *fastReflection_Record) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.Type_ != "" {
value := protoreflect.ValueOfString(x.Type_)
if !f(fd_Record_type, value) {
if x.Types != "" {
value := protoreflect.ValueOfString(x.Types)
if !f(fd_Record_types, value) {
return
}
}
@@ -1485,8 +1485,8 @@ func (x *fastReflection_Record) Has(fd protoreflect.FieldDescriptor) bool {
return len(x.Attributes) != 0
case "cerc.registry.v1.Record.names":
return len(x.Names) != 0
case "cerc.registry.v1.Record.type":
return x.Type_ != ""
case "cerc.registry.v1.Record.types":
return x.Types != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.Record"))
@@ -1519,8 +1519,8 @@ func (x *fastReflection_Record) Clear(fd protoreflect.FieldDescriptor) {
x.Attributes = nil
case "cerc.registry.v1.Record.names":
x.Names = nil
case "cerc.registry.v1.Record.type":
x.Type_ = ""
case "cerc.registry.v1.Record.types":
x.Types = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.Record"))
@@ -1567,8 +1567,8 @@ func (x *fastReflection_Record) Get(descriptor protoreflect.FieldDescriptor) pro
}
listValue := &_Record_8_list{list: &x.Names}
return protoreflect.ValueOfList(listValue)
case "cerc.registry.v1.Record.type":
value := x.Type_
case "cerc.registry.v1.Record.types":
value := x.Types
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
@@ -1610,8 +1610,8 @@ func (x *fastReflection_Record) Set(fd protoreflect.FieldDescriptor, value proto
lv := value.List()
clv := lv.(*_Record_8_list)
x.Names = *clv.list
case "cerc.registry.v1.Record.type":
x.Type_ = value.Interface().(string)
case "cerc.registry.v1.Record.types":
x.Types = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.Record"))
@@ -1656,8 +1656,8 @@ func (x *fastReflection_Record) Mutable(fd protoreflect.FieldDescriptor) protore
panic(fmt.Errorf("field deleted of message cerc.registry.v1.Record is not mutable"))
case "cerc.registry.v1.Record.attributes":
panic(fmt.Errorf("field attributes of message cerc.registry.v1.Record is not mutable"))
case "cerc.registry.v1.Record.type":
panic(fmt.Errorf("field type of message cerc.registry.v1.Record is not mutable"))
case "cerc.registry.v1.Record.types":
panic(fmt.Errorf("field types of message cerc.registry.v1.Record is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.Record"))
@@ -1689,7 +1689,7 @@ func (x *fastReflection_Record) NewField(fd protoreflect.FieldDescriptor) protor
case "cerc.registry.v1.Record.names":
list := []string{}
return protoreflect.ValueOfList(&_Record_8_list{list: &list})
case "cerc.registry.v1.Record.type":
case "cerc.registry.v1.Record.types":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
@@ -1795,7 +1795,7 @@ func (x *fastReflection_Record) ProtoMethods() *protoiface.Methods {
n += 1 + l + runtime.Sov(uint64(l))
}
}
l = len(x.Type_)
l = len(x.Types)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
@@ -1828,10 +1828,10 @@ func (x *fastReflection_Record) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Type_) > 0 {
i -= len(x.Type_)
copy(dAtA[i:], x.Type_)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Type_)))
if len(x.Types) > 0 {
i -= len(x.Types)
copy(dAtA[i:], x.Types)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Types)))
i--
dAtA[i] = 0x4a
}
@@ -2195,7 +2195,7 @@ func (x *fastReflection_Record) ProtoMethods() *protoiface.Methods {
iNdEx = postIndex
case 9:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Type_", wireType)
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Types", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -2223,7 +2223,7 @@ func (x *fastReflection_Record) ProtoMethods() *protoiface.Methods {
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Type_ = string(dAtA[iNdEx:postIndex])
x.Types = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -6753,7 +6753,7 @@ type Record struct {
Owners []string `protobuf:"bytes,6,rep,name=owners,proto3" json:"owners,omitempty"`
Attributes []byte `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty"`
Names []string `protobuf:"bytes,8,rep,name=names,proto3" json:"names,omitempty"`
Type_ string `protobuf:"bytes,9,opt,name=type,proto3" json:"type,omitempty"`
Types string `protobuf:"bytes,9,opt,name=types,proto3" json:"types,omitempty"`
}
func (x *Record) Reset() {
@@ -6832,9 +6832,9 @@ func (x *Record) GetNames() []string {
return nil
}
func (x *Record) GetType_() string {
func (x *Record) GetTypes() string {
if x != nil {
return x.Type_
return x.Types
}
return ""
}
@@ -7352,7 +7352,7 @@ var file_cerc_registry_v1_registry_proto_rawDesc = []byte{
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x62, 0x69, 0x64, 0x22, 0x52, 0x1a,
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x42, 0x69, 0x64, 0x22, 0x89, 0x04, 0x0a, 0x06, 0x52,
0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x42, 0x69, 0x64, 0x22, 0x8b, 0x04, 0x0a, 0x06, 0x52,
0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x27, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x17, 0xf2, 0xde, 0x1f, 0x13, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x69, 0x64, 0x22,
0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x69, 0x64, 0x22, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3a,
@@ -7382,90 +7382,90 @@ var file_cerc_registry_v1_registry_proto_rawDesc = []byte{
0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x42, 0x1d, 0xf2,
0xde, 0x1f, 0x19, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x20,
0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x52, 0x05, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,
0x09, 0x42, 0x1d, 0xf2, 0xde, 0x1f, 0x19, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x74, 0x79, 0x70,
0x65, 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x5b, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05,
0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x65,
0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x4e,
0x61, 0x6d, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x05, 0x65, 0x6e,
0x74, 0x72, 0x79, 0x22, 0xe6, 0x03, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x5d, 0x0a, 0x10, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x70,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
0x33, 0xf2, 0xde, 0x1f, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x20, 0x79, 0x61, 0x6d,
0x6c, 0x3a, 0x22, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f,
0x6b, 0x65, 0x79, 0x22, 0x52, 0x0e, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x4b, 0x65, 0x79, 0x12, 0x52, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64,
0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2d, 0xf2, 0xde, 0x1f,
0x29, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6f, 0x77, 0x6e, 0x65,
0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x0c, 0x6f, 0x77, 0x6e, 0x65,
0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x75, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xf2, 0xde,
0x1f, 0x23, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x69, 0x64, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x69, 0x64, 0x22, 0x52, 0x09, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
0x12, 0x3a, 0x0a, 0x07, 0x62, 0x6f, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
0x09, 0x42, 0x21, 0xf2, 0xde, 0x1f, 0x1d, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x62, 0x6f, 0x6e,
0x64, 0x5f, 0x69, 0x64, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x62, 0x6f, 0x6e, 0x64,
0x5f, 0x69, 0x64, 0x22, 0x52, 0x06, 0x62, 0x6f, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x6e, 0x0a, 0x0b,
0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x31, 0xc8,
0xde, 0x1f, 0x00, 0xf2, 0xde, 0x1f, 0x25, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x65, 0x78, 0x70,
0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22,
0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x90, 0xdf, 0x1f, 0x01,
0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x53, 0x0a, 0x09,
0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a,
0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63,
0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e,
0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72,
0x79, 0x22, 0x84, 0x01, 0x0a, 0x0a, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
0x12, 0x39, 0x0a, 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x21, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x07, 0x68,
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63,
0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e,
0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x39, 0x0a, 0x0f, 0x4e, 0x61, 0x6d, 0x65,
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68,
0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69,
0x67, 0x68, 0x74, 0x22, 0x74, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
0x12, 0x2b, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xf2,
0xde, 0x1f, 0x15, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x73, 0x69, 0x67, 0x22, 0x20, 0x79, 0x61,
0x6d, 0x6c, 0x3a, 0x22, 0x73, 0x69, 0x67, 0x22, 0x52, 0x03, 0x73, 0x69, 0x67, 0x12, 0x3a, 0x0a,
0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21,
0xf2, 0xde, 0x1f, 0x1d, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65,
0x79, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79,
0x22, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x33, 0x0a, 0x0b, 0x45, 0x78, 0x70,
0x69, 0x72, 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23,
0x0a, 0x0b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x42, 0xc4, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63,
0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67,
0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69,
0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63,
0x65, 0x72, 0x63, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x3b,
0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x52, 0x58,
0xaa, 0x02, 0x10, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73,
0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x6d, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01,
0x28, 0x09, 0x42, 0x1d, 0xf2, 0xde, 0x1f, 0x19, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x74, 0x79,
0x70, 0x65, 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x74, 0x79, 0x70, 0x65, 0x73,
0x22, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x5b, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35,
0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e,
0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31,
0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x05,
0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xe6, 0x03, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x5d, 0x0a, 0x10, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x33, 0xf2, 0xde, 0x1f, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x6f, 0x77, 0x6e,
0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x20, 0x79,
0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x52, 0x0e, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x50, 0x75, 0x62,
0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x52, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2d, 0xf2,
0xde, 0x1f, 0x29, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6f, 0x77,
0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x0c, 0x6f, 0x77,
0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65,
0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x75,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27,
0xf2, 0xde, 0x1f, 0x23, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x69, 0x64, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x22, 0x52, 0x09, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x64, 0x12, 0x3a, 0x0a, 0x07, 0x62, 0x6f, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x42, 0x21, 0xf2, 0xde, 0x1f, 0x1d, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x62,
0x6f, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x62, 0x6f,
0x6e, 0x64, 0x5f, 0x69, 0x64, 0x22, 0x52, 0x06, 0x62, 0x6f, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x6e,
0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42,
0x31, 0xc8, 0xde, 0x1f, 0x00, 0xf2, 0xde, 0x1f, 0x25, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x65,
0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c,
0x3a, 0x22, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x90, 0xdf,
0x1f, 0x01, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x53,
0x0a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x32, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76,
0x31, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x65, 0x6e,
0x74, 0x72, 0x79, 0x22, 0x84, 0x01, 0x0a, 0x0a, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x12, 0x39, 0x0a, 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74,
0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a,
0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21,
0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76,
0x31, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x52, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x39, 0x0a, 0x0f, 0x4e, 0x61,
0x6d, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68,
0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x74, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75,
0x72, 0x65, 0x12, 0x2b, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
0x19, 0xf2, 0xde, 0x1f, 0x15, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x73, 0x69, 0x67, 0x22, 0x20,
0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x73, 0x69, 0x67, 0x22, 0x52, 0x03, 0x73, 0x69, 0x67, 0x12,
0x3a, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x42, 0x21, 0xf2, 0xde, 0x1f, 0x1d, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x5f,
0x6b, 0x65, 0x79, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x5f, 0x6b,
0x65, 0x79, 0x22, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x33, 0x0a, 0x0b, 0x45,
0x78, 0x70, 0x69, 0x72, 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x22, 0x23, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xc4, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65,
0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x42, 0x0d,
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
0x3b, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69,
0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76,
0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43,
0x52, 0x58, 0xaa, 0x02, 0x10, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x72, 0x79, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x65, 0x72, 0x63, 0x5c,
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a,
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
File diff suppressed because it is too large Load Diff
+84 -17
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: cerc/registry/v1/tx.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Msg_SetRecord_FullMethodName = "/cerc.registry.v1.Msg/SetRecord"
@@ -29,11 +29,14 @@ const (
Msg_DeleteName_FullMethodName = "/cerc.registry.v1.Msg/DeleteName"
Msg_ReserveAuthority_FullMethodName = "/cerc.registry.v1.Msg/ReserveAuthority"
Msg_SetAuthorityBond_FullMethodName = "/cerc.registry.v1.Msg/SetAuthorityBond"
Msg_UpdateParams_FullMethodName = "/cerc.registry.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Msg is a service which exposes the registry functionality
type MsgClient interface {
// SetRecord records a new record with given payload and bond id
SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error)
@@ -55,6 +58,9 @@ type MsgClient interface {
ReserveAuthority(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error)
// SetAuthorityBond
SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@@ -66,8 +72,9 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgSetRecordResponse)
err := c.cc.Invoke(ctx, Msg_SetRecord_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_SetRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -75,8 +82,9 @@ func (c *msgClient) SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grp
}
func (c *msgClient) RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ...grpc.CallOption) (*MsgRenewRecordResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRenewRecordResponse)
err := c.cc.Invoke(ctx, Msg_RenewRecord_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_RenewRecord_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -84,8 +92,9 @@ func (c *msgClient) RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ..
}
func (c *msgClient) AssociateBond(ctx context.Context, in *MsgAssociateBond, opts ...grpc.CallOption) (*MsgAssociateBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgAssociateBondResponse)
err := c.cc.Invoke(ctx, Msg_AssociateBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_AssociateBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -93,8 +102,9 @@ func (c *msgClient) AssociateBond(ctx context.Context, in *MsgAssociateBond, opt
}
func (c *msgClient) DissociateBond(ctx context.Context, in *MsgDissociateBond, opts ...grpc.CallOption) (*MsgDissociateBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgDissociateBondResponse)
err := c.cc.Invoke(ctx, Msg_DissociateBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_DissociateBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -102,8 +112,9 @@ func (c *msgClient) DissociateBond(ctx context.Context, in *MsgDissociateBond, o
}
func (c *msgClient) DissociateRecords(ctx context.Context, in *MsgDissociateRecords, opts ...grpc.CallOption) (*MsgDissociateRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgDissociateRecordsResponse)
err := c.cc.Invoke(ctx, Msg_DissociateRecords_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_DissociateRecords_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -111,8 +122,9 @@ func (c *msgClient) DissociateRecords(ctx context.Context, in *MsgDissociateReco
}
func (c *msgClient) ReassociateRecords(ctx context.Context, in *MsgReassociateRecords, opts ...grpc.CallOption) (*MsgReassociateRecordsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgReassociateRecordsResponse)
err := c.cc.Invoke(ctx, Msg_ReassociateRecords_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_ReassociateRecords_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -120,8 +132,9 @@ func (c *msgClient) ReassociateRecords(ctx context.Context, in *MsgReassociateRe
}
func (c *msgClient) SetName(ctx context.Context, in *MsgSetName, opts ...grpc.CallOption) (*MsgSetNameResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgSetNameResponse)
err := c.cc.Invoke(ctx, Msg_SetName_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_SetName_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -129,8 +142,9 @@ func (c *msgClient) SetName(ctx context.Context, in *MsgSetName, opts ...grpc.Ca
}
func (c *msgClient) DeleteName(ctx context.Context, in *MsgDeleteName, opts ...grpc.CallOption) (*MsgDeleteNameResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgDeleteNameResponse)
err := c.cc.Invoke(ctx, Msg_DeleteName_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_DeleteName_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -138,8 +152,9 @@ func (c *msgClient) DeleteName(ctx context.Context, in *MsgDeleteName, opts ...g
}
func (c *msgClient) ReserveAuthority(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgReserveAuthorityResponse)
err := c.cc.Invoke(ctx, Msg_ReserveAuthority_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_ReserveAuthority_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -147,8 +162,19 @@ func (c *msgClient) ReserveAuthority(ctx context.Context, in *MsgReserveAuthorit
}
func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgSetAuthorityBondResponse)
err := c.cc.Invoke(ctx, Msg_SetAuthorityBond_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, Msg_SetAuthorityBond_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -157,7 +183,9 @@ func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBon
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
// for forward compatibility.
//
// Msg is a service which exposes the registry functionality
type MsgServer interface {
// SetRecord records a new record with given payload and bond id
SetRecord(context.Context, *MsgSetRecord) (*MsgSetRecordResponse, error)
@@ -179,12 +207,18 @@ type MsgServer interface {
ReserveAuthority(context.Context, *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error)
// SetAuthorityBond
SetAuthorityBond(context.Context, *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
func (UnimplementedMsgServer) SetRecord(context.Context, *MsgSetRecord) (*MsgSetRecordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetRecord not implemented")
@@ -216,7 +250,11 @@ func (UnimplementedMsgServer) ReserveAuthority(context.Context, *MsgReserveAutho
func (UnimplementedMsgServer) SetAuthorityBond(context.Context, *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetAuthorityBond not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@@ -226,6 +264,13 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
@@ -409,6 +454,24 @@ func _Msg_SetAuthorityBond_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -456,6 +519,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "SetAuthorityBond",
Handler: _Msg_SetAuthorityBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/registry/v1/tx.proto",
+755
View File
@@ -0,0 +1,755 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package typesv1
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
runtime "github.com/cosmos/cosmos-proto/runtime"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
types "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/gogoproto/gogoproto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
md_LockupAccount protoreflect.MessageDescriptor
fd_LockupAccount_base_account protoreflect.FieldDescriptor
fd_LockupAccount_name protoreflect.FieldDescriptor
fd_LockupAccount_distribution protoreflect.FieldDescriptor
)
func init() {
file_cerc_types_v1_lockup_proto_init()
md_LockupAccount = File_cerc_types_v1_lockup_proto.Messages().ByName("LockupAccount")
fd_LockupAccount_base_account = md_LockupAccount.Fields().ByName("base_account")
fd_LockupAccount_name = md_LockupAccount.Fields().ByName("name")
fd_LockupAccount_distribution = md_LockupAccount.Fields().ByName("distribution")
}
var _ protoreflect.Message = (*fastReflection_LockupAccount)(nil)
type fastReflection_LockupAccount LockupAccount
func (x *LockupAccount) ProtoReflect() protoreflect.Message {
return (*fastReflection_LockupAccount)(x)
}
func (x *LockupAccount) slowProtoReflect() protoreflect.Message {
mi := &file_cerc_types_v1_lockup_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_LockupAccount_messageType fastReflection_LockupAccount_messageType
var _ protoreflect.MessageType = fastReflection_LockupAccount_messageType{}
type fastReflection_LockupAccount_messageType struct{}
func (x fastReflection_LockupAccount_messageType) Zero() protoreflect.Message {
return (*fastReflection_LockupAccount)(nil)
}
func (x fastReflection_LockupAccount_messageType) New() protoreflect.Message {
return new(fastReflection_LockupAccount)
}
func (x fastReflection_LockupAccount_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_LockupAccount
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_LockupAccount) Descriptor() protoreflect.MessageDescriptor {
return md_LockupAccount
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_LockupAccount) Type() protoreflect.MessageType {
return _fastReflection_LockupAccount_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_LockupAccount) New() protoreflect.Message {
return new(fastReflection_LockupAccount)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_LockupAccount) Interface() protoreflect.ProtoMessage {
return (*LockupAccount)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_LockupAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.BaseAccount != nil {
value := protoreflect.ValueOfMessage(x.BaseAccount.ProtoReflect())
if !f(fd_LockupAccount_base_account, value) {
return
}
}
if x.Name != "" {
value := protoreflect.ValueOfString(x.Name)
if !f(fd_LockupAccount_name, value) {
return
}
}
if x.Distribution != "" {
value := protoreflect.ValueOfString(x.Distribution)
if !f(fd_LockupAccount_distribution, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_LockupAccount) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
return x.BaseAccount != nil
case "cerc.types.v1.LockupAccount.name":
return x.Name != ""
case "cerc.types.v1.LockupAccount.distribution":
return x.Distribution != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
x.BaseAccount = nil
case "cerc.types.v1.LockupAccount.name":
x.Name = ""
case "cerc.types.v1.LockupAccount.distribution":
x.Distribution = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_LockupAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
value := x.BaseAccount
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "cerc.types.v1.LockupAccount.name":
value := x.Name
return protoreflect.ValueOfString(value)
case "cerc.types.v1.LockupAccount.distribution":
value := x.Distribution
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
x.BaseAccount = value.Message().Interface().(*types.BaseAccount)
case "cerc.types.v1.LockupAccount.name":
x.Name = value.Interface().(string)
case "cerc.types.v1.LockupAccount.distribution":
x.Distribution = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
if x.BaseAccount == nil {
x.BaseAccount = new(types.BaseAccount)
}
return protoreflect.ValueOfMessage(x.BaseAccount.ProtoReflect())
case "cerc.types.v1.LockupAccount.name":
panic(fmt.Errorf("field name of message cerc.types.v1.LockupAccount is not mutable"))
case "cerc.types.v1.LockupAccount.distribution":
panic(fmt.Errorf("field distribution of message cerc.types.v1.LockupAccount is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_LockupAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.types.v1.LockupAccount.base_account":
m := new(types.BaseAccount)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "cerc.types.v1.LockupAccount.name":
return protoreflect.ValueOfString("")
case "cerc.types.v1.LockupAccount.distribution":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.types.v1.LockupAccount"))
}
panic(fmt.Errorf("message cerc.types.v1.LockupAccount does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_LockupAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cerc.types.v1.LockupAccount", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_LockupAccount) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_LockupAccount) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_LockupAccount) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_LockupAccount) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.BaseAccount != nil {
l = options.Size(x.BaseAccount)
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Name)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Distribution)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Distribution) > 0 {
i -= len(x.Distribution)
copy(dAtA[i:], x.Distribution)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Distribution)))
i--
dAtA[i] = 0x1a
}
if len(x.Name) > 0 {
i -= len(x.Name)
copy(dAtA[i:], x.Name)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name)))
i--
dAtA[i] = 0x12
}
if x.BaseAccount != nil {
encoded, err := options.Marshal(x.BaseAccount)
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*LockupAccount)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LockupAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LockupAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if x.BaseAccount == nil {
x.BaseAccount = &types.BaseAccount{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BaseAccount); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Distribution", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Distribution = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cerc/types/v1/lockup.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// LockupAccount extends the Cosmos SDK BaseAccount with a name and distribution
// field. It satisfies the ModuleAccountI interface to allow querying it as a
// module account.
type LockupAccount struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
BaseAccount *types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3" json:"base_account,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Distribution string `protobuf:"bytes,3,opt,name=distribution,proto3" json:"distribution,omitempty"`
}
func (x *LockupAccount) Reset() {
*x = LockupAccount{}
if protoimpl.UnsafeEnabled {
mi := &file_cerc_types_v1_lockup_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LockupAccount) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LockupAccount) ProtoMessage() {}
// Deprecated: Use LockupAccount.ProtoReflect.Descriptor instead.
func (*LockupAccount) Descriptor() ([]byte, []int) {
return file_cerc_types_v1_lockup_proto_rawDescGZIP(), []int{0}
}
func (x *LockupAccount) GetBaseAccount() *types.BaseAccount {
if x != nil {
return x.BaseAccount
}
return nil
}
func (x *LockupAccount) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *LockupAccount) GetDistribution() string {
if x != nil {
return x.Distribution
}
return ""
}
var File_cerc_types_v1_lockup_proto protoreflect.FileDescriptor
var file_cerc_types_v1_lockup_proto_rawDesc = []byte{
0x0a, 0x1a, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f,
0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x63, 0x65,
0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69,
0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61,
0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x8b, 0x02, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x12, 0x49, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61,
0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x04, 0xd0, 0xde, 0x1f, 0x01, 0x52,
0x0b, 0x62, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x77, 0x88, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x22, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
0xca, 0xb4, 0x2d, 0x1c, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76,
0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
0x8a, 0xe7, 0xb0, 0x2a, 0x15, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x2f, 0x4c, 0x6f, 0x63,
0x6b, 0x75, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x92, 0xe7, 0xb0, 0x2a, 0x0e, 0x6c,
0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xad, 0x01,
0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63,
0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76,
0x31, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa,
0x02, 0x0d, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca,
0x02, 0x0d, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2,
0x02, 0x19, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c,
0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x65,
0x72, 0x63, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cerc_types_v1_lockup_proto_rawDescOnce sync.Once
file_cerc_types_v1_lockup_proto_rawDescData = file_cerc_types_v1_lockup_proto_rawDesc
)
func file_cerc_types_v1_lockup_proto_rawDescGZIP() []byte {
file_cerc_types_v1_lockup_proto_rawDescOnce.Do(func() {
file_cerc_types_v1_lockup_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_types_v1_lockup_proto_rawDescData)
})
return file_cerc_types_v1_lockup_proto_rawDescData
}
var file_cerc_types_v1_lockup_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cerc_types_v1_lockup_proto_goTypes = []interface{}{
(*LockupAccount)(nil), // 0: cerc.types.v1.LockupAccount
(*types.BaseAccount)(nil), // 1: cosmos.auth.v1beta1.BaseAccount
}
var file_cerc_types_v1_lockup_proto_depIdxs = []int32{
1, // 0: cerc.types.v1.LockupAccount.base_account:type_name -> cosmos.auth.v1beta1.BaseAccount
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_cerc_types_v1_lockup_proto_init() }
func file_cerc_types_v1_lockup_proto_init() {
if File_cerc_types_v1_lockup_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cerc_types_v1_lockup_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LockupAccount); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cerc_types_v1_lockup_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cerc_types_v1_lockup_proto_goTypes,
DependencyIndexes: file_cerc_types_v1_lockup_proto_depIdxs,
MessageInfos: file_cerc_types_v1_lockup_proto_msgTypes,
}.Build()
File_cerc_types_v1_lockup_proto = out.File
file_cerc_types_v1_lockup_proto_rawDesc = nil
file_cerc_types_v1_lockup_proto_goTypes = nil
file_cerc_types_v1_lockup_proto_depIdxs = nil
}
+180
View File
@@ -0,0 +1,180 @@
package app
import (
"bytes"
"crypto/rand"
"encoding/gob"
"encoding/json"
"fmt"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconicd/server/distsig"
)
type (
// VoteExtensionHandler defines the vote extension handler for LaconicApp.
VoteExtensionHandler struct {
app *LaconicApp
}
// VoteExtension defines the structure used to create a vote extension.
VoteExtension struct {
Hash []byte
Height int64
Data []byte
}
)
func NewVoteExtensionHandler() *VoteExtensionHandler {
return &VoteExtensionHandler{}
}
func (app *LaconicApp) NewVoteExtensionHandler() *VoteExtensionHandler {
return &VoteExtensionHandler{app: app}
}
func (h *VoteExtensionHandler) SetHandlers(bApp *baseapp.BaseApp) {
if h.app != nil {
// Use the real laconic handlers when app is available
bApp.SetExtendVoteHandler(h.ExtendVoteWithLaconic())
bApp.SetVerifyVoteExtensionHandler(h.VerifyVoteExtensionWithLaconic())
bApp.SetPrepareProposal(h.PrepareProposal())
bApp.SetProcessProposal(h.ProcessProposal())
} else {
// Use dummy handlers for testing
bApp.SetExtendVoteHandler(h.ExtendVote())
bApp.SetVerifyVoteExtensionHandler(h.VerifyVoteExtension())
}
}
func (h *VoteExtensionHandler) ExtendVote() sdk.ExtendVoteHandler {
return func(_ sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) {
buf := make([]byte, 1024)
_, err := rand.Read(buf)
if err != nil {
return nil, fmt.Errorf("failed to generate random vote extension data: %w", err)
}
ve := VoteExtension{
Hash: req.Hash,
Height: req.Height,
Data: buf,
}
bz, err := json.Marshal(ve)
if err != nil {
return nil, fmt.Errorf("failed to encode vote extension: %w", err)
}
return &abci.ResponseExtendVote{VoteExtension: bz}, nil
}
}
func (h *VoteExtensionHandler) VerifyVoteExtension() sdk.VerifyVoteExtensionHandler {
return func(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) {
var ve VoteExtension
if err := json.Unmarshal(req.VoteExtension, &ve); err != nil {
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
}
switch {
case req.Height != ve.Height:
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
case !bytes.Equal(req.Hash, ve.Hash):
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
case len(ve.Data) != 1024:
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
}
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil
}
}
// PrepareProposal is responsible for:
// - collecting Nitro state updates and applying them as inserted transactions in the block proposal
func (h *VoteExtensionHandler) PrepareProposal() sdk.PrepareProposalHandler {
return func(ctx sdk.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) {
// paramsResp, err := h.app.ConsensusParamsKeeper.Params(ctx, &consensustypes.QueryParamsRequest{})
// if err != nil {
// return nil, err
// }
// var maxBlockGas uint64
// if b := paramsResp.GetParams().Block; b != nil {
// maxBlockGas = uint64(b.MaxGas)
// }
// Decode transactions from bytes
txs := make([]sdk.Tx, 0, len(req.Txs))
for _, txBz := range req.Txs {
tx, err := h.app.txConfig.TxDecoder()(txBz)
if err != nil {
continue // Skip invalid transactions
}
txs = append(txs, tx)
}
// For now, just return the transactions as-is
// TODO: Add custom transaction selection logic here
return &abci.ResponsePrepareProposal{Txs: req.Txs}, nil
}
}
func (h *VoteExtensionHandler) ProcessProposal() sdk.ProcessProposalHandler {
return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
// For now, accept all proposals
// TODO: Add custom proposal validation logic here
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil
}
}
// ExtendVoteWithLaconic implements the real Laconic-specific vote extension logic
// - renews distsig key (DKG) if validator set has changed
// - broadcasts prepared DKG and distsig messages
func (h *VoteExtensionHandler) ExtendVoteWithLaconic() sdk.ExtendVoteHandler {
return func(ctx sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) {
// Check if we have a distributed signature manager
// Since we can't access DistSigManager() directly in v1, we'll implement a simpler version
// TODO: Integrate with actual distributed signature manager when available
// Check if we are a participant
if h.app.OnboardingKeeper != nil {
// For now, return empty vote extension
// TODO: Implement the full distsig logic here
return &abci.ResponseExtendVote{VoteExtension: []byte{}}, nil
}
return &abci.ResponseExtendVote{VoteExtension: []byte{}}, nil
}
}
// VerifyVoteExtensionWithLaconic implements the real Laconic-specific vote extension verification
func (h *VoteExtensionHandler) VerifyVoteExtensionWithLaconic() sdk.VerifyVoteExtensionHandler {
return func(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) {
if len(req.VoteExtension) == 0 {
// Empty vote extension is acceptable
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil
}
// Decode and verify the vote extension
dec := gob.NewDecoder(bytes.NewReader(req.VoteExtension))
var messages distsig.PeerMessages
if err := dec.Decode(&messages); err != nil {
// If we can't decode, reject
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil
}
// TODO: Actually verify the messages with the distributed signature manager
// For now, just accept
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil
}
}
+79
View File
@@ -0,0 +1,79 @@
package app
import (
_ "embed"
"math"
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"git.vdb.to/cerc-io/laconicd/app/params"
)
// Reference: https://github.com/cosmos/cosmos-sdk/blob/v0.50.10/x/auth/ante/validator_tx_fee.go#L15
// checkTxFeeWithValidatorMinGasPrices implements the default fee logic, where the minimum price per
// unit of gas is fixed and set by each validator, can the tx priority is computed from the gas price.
func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}
feeCoins := feeTx.GetFee()
gas := feeTx.GetGas()
// Only allow alnt as a fee token
for _, coin := range feeCoins {
if coin.Denom != params.CoinUnit {
return nil, 0, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid fee denom %s, only %s is accepted", coin.Denom, params.CoinUnit)
}
}
// Ensure that the provided fees meet a minimum threshold for the validator,
// if this is a CheckTx. This is only for local mempool purposes, and thus
// is only ran on check tx.
if ctx.IsCheckTx() {
minGasPrices := ctx.MinGasPrices()
if !minGasPrices.IsZero() {
requiredFees := make(sdk.Coins, len(minGasPrices))
// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
glDec := sdkmath.LegacyNewDec(int64(gas))
for i, gp := range minGasPrices {
fee := gp.Amount.Mul(glDec)
requiredFees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt())
}
if !feeCoins.IsAnyGTE(requiredFees) {
return nil, 0, errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "insufficient fees; got: %s required: %s", feeCoins, requiredFees)
}
}
}
priority := getTxPriority(feeCoins, int64(gas))
return feeCoins, priority, nil
}
// getTxPriority returns a naive tx priority based on the amount of the smallest denomination of the gas price
// provided in a transaction.
// NOTE: This implementation should be used with a great consideration as it opens potential attack vectors
// where txs with multiple coins could not be prioritize as expected.
func getTxPriority(fee sdk.Coins, gas int64) int64 {
var priority int64
for _, c := range fee {
p := int64(math.MaxInt64)
gasPrice := c.Amount.QuoRaw(gas)
if gasPrice.IsInt64() {
p = gasPrice.Int64()
}
if priority == 0 || p < priority {
priority = p
}
}
return priority
}
+167 -46
View File
@@ -3,19 +3,15 @@ package app
import (
_ "embed"
"io"
"os"
"path/filepath"
dbm "github.com/cosmos/cosmos-db"
"cosmossdk.io/core/appconfig"
clienthelpers "cosmossdk.io/client/v2/helpers"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
auctionkeeper "git.vdb.to/cerc-io/laconicd/x/auction/keeper"
bondkeeper "git.vdb.to/cerc-io/laconicd/x/bond/keeper"
registrykeeper "git.vdb.to/cerc-io/laconicd/x/registry/keeper"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
@@ -25,36 +21,47 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
protocolpoolkeeper "github.com/cosmos/cosmos-sdk/x/protocolpool/keeper"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
auctionkeeper "git.vdb.to/cerc-io/laconicd/x/auction/keeper"
bondkeeper "git.vdb.to/cerc-io/laconicd/x/bond/keeper"
nitrokeeper "git.vdb.to/cerc-io/laconicd/x/nitro/keeper"
onboardingkeeper "git.vdb.to/cerc-io/laconicd/x/onboarding/keeper"
registrykeeper "git.vdb.to/cerc-io/laconicd/x/registry/keeper"
types "git.vdb.to/cerc-io/laconicd/x/types/v1"
_ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/auction/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/bond/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/registry/module" // import for side-effects
_ "cosmossdk.io/x/evidence" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/auth" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/protocolpool" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/auction/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/bond/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/onboarding/module" // import for side-effects
_ "git.vdb.to/cerc-io/laconicd/x/registry/module" // import for side-effects
)
// DefaultNodeHome default home directories for the application daemon
var DefaultNodeHome string
//go:embed app.yaml
var AppConfigYAML []byte
var (
_ runtime.AppI = (*LaconicApp)(nil)
_ servertypes.Application = (*LaconicApp)(nil)
@@ -70,43 +77,36 @@ type LaconicApp struct {
txConfig client.TxConfig
interfaceRegistry codectypes.InterfaceRegistry
// keepers
// essential keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
BankKeeper bankkeeper.BaseKeeper
StakingKeeper *stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
CrisisKeeper *crisiskeeper.Keeper
GovKeeper *govkeeper.Keeper
ConsensusParamsKeeper consensuskeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
// supplementary keepers
ProtocolPoolKeeper protocolpoolkeeper.Keeper
// laconic keepers
AuctionKeeper *auctionkeeper.Keeper // (Use * as per ProvideModule implementation)
BondKeeper *bondkeeper.Keeper
RegistryKeeper registrykeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper
BondKeeper *bondkeeper.Keeper
RegistryKeeper registrykeeper.Keeper
OnboardingKeeper *onboardingkeeper.Keeper
NitroKeeper nitrokeeper.Keeper
// simulation manager
sm *module.SimulationManager
}
func init() {
userHomeDir, err := os.UserHomeDir()
var err error
DefaultNodeHome, err = clienthelpers.GetNodeHomeDirectory(".laconicd")
if err != nil {
panic(err)
}
DefaultNodeHome = filepath.Join(userHomeDir, ".laconicd")
}
// AppConfig returns the default app config.
func AppConfig() depinject.Config {
return depinject.Configs(
appconfig.LoadYAML(AppConfigYAML),
depinject.Supply(
// supply custom module basics
map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
},
),
)
}
// NewLaconicApp returns a reference to an initialized LaconicApp.
@@ -121,16 +121,20 @@ func NewLaconicApp(
var (
app = &LaconicApp{}
appBuilder *runtime.AppBuilder
)
if err := depinject.Inject(
depinject.Configs(
AppConfig(),
appConfig = depinject.Configs(
AppModuleConfig,
depinject.Supply(
logger,
appOpts,
),
),
)
)
// if err := depinject.Inject(appConfig,
if err := depinject.InjectDebug(
depinject.FileLogger("/Users/roy/vulcanize/dump/laconic-debug/depinject_app.log"),
appConfig,
&appBuilder,
&app.appCodec,
&app.legacyAmino,
@@ -139,16 +143,32 @@ func NewLaconicApp(
&app.AccountKeeper,
&app.BankKeeper,
&app.StakingKeeper,
&app.SlashingKeeper,
&app.DistrKeeper,
&app.CrisisKeeper,
&app.GovKeeper,
&app.ConsensusParamsKeeper,
&app.EvidenceKeeper,
&app.ProtocolPoolKeeper,
&app.AuctionKeeper,
&app.BondKeeper,
&app.RegistryKeeper,
&app.OnboardingKeeper,
&app.NitroKeeper,
); err != nil {
return nil, err
}
// Register custom interfaces
RegisterCustomInterfaces(app.interfaceRegistry)
RegisterCustomLegacyAminoCodec(app.legacyAmino)
// create and set vote extension handler
voteExtOp := func(bApp *baseapp.BaseApp) {
voteExtHandler := app.NewVoteExtensionHandler()
voteExtHandler.SetHandlers(bApp)
}
baseAppOptions = append(baseAppOptions, voteExtOp, baseapp.SetOptimisticExecution())
app.App = appBuilder.Build(db, traceStore, baseAppOptions...)
// register streaming services
@@ -158,13 +178,14 @@ func NewLaconicApp(
/**** Module Options ****/
app.ModuleManager.RegisterInvariants(app.CrisisKeeper)
// create the simulation manager and define the order of the modules for deterministic simulations
// NOTE: this is not required apps that don't use the simulator for fuzz testing transactions
app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, make(map[string]module.AppModuleSimulation, 0))
app.sm.RegisterStoreDecoders()
// set custom ante handler
app.setAnteHandler()
if err := app.Load(loadLatest); err != nil {
return nil, err
}
@@ -172,12 +193,56 @@ func NewLaconicApp(
return app, nil
}
// setCustomAnteHandler overwrites default ante handlers with custom ante handlers
// Reference: https://github.com/cosmos/cosmos-sdk/blob/v0.50.10/x/auth/tx/config/config.go#L149
func (app *LaconicApp) setAnteHandler() error {
anteHandler, err := ante.NewAnteHandler(
ante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
SignModeHandler: app.txConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
TxFeeChecker: checkTxFeeWithValidatorMinGasPrices,
},
)
if err != nil {
return err
}
// Set the AnteHandler for the app
app.SetAnteHandler(anteHandler)
return nil
}
// LegacyAmino returns LaconicApp's amino codec.
//
// NOTE: This is solely to be used for testing purposes as it may be desirable
// for modules to register their own custom testing types.
func (app *LaconicApp) LegacyAmino() *codec.LegacyAmino {
return app.legacyAmino
}
// AppCodec returns LaconicApp's app codec.
//
// NOTE: This is solely to be used for testing purposes as it may be desirable
// for modules to register their own custom testing types.
func (app *LaconicApp) AppCodec() codec.Codec {
return app.appCodec
}
// InterfaceRegistry returns LaconicApp's InterfaceRegistry.
func (app *LaconicApp) InterfaceRegistry() codectypes.InterfaceRegistry {
return app.interfaceRegistry
}
// TxConfig returns LaconicApp's TxConfig
func (app *LaconicApp) TxConfig() client.TxConfig {
return app.txConfig
}
// GetKey returns the KVStoreKey for the provided store key.
//
// NOTE: This is solely to be used for testing purposes.
func (app *LaconicApp) GetKey(storeKey string) *storetypes.KVStoreKey {
sk := app.UnsafeFindStoreKey(storeKey)
kvStoreKey, ok := sk.(*storetypes.KVStoreKey)
@@ -212,3 +277,59 @@ func (app *LaconicApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.AP
panic(err)
}
}
func RegisterCustomInterfaces(interfaceRegistry codectypes.InterfaceRegistry) {
// Custom LockupAccount type needs to be registered to be able to use it as a genesis account
interfaceRegistry.RegisterImplementations((*authtypes.GenesisAccount)(nil), &types.LockupAccount{})
// LockupAccount extends auth Account
interfaceRegistry.RegisterInterface(
"cosmos.auth.v1beta1.AccountI",
(*sdk.AccountI)(nil),
&types.LockupAccount{},
)
// LockupAccount extends auth ModuleAccount
interfaceRegistry.RegisterInterface(
"cosmos.auth.v1beta1.ModuleAccountI",
(*sdk.ModuleAccountI)(nil),
&types.LockupAccount{},
)
interfaceRegistry.RegisterInterface(
"cosmos.auth.v1beta1.GenesisAccount",
(*authtypes.GenesisAccount)(nil),
&types.LockupAccount{},
)
interfaceRegistry.RegisterInterface(
"cerc.types.v1.LockupAccountI",
(*types.LockupAccountI)(nil),
&types.LockupAccount{},
)
}
func RegisterCustomLegacyAminoCodec(registrar *codec.LegacyAmino) {
registrar.RegisterInterface((*types.LockupAccountI)(nil), nil)
registrar.RegisterConcrete(&types.LockupAccount{}, "laconic/LockupAccount", nil)
}
// setCustomAnteHandler overwrites default ante handlers with custom ante handlers
// Reference: https://github.com/cosmos/cosmos-sdk/blob/v0.50.10/x/auth/tx/config/config.go#L149
func (app *LaconicApp) setCustomAnteHandler() {
anteHandler, err := ante.NewAnteHandler(
ante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
SignModeHandler: app.txConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
TxFeeChecker: checkTxFeeWithValidatorMinGasPrices,
},
)
if err != nil {
panic(err)
}
// Set the AnteHandler for the app
app.SetAnteHandler(anteHandler)
}
+48 -6
View File
@@ -6,14 +6,35 @@ modules:
# During begin block slashing happens after distr.BeginBlocker so that
# there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant.
# NOTE: staking module is required if HistoricalEntries param > 0
begin_blockers: [distribution, staking]
end_blockers: [crisis, staking, auction, registry]
begin_blockers: [distribution, protocolpool, slashing, evidence, staking]
end_blockers: [gov, staking, protocolpool, auction, registry]
# NOTE: The genutils module must occur after staking so that pools are properly initialized with tokens from genesis accounts.
# NOTE: The genutils module must also occur after auth so that it can access the params from auth.
init_genesis: [auth, bank, distribution, staking, crisis, genutil, auction, bond, registry]
init_genesis:
- consensus
- auth
- bank
- distribution
- staking
- slashing
- gov
- genutil
- evidence
- protocolpool
- auction
- bond
- registry
- onboarding
- nitro
override_store_keys:
- module_name: auth
kv_store_key: acc
skip_store_keys:
- tx
- validate
- genutil
- runtime
- vesting
- name: auth
config:
"@type": cosmos.auth.module.v1.Module
@@ -25,20 +46,29 @@ modules:
permissions: [burner, staking]
- account: not_bonded_tokens_pool
permissions: [burner, staking]
- account: gov
permissions: [burner]
- account: protocolpool
- account: protocolpool_escrow
- account: auction
- account: auction_burn
- account: bond
- account: registry
- account: record_rent
- account: authority_rent
- account: lps_lockup
enable_unordered_transactions: true
- name: bank
config:
"@type": cosmos.bank.module.v1.Module
blocked_module_accounts_override:
[auth, distribution, bonded_tokens_pool, not_bonded_tokens_pool]
[fee_collector, distribution, bonded_tokens_pool, not_bonded_tokens_pool]
- name: staking
config:
"@type": cosmos.staking.module.v1.Module
- name: slashing
config:
"@type": cosmos.slashing.module.v1.Module
- name: distribution
config:
"@type": cosmos.distribution.module.v1.Module
@@ -51,9 +81,15 @@ modules:
- name: tx
config:
"@type": cosmos.tx.config.v1.Config
- name: crisis
- name: gov
config:
"@type": cosmos.crisis.module.v1.Module
"@type": cosmos.gov.module.v1.Module
- name: evidence
config:
"@type": cosmos.evidence.module.v1.Module
- name: protocolpool
config:
"@type": cosmos.protocolpool.module.v1.Module
- name: bond
config:
"@type": cerc.bond.module.v1.Module
@@ -63,3 +99,9 @@ modules:
- name: registry
config:
"@type": cerc.registry.module.v1.Module
- name: onboarding
config:
"@type": cerc.onboarding.module.v1.Module
- name: nitro
config:
"@type": cerc.nitro.module.v1.Module
+50
View File
@@ -0,0 +1,50 @@
package app
import (
"fmt"
"testing"
abci "github.com/cometbft/cometbft/abci/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"
"cosmossdk.io/log"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
)
func TestLaconicAppExportAndBlockedAccounts(t *testing.T) {
db := dbm.NewMemDB()
logger := log.NewTestLogger(t)
app := NewLaconicAppWithCustomOptions(t, false, SetupOptions{
Logger: logger.With("instance", "first"),
DB: db,
AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
})
// BlockedAddresses returns a map of addresses in app v1 and a map of modules name in app di.
for _, acc := range BlockedAccounts() {
addr := app.AccountKeeper.GetModuleAddress(acc)
require.True(
t,
app.BankKeeper.BlockedAddr(addr),
fmt.Sprintf("ensure that blocked addresses are properly set in bank keeper: %s should be blocked", acc),
)
}
// finalize block so we have CheckTx state set
_, err := app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: 1,
})
require.NoError(t, err)
_, err = app.Commit()
require.NoError(t, err)
// Making a new app object with the db, so that initchain hasn't been called
app2, err := NewLaconicApp(logger.With("instance", "second"), db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()))
require.NoError(t, err)
_, err = app2.ExportAppStateAndValidators(false, []string{}, []string{})
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
}
+42
View File
@@ -0,0 +1,42 @@
package app
import (
_ "embed"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"git.vdb.to/cerc-io/laconicd/server"
"git.vdb.to/cerc-io/laconicd/utils"
)
var (
//go:embed app.yaml
AppModuleConfigYAML []byte
// AppModuleConfig returns the default app config.
AppModuleConfig = depinject.Configs(
appconfig.LoadYAML(AppModuleConfigYAML),
depinject.Provide(
server.NewGasService,
),
depinject.Supply(
utils.NewAddressCodec,
utils.NewValidatorAddressCodec,
utils.NewConsensusAddressCodec,
// supply custom module basics
map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(
[]govclient.ProposalHandler{},
),
},
),
)
)
+62
View File
@@ -0,0 +1,62 @@
package config
import (
"fmt"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
"github.com/pelletier/go-toml/v2"
"git.vdb.to/cerc-io/laconicd/app/params"
"git.vdb.to/cerc-io/laconicd/server/nitro"
"git.vdb.to/cerc-io/laconicd/server/relay"
)
type LaconicAppConfig struct {
serverconfig.Config `mapstructure:",squash"`
customConfigs `mapstructure:",squash"`
}
// the custom parts of the full config, so we can encode them separately
type customConfigs struct {
Nitro nitro.Config `mapstructure:"nitro" toml:"nitro"`
Relay relay.Config `mapstructure:"relay" toml:"relay"`
}
var DefaultConfigTemplate string
func init() {
var err error
DefaultConfigTemplate, err = createConfigTemplate()
if err != nil {
panic(err)
}
}
func DefaultConfig() LaconicAppConfig {
srvCfg := serverconfig.DefaultConfig()
// In laconicd, we set the min gas prices to 0.
srvCfg.MinGasPrices = "0" + params.CoinUnit
// Now we set the custom config default values.
customAppConfig := LaconicAppConfig{
*srvCfg,
customConfigs{
Nitro: *nitro.DefaultConfig(),
Relay: *relay.DefaultConfig(),
},
}
return customAppConfig
}
func createConfigTemplate() (string, error) {
defaultCustomConfigs := customConfigs{
Nitro: *nitro.DefaultConfig(),
Relay: *relay.DefaultConfig(),
}
b, err := toml.Marshal(defaultCustomConfigs)
if err != nil {
return "", err
}
return fmt.Sprintf("%s\n%s", serverconfig.DefaultConfigTemplate, b), nil
}
+61 -42
View File
@@ -2,26 +2,25 @@ package app
import (
"encoding/json"
"errors"
"fmt"
"log"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
storetypes "cosmossdk.io/store/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
// ExportAppStateAndValidators exports the state of the application for a genesis file.
func (app *LaconicApp) ExportAppStateAndValidators(
forZeroHeight bool,
jailAllowedAddrs []string,
modulesToExport []string,
) (servertypes.ExportedApp, error) {
// ExportAppStateAndValidators exports the state of the application for a genesis
// file.
func (app *LaconicApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()})
ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
// We export at last height + 1, because that's the height at which
// CometBFT will start InitChain.
@@ -31,9 +30,9 @@ func (app *LaconicApp) ExportAppStateAndValidators(
app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs)
}
genState, err := app.ModuleManager.ExportGenesis(ctx, app.appCodec)
genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport)
if err != nil {
return servertypes.ExportedApp{}, fmt.Errorf("failed to export genesis state: %w", err)
return servertypes.ExportedApp{}, err
}
appState, err := json.MarshalIndent(genState, "", " ")
@@ -46,19 +45,18 @@ func (app *LaconicApp) ExportAppStateAndValidators(
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
ConsensusParams: app.GetConsensusParams(ctx),
}, err
}
// prepare for fresh start at zero height
// NOTE zero height genesis is a temporary feature, which will be deprecated in favour of export at a block height
// NOTE zero height genesis is a temporary feature which will be deprecated
//
// in favor of export at a block height
func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false
applyAllowedAddrs := len(jailAllowedAddrs) > 0
// check if there is a allowed address list
if len(jailAllowedAddrs) > 0 {
applyAllowedAddrs = true
}
allowedAddrsMap := make(map[string]bool)
@@ -73,15 +71,17 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
/* Handle fee distribution state. */
// withdraw all validator commission
_ = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator())
if err != nil {
panic(err)
}
_, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz)
return false
})
if err != nil {
panic(err)
}
// withdraw all delegator rewards
dels, err := app.StakingKeeper.GetAllDelegations(ctx)
@@ -95,10 +95,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
panic(err)
}
delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress)
if err != nil {
panic(err)
}
delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress)
_, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr)
}
@@ -114,23 +111,20 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
ctx = ctx.WithBlockHeight(0)
// reinitialize all validators
_ = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator())
if err != nil {
panic(err)
}
// donate any unwithdrawn outstanding reward fraction tokens to the community pool
scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz)
if err != nil {
panic(err)
}
feePool, err := app.DistrKeeper.FeePool.Get(ctx)
if err != nil {
panic(err)
}
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil {
panic(err)
@@ -148,11 +142,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
if err != nil {
panic(err)
}
delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress)
if err != nil {
panic(err)
}
delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress)
if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil {
// never called as BeforeDelegationCreated always returns nil
@@ -171,36 +161,45 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
/* Handle staking state. */
// iterate through redelegations, reset creation height
_ = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
for i := range red.Entries {
red.Entries[i].CreationHeight = 0
}
_ = app.StakingKeeper.SetRedelegation(ctx, red)
err = app.StakingKeeper.SetRedelegation(ctx, red)
if err != nil {
panic(err)
}
return false
})
if err != nil {
panic(fmt.Errorf("error while iterating redelegations: %w", err))
}
// iterate through unbonding delegations, reset creation height
_ = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
for i := range ubd.Entries {
ubd.Entries[i].CreationHeight = 0
}
_ = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
if err != nil {
panic(err)
}
return false
})
if err != nil {
panic(fmt.Errorf("error while iterating unbonding delegations: %w", err))
}
// Iterate through validators by power descending, reset bond heights, and
// update bond intra-tx counters.
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
counter := int16(0)
for ; iter.Valid(); iter.Next() {
addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key()))
validator, err := app.StakingKeeper.GetValidator(ctx, addr)
if errors.Is(err, stakingtypes.ErrNoValidatorFound) {
if err != nil {
panic("expected validator, not found")
} else if err != nil {
panic(err)
}
validator.UnbondingHeight = 0
@@ -208,8 +207,10 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
validator.Jailed = true
}
_ = app.StakingKeeper.SetValidator(ctx, validator)
counter++
err = app.StakingKeeper.SetValidator(ctx, validator)
if err != nil {
panic(fmt.Errorf("unable to set validator: %w", err))
}
}
if err := iter.Close(); err != nil {
@@ -221,4 +222,22 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
if err != nil {
log.Fatal(err)
}
/* Handle slashing state. */
// reset start height on signing infos
err = app.SlashingKeeper.IterateValidatorSigningInfos(
ctx,
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
info.StartHeight = 0
err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
if err != nil {
panic("unable to set validator signing info")
}
return false
},
)
if err != nil {
panic(fmt.Errorf("error while iterating validator signing info: %w", err))
}
}
+13 -3
View File
@@ -10,9 +10,14 @@ import (
)
const (
CoinUnit = "photon"
// Registered token
LpsCoinUnit = "lps"
LpsBaseCoinUnit = "alps"
LpsExponent = 18
DefaultBondDenom = CoinUnit
// Native token, only denominated in alnt
// Used for staking, fees and laconic module ops
CoinUnit = "alnt"
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address.
Bech32PrefixAccAddr = "laconic"
@@ -34,10 +39,15 @@ var (
func init() {
SetAddressPrefixes()
RegisterDenoms()
sdk.DefaultBondDenom = CoinUnit
}
func RegisterDenoms() {
err := sdk.RegisterDenom(CoinUnit, math.LegacyOneDec())
err := sdk.RegisterDenom(LpsCoinUnit, math.LegacyOneDec())
if err != nil {
panic(err)
}
err = sdk.RegisterDenom(LpsBaseCoinUnit, math.LegacyNewDecWithPrec(1, LpsExponent))
if err != nil {
panic(err)
}
@@ -0,0 +1,154 @@
package cmd
import (
"encoding/json"
"fmt"
"os"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
types "git.vdb.to/cerc-io/laconicd/x/types/v1"
)
const (
flagAppendMode = "append"
)
// AddGenesisLockupAccountCmd returns add-genesis-lockup-account cobra Command.
func AddGenesisLockupAccountCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "add-genesis-lockup-account <account_name> <distribution-json-file> <coin>[,<coin>...]",
Short: "Add genesis lockup account with give name",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
config.SetRoot(clientCtx.HomeDir)
moduleName := args[0]
distributionFilePath := args[1]
var distribution []interface{}
distributionBytes, err := os.ReadFile(distributionFilePath)
if err != nil {
return fmt.Errorf("failed to read %s file: %w", distributionFilePath, err)
}
if err = json.Unmarshal(distributionBytes, &distribution); err != nil {
return fmt.Errorf("distribution is invalid json: %v", err)
}
appendflag, _ := cmd.Flags().GetBool(flagAppendMode)
return AddGenesisLockupAccount(clientCtx.Codec, moduleName, string(distributionBytes), appendflag, config.GenesisFile(), args[2])
},
}
cmd.Flags().Bool(flagAppendMode, false, "append the coins to an account already in the genesis.json file")
return cmd
}
func AddGenesisLockupAccount(
cdc codec.Codec,
moduleName string,
distribution string,
appendAcct bool,
genesisFileURL, amountStr string,
) error {
coins, err := sdk.ParseCoinsNormalized(amountStr)
if err != nil {
return fmt.Errorf("failed to parse coins: %w", err)
}
// create concrete account type based on input parameters
moduleAccount := authtypes.NewEmptyModuleAccount(moduleName)
accAddr := moduleAccount.GetAddress()
balances := banktypes.Balance{Address: accAddr.String(), Coins: coins.Sort()}
genAccount := &types.LockupAccount{
BaseAccount: moduleAccount.BaseAccount,
Name: moduleAccount.Name,
Distribution: distribution,
}
if err := genAccount.Validate(); err != nil {
return fmt.Errorf("failed to validate new genesis account: %w", err)
}
appState, appGenesis, err := genutiltypes.GenesisStateFromGenFile(genesisFileURL)
if err != nil {
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
}
authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState)
accs, err := authtypes.UnpackAccounts(authGenState.Accounts)
if err != nil {
return fmt.Errorf("failed to get accounts from any: %w", err)
}
bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState)
if accs.Contains(accAddr) {
if !appendAcct {
return fmt.Errorf(" Account %s already exists\nUse `append` flag to append account at existing address", accAddr)
}
genesisB := banktypes.GetGenesisStateFromAppState(cdc, appState)
for idx, acc := range genesisB.Balances {
if acc.Address != accAddr.String() {
continue
}
updatedCoins := acc.Coins.Add(coins...)
bankGenState.Balances[idx] = banktypes.Balance{Address: accAddr.String(), Coins: updatedCoins.Sort()}
break
}
} else {
// Add the new account to the set of genesis accounts and sanitize the accounts afterwards.
accs = append(accs, genAccount)
accs = authtypes.SanitizeGenesisAccounts(accs)
genAccs, err := authtypes.PackAccounts(accs)
if err != nil {
return fmt.Errorf("failed to convert accounts into any's: %w", err)
}
authGenState.Accounts = genAccs
authGenStateBz, err := cdc.MarshalJSON(&authGenState)
if err != nil {
return fmt.Errorf("failed to marshal auth genesis state: %w", err)
}
appState[authtypes.ModuleName] = authGenStateBz
bankGenState.Balances = append(bankGenState.Balances, balances)
}
bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances)
bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...)
bankGenStateBz, err := cdc.MarshalJSON(bankGenState)
if err != nil {
return fmt.Errorf("failed to marshal bank genesis state: %w", err)
}
appState[banktypes.ModuleName] = bankGenStateBz
appStateJSON, err := json.Marshal(appState)
if err != nil {
return fmt.Errorf("failed to marshal application genesis state: %w", err)
}
appGenesis.AppState = appStateJSON
return genutil.ExportGenesisFile(appGenesis, genesisFileURL)
}
+93 -44
View File
@@ -1,21 +1,18 @@
package cmd
import (
"context"
"errors"
"io"
"github.com/cometbft/cometbft/node"
dbm "github.com/cosmos/cosmos-db"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/sync/errgroup"
"cosmossdk.io/log"
confixcmd "cosmossdk.io/tools/confix/cmd"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/cosmos/cosmos-sdk/client/rpc"
@@ -25,47 +22,104 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/gql"
laconicserver "git.vdb.to/cerc-io/laconicd/server"
"git.vdb.to/cerc-io/laconicd/server/nitro"
"git.vdb.to/cerc-io/laconicd/server/relay"
)
func initRootCmd(rootCmd *cobra.Command, txConfig client.TxConfig, basicManager module.BasicManager) {
func initRootCmd(
rootCmd *cobra.Command,
txConfig client.TxConfig,
basicManager module.BasicManager,
) *laconicserver.ServerAux {
cfg := sdk.GetConfig()
cfg.Seal()
rootCmd.AddCommand(
genutilcli.InitCmd(basicManager, app.DefaultNodeHome),
NewTestnetCmd(basicManager, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
confixcmd.ConfigCommand(),
pruning.Cmd(newApp, app.DefaultNodeHome),
snapshot.Cmd(newApp),
)
server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, func(startCmd *cobra.Command) {
// Override start command to run the GQL server
newStartCmd := server.StartCmdWithOptions(newApp, app.DefaultNodeHome, server.StartCmdOptions{
PostSetup: func(svrCtx *server.Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error {
g.Go(func() error {
return gql.Server(ctx, clientCtx, svrCtx.Logger.With("module", "gql-server"))
})
return nil
},
})
startCmd.RunE = newStartCmd.RunE
addStartComponents := func(startCmd *cobra.Command) {
laconicserver.SetRequiredComponents(startCmd, &gql.Server{}, &nitro.Server{}, &relay.Server{})
}
var srv laconicserver.ServerAux
server.AddCommandsWithStartCmdOptions(rootCmd, app.DefaultNodeHome, newApp, appExport, server.StartCmdOptions{
AddFlags: addStartComponents,
// reactors will be configured at start, after the command is fully initialized
CometNodeOptions: []node.Option{srv.AddReactors},
})
// Capture the genesis command from genutilcli and add new commands
genesisCmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome)
genesisCmd.AddCommand(AddGenesisLockupAccountCmd())
// add keybase, auxiliary RPC, query, genesis, and tx child commands
rootCmd.AddCommand(
server.StatusCommand(),
genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome),
genesisCommand(txConfig, basicManager),
queryCommand(),
txCommand(),
keys.Commands(),
)
return &srv
}
// initializes all server components needed by a command
func initComponents(
configMap laconicserver.ConfigMap,
clientCtx client.Context,
logger log.Logger,
needComponent func(string) bool,
) ([]laconicserver.ServerComponent, error) {
var (
components []laconicserver.ServerComponent
gqlServer = &gql.Server{}
nitroServer = &nitro.Server{}
relayServer = &relay.Server{}
err error
)
if needComponent(gqlServer.Name()) {
gqlServer, err = gql.New(clientCtx, configMap, logger.With("module", "gql-server"))
if err != nil {
return nil, err
}
components = append(components, gqlServer)
}
if needComponent(nitroServer.Name()) {
nitroServer, err = nitro.New(configMap, logger, clientCtx.Keyring)
if err != nil {
return nil, err
}
components = append(components, nitroServer)
}
if needComponent(relayServer.Name()) {
relayServer, err = relay.New(configMap, logger)
if err != nil {
return nil, err
}
components = append(components, relayServer)
}
return components, nil
}
// genesisCommand builds genesis-related `laconicd genesis` command. Users may provide application specific commands as a parameter
func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command {
cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome)
for _, subCmd := range cmds {
cmd.AddCommand(subCmd)
}
return cmd
}
func queryCommand() *cobra.Command {
@@ -79,7 +133,7 @@ func queryCommand() *cobra.Command {
}
cmd.AddCommand(
rpc.ValidatorCommand(),
rpc.WaitTxCmd(),
server.QueryBlockCmd(),
authcmd.QueryTxsByEventsCmd(),
server.QueryBlocksCmd(),
@@ -114,18 +168,26 @@ func txCommand() *cobra.Command {
return cmd
}
// newApp is an appCreator
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application {
// newApp creates the application
func newApp(
logger log.Logger,
db dbm.DB,
traceStore io.Writer,
appOpts servertypes.AppOptions,
) servertypes.Application {
baseappOptions := server.DefaultBaseappOptions(appOpts)
app, err := app.NewLaconicApp(logger, db, traceStore, true, appOpts, baseappOptions...)
ret, err := app.NewLaconicApp(
logger, db, traceStore, true,
appOpts,
baseappOptions...,
)
if err != nil {
panic(err)
}
return app
return ret
}
// appExport creates a new app (optionally at a given height) and exports state.
// appExport creates a new laconicd (optionally at a given height) and exports state.
func appExport(
logger log.Logger,
db dbm.DB,
@@ -136,18 +198,6 @@ func appExport(
appOpts servertypes.AppOptions,
modulesToExport []string,
) (servertypes.ExportedApp, error) {
var (
laconicApp *app.LaconicApp
err error
)
// this check is necessary as we use the flag in x/upgrade.
// we can exit more gracefully by checking the flag here.
homePath, ok := appOpts.Get(flags.FlagHome).(string)
if !ok || homePath == "" {
return servertypes.ExportedApp{}, errors.New("application home not set")
}
viperAppOpts, ok := appOpts.(*viper.Viper)
if !ok {
return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper")
@@ -157,18 +207,17 @@ func appExport(
viperAppOpts.Set(server.FlagInvCheckPeriod, 1)
appOpts = viperAppOpts
var laconicApp *app.LaconicApp
var err error
if height != -1 {
laconicApp, err = app.NewLaconicApp(logger, db, traceStore, false, appOpts)
if err != nil {
if laconicApp, err = app.NewLaconicApp(logger, db, traceStore, false, appOpts); err != nil {
return servertypes.ExportedApp{}, err
}
if err := laconicApp.LoadHeight(height); err != nil {
if err = laconicApp.LoadHeight(height); err != nil {
return servertypes.ExportedApp{}, err
}
} else {
laconicApp, err = app.NewLaconicApp(logger, db, traceStore, true, appOpts)
if err != nil {
if laconicApp, err = app.NewLaconicApp(logger, db, traceStore, true, appOpts); err != nil {
return servertypes.ExportedApp{}, err
}
}
+36
View File
@@ -0,0 +1,36 @@
package cmd
import (
"time"
cmtcfg "github.com/cometbft/cometbft/config"
)
// initCometBFTConfig helps to override default CometBFT config values.
func initCometBFTConfig() *cmtcfg.Config {
cfg := cmtcfg.DefaultConfig()
// display only warn logs by default for builtin modules except server, p2p, state
cfg.LogLevel = "*:warn,server:info,p2p:info,state:info"
cfg.LogLevel += ",auction:info,bond:info,registry:info,gql-server:info"
// // TODO: understand full meaning of these settings
cfg.Consensus.TimeoutPropose = 5000 * time.Millisecond
// cfg.Consensus.TimeoutProposeDelta = 500 * time.Millisecond
// cfg.Consensus.TimeoutPrevote = 1000 * time.Millisecond
// cfg.Consensus.TimeoutPrevoteDelta = 500 * time.Millisecond
// cfg.Consensus.TimeoutPrecommit = 1000 * time.Millisecond
// cfg.Consensus.TimeoutPrecommitDelta = 500 * time.Millisecond
// // start new block as soon as 2/3 precommits are received
// cfg.Consensus.TimeoutCommit = 0 * time.Second
cfg.Consensus.CreateEmptyBlocks = false
// overwrite default pprof listen address
cfg.RPC.PprofListenAddress = "localhost:6060"
// use previous db backend
cfg.DBBackend = "goleveldb"
return cfg
}
+87
View File
@@ -0,0 +1,87 @@
package cmd
import (
"fmt"
"io"
"log/slog"
"math"
"time"
"cosmossdk.io/log"
sdk_slog "cosmossdk.io/log/slog"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/lmittmann/tint"
"git.vdb.to/cerc-io/laconicd/server"
)
func createSlogLogger(cfg server.ConfigMap, out io.Writer) (log.Logger, error) {
handler, err := createSlogHandler(cfg, out)
if err != nil {
return nil, err
}
return sdk_slog.NewCustomLogger(slog.New(handler)), nil
}
func createSlogHandler(cfg server.ConfigMap, out io.Writer) (slog.Handler, error) {
var (
format string
noColor bool
level string
)
if v, ok := cfg[flags.FlagLogFormat]; ok {
format = v.(string)
}
if v, ok := cfg[flags.FlagLogNoColor]; ok {
noColor = v.(bool)
}
if v, ok := cfg[flags.FlagLogLevel]; ok {
level = v.(string)
}
logLvl, err := parseSlogLevel(level)
if err != nil {
// If the log level is not a valid zerolog level, then we try to parse it as a key filter.
filterFunc, err := log.ParseLogLevelWithParser(level, parseSlogLevel)
if err != nil {
return nil, err
}
out = log.NewFilterWriter(out, filterFunc)
}
var handler slog.Handler
// if json format is requested, ignore no_color
if format == flags.OutputFormatJSON {
handler = slog.NewJSONHandler(out, &slog.HandlerOptions{
Level: logLvl,
})
} else {
handler = tint.NewHandler(out, &tint.Options{
Level: logLvl,
TimeFormat: time.RFC3339Nano,
NoColor: noColor,
})
}
return handler, nil
}
func parseSlogLevel(l string) (slog.Level, error) {
// Legal log level values are hardcoded into server/v2 command factory:
// (trace|debug|info|warn|error|fatal|panic|disabled or '*:<level>,<key>:<level>')
// however, slog only has debug, info, warn, error
switch l {
case "debug", "trace":
return slog.LevelDebug, nil
case "info":
return slog.LevelInfo, nil
case "warn":
return slog.LevelWarn, nil
case "error":
return slog.LevelError, nil
case "fatal", "panic":
return slog.LevelError, nil
case "disabled":
return slog.Level(math.MaxInt), nil
}
return 0, fmt.Errorf("invalid log level: %s", l)
}
+101 -69
View File
@@ -2,39 +2,42 @@ package cmd
import (
"os"
"time"
cmtcfg "github.com/cometbft/cometbft/config"
"github.com/spf13/cobra"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
"cosmossdk.io/client/v2/autocli"
clientv2keyring "cosmossdk.io/client/v2/autocli/keyring"
"cosmossdk.io/core/address"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
clientconfig "github.com/cosmos/cosmos-sdk/client/config"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/gql"
appconfig "git.vdb.to/cerc-io/laconicd/app/config"
)
const EnvPrefix = "LACONIC"
const (
// EnvPrefix is the environment variable prefix for the application
EnvPrefix = "LACONIC"
// NewRootCmd creates a new root command for laconicd. It is called once in the
// main function.
func NewRootCmd() *cobra.Command {
// DefaultNodeHome is the default data directory name for the application
DefaultNodeHome = ".laconicd"
)
// NewRootCmd creates a new root command for laconicd. It is called once in the main function.
func NewRootCmd(args ...string) (*cobra.Command, error) {
var (
txConfigOpts tx.ConfigOptions
autoCliOpts autocli.AppOptions
@@ -43,13 +46,12 @@ func NewRootCmd() *cobra.Command {
)
if err := depinject.Inject(
depinject.Configs(app.AppConfig(),
depinject.Configs(app.AppModuleConfig,
depinject.Supply(
log.NewNopLogger(),
),
depinject.Provide(
ProvideClientContext,
ProvideKeyring,
),
),
&txConfigOpts,
@@ -57,68 +59,34 @@ func NewRootCmd() *cobra.Command {
&moduleBasicManager,
&clientCtx,
); err != nil {
panic(err)
return nil, err
}
rootCmd := &cobra.Command{
Use: "laconicd",
Short: "Laconic Daemon",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())
clientCtx = clientCtx.WithCmdContext(cmd.Context()).WithViper(EnvPrefix)
clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags())
if err != nil {
return err
}
clientCtx, err = config.ReadFromClientConfig(clientCtx)
if err != nil {
return err
}
// sign mode textual is only available in online mode
if !clientCtx.Offline {
// This needs to go after ReadFromClientConfig, as that function ets the RPC client needed for SIGN_MODE_TEXTUAL.
txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx)
txConfigWithTextual, err := tx.NewTxConfigWithOptions(codec.NewProtoCodec(clientCtx.InterfaceRegistry), txConfigOpts)
if err != nil {
return err
}
clientCtx = clientCtx.WithTxConfig(txConfigWithTextual)
}
if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil {
return err
}
// overwrite the minimum gas price from the app configuration
srvCfg := serverconfig.DefaultConfig()
srvCfg.MinGasPrices = "0photon"
// overwrite the block timeout
cmtCfg := cmtcfg.DefaultConfig()
cmtCfg.Consensus.TimeoutCommit = 3 * time.Second
cmtCfg.LogLevel = "*:error,p2p:info,state:info,auction:info,bond:info,registry:info,gql-server:info" // better default logging
return server.InterceptConfigsPreRunHandler(cmd, serverconfig.DefaultConfigTemplate, srvCfg, cmtCfg)
},
Use: "laconicd",
SilenceErrors: true,
SilenceUsage: true, // prevent usage printing on every error
PersistentPreRunE: RootCommandPersistentPreRun(clientCtx, txConfigOpts),
}
initRootCmd(rootCmd, clientCtx.TxConfig, moduleBasicManager)
initCtx := initRootCmd(rootCmd, clientCtx.TxConfig, moduleBasicManager)
nodeCmds := nodeservice.NewNodeCommands()
autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions)
autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions()
if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
panic(err)
return nil, err
}
rootCmd.SetArgs(args)
// Add flags for GQL server.
rootCmd = gql.AddGQLFlags(rootCmd)
return rootCmd
// now enhance the subcommand
subCmd, _, err := rootCmd.Find(args)
if err != nil {
return nil, err
}
initCtx.AddComponents(subCmd, initComponents)
return rootCmd, nil
}
func ProvideClientContext(
@@ -133,18 +101,24 @@ func ProvideClientContext(
WithTxConfig(txConfig).
WithLegacyAmino(legacyAmino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithHomeDir(app.DefaultNodeHome).
WithViper(EnvPrefix) // env variable prefix
// Read the config again to overwrite the default values with the values from the config file
clientCtx, _ = config.ReadFromClientConfig(clientCtx)
clientCtx, _ = clientconfig.ReadFromClientConfig(clientCtx)
// Workaround: Unset clientCtx.HomeDir and clientCtx.KeyringDir from depinject clientCtx as they are given precedence over the CLI args (--home flag) in some commands
// Workaround: Unset clientCtx.HomeDir and clientCtx.KeyringDir from depinject clientCtx as they are given precedence over
// the CLI args (--home flag) in some commands
// TODO: Implement proper fix
clientCtx.HomeDir = ""
clientCtx.KeyringDir = ""
// XXX TODO fix after rebase
// Custom LockupAccount type needs to be registered
// interfaceRegistry.RegisterImplementations((*types.LockupAccountI)(nil), &types.LockupAccount{})
// interfaceRegistry.RegisterImplementations((*authtypes.GenesisAccount)(nil), &types.LockupAccount{})
return clientCtx
}
@@ -156,3 +130,61 @@ func ProvideKeyring(clientCtx client.Context, addressCodec address.Codec) (clien
return keyring.NewAutoCLIKeyring(kb)
}
func RootCommandPersistentPreRun(
clientCtx client.Context,
txConfigOpts tx.ConfigOptions,
) func(*cobra.Command, []string) error {
return func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())
clientCtx = clientCtx.WithCmdContext(cmd.Context()).WithViper("")
clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags())
if err != nil {
return err
}
clientCtx, err = clientconfig.ReadFromClientConfig(clientCtx)
if err != nil {
return err
}
// This needs to go after ReadFromClientConfig, as that function
// sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode
// is only available if the client is online.
if !clientCtx.Offline {
txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx)
txConfigWithTextual, err := tx.NewTxConfigWithOptions(codec.NewProtoCodec(clientCtx.InterfaceRegistry), txConfigOpts)
if err != nil {
return err
}
clientCtx = clientCtx.WithTxConfig(txConfigWithTextual)
}
if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil {
return err
}
appConfig := appconfig.DefaultConfig()
cmtConfig := initCometBFTConfig()
serverCtx, err := server.InterceptConfigsAndCreateContext(
cmd, appconfig.DefaultConfigTemplate, appConfig, cmtConfig,
)
if err != nil {
return err
}
// use slog-based logger to combine with nitro logs
logger, err := createSlogLogger(serverCtx.Viper.AllSettings(), cmd.OutOrStdout())
if err != nil {
return err
}
serverCtx.Logger = logger.With(log.ModuleKey, "server")
return server.SetCmdServerContext(cmd, serverCtx)
}
}
+67
View File
@@ -0,0 +1,67 @@
package cmd_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/flags"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/cmd/laconicd/cmd"
)
func TestInitCmd(t *testing.T) {
rootCmd, err := cmd.NewRootCmd()
require.NoError(t, err)
rootCmd.SetArgs([]string{
"init", // Test the init cmd
"simapp-test", // Moniker
fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists
})
require.NoError(t, svrcmd.Execute(rootCmd, "", app.DefaultNodeHome))
}
func TestHomeFlagRegistration(t *testing.T) {
homeDir := "/tmp/foo"
rootCmd, err := cmd.NewRootCmd()
require.NoError(t, err)
rootCmd.SetArgs([]string{
"query",
fmt.Sprintf("--%s", flags.FlagHome),
homeDir,
})
require.NoError(t, svrcmd.Execute(rootCmd, "", app.DefaultNodeHome))
result, err := rootCmd.Flags().GetString(flags.FlagHome)
require.NoError(t, err)
require.Equal(t, result, homeDir)
}
func TestHelpRequested(t *testing.T) {
argz := [][]string{
{"query", "--help"},
{"query", "tx", "-h"},
{"--help"},
{"start", "-h"},
}
for _, args := range argz {
rootCmd, err := cmd.NewRootCmd(args...)
require.NoError(t, err)
var out bytes.Buffer
rootCmd.SetArgs(args)
rootCmd.SetOut(&out)
require.NoError(t, rootCmd.Execute())
require.Contains(t, out.String(), args[0])
require.Contains(t, out.String(), "--help")
require.Contains(t, out.String(), "Usage:")
}
}
+598
View File
@@ -0,0 +1,598 @@
package cmd
import (
"bufio"
"encoding/json"
"fmt"
"net"
"os"
"path/filepath"
"time"
cmtcfg "github.com/cometbft/cometbft/config"
cmtconfig "github.com/cometbft/cometbft/config"
cmttime "github.com/cometbft/cometbft/types/time"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"cosmossdk.io/math"
"cosmossdk.io/math/unsafe"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/server"
srvconfig "github.com/cosmos/cosmos-sdk/server/config"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"git.vdb.to/cerc-io/laconicd/app"
appconfig "git.vdb.to/cerc-io/laconicd/app/config"
)
var (
flagNodeDirPrefix = "node-dir-prefix"
flagNumValidators = "validator-count"
flagOutputDir = "output-dir"
flagNodeDaemonHome = "node-daemon-home"
flagStartingIPAddress = "starting-ip-address"
flagListenIPAddress = "listen-ip-address"
flagEnableLogging = "enable-logging"
flagGRPCAddress = "grpc.address"
flagRPCAddress = "rpc.address"
flagAPIAddress = "api.address"
flagPrintMnemonic = "print-mnemonic"
flagStakingDenom = "staking-denom"
flagCommitTimeout = "commit-timeout"
flagSingleHost = "single-host"
)
type initArgs struct {
algo string
chainID string
keyringBackend string
minGasPrices string
nodeDaemonHome string
nodeDirPrefix string
numValidators int
outputDir string
startingIPAddress string
listenIPAddress string
singleMachine bool
bondTokenDenom string
}
type startArgs struct {
algo string
apiAddress string
chainID string
enableLogging bool
grpcAddress string
minGasPrices string
numValidators int
outputDir string
printMnemonic bool
rpcAddress string
timeoutCommit time.Duration
}
func addTestnetFlagsToCmd(cmd *cobra.Command) {
cmd.Flags().IntP(flagNumValidators, "v", 4, "Number of validators to initialize the testnet with")
cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet")
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)")
cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")
// support old flags name for backwards compatibility
cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
if name == flags.FlagKeyAlgorithm {
name = flags.FlagKeyType
}
return pflag.NormalizedName(name)
})
}
// NewTestnetCmd creates a root testnet command with subcommands to run an in-process testnet or initialize
// validator configuration files for running a multi-validator testnet in a separate process
func NewTestnetCmd(mm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command {
testnetCmd := &cobra.Command{
Use: "testnet",
Short: "subcommands for starting or configuring local testnets",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
testnetCmd.AddCommand(testnetStartCmd())
testnetCmd.AddCommand(testnetInitFilesCmd(mm, genBalIterator))
return testnetCmd
}
// testnetInitFilesCmd returns a cmd to initialize all files for CometBFT testnet and application
func testnetInitFilesCmd(mm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command {
cmd := &cobra.Command{
Use: "init-files",
Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)",
Long: fmt.Sprintf(`init-files will setup one directory per validator and populate each with
necessary files (private validator, genesis, config, etc.) for running validator nodes.
Booting up a network with these validator folders is intended to be used with Docker Compose,
or a similar setup where each node has a manually configurable IP address.
Note, strict routability for addresses is turned off in the config file.
Example:
%s testnet init-files --validator-count 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2
`, version.AppName),
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
config := cmtcfg.DefaultConfig()
args := initArgs{}
args.outputDir, _ = cmd.Flags().GetString(flagOutputDir)
args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend)
args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID)
args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices)
args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix)
args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome)
args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress)
args.listenIPAddress, _ = cmd.Flags().GetString(flagListenIPAddress)
args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators)
args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType)
args.bondTokenDenom, _ = cmd.Flags().GetString(flagStakingDenom)
args.singleMachine, _ = cmd.Flags().GetBool(flagSingleHost)
config.Consensus.TimeoutCommit, err = cmd.Flags().GetDuration(flagCommitTimeout)
if err != nil {
return err
}
return initTestnetFiles(clientCtx, cmd, config, mm, genBalIterator, args)
},
}
addTestnetFlagsToCmd(cmd)
cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix for the name of per-validator subdirectories (to be number-suffixed like node0, node1, ...)")
cmd.Flags().String(flagNodeDaemonHome, "laconicd", "Home directory of the node's daemon configuration")
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")
cmd.Flags().String(flagListenIPAddress, "127.0.0.1", "TCP or UNIX socket IP address for the RPC server to listen on")
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
cmd.Flags().Duration(flagCommitTimeout, 5*time.Second, "Time to wait after a block commit before starting on the new height")
cmd.Flags().Bool(flagSingleHost, false, "Cluster runs on a single host machine with different ports")
cmd.Flags().String(flagStakingDenom, sdk.DefaultBondDenom, "Default staking token denominator")
return cmd
}
// testnetStartCmd returns a cmd to start multi validator in-process testnet
func testnetStartCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "start",
Short: "Launch an in-process multi-validator testnet",
Long: fmt.Sprintf(`testnet will launch an in-process multi-validator testnet,
and generate a directory for each validator populated with necessary
configuration files (private validator, genesis, config, etc.).
Example:
%s testnet --validator-count 4 --output-dir ./.testnets
`, version.AppName),
RunE: func(cmd *cobra.Command, _ []string) (err error) {
args := startArgs{}
args.outputDir, _ = cmd.Flags().GetString(flagOutputDir)
args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID)
args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices)
args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators)
args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType)
args.enableLogging, _ = cmd.Flags().GetBool(flagEnableLogging)
args.rpcAddress, _ = cmd.Flags().GetString(flagRPCAddress)
args.apiAddress, _ = cmd.Flags().GetString(flagAPIAddress)
args.grpcAddress, _ = cmd.Flags().GetString(flagGRPCAddress)
args.printMnemonic, _ = cmd.Flags().GetBool(flagPrintMnemonic)
return startTestnet(cmd, args)
},
}
addTestnetFlagsToCmd(cmd)
cmd.Flags().Bool(flagEnableLogging, false, "Enable INFO logging of CometBFT validator nodes")
cmd.Flags().String(flagRPCAddress, "tcp://0.0.0.0:26657", "the RPC address to listen on")
cmd.Flags().String(flagAPIAddress, "tcp://0.0.0.0:1317", "the address to listen on for REST API")
cmd.Flags().String(flagGRPCAddress, "0.0.0.0:9090", "the gRPC server address to listen on")
cmd.Flags().Bool(flagPrintMnemonic, true, "print mnemonic of first validator to stdout for manual testing")
return cmd
}
const nodeDirPerm = 0o755
// initTestnetFiles initializes testnet files for a testnet to be run in a separate process
func initTestnetFiles(
clientCtx client.Context,
cmd *cobra.Command,
nodeConfig *cmtconfig.Config,
mm module.BasicManager,
genBalIterator banktypes.GenesisBalancesIterator,
args initArgs,
) error {
if args.chainID == "" {
args.chainID = "chain-" + unsafe.Str(6)
}
nodeIDs := make([]string, args.numValidators)
valPubKeys := make([]cryptotypes.PubKey, args.numValidators)
appConfig := appconfig.DefaultConfig()
appConfig.MinGasPrices = args.minGasPrices
appConfig.API.Enable = true
appConfig.Telemetry.Enabled = true
appConfig.Telemetry.PrometheusRetentionTime = 60
appConfig.Telemetry.EnableHostnameLabel = false
appConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}}
var (
genAccounts []authtypes.GenesisAccount
genBalances []banktypes.Balance
genFiles []string
)
const (
rpcPort = 26657
apiPort = 1317
grpcPort = 9090
)
p2pPortStart := 26656
inBuf := bufio.NewReader(cmd.InOrStdin())
// generate private keys, node IDs, and initial transactions
for i := 0; i < args.numValidators; i++ {
var portOffset int
if args.singleMachine {
portOffset = i
p2pPortStart = 16656 // use different start point to not conflict with rpc port
nodeConfig.P2P.AddrBookStrict = false
nodeConfig.P2P.PexReactor = false
nodeConfig.P2P.AllowDuplicateIP = true
appConfig.API.Address = fmt.Sprintf("tcp://0.0.0.0:%d", apiPort+portOffset)
appConfig.GRPC.Address = fmt.Sprintf("0.0.0.0:%d", grpcPort+portOffset)
}
nodeDirName := fmt.Sprintf("%s%d", args.nodeDirPrefix, i)
nodeDir := filepath.Join(args.outputDir, nodeDirName, args.nodeDaemonHome)
gentxsDir := filepath.Join(args.outputDir, "gentxs")
nodeConfig.SetRoot(nodeDir)
nodeConfig.Moniker = nodeDirName
nodeConfig.RPC.ListenAddress = fmt.Sprintf("tcp://%s:%d", args.listenIPAddress, rpcPort+portOffset)
if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil {
_ = os.RemoveAll(args.outputDir)
return err
}
var (
err error
ip string
)
if args.singleMachine {
ip = "127.0.0.1"
} else {
ip, err = getIP(i, args.startingIPAddress)
if err != nil {
_ = os.RemoveAll(args.outputDir)
return err
}
}
nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(nodeConfig)
if err != nil {
_ = os.RemoveAll(args.outputDir)
return err
}
memo := fmt.Sprintf("%s@%s:%d", nodeIDs[i], ip, p2pPortStart+portOffset)
genFiles = append(genFiles, nodeConfig.GenesisFile())
kb, err := keyring.New(sdk.KeyringServiceName(), args.keyringBackend, nodeDir, inBuf, clientCtx.Codec)
if err != nil {
return err
}
keyringAlgos, _ := kb.SupportedAlgorithms()
algo, err := keyring.NewSigningAlgoFromString(args.algo, keyringAlgos)
if err != nil {
return err
}
addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo)
if err != nil {
_ = os.RemoveAll(args.outputDir)
return err
}
info := map[string]string{"secret": secret}
cliPrint, err := json.Marshal(info)
if err != nil {
return err
}
// save private key seed words
if err := writeFile(fmt.Sprintf("%v.json", "key_seed"), nodeDir, cliPrint); err != nil {
return err
}
accTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction)
accStakingTokens := sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction)
coins := sdk.Coins{
sdk.NewCoin("testtoken", accTokens),
sdk.NewCoin(args.bondTokenDenom, accStakingTokens),
}
genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()})
genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0))
valAddr := sdk.ValAddress(addr)
valStr := valAddr.String()
valTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction)
createValMsg, err := stakingtypes.NewMsgCreateValidator(
valStr,
valPubKeys[i],
sdk.NewCoin(args.bondTokenDenom, valTokens),
stakingtypes.NewDescription(nodeDirName, "", "", "", ""),
stakingtypes.NewCommissionRates(math.LegacyOneDec(), math.LegacyOneDec(), math.LegacyOneDec()),
math.OneInt(),
)
if err != nil {
return err
}
txBuilder := clientCtx.TxConfig.NewTxBuilder()
if err := txBuilder.SetMsgs(createValMsg); err != nil {
return err
}
txBuilder.SetMemo(memo)
txFactory := tx.Factory{}
txFactory = txFactory.
WithChainID(args.chainID).
WithMemo(memo).
WithKeybase(kb).
WithTxConfig(clientCtx.TxConfig)
if err := tx.Sign(cmd.Context(), txFactory, nodeDirName, txBuilder, true); err != nil {
return err
}
txBz, err := clientCtx.TxConfig.TxJSONEncoder()(txBuilder.GetTx())
if err != nil {
return err
}
if err := writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz); err != nil {
return err
}
srvconfig.SetConfigTemplate(appconfig.DefaultConfigTemplate)
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig)
}
if err := initGenFiles(clientCtx, mm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil {
return err
}
err := collectGenFiles(
clientCtx, nodeConfig, args.chainID, nodeIDs, valPubKeys, args.numValidators,
args.outputDir, args.nodeDirPrefix, args.nodeDaemonHome, genBalIterator,
rpcPort, p2pPortStart, args.singleMachine,
)
if err != nil {
return err
}
server.GetServerContextFromCmd(cmd).Viper.Set(flags.FlagHome, nodeConfig.RootDir)
cmd.PrintErrf("Successfully initialized %d node directories\n", args.numValidators)
return nil
}
func initGenFiles(
clientCtx client.Context, mm module.BasicManager, chainID string,
genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance,
genFiles []string, numValidators int,
) error {
appGenState := mm.DefaultGenesis(clientCtx.Codec)
// set the accounts in the genesis state
var authGenState authtypes.GenesisState
clientCtx.Codec.MustUnmarshalJSON(appGenState[authtypes.ModuleName], &authGenState)
accounts, err := authtypes.PackAccounts(genAccounts)
if err != nil {
return err
}
authGenState.Accounts = accounts
appGenState[authtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&authGenState)
// set the balances in the genesis state
var bankGenState banktypes.GenesisState
clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState)
bankGenState.Balances = banktypes.SanitizeGenesisBalances(genBalances)
for _, bal := range bankGenState.Balances {
bankGenState.Supply = bankGenState.Supply.Add(bal.Coins...)
}
appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState)
appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ")
if err != nil {
return err
}
appGenesis := genutiltypes.NewAppGenesisWithVersion(chainID, appGenStateJSON)
// generate empty genesis files for each validator and save
for i := 0; i < numValidators; i++ {
if err := appGenesis.SaveAs(genFiles[i]); err != nil {
return err
}
}
return nil
}
func collectGenFiles(
clientCtx client.Context, nodeConfig *cmtconfig.Config, chainID string,
nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int,
outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator,
rpcPortStart, p2pPortStart int,
singleMachine bool,
) error {
var appState json.RawMessage
genTime := cmttime.Now()
for i := 0; i < numValidators; i++ {
if singleMachine {
portOffset := i
nodeConfig.RPC.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", rpcPortStart+portOffset)
nodeConfig.P2P.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%d", p2pPortStart+portOffset)
}
nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i)
nodeDir := filepath.Join(outputDir, nodeDirName, nodeDaemonHome)
gentxsDir := filepath.Join(outputDir, "gentxs")
nodeConfig.Moniker = nodeDirName
nodeConfig.SetRoot(nodeDir)
nodeID, valPubKey := nodeIDs[i], valPubKeys[i]
initCfg := genutiltypes.NewInitConfig(chainID, gentxsDir, nodeID, valPubKey)
appGenesis, err := genutiltypes.AppGenesisFromFile(nodeConfig.GenesisFile())
if err != nil {
return err
}
nodeAppState, err := genutil.GenAppStateFromConfig(
clientCtx.Codec,
clientCtx.TxConfig,
nodeConfig,
initCfg,
appGenesis,
genBalIterator,
genutiltypes.DefaultMessageValidator,
clientCtx.TxConfig.SigningContext().ValidatorAddressCodec(),
)
if err != nil {
return err
}
if appState == nil {
// set the canonical application state (they should not differ)
appState = nodeAppState
}
genFile := nodeConfig.GenesisFile()
// overwrite each validator's genesis file to have a canonical genesis time
if err := genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime); err != nil {
return err
}
}
return nil
}
func getIP(i int, startingIPAddr string) (ip string, err error) {
if len(startingIPAddr) == 0 {
ip, err = server.ExternalIP()
if err != nil {
return "", err
}
return ip, nil
}
return calculateIP(startingIPAddr, i)
}
func calculateIP(ip string, i int) (string, error) {
ipv4 := net.ParseIP(ip).To4()
if ipv4 == nil {
return "", fmt.Errorf("%v: non ipv4 address", ip)
}
for j := 0; j < i; j++ {
ipv4[3]++
}
return ipv4.String(), nil
}
func writeFile(name, dir string, contents []byte) error {
file := filepath.Join(dir, name)
if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("could not create directory %q: %w", dir, err)
}
if err := os.WriteFile(file, contents, 0o600); err != nil {
return err
}
return nil
}
// startTestnet starts an in-process testnet
func startTestnet(cmd *cobra.Command, args startArgs) error {
networkConfig := network.DefaultConfig(app.NewTestNetworkFixture)
// Default networkConfig.ChainID is random, and we should only override it if chainID provided
// is non-empty
if args.chainID != "" {
networkConfig.ChainID = args.chainID
}
networkConfig.SigningAlgo = args.algo
networkConfig.MinGasPrices = args.minGasPrices
networkConfig.NumValidators = args.numValidators
networkConfig.EnableLogging = args.enableLogging
networkConfig.RPCAddress = args.rpcAddress
networkConfig.APIAddress = args.apiAddress
networkConfig.GRPCAddress = args.grpcAddress
networkConfig.PrintMnemonic = args.printMnemonic
networkConfig.TimeoutCommit = args.timeoutCommit
networkLogger := network.NewCLILogger(cmd)
baseDir := fmt.Sprintf("%s/%s", args.outputDir, networkConfig.ChainID)
if _, err := os.Stat(baseDir); !os.IsNotExist(err) {
return fmt.Errorf(
"testnests directory already exists for chain-id '%s': %s, please remove or select a new --chain-id",
networkConfig.ChainID, baseDir)
}
testnet, err := network.New(networkLogger, baseDir, networkConfig)
if err != nil {
return err
}
if _, err := testnet.WaitForHeight(1); err != nil {
return err
}
cmd.Println("press the Enter Key to terminate")
if _, err := fmt.Scanln(); err != nil { // wait for Enter Key
return err
}
testnet.Cleanup()
return nil
}
+72
View File
@@ -0,0 +1,72 @@
package cmd
import (
"context"
"fmt"
"testing"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/types/module"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
"github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/staking"
)
func Test_TestnetCmd(t *testing.T) {
moduleBasic := module.NewBasicManager(
auth.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModuleBasic{},
staking.AppModuleBasic{},
distribution.AppModuleBasic{},
consensus.AppModuleBasic{},
)
home := t.TempDir()
encodingConfig := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, staking.AppModuleBasic{})
logger := log.NewNopLogger()
cfg, err := genutiltest.CreateDefaultCometConfig(home)
require.NoError(t, err)
err = genutiltest.ExecInitCmd(moduleBasic, home, encodingConfig.Codec)
require.NoError(t, err)
serverCtx := server.NewContext(viper.New(), cfg, logger)
clientCtx := client.Context{}.
WithCodec(encodingConfig.Codec).
WithHomeDir(home).
WithTxConfig(encodingConfig.TxConfig)
ctx := context.Background()
ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx)
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
cmd := testnetInitFilesCmd(moduleBasic, banktypes.GenesisBalancesIterator{})
cmd.SetArgs([]string{
fmt.Sprintf("--%s=test", flags.FlagKeyringBackend, keyring.BackendTest),
fmt.Sprintf("--output-dir=%s", home),
})
err = cmd.ExecuteContext(ctx)
require.NoError(t, err)
genFile := cfg.GenesisFile()
appState, _, err := genutiltypes.GenesisStateFromGenFile(genFile)
require.NoError(t, err)
bankGenState := banktypes.GetGenesisStateFromAppState(encodingConfig.Codec, appState)
require.NotEmpty(t, bankGenState.Supply.String())
}
-28
View File
@@ -1,28 +0,0 @@
package main_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/flags"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/cmd/laconicd/cmd"
)
func TestInitCmd(t *testing.T) {
rootCmd := cmd.NewRootCmd()
rootCmd.SetArgs([]string{
"init", // Test the init cmd
"localtestnet", // Moniker
fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists
fmt.Sprintf("--%s=%s", flags.FlagChainID, "laconic_9000-1"),
})
err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome)
require.NoError(t, err)
}
+16 -6
View File
@@ -1,22 +1,32 @@
package main
import (
"errors"
"fmt"
"os"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"git.vdb.to/cerc-io/laconicd/app"
"git.vdb.to/cerc-io/laconicd/app/params"
_ "git.vdb.to/cerc-io/laconicd/app/params" // import for side-effects
"git.vdb.to/cerc-io/laconicd/cmd/laconicd/cmd"
)
func main() {
params.SetAddressPrefixes()
rootCmd := cmd.NewRootCmd()
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
fmt.Fprintln(rootCmd.OutOrStderr(), err)
// reproduce default cobra behavior so that eager parsing of flags is possible.
// see: https://github.com/spf13/cobra/blob/e94f6d0dd9a5e5738dca6bce03c4b1207ffbc0ec/command.go#L1082
args := os.Args[1:]
rootCmd, err := cmd.NewRootCmd(args...)
if err != nil {
if _, pErr := fmt.Fprintln(os.Stderr, err); pErr != nil {
panic(errors.Join(err, pErr))
}
os.Exit(1)
}
if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil {
if _, pErr := fmt.Fprintln(rootCmd.OutOrStderr(), err); pErr != nil {
panic(errors.Join(err, pErr))
}
os.Exit(1)
}
}
+209 -120
View File
@@ -1,8 +1,8 @@
module git.vdb.to/cerc-io/laconicd
go 1.21
go 1.23.5
toolchain go1.21.0
toolchain go1.23.6
replace (
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
@@ -12,182 +12,271 @@ replace (
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
// DEV
replace (
cosmossdk.io/client/v2 => ../mod/cosmos-sdk/client/v2
cosmossdk.io/log => ../mod/cosmos-sdk/log
cosmossdk.io/systemtests => ../mod/cosmos-sdk/systemtests
cosmossdk.io/tools/confix => ../mod/cosmos-sdk/tools/confix
github.com/cometbft/cometbft => ../mod/cometbft
// github.com/cometbft/cometbft/api => ../mod/cometbft/api
github.com/cosmos/cosmos-sdk => ../mod/cosmos-sdk
)
// DEV - nitro deps
replace (
// github.com/ethereum/go-ethereum => ../mod/go-ethereum
git.vdb.to/cerc-io/chainsig => ../mod/chainsig
github.com/statechannels/go-nitro => ../mod/go-nitro
go.dedis.ch/kyber/v3 => ../mod/kyber
// go.dedis.ch/kyber/v3 => github.com/cerc-io/kyber/v3 v3.0.0-20250728035006-f80208a7f291 // branch dev-3.x
)
require (
cosmossdk.io/api v0.7.2
cosmossdk.io/client/v2 v2.0.0-beta.1
cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.11.0
cosmossdk.io/depinject v1.0.0-alpha.4
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.3.0
cosmossdk.io/math v1.2.0
cosmossdk.io/store v1.0.2
cosmossdk.io/tools/confix v0.1.0
cosmossdk.io/api v0.9.2
cosmossdk.io/client/v2 v2.0.0-00010101000000-000000000000
cosmossdk.io/collections v1.3.1
cosmossdk.io/core v0.11.3
cosmossdk.io/depinject v1.2.1
cosmossdk.io/errors v1.0.2
cosmossdk.io/log v1.6.0
cosmossdk.io/math v1.5.3
cosmossdk.io/store v1.1.2
cosmossdk.io/systemtests v1.2.1
cosmossdk.io/tools/confix v0.1.2
cosmossdk.io/x/evidence v0.2.0
git.vdb.to/cerc-io/chain-signatures v0.1.0
github.com/99designs/gqlgen v0.17.22
github.com/cometbft/cometbft v0.38.2
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.3
github.com/cometbft/cometbft v0.38.17
github.com/cosmos/cosmos-db v1.1.3
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.53.0
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/gogoproto v1.7.0
github.com/deckarep/golang-set v1.8.0
github.com/ethereum/go-ethereum v1.16.1
github.com/gibson042/canonicaljson-go v1.0.3
github.com/go-chi/chi/v5 v5.0.8
github.com/golang/protobuf v1.5.3
github.com/go-chi/chi/v5 v5.2.2
github.com/golang/protobuf v1.5.4
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-cid v0.5.0
github.com/ipld/go-ipld-prime v0.21.0
github.com/rs/cors v1.8.3
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
github.com/vektah/gqlparser/v2 v2.5.11
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.6.0
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
github.com/lmittmann/tint v1.1.2
github.com/mitchellh/mapstructure v1.5.0
github.com/pelletier/go-toml/v2 v2.2.4
github.com/rs/cors v1.11.1
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.7
github.com/spf13/viper v1.20.1
github.com/statechannels/go-nitro v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
github.com/vektah/gqlparser/v2 v2.5.30
go.dedis.ch/kyber/v3 v3.1.0
golang.org/x/time v0.10.0
google.golang.org/genproto/googleapis/api v0.0.0-20250528174236-200df99c418a
google.golang.org/grpc v1.72.2
google.golang.org/protobuf v1.36.6
gopkg.in/yaml.v3 v3.0.1
)
require (
cosmossdk.io/x/tx v0.13.0 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
cosmossdk.io/schema v1.1.0 // indirect
cosmossdk.io/x/tx v0.14.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/DataDog/zstd v1.5.7 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/agnivade/levenshtein v1.2.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/bgentry/speakeasy v0.2.0 // indirect
github.com/bits-and-blooms/bitset v1.22.0 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20231101195458-481da04154d6 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/errors v1.12.0 // indirect
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
github.com/cockroachdb/pebble v1.1.5 // indirect
github.com/cockroachdb/redact v1.1.6 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/cometbft/cometbft-db v0.14.1 // indirect
github.com/consensys/gnark-crypto v0.18.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.0.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect
github.com/cosmos/iavl v1.2.2 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.14.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/creachadair/atomicfile v0.3.7 // indirect
github.com/creachadair/tomledit v0.0.27 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/emicklei/dot v1.6.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/ferranbt/fastssz v0.1.2 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/getsentry/sentry-go v0.33.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/glog v1.2.4 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.1 // indirect
github.com/hashicorp/go-plugin v1.5.2 // indirect
github.com/hashicorp/go-metrics v0.5.4 // indirect
github.com/hashicorp/go-plugin v1.6.3 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/huandu/skiplist v1.2.1 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.6 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/linxGnu/grocksdb v1.9.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mdp/qrterminal/v3 v3.2.1 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/multiformats/go-base32 v0.0.3 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multibase v0.0.3 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/rs/zerolog v1.34.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.9.2 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/buntdb v1.2.10 // indirect
github.com/tidwall/grect v0.1.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/rtred v0.1.2 // indirect
github.com/tidwall/tinyqueue v0.1.1 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/urfave/cli/v2 v2.27.7 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
go.dedis.ch/fixbuf v1.0.3 // indirect
go.dedis.ch/protobuf v1.0.11 // indirect
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/mock v0.5.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/arch v0.15.0 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.5.1 // indirect
lukechampine.com/blake3 v1.1.6 // indirect
gotest.tools/v3 v3.5.2 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
pgregory.net/rapid v1.2.0 // indirect
rsc.io/qr v0.2.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
+660 -548
View File
File diff suppressed because it is too large Load Diff
+55 -20
View File
@@ -1,11 +1,35 @@
# cerc-io laconic gql
> Browser : http://localhost:9473 for gql
> Browser : <http://localhost:9473> for gql
## Run gqlgen
On having some change in the GQL schema (for example: adding a new query) update the [schema.graphql](./cerc-io/laconicd/schema.graphql) file as required and run the following:
- Generate GQL bindings:
```bash
# Install gqlgen if not present
go get github.com/99designs/gqlgen@v0.17.22
# Generate bindings
cd gql
go run github.com/99designs/gqlgen generate
```
- Implement the required resolver method(s)
- Regenerate GQL bindings:
```bash
# Generate bindings
go run github.com/99designs/gqlgen generate
```
## Start server
```shell
laconicd start --gql-playground --gql-server
laconicd start --gql.playground --gql.server
```
Basic node status:
@@ -20,15 +44,15 @@ Basic node status:
moniker
}
sync {
latest_block_height
catching_up
latestBlockHeight
catchingUp
}
num_peers
numPeers
peers {
is_outbound
remote_ip
isOutbound
remoteIp
}
disk_usage
diskUsage
}
}
```
@@ -45,32 +69,32 @@ Full node status:
moniker
}
sync {
latest_block_hash
latest_block_time
latest_block_height
catching_up
latestBlockHash
latestBlockTime
latestBlockHeight
catchingUp
}
validator {
address
voting_power
proposer_priority
votingPower
proposerPriority
}
validators {
address
voting_power
proposer_priority
votingPower
proposerPriority
}
num_peers
numPeers
peers {
node {
id
network
moniker
}
is_outbound
remote_ip
isOutbound
remoteIp
}
disk_usage
diskUsage
}
}
```
@@ -351,3 +375,14 @@ Resolve Names
}
}
```
Query participants:
```graphql
{
getParticipants {
cosmosAddress
nitroAddress
}
}
```
+44 -14
View File
@@ -30,6 +30,13 @@ type Account {
balance: [Coin!] # Current balance for each coin type.
}
type Participant {
cosmosAddress: String! # Cosmos address of the participant who will be registered.
nitroAddress: String! # Nitro addresss of the participant who will be registered.
role: String! # Participant's role
kycId: String! # Participant's KYC receipt ID
}
# Value describes a DAG-JSON compatible value.
union Value =
BooleanValue
@@ -106,24 +113,24 @@ type NodeInfo {
# Node sync status.
type SyncInfo {
latest_block_hash: String!
latest_block_height: String!
latest_block_time: String!
catching_up: Boolean!
latestBlockHash: String!
latestBlockHeight: String!
latestBlockTime: String!
catchingUp: Boolean!
}
# Validator set info (https://docs.tendermint.com/master/rpc/#/Info/validators).
type ValidatorInfo {
address: String!
voting_power: String!
proposer_priority: String
votingPower: String!
proposerPriority: String
}
# Network/peer info (https://docs.tendermint.com/master/rpc/#/Info/net_info).
type PeerInfo {
node: NodeInfo!
is_outbound: Boolean!
remote_ip: String!
isOutbound: Boolean!
remoteIp: String!
}
# Vulcanize laconic status.
@@ -133,9 +140,9 @@ type Status {
sync: SyncInfo!
validator: ValidatorInfo
validators: [ValidatorInfo]!
num_peers: String!
numPeers: String!
peers: [PeerInfo]
disk_usage: String!
diskUsage: String!
}
# An auction bid.
@@ -161,10 +168,14 @@ type Auction {
commitFee: Coin! # Fee required to bid/participate in the auction.
revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid).
minimumBid: Coin! # Minimum bid amount.
winnerAddress: String! # Winner address.
winnerBid: Coin! # The winning bid amount.
winnerAddresses: [String!]! # Winner address.
winnerBids: [Coin!]! # The winning bid amount.
winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid).
bids: [AuctionBid] # Bids make in the auction.
maxPrice: Coin! # Max bid amount for service provider auction.
kind: String! # Auction kind.
numProviders: Int # Number of service providers
fundsReleased: Boolean! # Whether funds have been released to providers
bids: [AuctionBid!]! # Bids made in the auction.
}
# Record defines the basic properties of an entity in the graph database.
@@ -190,6 +201,11 @@ type AuthorityRecord {
auction: Auction # Authority auction.
}
type Authority {
name: String!
entry: AuthorityRecord!
}
# Name record entry, created at a particular height.
type NameRecordEntry {
id: String! # Target record ID.
@@ -215,7 +231,7 @@ type Query {
getBondsByIds(ids: [String!]): [Bond]
# Query bonds.
queryBonds(attributes: [KeyValueInput!]): [Bond]
queryBonds: [Bond]
# Query bonds by owner.
queryBondsByOwner(ownerAddresses: [String!]): [OwnerBonds]
@@ -234,12 +250,21 @@ type Query {
# Whether to query all records, not just named ones (false by default).
all: Boolean
# Pagination limit
limit: Int
# Pagination offset
offset: Int
): [Record]
#
# Naming API.
#
# Get authorities list.
getAuthorities(owner: String): [Authority]!
# Lookup authority information.
lookupAuthorities(names: [String!]): [AuthorityRecord]!
@@ -255,4 +280,9 @@ type Query {
# Get auctions by IDs.
getAuctionsByIds(ids: [String!]): [Auction]
# Query participants.
getParticipants: [Participant]!
getParticipantByAddress(address: String!): Participant!
getParticipantByNitroAddress(nitroAddress: String!): Participant!
}
+19
View File
@@ -0,0 +1,19 @@
package gql
func DefaultConfig() *Config {
return &Config{
Enable: false,
Playground: false,
PlaygroundAPIBase: "",
Port: 9473,
// LogFile: "",
}
}
type Config struct {
Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable the GraphQL server."`
Playground bool `mapstructure:"playground" toml:"playground" comment:"Enable the GraphQL playground."`
PlaygroundAPIBase string `mapstructure:"playground-api-base" toml:"playground-api-base" comment:"GraphQL API base path to use in the playground."`
Port uint `mapstructure:"port" toml:"port" comment:"Port to use for the GraphQL server."`
// LogFile string `mapstructure:"log-file" toml:"log-file" comment:"File to tail for the 'getLogs' API."`
}
+19 -10
View File
@@ -1,15 +1,24 @@
package gql
import "github.com/spf13/cobra"
import "github.com/spf13/pflag"
// AddGQLFlags adds gql flags for
func AddGQLFlags(cmd *cobra.Command) *cobra.Command {
// Add flags for GQL server.
cmd.PersistentFlags().Bool("gql-server", false, "Start GQL server.")
cmd.PersistentFlags().Bool("gql-playground", false, "Enable GQL playground.")
cmd.PersistentFlags().String("gql-playground-api-base", "", "GQL API base path to use in GQL playground.")
cmd.PersistentFlags().String("gql-port", "9473", "Port to use for the GQL server.")
cmd.PersistentFlags().String("log-file", "", "File to tail for GQL 'getLogs' API.")
var (
FlagEnable = prefix("enable")
FlagPlayground = prefix("playground")
FlagPlaygroundAPIBase = prefix("playground-api-base")
FlagPort = prefix("port")
//FlagLogFile = prefix("log-file")
)
return cmd
// AddGQLFlags adds flags for the GraphQL server.
func AddGQLFlags(flags *pflag.FlagSet) {
flags.Bool(FlagEnable, false, "Enable the GraphQL server")
flags.Bool(FlagPlayground, false, "Enable the GraphQL playground")
flags.String(FlagPlaygroundAPIBase, "", "GraphQL API base path to use in the playground")
flags.String(FlagPort, "9473", "Port to use for the GraphQL server.")
// cmd.PersistentFlags().String(FlagLogFile, "", "File to tail for GraphQL 'getLogs' API")
}
func prefix(f string) string {
return ServerName + "." + f
}
+3 -3
View File
@@ -4,9 +4,9 @@
schema:
- cerc-io/laconicd/*.graphql
exec:
filename: generated.go
filename: schema/generated.go
model:
filename: models_gen.go
filename: schema/models_gen.go
resolver:
filename: resolver.go
type: Resolver
@@ -14,4 +14,4 @@ resolver:
models:
Link:
model:
- git.vdb.to/cerc-io/laconicd/gql.Link
- git.vdb.to/cerc-io/laconicd/gql/schema.Link
+4 -4
View File
@@ -26,7 +26,7 @@ func PlaygroundHandler(apiURL string) http.HandlerFunc {
}
}
// https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html
// https://github.com/graphql/graphiql/blob/graphiql%402.4.7/examples/graphiql-cdn/index.html
var page = template.Must(template.New("graphiql").Parse(`
<!DOCTYPE html>
<html lang="en">
@@ -68,17 +68,17 @@ var page = template.Must(template.New("graphiql").Parse(`
copy them directly into your environment, or perhaps include them in your
favored resource bundler.
-->
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
<link rel="stylesheet" href="https://unpkg.com/graphiql@2.4.7/graphiql.min.css" />
</head>
<body>
<div id="graphiql">Loading...</div>
<script
src="https://unpkg.com/graphiql/graphiql.min.js"
src="https://unpkg.com/graphiql@2.4.7/graphiql.min.js"
type="application/javascript"
></script>
<script>
// https://github.com/graphql/graphiql/blob/main/packages/graphiql/resources/renderExample.js
// https://github.com/graphql/graphiql/blob/graphiql%402.4.7/packages/graphiql/resources/renderExample.js
// Parse the search string to get url parameters.
var search = window.location.search;
+156 -48
View File
@@ -8,11 +8,15 @@ import (
"github.com/cosmos/cosmos-sdk/client"
types "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"git.vdb.to/cerc-io/laconicd/gql/schema"
"git.vdb.to/cerc-io/laconicd/utils"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
bondtypes "git.vdb.to/cerc-io/laconicd/x/bond"
onboardingTypes "git.vdb.to/cerc-io/laconicd/x/onboarding"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
)
@@ -22,22 +26,55 @@ const DefaultLogNumLines = 50
// MaxLogNumLines is the max number of log lines that can be tailed.
const MaxLogNumLines = 1000
// Whether to use default page limit when pagination args are not passed.
const UseDefaultPagination = false
type Resolver struct {
ctx client.Context
logFile string
}
// Query is the entry point to query execution.
func (r *Resolver) Query() QueryResolver {
func (r *Resolver) Query() schema.QueryResolver {
return &queryResolver{r}
}
type queryResolver struct{ *Resolver }
func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) {
func (q queryResolver) GetAuthorities(ctx context.Context, owner *string) ([]*schema.Authority, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
auctionQueryClient := auctiontypes.NewQueryClient(q.ctx)
gqlResponse := []*AuthorityRecord{}
authoritiesReq := &registrytypes.QueryAuthoritiesRequest{}
if owner != nil {
authoritiesReq.Owner = *owner
}
authoritiesResp, err := nsQueryClient.Authorities(ctx, authoritiesReq)
if err != nil {
return nil, err
}
authorities := make([]*schema.Authority, len(authoritiesResp.GetAuthorities()))
for i, a := range authoritiesResp.Authorities {
entry, err := getAuthorityRecord(*a.Entry, auctionQueryClient)
if err != nil {
return nil, err
}
authorities[i] = &schema.Authority{
Name: a.Name,
Entry: entry,
}
}
return authorities, nil
}
func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([]*schema.AuthorityRecord, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
auctionQueryClient := auctiontypes.NewQueryClient(q.ctx)
gqlResponse := []*schema.AuthorityRecord{}
for _, name := range names {
res, err := nsQueryClient.Whois(context.Background(), &registrytypes.QueryWhoisRequest{Name: name})
@@ -51,38 +88,20 @@ func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([
}
nameAuthority := res.GetNameAuthority()
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
gqlNameAuthorityRecord, err := getAuthorityRecord(nameAuthority, auctionQueryClient)
if err != nil {
return nil, err
}
if nameAuthority.AuctionId != "" {
auctionResp, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.QueryGetAuctionRequest{Id: nameAuthority.GetAuctionId()})
if err != nil {
return nil, err
}
bidsResp, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.QueryGetBidsRequest{AuctionId: nameAuthority.GetAuctionId()})
if err != nil {
return nil, err
}
gqlAuctionRecord, err := GetGQLAuction(auctionResp.GetAuction(), bidsResp.GetBids())
if err != nil {
return nil, err
}
gqlNameAuthorityRecord.Auction = gqlAuctionRecord
}
gqlResponse = append(gqlResponse, gqlNameAuthorityRecord)
}
return gqlResponse, nil
}
func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*Record, error) {
func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*schema.Record, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
var gqlResponse []*Record
var gqlResponse []*schema.Record
for _, name := range names {
res, err := nsQueryClient.ResolveLrn(context.Background(), &registrytypes.QueryResolveLrnRequest{Lrn: name})
if err != nil {
@@ -101,9 +120,9 @@ func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*Rec
return gqlResponse, nil
}
func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*NameRecord, error) {
func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*schema.NameRecord, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
var gqlResponse []*NameRecord
var gqlResponse []*schema.NameRecord
for _, name := range names {
res, err := nsQueryClient.LookupLrn(context.Background(), &registrytypes.QueryLookupLrnRequest{Lrn: name})
@@ -123,14 +142,34 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
return gqlResponse, nil
}
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) {
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*schema.KeyValueInput, all *bool, limit *int, offset *int) ([]*schema.Record, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
var pagination *query.PageRequest
// Use defaults only if limit and offset not provided
// and UseDefaultPagination is true
if limit == nil && offset == nil {
if UseDefaultPagination {
pagination = &query.PageRequest{}
}
} else {
pagination = &query.PageRequest{}
if limit != nil {
pagination.Limit = uint64(*limit)
}
if offset != nil {
pagination.Offset = uint64(*offset)
}
}
res, err := nsQueryClient.Records(
context.Background(),
&registrytypes.QueryRecordsRequest{
Attributes: toRPCAttributes(attributes),
All: (all != nil && *all),
Pagination: pagination,
},
)
if err != nil {
@@ -138,7 +177,7 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
}
records := res.GetRecords()
gqlResponse := make([]*Record, len(records))
gqlResponse := make([]*schema.Record, len(records))
for i, record := range records {
gqlRecord, err := getGQLRecord(context.Background(), q, record)
@@ -151,9 +190,9 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
return gqlResponse, nil
}
func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) {
func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*schema.Record, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
gqlResponse := make([]*Record, len(ids))
gqlResponse := make([]*schema.Record, len(ids))
for i, id := range ids {
res, err := nsQueryClient.GetRecord(context.Background(), &registrytypes.QueryGetRecordRequest{Id: id})
@@ -172,7 +211,7 @@ func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Re
return gqlResponse, nil
}
func (q queryResolver) GetStatus(ctx context.Context) (*Status, error) {
func (q queryResolver) GetStatus(ctx context.Context) (*schema.Status, error) {
nodeInfo, syncInfo, validatorInfo, err := getStatusInfo(q.ctx)
if err != nil {
return nil, err
@@ -193,7 +232,7 @@ func (q queryResolver) GetStatus(ctx context.Context) (*Status, error) {
return nil, err
}
return &Status{
return &schema.Status{
Version: RegistryVersion,
Node: nodeInfo,
Sync: syncInfo,
@@ -205,8 +244,8 @@ func (q queryResolver) GetStatus(ctx context.Context) (*Status, error) {
}, nil
}
func (q queryResolver) GetAccounts(ctx context.Context, addresses []string) ([]*Account, error) {
accounts := make([]*Account, len(addresses))
func (q queryResolver) GetAccounts(ctx context.Context, addresses []string) ([]*schema.Account, error) {
accounts := make([]*schema.Account, len(addresses))
for index, address := range addresses {
account, err := q.GetAccount(ctx, address)
if err != nil {
@@ -217,7 +256,7 @@ func (q queryResolver) GetAccounts(ctx context.Context, addresses []string) ([]*
return accounts, nil
}
func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account, error) {
func (q queryResolver) GetAccount(ctx context.Context, address string) (*schema.Account, error) {
authQueryClient := authtypes.NewQueryClient(q.ctx)
accountResponse, err := authQueryClient.Account(ctx, &authtypes.QueryAccountRequest{Address: address})
if err != nil {
@@ -243,7 +282,7 @@ func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account
accNum := strconv.FormatUint(account.GetAccountNumber(), 10)
seq := strconv.FormatUint(account.GetSequence(), 10)
return &Account{
return &schema.Account{
Address: address,
Number: accNum,
Sequence: seq,
@@ -252,8 +291,8 @@ func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account
}, nil
}
func (q queryResolver) GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error) {
bonds := make([]*Bond, len(ids))
func (q queryResolver) GetBondsByIds(ctx context.Context, ids []string) ([]*schema.Bond, error) {
bonds := make([]*schema.Bond, len(ids))
for index, id := range ids {
bondObj, err := q.GetBond(ctx, id)
if err != nil {
@@ -265,7 +304,7 @@ func (q queryResolver) GetBondsByIds(ctx context.Context, ids []string) ([]*Bond
return bonds, nil
}
func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) {
func (q *queryResolver) GetBond(ctx context.Context, id string) (*schema.Bond, error) {
bondQueryClient := bondtypes.NewQueryClient(q.ctx)
bondResp, err := bondQueryClient.GetBondById(context.Background(), &bondtypes.QueryGetBondByIdRequest{Id: id})
if err != nil {
@@ -283,14 +322,14 @@ func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) {
return getGQLBond(bondResp.GetBond())
}
func (q queryResolver) QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error) {
func (q queryResolver) QueryBonds(ctx context.Context) ([]*schema.Bond, error) {
bondQueryClient := bondtypes.NewQueryClient(q.ctx)
bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryBondsRequest{})
if err != nil {
return nil, err
}
gqlResponse := make([]*Bond, len(bonds.GetBonds()))
gqlResponse := make([]*schema.Bond, len(bonds.GetBonds()))
for i, bondObj := range bonds.GetBonds() {
gqlBond, err := getGQLBond(bondObj)
if err != nil {
@@ -303,8 +342,8 @@ func (q queryResolver) QueryBonds(ctx context.Context, attributes []*KeyValueInp
}
// QueryBondsByOwner will return bonds by owner
func (q queryResolver) QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error) {
ownerBonds := make([]*OwnerBonds, len(ownerAddresses))
func (q queryResolver) QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*schema.OwnerBonds, error) {
ownerBonds := make([]*schema.OwnerBonds, len(ownerAddresses))
for index, ownerAddress := range ownerAddresses {
bondsObj, err := q.GetBondsByOwner(ctx, ownerAddress)
if err != nil {
@@ -316,14 +355,14 @@ func (q queryResolver) QueryBondsByOwner(ctx context.Context, ownerAddresses []s
return ownerBonds, nil
}
func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*OwnerBonds, error) {
func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*schema.OwnerBonds, error) {
bondQueryClient := bondtypes.NewQueryClient(q.ctx)
bondResp, err := bondQueryClient.GetBondsByOwner(context.Background(), &bondtypes.QueryGetBondsByOwnerRequest{Owner: address})
if err != nil {
return nil, err
}
ownerBonds := make([]*Bond, len(bondResp.GetBonds()))
ownerBonds := make([]*schema.Bond, len(bondResp.GetBonds()))
for i, bond := range bondResp.GetBonds() {
// #nosec G601
bondObj, err := getGQLBond(&bond) //nolint: all
@@ -333,12 +372,12 @@ func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*Ow
ownerBonds[i] = bondObj
}
return &OwnerBonds{Bonds: ownerBonds, Owner: address}, nil
return &schema.OwnerBonds{Bonds: ownerBonds, Owner: address}, nil
}
func (q queryResolver) GetAuctionsByIds(ctx context.Context, ids []string) ([]*Auction, error) {
func (q queryResolver) GetAuctionsByIds(ctx context.Context, ids []string) ([]*schema.Auction, error) {
auctionQueryClient := auctiontypes.NewQueryClient(q.ctx)
gqlAuctionResponse := make([]*Auction, len(ids))
gqlAuctionResponse := make([]*schema.Auction, len(ids))
for i, id := range ids {
auctionObj, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.QueryGetAuctionRequest{Id: id})
if err != nil {
@@ -359,3 +398,72 @@ func (q queryResolver) GetAuctionsByIds(ctx context.Context, ids []string) ([]*A
return gqlAuctionResponse, nil
}
func (q queryResolver) GetParticipants(ctx context.Context) ([]*schema.Participant, error) {
onboardingQueryClient := onboardingTypes.NewQueryClient(q.ctx)
participantResp, err := onboardingQueryClient.Participants(context.Background(), &onboardingTypes.QueryParticipantsRequest{})
if err != nil {
return nil, err
}
participants := make([]*schema.Participant, len(participantResp.GetParticipants()))
for i, p := range participantResp.Participants {
nitroAddress, err := utils.EthAddressFromPubKey(p.PublicKey)
if err != nil {
return nil, err
}
participants[i] = &schema.Participant{
CosmosAddress: p.CosmosAddress,
NitroAddress: nitroAddress.String(),
Role: p.Role,
KycID: p.KycId,
}
}
return participants, nil
}
func (q queryResolver) GetParticipantByAddress(ctx context.Context, address string) (*schema.Participant, error) {
onboardingQueryClient := onboardingTypes.NewQueryClient(q.ctx)
participantResp, err := onboardingQueryClient.GetParticipantByAddress(ctx, &onboardingTypes.QueryGetParticipantByAddressRequest{Address: address})
if err != nil {
return nil, err
}
p := participantResp.Participant
nitroAddress, err := utils.EthAddressFromPubKey(p.PublicKey)
if err != nil {
return nil, err
}
participant := &schema.Participant{
CosmosAddress: p.CosmosAddress,
NitroAddress: nitroAddress.String(),
Role: p.Role,
KycID: p.KycId,
}
return participant, nil
}
func (q queryResolver) GetParticipantByNitroAddress(ctx context.Context, nitroAddress string) (*schema.Participant, error) {
onboardingQueryClient := onboardingTypes.NewQueryClient(q.ctx)
participantResp, err := onboardingQueryClient.GetParticipantByNitroAddress(
ctx,
&onboardingTypes.QueryGetParticipantByNitroAddressRequest{
NitroAddress: nitroAddress,
},
)
if err != nil {
return nil, err
}
p := participantResp.Participant
participant := &schema.Participant{
CosmosAddress: p.CosmosAddress,
NitroAddress: nitroAddress,
Role: p.Role,
KycID: p.KycId,
}
return participant, nil
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
package gql
package schema
import (
"context"
+40 -24
View File
@@ -1,6 +1,6 @@
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package gql
package schema
type Value interface {
IsValue()
@@ -26,19 +26,23 @@ type Attribute struct {
}
type Auction struct {
ID string `json:"id"`
Status string `json:"status"`
OwnerAddress string `json:"ownerAddress"`
CreateTime string `json:"createTime"`
CommitsEndTime string `json:"commitsEndTime"`
RevealsEndTime string `json:"revealsEndTime"`
CommitFee *Coin `json:"commitFee"`
RevealFee *Coin `json:"revealFee"`
MinimumBid *Coin `json:"minimumBid"`
WinnerAddress string `json:"winnerAddress"`
WinnerBid *Coin `json:"winnerBid"`
WinnerPrice *Coin `json:"winnerPrice"`
Bids []*AuctionBid `json:"bids"`
ID string `json:"id"`
Status string `json:"status"`
OwnerAddress string `json:"ownerAddress"`
CreateTime string `json:"createTime"`
CommitsEndTime string `json:"commitsEndTime"`
RevealsEndTime string `json:"revealsEndTime"`
CommitFee *Coin `json:"commitFee"`
RevealFee *Coin `json:"revealFee"`
MinimumBid *Coin `json:"minimumBid"`
WinnerAddresses []string `json:"winnerAddresses"`
WinnerBids []*Coin `json:"winnerBids"`
WinnerPrice *Coin `json:"winnerPrice"`
MaxPrice *Coin `json:"maxPrice"`
Kind string `json:"kind"`
NumProviders *int `json:"numProviders"`
FundsReleased bool `json:"fundsReleased"`
Bids []*AuctionBid `json:"bids"`
}
type AuctionBid struct {
@@ -52,6 +56,11 @@ type AuctionBid struct {
BidAmount *Coin `json:"bidAmount"`
}
type Authority struct {
Name string `json:"name"`
Entry *AuthorityRecord `json:"entry"`
}
type AuthorityRecord struct {
OwnerAddress string `json:"ownerAddress"`
OwnerPublicKey string `json:"ownerPublicKey"`
@@ -135,10 +144,17 @@ type OwnerBonds struct {
Bonds []*Bond `json:"bonds"`
}
type Participant struct {
CosmosAddress string `json:"cosmosAddress"`
NitroAddress string `json:"nitroAddress"`
Role string `json:"role"`
KycID string `json:"kycId"`
}
type PeerInfo struct {
Node *NodeInfo `json:"node"`
IsOutbound bool `json:"is_outbound"`
RemoteIP string `json:"remote_ip"`
IsOutbound bool `json:"isOutbound"`
RemoteIP string `json:"remoteIp"`
}
type Record struct {
@@ -158,9 +174,9 @@ type Status struct {
Sync *SyncInfo `json:"sync"`
Validator *ValidatorInfo `json:"validator"`
Validators []*ValidatorInfo `json:"validators"`
NumPeers string `json:"num_peers"`
NumPeers string `json:"numPeers"`
Peers []*PeerInfo `json:"peers"`
DiskUsage string `json:"disk_usage"`
DiskUsage string `json:"diskUsage"`
}
type StringValue struct {
@@ -170,16 +186,16 @@ type StringValue struct {
func (StringValue) IsValue() {}
type SyncInfo struct {
LatestBlockHash string `json:"latest_block_hash"`
LatestBlockHeight string `json:"latest_block_height"`
LatestBlockTime string `json:"latest_block_time"`
CatchingUp bool `json:"catching_up"`
LatestBlockHash string `json:"latestBlockHash"`
LatestBlockHeight string `json:"latestBlockHeight"`
LatestBlockTime string `json:"latestBlockTime"`
CatchingUp bool `json:"catchingUp"`
}
type ValidatorInfo struct {
Address string `json:"address"`
VotingPower string `json:"voting_power"`
ProposerPriority *string `json:"proposer_priority"`
VotingPower string `json:"votingPower"`
ProposerPriority *string `json:"proposerPriority"`
}
type ValueInput struct {
+84 -35
View File
@@ -2,68 +2,117 @@ package gql
import (
"context"
"errors"
"fmt"
"net/http"
"time"
"cosmossdk.io/log"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/cosmos/cosmos-sdk/client"
"github.com/go-chi/chi/v5"
"github.com/rs/cors"
"github.com/spf13/viper"
"github.com/spf13/pflag"
"github.com/cosmos/cosmos-sdk/client"
"git.vdb.to/cerc-io/laconicd/gql/schema"
"git.vdb.to/cerc-io/laconicd/server"
)
// Server configures and starts the GQL server.
func Server(ctx context.Context, clientCtx client.Context, logger log.Logger) error {
if !viper.GetBool("gql-server") {
return nil
const (
ServerName = "gql"
)
type Server struct {
logger log.Logger
router chi.Router
config *Config
httpServer *http.Server
}
// func New(logger log.Logger, cfg server.ConfigMap, clientCtx client.Context) (*Server, error) {
func New(clientCtx client.Context, cfg server.ConfigMap, logger log.Logger) (*Server, error) {
s := &Server{
logger: logger.With(log.ModuleKey, ServerName),
router: chi.NewRouter(),
}
router := chi.NewRouter()
s.config = s.Config().(*Config)
if len(cfg) > 0 {
if err := server.UnmarshalSubConfig(cfg, s.Name(), &s.config); err != nil {
return nil, fmt.Errorf("failed to unmarshal config: %w", err)
}
}
// Add CORS middleware around every request
// See https://github.com/rs/cors for full option listing
router.Use(cors.New(cors.Options{
s.router.Use(cors.New(cors.Options{
AllowedOrigins: []string{"*"},
Debug: false,
}).Handler)
logFile := viper.GetString("log-file")
port := viper.GetString("gql-port")
srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{
ctx: clientCtx,
logFile: logFile,
srv := handler.NewDefaultServer(schema.NewExecutableSchema(schema.Config{Resolvers: &Resolver{
ctx: clientCtx,
// logFile: logFile,
}}))
router.Handle("/", PlaygroundHandler("/api"))
s.router.Handle("/", PlaygroundHandler("/api"))
if viper.GetBool("gql-playground") {
apiBase := viper.GetString("gql-playground-api-base")
router.Handle("/webui", PlaygroundHandler(apiBase+"/api"))
router.Handle("/console", PlaygroundHandler(apiBase+"/graphql"))
if s.config.Playground {
apiBase := s.config.PlaygroundAPIBase
s.router.Handle("/webui", PlaygroundHandler(apiBase+"/api"))
s.router.Handle("/console", PlaygroundHandler(apiBase+"/graphql"))
}
router.Handle("/api", srv)
router.Handle("/graphql", srv)
s.router.Handle("/api", srv)
s.router.Handle("/graphql", srv)
return s, nil
}
errCh := make(chan error)
func (s *Server) Name() string {
return ServerName
}
go func() {
logger.Info(fmt.Sprintf("Connect to GraphQL playground url: http://localhost:%s", port))
errCh <- http.ListenAndServe(":"+port, router)
}()
select {
case <-ctx.Done():
// Gracefully stop the GQL server.
logger.Info("Stopping GQL server...")
// Server configures and starts the GQL server.
func (s *Server) Start(ctx context.Context) error {
if !s.config.Enable {
s.logger.Info(fmt.Sprintf("%s server is disabled via config", s.Name()))
return nil
case err := <-errCh:
logger.Error(fmt.Sprintf("Failed to start GQL server: %s", err))
}
if s.config.Playground {
s.logger.Info(fmt.Sprintf("Connect to GraphQL playground URL at http://localhost:%d", s.config.Port))
}
s.httpServer = &http.Server{
Addr: fmt.Sprintf(":%d", s.config.Port),
Handler: s.router,
ReadHeaderTimeout: 3 * time.Second,
}
if err := s.httpServer.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
s.logger.Error("Failed to start GraphQL server", "error", err)
return err
}
return nil
}
func (s *Server) Stop(ctx context.Context) error {
if !s.config.Enable {
return nil
}
s.logger.Info("stopping GraphQL server")
return s.httpServer.Shutdown(ctx)
}
func (s *Server) Config() any {
if s.config == nil {
return DefaultConfig()
}
return s.config
}
func (s *Server) StartCmdFlags() *pflag.FlagSet {
flags := pflag.NewFlagSet(s.Name(), pflag.ExitOnError)
AddGQLFlags(flags)
return flags
}
+11 -9
View File
@@ -7,13 +7,14 @@ import (
"strconv"
"strings"
"git.vdb.to/cerc-io/laconicd/gql/schema"
"github.com/cosmos/cosmos-sdk/client"
)
// NodeDataPath is the path to the laconicd data folder.
var NodeDataPath = os.ExpandEnv("$HOME/.laconicd/data")
func getStatusInfo(client client.Context) (*NodeInfo, *SyncInfo, *ValidatorInfo, error) {
func getStatusInfo(client client.Context) (*schema.NodeInfo, *schema.SyncInfo, *schema.ValidatorInfo, error) {
nodeClient, err := client.GetNode()
if err != nil {
return nil, nil, nil, err
@@ -23,23 +24,24 @@ func getStatusInfo(client client.Context) (*NodeInfo, *SyncInfo, *ValidatorInfo,
return nil, nil, nil, err
}
return &NodeInfo{
return &schema.NodeInfo{
ID: string(nodeStatus.NodeInfo.ID()),
Network: nodeStatus.NodeInfo.Network,
Moniker: nodeStatus.NodeInfo.Moniker,
}, &SyncInfo{
}, &schema.SyncInfo{
LatestBlockHash: nodeStatus.SyncInfo.LatestBlockHash.String(),
LatestBlockHeight: strconv.FormatInt(nodeStatus.SyncInfo.LatestBlockHeight, 10),
LatestBlockTime: nodeStatus.SyncInfo.LatestBlockTime.String(),
CatchingUp: nodeStatus.SyncInfo.CatchingUp,
}, &ValidatorInfo{
}, &schema.ValidatorInfo{
Address: nodeStatus.ValidatorInfo.Address.String(),
VotingPower: strconv.FormatInt(nodeStatus.ValidatorInfo.VotingPower, 10),
ProposerPriority: nil,
}, nil
}
func getNetInfo(client client.Context) (string, []*PeerInfo, error) {
// nolint: all
func getNetInfo(_ client.Context) (string, []*schema.PeerInfo, error) {
// TODO: Implement
// nodeClient, err := client.GetNode()
@@ -67,10 +69,10 @@ func getNetInfo(client client.Context) (string, []*PeerInfo, error) {
// return strconv.FormatInt(int64(netInfo.NPeers), 10), peersInfo, nil
return strconv.FormatInt(int64(0), 10), []*PeerInfo{}, nil
return strconv.FormatInt(int64(0), 10), []*schema.PeerInfo{}, nil
}
func getValidatorSet(client client.Context) ([]*ValidatorInfo, error) {
func getValidatorSet(client client.Context) ([]*schema.ValidatorInfo, error) {
nodeClient, err := client.GetNode()
if err != nil {
return nil, err
@@ -80,10 +82,10 @@ func getValidatorSet(client client.Context) ([]*ValidatorInfo, error) {
return nil, err
}
validatorSet := make([]*ValidatorInfo, len(res.Validators))
validatorSet := make([]*schema.ValidatorInfo, len(res.Validators))
for index, validator := range res.Validators {
proposerPriority := strconv.FormatInt(validator.ProposerPriority, 10)
validatorSet[index] = &ValidatorInfo{
validatorSet[index] = &schema.ValidatorInfo{
Address: validator.Address.String(),
VotingPower: strconv.FormatInt(validator.VotingPower, 10),
ProposerPriority: &proposerPriority,
+81 -47
View File
@@ -9,6 +9,7 @@ import (
"github.com/ipld/go-ipld-prime"
"github.com/ipld/go-ipld-prime/codec/dagjson"
"git.vdb.to/cerc-io/laconicd/gql/schema"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
bondtypes "git.vdb.to/cerc-io/laconicd/x/bond"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
@@ -23,8 +24,8 @@ const BondIDAttributeName = "bondId"
// ExpiryTimeAttributeName denotes the record expiry time.
const ExpiryTimeAttributeName = "expiryTime"
func getGQLCoin(coin sdk.Coin) *Coin {
gqlCoin := Coin{
func getGQLCoin(coin sdk.Coin) *schema.Coin {
gqlCoin := schema.Coin{
Type: coin.Denom,
Quantity: coin.Amount.BigInt().String(),
}
@@ -32,8 +33,8 @@ func getGQLCoin(coin sdk.Coin) *Coin {
return &gqlCoin
}
func getGQLCoins(coins sdk.Coins) []*Coin {
gqlCoins := make([]*Coin, len(coins))
func getGQLCoins(coins sdk.Coins) []*schema.Coin {
gqlCoins := make([]*schema.Coin, len(coins))
for index, coin := range coins {
gqlCoins[index] = getGQLCoin(coin)
}
@@ -41,12 +42,12 @@ func getGQLCoins(coins sdk.Coins) []*Coin {
return gqlCoins
}
func GetGQLNameAuthorityRecord(record *registrytypes.NameAuthority) (*AuthorityRecord, error) {
func GetGQLNameAuthorityRecord(record *registrytypes.NameAuthority) (*schema.AuthorityRecord, error) {
if record == nil {
return nil, nil
}
return &AuthorityRecord{
return &schema.AuthorityRecord{
OwnerAddress: record.OwnerAddress,
OwnerPublicKey: record.OwnerPublicKey,
Height: strconv.FormatUint(record.Height, 10),
@@ -56,7 +57,7 @@ func GetGQLNameAuthorityRecord(record *registrytypes.NameAuthority) (*AuthorityR
}, nil
}
func getGQLRecord(ctx context.Context, resolver QueryResolver, record registrytypes.Record) (*Record, error) {
func getGQLRecord(ctx context.Context, resolver schema.QueryResolver, record registrytypes.Record) (*schema.Record, error) {
// Nil record.
if record.Deleted {
return nil, nil
@@ -81,22 +82,22 @@ func getGQLRecord(ctx context.Context, resolver QueryResolver, record registryty
return nil, err
}
return &Record{
return &schema.Record{
ID: record.Id,
BondID: record.GetBondId(),
CreateTime: record.GetCreateTime(),
ExpiryTime: record.GetExpiryTime(),
Owners: record.GetOwners(),
Names: record.GetNames(),
Attributes: attributes.(MapValue).Value,
Attributes: attributes.(schema.MapValue).Value,
References: references,
}, nil
}
func resolveIPLDNode(node ipld.Node, links *[]string) (Value, error) {
func resolveIPLDNode(node ipld.Node, links *[]string) (schema.Value, error) {
switch node.Kind() {
case ipld.Kind_Map:
var entries []*Attribute
var entries []*schema.Attribute
for itr := node.MapIterator(); !itr.Done(); {
k, v, err := itr.Next()
if err != nil {
@@ -113,14 +114,14 @@ func resolveIPLDNode(node ipld.Node, links *[]string) (Value, error) {
if err != nil {
return nil, err
}
entries = append(entries, &Attribute{
entries = append(entries, &schema.Attribute{
Key: s,
Value: val,
})
}
return MapValue{entries}, nil
return schema.MapValue{entries}, nil
case ipld.Kind_List:
var values []Value
var values []schema.Value
for itr := node.ListIterator(); !itr.Done(); {
_, v, err := itr.Next()
if err != nil {
@@ -132,7 +133,7 @@ func resolveIPLDNode(node ipld.Node, links *[]string) (Value, error) {
}
values = append(values, val)
}
return ArrayValue{values}, nil
return schema.ArrayValue{values}, nil
case ipld.Kind_Null:
return nil, nil
case ipld.Kind_Bool:
@@ -140,82 +141,82 @@ func resolveIPLDNode(node ipld.Node, links *[]string) (Value, error) {
if err != nil {
return nil, err
}
return BooleanValue{val}, nil
return schema.BooleanValue{val}, nil
case ipld.Kind_Int:
val, err := node.AsInt()
if err != nil {
return nil, err
}
// TODO: handle bigger ints
return IntValue{int(val)}, nil
return schema.IntValue{int(val)}, nil
case ipld.Kind_Float:
val, err := node.AsFloat()
if err != nil {
return nil, err
}
return FloatValue{val}, nil
return schema.FloatValue{val}, nil
case ipld.Kind_String:
val, err := node.AsString()
if err != nil {
return nil, err
}
return StringValue{val}, nil
return schema.StringValue{val}, nil
case ipld.Kind_Bytes:
val, err := node.AsBytes()
if err != nil {
return nil, err
}
return BytesValue{string(val)}, nil
return schema.BytesValue{string(val)}, nil
case ipld.Kind_Link:
val, err := node.AsLink()
if err != nil {
return nil, err
}
*links = append(*links, val.String())
return LinkValue{Link(val.String())}, nil
return schema.LinkValue{schema.Link(val.String())}, nil
default:
return nil, fmt.Errorf("invalid node kind")
}
}
func getGQLNameRecord(record *registrytypes.NameRecord) (*NameRecord, error) {
func getGQLNameRecord(record *registrytypes.NameRecord) (*schema.NameRecord, error) {
if record == nil {
return nil, fmt.Errorf("got nil record")
}
records := make([]*NameRecordEntry, len(record.History))
records := make([]*schema.NameRecordEntry, len(record.History))
for index, entry := range record.History {
records[index] = getNameRecordEntry(entry)
}
return &NameRecord{
return &schema.NameRecord{
Latest: getNameRecordEntry(record.Latest),
History: records,
}, nil
}
func getNameRecordEntry(record *registrytypes.NameRecordEntry) *NameRecordEntry {
return &NameRecordEntry{
func getNameRecordEntry(record *registrytypes.NameRecordEntry) *schema.NameRecordEntry {
return &schema.NameRecordEntry{
ID: record.Id,
Height: strconv.FormatUint(record.Height, 10),
}
}
func getGQLBond(bondObj *bondtypes.Bond) (*Bond, error) {
func getGQLBond(bondObj *bondtypes.Bond) (*schema.Bond, error) {
// Nil record.
if bondObj == nil {
return nil, nil
}
return &Bond{
return &schema.Bond{
ID: bondObj.Id,
Owner: bondObj.Owner,
Balance: getGQLCoins(bondObj.Balance),
}, nil
}
func getAuctionBid(bid *auctiontypes.Bid) *AuctionBid {
return &AuctionBid{
func getAuctionBid(bid *auctiontypes.Bid) *schema.AuctionBid {
return &schema.AuctionBid{
BidderAddress: bid.BidderAddress,
Status: bid.Status,
CommitHash: bid.CommitHash,
@@ -227,27 +228,33 @@ func getAuctionBid(bid *auctiontypes.Bid) *AuctionBid {
}
}
func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Auction, error) {
func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*schema.Auction, error) {
if auction == nil {
return nil, nil
}
gqlAuction := Auction{
ID: auction.Id,
Status: auction.Status,
OwnerAddress: auction.OwnerAddress,
CreateTime: auction.GetCreateTime(),
CommitsEndTime: auction.GetCommitsEndTime(),
RevealsEndTime: auction.GetRevealsEndTime(),
CommitFee: getGQLCoin(auction.CommitFee),
RevealFee: getGQLCoin(auction.RevealFee),
MinimumBid: getGQLCoin(auction.MinimumBid),
WinnerAddress: auction.WinnerAddress,
WinnerBid: getGQLCoin(auction.WinningBid),
WinnerPrice: getGQLCoin(auction.WinningPrice),
numProviders := int(auction.NumProviders)
gqlAuction := schema.Auction{
ID: auction.Id,
Status: auction.Status,
OwnerAddress: auction.OwnerAddress,
CreateTime: auction.GetCreateTime(),
CommitsEndTime: auction.GetCommitsEndTime(),
RevealsEndTime: auction.GetRevealsEndTime(),
CommitFee: getGQLCoin(auction.CommitFee),
RevealFee: getGQLCoin(auction.RevealFee),
MinimumBid: getGQLCoin(auction.MinimumBid),
WinnerAddresses: auction.WinnerAddresses,
WinnerBids: getGQLCoins(auction.WinningBids),
WinnerPrice: getGQLCoin(auction.WinningPrice),
MaxPrice: getGQLCoin(auction.MaxPrice),
Kind: auction.Kind,
NumProviders: &numProviders,
FundsReleased: auction.FundsReleased,
}
auctionBids := make([]*AuctionBid, len(bids))
auctionBids := make([]*schema.AuctionBid, len(bids))
for index, entry := range bids {
auctionBids[index] = getAuctionBid(entry)
}
@@ -257,7 +264,7 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
return &gqlAuction, nil
}
func toRPCValue(value *ValueInput) *registrytypes.QueryRecordsRequest_ValueInput {
func toRPCValue(value *schema.ValueInput) *registrytypes.QueryRecordsRequest_ValueInput {
var rpcval registrytypes.QueryRecordsRequest_ValueInput
switch {
@@ -289,7 +296,7 @@ func toRPCValue(value *ValueInput) *registrytypes.QueryRecordsRequest_ValueInput
return &rpcval
}
func toRPCAttributes(attrs []*KeyValueInput) []*registrytypes.QueryRecordsRequest_KeyValueInput {
func toRPCAttributes(attrs []*schema.KeyValueInput) []*registrytypes.QueryRecordsRequest_KeyValueInput {
kvPairs := []*registrytypes.QueryRecordsRequest_KeyValueInput{}
for _, value := range attrs {
@@ -303,3 +310,30 @@ func toRPCAttributes(attrs []*KeyValueInput) []*registrytypes.QueryRecordsReques
return kvPairs
}
func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryClient auctiontypes.QueryClient) (*schema.AuthorityRecord, error) {
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
if err != nil {
return nil, err
}
if nameAuthority.AuctionId != "" {
auctionResp, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.QueryGetAuctionRequest{Id: nameAuthority.GetAuctionId()})
if err != nil {
return nil, err
}
bidsResp, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.QueryGetBidsRequest{AuctionId: nameAuthority.GetAuctionId()})
if err != nil {
return nil, err
}
gqlAuctionRecord, err := GetGQLAuction(auctionResp.GetAuction(), bidsResp.GetBids())
if err != nil {
return nil, err
}
gqlNameAuthorityRecord.Auction = gqlAuctionRecord
}
return gqlNameAuthorityRecord, nil
}
+47
View File
@@ -0,0 +1,47 @@
# Lockup Account Usage
* Add a genesis lockup account:
```bash
laconicd genesis add-genesis-lockup-account <account_name> <distribution-json-file> <coin>[,<coin>...]
# Example
# laconicd genesis add-genesis-lockup-account lps_lockup distribution.json 1000alps
```
* This adds a `LockupAccount` with given name and balance in the genesis file
* The lockup account can be queried as shown below once the chain starts
* Query a lockup account:
```bash
laconicd query auth module-account <account_name>
# Example
# laconicd query auth module-account lps_lockup
# account:
# type: laconic/LockupAccount
# value:
# base_account:
# account_number: "1"
# address: laconic1mprsxp9jqe0d0lp88fxuccthwgy7tqgt5x9y65
# distribution: |-
# {
# ...
```
* Query a lockup account's balance:
```bash
laconicd query bank balances <address>
# Example
lockup_account_address=$(laconicd query auth module-account lps_lockup -o json | jq -r '.account.value.base_account.address')
laconicd query bank balances $lockup_account_address
balances:
- amount: "1000"
denom: alps
pagination:
total: "1"
```
+1
View File
@@ -4,6 +4,7 @@ deps:
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
- buf.build/googleapis/googleapis
- buf.build/protocolbuffers/wellknowntypes
lint:
use:
- DEFAULT
@@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/auction"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}
+43 -52
View File
@@ -3,76 +3,44 @@ syntax = "proto3";
package cerc.auction.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "cosmos/base/v1beta1/coin.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/auction";
// Params defines the auction module parameters
message Params {
// Write custom stringer method
option (gogoproto.goproto_stringer) = false;
// Duration of the commits phase in seconds
google.protobuf.Duration commits_duration = 1 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
];
// Duration of the reveals phase in seconds
google.protobuf.Duration reveals_duration = 2 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
];
// Commit fees
cosmos.base.v1beta1.Coin commit_fee = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
];
// Reveal fees
cosmos.base.v1beta1.Coin reveal_fee = 4 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
];
// Minimum acceptable bid amount
cosmos.base.v1beta1.Coin minimum_bid = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
}
message Params {}
// Auction represents a sealed-bid on-chain auction
message Auction {
option (gogoproto.goproto_getters) = false;
string id = 1;
string status = 2;
// Auction kind (vickrey | provider)
string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
string status = 3;
// Address of the creator of the auction
string owner_address = 3;
string owner_address = 4;
// Timestamp at which the auction was created
google.protobuf.Timestamp create_time = 4 [
google.protobuf.Timestamp create_time = 5 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\""
];
// Timestamp at which the commits phase concluded
google.protobuf.Timestamp commits_end_time = 5 [
google.protobuf.Timestamp commits_end_time = 6 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\""
];
// Timestamp at which the reveals phase concluded
google.protobuf.Timestamp reveals_end_time = 6 [
google.protobuf.Timestamp reveals_end_time = 7 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\""
@@ -80,35 +48,58 @@ message Auction {
// Commit and reveal fees must both be paid when committing a bid
// Reveal fee is returned only if the bid is revealed
cosmos.base.v1beta1.Coin commit_fee = 7 [
cosmos.base.v1beta1.Coin commit_fee = 8 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
];
cosmos.base.v1beta1.Coin reveal_fee = 8 [
cosmos.base.v1beta1.Coin reveal_fee = 9 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
];
// Minimum acceptable bid amount for a valid commit
cosmos.base.v1beta1.Coin minimum_bid = 9 [
// Only applicable in vickrey auctions
cosmos.base.v1beta1.Coin minimum_bid = 10 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
// Address of the winner
string winner_address = 10;
// Addresses of the winners
// (single winner for vickrey auction)
// (multiple winners for provider auctions)
repeated string winner_addresses = 11;
// Winning bid, i.e., the highest bid
cosmos.base.v1beta1.Coin winning_bid = 11 [
// Winning bids, i.e. the best bids
repeated cosmos.base.v1beta1.Coin winning_bids = 12 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\""
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\""
];
// Amount the winner pays, i.e. the second highest auction
cosmos.base.v1beta1.Coin winning_price = 12 [
// Auction winning price
// vickrey auction: second highest bid, paid by the winner
// provider auction: higest bid amongst winning_bids, paid by auction creator
// to each winner
cosmos.base.v1beta1.Coin winning_price = 13 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\""
];
// Maximum acceptable bid amount for a valid commit
// Only applicable in provider auctions
cosmos.base.v1beta1.Coin max_price = 14 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
];
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
int32 num_providers = 15;
// Whether funds have been released to providers
// Only applicable in provider auctions
bool funds_released = 16
[ (gogoproto.moretags) =
"json:\"funds_released\" yaml:\"funds_released\"" ];
}
// Auctions represent all the auctions in the module
+75 -8
View File
@@ -7,6 +7,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/duration.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cerc/auction/v1/auction.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/auction";
@@ -29,6 +30,15 @@ service Msg {
rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse) {
option (google.api.http).post = "/cerc/auction/v1/reveal_bid";
};
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// ReleaseFunds is the command for paying the winners of provider auctions
rpc ReleaseFunds(MsgReleaseFunds) returns (MsgReleaseFundsResponse) {
option (google.api.http).post = "/cerc/auction/v1/release_funds";
};
}
// MsgCreateAuction defines a create auction message
@@ -36,41 +46,56 @@ message MsgCreateAuction {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Address of the signer
string signer = 1
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
// Auction kind (vickrey | provider)
string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
// Duration of the commits phase in seconds
google.protobuf.Duration commits_duration = 1 [
google.protobuf.Duration commits_duration = 3 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
];
// Duration of the reveals phase in seconds
google.protobuf.Duration reveals_duration = 2 [
google.protobuf.Duration reveals_duration = 4 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
];
// Commit fees
cosmos.base.v1beta1.Coin commit_fee = 3 [
cosmos.base.v1beta1.Coin commit_fee = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
];
// Reveal fees
cosmos.base.v1beta1.Coin reveal_fee = 4 [
cosmos.base.v1beta1.Coin reveal_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
];
// Minimum acceptable bid amount
cosmos.base.v1beta1.Coin minimum_bid = 5 [
// Only applicable in vickrey auctions
cosmos.base.v1beta1.Coin minimum_bid = 7 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
// Address of the signer
string signer = 6
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
// Maximum acceptable bid amount
// Only applicable in provider auctions
cosmos.base.v1beta1.Coin max_price = 8 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
];
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
int32 num_providers = 9;
}
// MsgCreateAuctionResponse returns the details of the created auction
@@ -134,3 +159,45 @@ message MsgRevealBidResponse {
Auction auction = 1
[ (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" ];
}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/auction parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};
// ReleaseFunds defines the message to pay the winners of provider auctions
message MsgReleaseFunds {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Auction id
string auction_id = 1
[ (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" ];
// Address of the signer
string signer = 2
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
}
// MsgReleaseFundsResponse returns the state of the auction after releasing the
// funds
message MsgReleaseFundsResponse {
option (gogoproto.goproto_getters) = false;
// Auction details
Auction auction = 1
[ (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" ];
}
+4
View File
@@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/bond"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}
+24
View File
@@ -6,6 +6,8 @@ import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cerc/bond/v1/bond.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/bond";
@@ -32,6 +34,10 @@ service Msg {
rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse) {
option (google.api.http).post = "/cerc/bond/v1/cancel_bond";
};
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgCreateBond defines a SDK message for creating a new bond.
@@ -91,3 +97,21 @@ message MsgCancelBond {
// MsgCancelBondResponse defines the Msg/CancelBond response type.
message MsgCancelBondResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/bond parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};
+20
View File
@@ -0,0 +1,20 @@
syntax = "proto3";
package cerc.nitro.module.v1;
import "cosmos/app/v1alpha1/module.proto";
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/nitro"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
// TODO LNT address here?
string token_address = 3;
}
+33
View File
@@ -0,0 +1,33 @@
syntax = "proto3";
package cerc.nitro.v1;
import "google/api/annotations.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/nitro/types/v1";
// Params defines the parameters of the nitro module.
message Params {
bytes nitro_adjudicator_address = 1;
bytes virtual_payment_app_address = 2;
bytes consensus_app_address = 3;
}
message PaymentChannel {
string channel_id = 1;
// TODO
}
message Fund {
option (gogoproto.equal) = true;
string token_address = 1;
string amount = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}
+10
View File
@@ -0,0 +1,10 @@
syntax = "proto3";
package cerc.nitro.v1;
option go_package = "git.vdb.to/cerc-io/laconicd/server/nitro";
// P2PMessage wraps a json-encoded Nitro protocols.Message
// TODO: proper proto message?
message P2PMessage {
string content = 1;
}
+14
View File
@@ -0,0 +1,14 @@
syntax = "proto3";
package cerc.nitro.v1;
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/nitro/types/v1";
service Query {
}
+139
View File
@@ -0,0 +1,139 @@
syntax = "proto3";
package cerc.nitro.v1;
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/nitro/types/v1";
// 1. user submits OpenChannel tx (from local relay node)
//
// 2. tx is not processed; instead first block proposer to pick up tx triggers Nitro
// CreateLedgerChannel call (or client makes the call and the tx indicates it was made, then
// proposer pushes an event to Nitro?)
//
// 3. objective is cranked among Nitro nodes over comet p2p
//
// 4. once complete, block proposer includes actual tx; client can detect update via Event api
service Msg {
option (cosmos.msg.v1.service) = true;
// TODO: OpenLedgerChannel?
rpc OpenChannel(MsgOpenChannel) returns (MsgOpenChannelResponse) {
option (google.api.http).post = "/cerc/nitro/v1/open_channel";
}
rpc CloseChannel(MsgCloseChannel) returns (MsgCloseChannelResponse) {
option (google.api.http).post = "/cerc/nitro/v1/close_channel";
}
rpc CreatePaymentChannel(MsgCreatePaymentChannel) returns (MsgCreatePaymentChannelResponse) {
option (google.api.http).post = "/cerc/nitro/v1/create_payment_channel";
}
rpc ClosePaymentChannel(MsgClosePaymentChannel) returns (MsgClosePaymentChannelResponse) {
option (google.api.http).post = "/cerc/nitro/v1/close_payment_channel";
}
rpc Pay(MsgPay) returns (MsgPayResponse) {
option (google.api.http).post = "/cerc/nitro/v1/pay";
}
}
message MsgOpenChannel {
option (cosmos.msg.v1.signer) = "signer";
// Nitro address of proposing party
string nitro_address = 1;
// Nitro address of counterparty
string counterparty = 2;
// Simplified outcome just includes the funding amount from payer
// TODO: review use of coins to represent ETH/ERC20
repeated cosmos.base.v1beta1.Coin funds = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
// Nitro channel ID
string channel_id = 4;
// Tx signer address is independent of proposer ETH address
string signer = 5;
}
message MsgOpenChannelResponse {}
message MsgCloseChannel {
option (cosmos.msg.v1.signer) = "signer";
// Nitro channel ID to close
string channel_id = 1;
// Whether to close via challenge (dispute resolution) or cooperative closure
bool is_challenge = 2;
// Laconic address of proposing party
string signer = 3;
}
message MsgCloseChannelResponse {}
message MsgCreatePaymentChannel {
option (cosmos.msg.v1.signer) = "signer";
// Nitro address of proposing party
string nitro_address = 1;
// Nitro address of counterparty
string counterparty = 2;
// Nitro addresses of intermediaries
repeated string intermediaries = 3;
// Challenge duration for the channel
uint32 challenge_duration = 4;
// Funding amount for the payment channel
repeated cosmos.base.v1beta1.Coin funds = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
// Nitro channel ID
string channel_id = 6;
// Laconic address of proposing party
string signer = 7;
}
message MsgCreatePaymentChannelResponse {}
message MsgClosePaymentChannel {
option (cosmos.msg.v1.signer) = "signer";
// Nitro channel ID to close
string channel_id = 1;
// Laconic address of proposing party
string signer = 2;
}
message MsgClosePaymentChannelResponse {}
message MsgPay {
option (cosmos.msg.v1.signer) = "signer";
// Nitro channel ID through which to send payment
string channel_id = 1;
// Amount to pay
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.nullable) = false
];
// Laconic address of the payer
string signer = 3;
}
message MsgPayResponse {}
@@ -0,0 +1,15 @@
syntax = "proto3";
package cerc.onboarding.module.v1;
import "cosmos/app/v1alpha1/module.proto";
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/onboarding"
};
string authority = 1;
}
+16
View File
@@ -0,0 +1,16 @@
syntax = "proto3";
package cerc.onboarding.v1;
import "gogoproto/gogo.proto";
import "cerc/onboarding/v1/onboarding.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
// GenesisState defines the onboarding module's genesis state.
message GenesisState {
// params defines all the parameters of the module.
Params params = 1 [ (gogoproto.nullable) = false ];
// participants defines all the participants
repeated Participant participants = 2 [ (gogoproto.nullable) = false ];
}
+41
View File
@@ -0,0 +1,41 @@
syntax = "proto3";
package cerc.onboarding.v1;
import "gogoproto/gogo.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
// Params defines the parameters of the onboarding module.
message Params {
bool onboarding_enabled = 1
[ (gogoproto.moretags) =
"json:\"onboarding_enabled\" yaml:\"onboarding_enabled\"" ];
}
// Participant defines the data that will be stored for each enrolled
// participant
message Participant {
// participant's cosmos (laconic) address
string cosmos_address = 1
[ (gogoproto.moretags) =
"json:\"cosmos_address\" yaml:\"cosmos_address\"" ];
// full public key used to derive participant's Nitro address
bytes public_key = 2;
// participant's role (participant | validator)
string role = 3 [ (gogoproto.moretags) = "json:\"role\" yaml:\"role\"" ];
// participant's KYC receipt ID
string kyc_id = 4
[ (gogoproto.moretags) = "json:\"kyc_id\" yaml:\"kyc_id\"" ];
}
// EthPayload defines the payload that is signed by the ethereum private key
message EthPayload {
string address = 1
[ (gogoproto.moretags) = "json:\"address\" yaml:\"address\"" ];
string msg = 2 [ (gogoproto.moretags) = "json:\"msg\" yaml:\"msg\"" ];
}
+75
View File
@@ -0,0 +1,75 @@
syntax = "proto3";
package cerc.onboarding.v1;
import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cerc/onboarding/v1/onboarding.proto";
import "google/api/annotations.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
// Query defines the gRPC querier service for onboarding module
service Query {
// Participants queries Participants list
rpc Participants(QueryParticipantsRequest)
returns (QueryParticipantsResponse) {
option (google.api.http).get = "/cerc/onboarding/v1/participants";
}
// GetParticipantByAddress queries a participant by cosmos (laconic) address
rpc GetParticipantByAddress(QueryGetParticipantByAddressRequest)
returns (QueryGetParticipantByAddressResponse) {
option (google.api.http).get = "/cerc/onboarding/v1/participants/{address}";
}
// GetParticipantByNitroAddress queries a participant by nitro address
rpc GetParticipantByNitroAddress(QueryGetParticipantByNitroAddressRequest)
returns (QueryGetParticipantByNitroAddressResponse) {
option (google.api.http).get =
"/cerc/onboarding/v1/participants-by-nitro/{nitro_address}";
}
}
// QueryParticipantsRequest queries participants
message QueryParticipantsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// QueryParticipantsResponse is response type for querying the participants
message QueryParticipantsResponse {
repeated Participant participants = 1
[ (gogoproto.moretags) = "json:\"participants\" yaml:\"participants\"" ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGetParticipantByAddressRequest queries participant by the laconic
// address
message QueryGetParticipantByAddressRequest {
// Laconic address
string address = 1;
}
// QueryGetParticipantByAddressResponse is response type for querying
// participant by the laconic address
message QueryGetParticipantByAddressResponse {
// Participant details
Participant participant = 1;
}
// QueryGetParticipantByNitroAddressRequest queries participant by the nitro
// address
message QueryGetParticipantByNitroAddressRequest {
// Nitro address
string nitro_address = 1;
}
// QueryGetParticipantByNitroAddressResponse is response type for querying
// participant by the nitro address
message QueryGetParticipantByNitroAddressResponse {
// Participant details
Participant participant = 1;
}
+37
View File
@@ -0,0 +1,37 @@
syntax = "proto3";
package cerc.onboarding.v1;
import "cosmos/msg/v1/msg.proto";
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cerc/onboarding/v1/onboarding.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/onboarding";
// Msg defines the onboarding Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// OnboardParticipant defines a method for enrolling a new validator.
rpc OnboardParticipant(MsgOnboardParticipant)
returns (MsgOnboardParticipantResponse) {
option (google.api.http).post = "/cerc/onboarding/v1/onboard_participant";
};
}
// MsgOnboardParticipant defines a SDK message for enrolling a new validator.
message MsgOnboardParticipant {
option (cosmos.msg.v1.signer) = "participant";
// Participant is the msg sender
string participant = 1;
EthPayload eth_payload = 2 [ (gogoproto.nullable) = false ];
string eth_signature = 3;
string role = 4;
string kyc_id = 5;
}
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response
// type.
message MsgOnboardParticipantResponse {}
@@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/registry"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}
+15
View File
@@ -58,6 +58,11 @@ service Query {
returns (QueryGetRegistryModuleBalanceResponse) {
option (google.api.http).get = "/cerc/registry/v1/balance";
}
// Authorities queries all authorities
rpc Authorities(QueryAuthoritiesRequest) returns (QueryAuthoritiesResponse) {
option (google.api.http).get = "/cerc/registry/v1/authorities";
}
}
// QueryParamsRequest is request type for registry params
@@ -152,6 +157,16 @@ message QueryWhoisResponse {
];
}
// QueryAuthoritiesRequest is request type to get all authorities
message QueryAuthoritiesRequest { string owner = 1; }
// QueryAuthoritiesResponse is response type for authorities request
message QueryAuthoritiesResponse {
repeated AuthorityEntry authorities = 1 [ (gogoproto.nullable) = false ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryLookupLrnRequest is request type for LookupLrn
message QueryLookupLrnRequest { string lrn = 1; }
+1 -1
View File
@@ -96,7 +96,7 @@ message Record {
[ (gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\"" ];
repeated string names = 8
[ (gogoproto.moretags) = "json:\"names\" yaml:\"names\"" ];
string type = 9 [ (gogoproto.moretags) = "json:\"types\" yaml:\"types\"" ];
string types = 9 [ (gogoproto.moretags) = "json:\"types\" yaml:\"types\"" ];
}
// AuthorityEntry defines a registry authority
+23
View File
@@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cosmos/msg/v1/msg.proto";
import "cerc/registry/v1/registry.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/registry";
@@ -66,6 +67,10 @@ service Msg {
returns (MsgSetAuthorityBondResponse) {
option (google.api.http).post = "/cerc/registry/v1/set_authority_bond";
}
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgSetRecord
@@ -203,3 +208,21 @@ message MsgReassociateRecords {
// MsgReassociateRecordsResponse
message MsgReassociateRecordsResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/registry parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {}
+26
View File
@@ -0,0 +1,26 @@
syntax = "proto3";
package cerc.types.v1;
import "amino/amino.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/auth/v1beta1/auth.proto";
import "gogoproto/gogo.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/types/v1";
// LockupAccount extends the Cosmos SDK BaseAccount with a name and distribution
// field. It satisfies the ModuleAccountI interface to allow querying it as a
// module account.
message LockupAccount {
option (amino.name) = "laconic/LockupAccount";
option (amino.message_encoding) = "lockup_account";
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) =
"cosmos.auth.v1beta1.ModuleAccountI";
option (cosmos_proto.implements_interface) = "cerc.types.v1.LockupAccountI";
cosmos.auth.v1beta1.BaseAccount base_account = 1 [ (gogoproto.embed) = true ];
string name = 2;
string distribution = 3;
}
+89 -85
View File
@@ -1,101 +1,105 @@
#!/bin/bash
KEY="alice"
CHAINID="laconic_9000-1"
MONIKER="localtestnet"
KEYRING="test"
LOGLEVEL="${LOGLEVEL:-info}"
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
set -x
fi
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
# validate dependencies are installed
command -v jq > /dev/null 2>&1 || {
echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"
exit 1
LACONIC_BIN=${LACONIC_BIN:-laconicd}
LACONIC_HOME="${LACONIC_HOME:-$HOME/.laconicd}"
KEYNAME="node_key"
CHAINID=${CHAINID:-"laconic_9000-1"}
MONIKER=${MONIKER:-"localtestnet"}
KEYRING=${KEYRING:-"test"}
DENOM=${DENOM:-"alnt"}
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"} # 10^15 alnt
ALLOCATION_AMOUNT=1000000000000000000000000000000 # 10^30 alnt | 10^12 lnt
LOGLEVEL=${LOGLEVEL:-"info"}
P2P_EXTERNAL_PORT=${P2P_EXTERNAL_PORT:-26656}
input_genesis_file=${GENESIS_FILE}
import_private_key=${PRIVATE_KEY}
laconicd="$LACONIC_BIN --home=$LACONIC_HOME --log_level=$LOGLEVEL"
set -e
if [ "$1" == "clean" ]; then
echo "Clearing existing data directory in $LACONIC_HOME"
rm -rf "$LACONIC_HOME"
else
echo "Using existing database at $LACONIC_HOME. To replace, run '$(basename $0) clean'"
fi
# Create a new home dir if needed
if [[ ! -d "$LACONIC_HOME/data/application.db" ]]; then
# Import the node key if passed, or generate one
if [[ -n "$import_private_key" ]]; then
$laconicd keys import-hex $KEYNAME 'b0b0000000000000000000000000000000000000000000000000000000000000'
else
printf "y\n" | $laconicd keys add $KEYNAME --keyring-backend $KEYRING --no-backup
fi
# Set moniker and chain-id (Moniker can be anything, chain-id must be an integer)
$laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM
else
KEYNAME=$($laconicd keys list --list-names --keyring-backend $KEYRING | head -1)
fi
if [[ ! -d "$db_path" ]]; then
$laconicd config set client chain-id $CHAINID
$laconicd config set client keyring-backend $KEYRING
if [[ -f ${input_genesis_file} ]]; then
# Use provided genesis config
cp $input_genesis_file $LACONIC_HOME/config/genesis.json
fi
$laconicd genesis validate
update_comet_config() { # comet config is not supported by confix cli
local file="$LACONIC_HOME/config/config.toml"
cp -f "$file" "${file}.bak" && tomlq --toml-output ".$1 = $2" "${file}.bak" > "$file"
}
# remove existing daemon and client
rm -rf $HOME/.laconicd/*
# disable empty blocks
update_comet_config consensus.create_empty_blocks 'false'
if [ -n "`which make`" ]; then
make install
fi
# Allow requests from any origin
update_comet_config rpc.cors_allowed_origins '["*"]'
laconicd config set client chain-id $CHAINID
laconicd config set client keyring-backend $KEYRING
# if $KEY exists it should be deleted
laconicd keys add $KEY --keyring-backend $KEYRING
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
laconicd init $MONIKER --chain-id $CHAINID --default-denom photon
update_genesis() {
jq "$1" $HOME/.laconicd/config/genesis.json > $HOME/.laconicd/config/tmp_genesis.json &&
mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
}
if [[ "$TEST_REGISTRY_EXPIRY" == "true" ]]; then
echo "Setting timers for expiry tests."
update_genesis '.app_state["registry"]["params"]["record_rent_duration"]="60s"'
update_genesis '.app_state["registry"]["params"]["authority_grace_period"]="60s"'
update_genesis '.app_state["registry"]["params"]["authority_rent_duration"]="60s"'
fi
if [[ "$TEST_AUCTION_ENABLED" == "true" ]]; then
echo "Enabling auction and setting timers."
update_genesis '.app_state["registry"]["params"]["authority_auction_enabled"]=true'
update_genesis '.app_state["registry"]["params"]["authority_rent_duration"]="60s"'
update_genesis '.app_state["registry"]["params"]["authority_grace_period"]="300s"'
update_genesis '.app_state["registry"]["params"]["authority_auction_commits_duration"]="60s"'
update_genesis '.app_state["registry"]["params"]["authority_auction_reveals_duration"]="60s"'
fi
# increase block time (?)
update_genesis '.consensus["params"]["block"]["time_iota_ms"]="1000"'
# Set gas limit in genesis
update_genesis '.consensus["params"]["block"]["max_gas"]="10000000"'
# disable produce empty block
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
else
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
fi
# Set persistent peers
update_comet_config p2p.seeds "\"$P2P_PEERS\""
update_comet_config p2p.persistent_peers "\"$P2P_PEERS\""
update_comet_config p2p.external_address "\"tcp://127.0.0.1:${P2P_EXTERNAL_PORT}\""
update_comet_config p2p.addr_book_strict false
# Enable telemetry (prometheus metrics: http://localhost:1317/metrics?format=prometheus)
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
sed -i '' 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
else
sed -i 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
sed -i 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
sed -i 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
fi
$laconicd config set app telemetry.enable true
$laconicd config set app telemetry.prometheus-retention-time 60
update_comet_config instrumentation.prometheus true
# Allocate genesis accounts (cosmos formatted addresses)
laconicd genesis add-genesis-account $KEY 100000000000000000000000000photon --keyring-backend $KEYRING
# Enable validator distsig
$laconicd config set app distsig.enable true
$laconicd config set app distsig.longterm-key "$KEYNAME"
# Sign genesis transaction
laconicd genesis gentx $KEY 1000000000000000000000photon --keyring-backend $KEYRING --chain-id $CHAINID
# Collect genesis tx
laconicd genesis collect-gentxs
# Run this to ensure everything worked and that the genesis file is setup correctly
laconicd genesis validate
# Nitro config, WIP
# $laconicd config set app nitro.use-distsig true # TODO
$laconicd config set app nitro.eth-key "$KEYNAME"
$laconicd config set app nitro.eth-url "$NITRO_ETH_URL"
$laconicd config set app nitro.eth-start-block "$NITRO_ETH_START_BLOCK"
$laconicd config set app nitro.eth-na-address "'$NITRO_ADJUDICATOR_ADDRESS'"
$laconicd config set app nitro.eth-vpa-address "'$VIRTUAL_PAYMENT_APP_ADDRESS'"
$laconicd config set app nitro.eth-ca-address "'$CONSENSUS_APP_ADDRESS'"
else
echo "Using existing database at $HOME/.laconicd. To replace, run '`basename $0` clean'"
echo "Using existing database at $LACONIC_HOME."
fi
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
laconicd start \
--pruning=nothing \
--log_level $LOGLEVEL \
--minimum-gas-prices=0.0001photon \
--api.enable \
# TODO new pruning config
$laconicd start \
--server.minimum-gas-prices="1$DENOM" \
--rpc.laddr="tcp://0.0.0.0:26657" \
--gql-server --gql-playground
--grpc.address="127.0.0.1:9091" \
--gql.enable --gql.playground
+120
View File
@@ -0,0 +1,120 @@
package server
import (
"context"
"errors"
"fmt"
"cosmossdk.io/log"
"github.com/cometbft/cometbft/node"
"github.com/cometbft/cometbft/p2p"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
)
// HasContextKey is implemented by servers that have a dedicated key under which they should be
// associated with a context.
type HasContextKey interface {
ContextKey() string
}
type HasP2PReactors interface {
P2PReactors() map[string]p2p.Reactor
}
// maps commands to server components they require
var cmdRequirements = map[*cobra.Command][]ServerComponent{}
// SetRequiredComponents sets required server components for a command
func SetRequiredComponents(cmd *cobra.Command, components ...ServerComponent) {
for _, c := range components {
cmdRequirements[cmd] = append(cmdRequirements[cmd], c)
if startmod, ok := c.(HasStartFlags); ok {
cmd.Flags().AddFlagSet(startmod.StartCmdFlags())
}
}
}
func RequiresComponent(cmd *cobra.Command, c string) bool {
components, ok := cmdRequirements[cmd]
if !ok {
return false
}
for _, mod := range components {
if mod.Name() == c {
return true
}
}
return false
}
type ComponentsCreator func(ConfigMap, client.Context, log.Logger, func(string) bool) ([]ServerComponent, error)
type ServerAux struct {
components []ServerComponent
}
// AddComponents adds hooks to create, start and stop the components returned from the passed
// constructor, and ensures they are available on the command context.
// It returns a node.Option to additionally configure the CometBFT node.
func (s *ServerAux) AddComponents(cmd *cobra.Command, initComponents ComponentsCreator) {
needsComponent := func(name string) bool {
return RequiresComponent(cmd, name)
}
// manage component lifecycle
cmd.PreRunE = func(cmd *cobra.Command, args []string) error {
serverCtx := server.GetServerContextFromCmd(cmd)
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
s.components, err = initComponents(
serverCtx.Viper.AllSettings(), clientCtx, serverCtx.Logger, needsComponent,
)
// add available context keys
for _, mod := range s.components {
if ckeymod, ok := mod.(HasContextKey); ok {
cmdCtx := cmd.Context()
if cmdCtx == nil {
cmdCtx = context.Background()
}
cmd.SetContext(context.WithValue(cmdCtx, ckeymod.ContextKey(), mod))
}
}
for _, mod := range s.components {
if err := mod.Start(cmd.Context()); err != nil {
return fmt.Errorf("failed to start server %s: %w", mod.Name(), err)
}
}
return nil
}
startFn := cmd.RunE
cmd.RunE = func(cmd *cobra.Command, args []string) error {
// if we do this in PostRunE, it won't be called if RunE errors
defer func() {
var err error
for _, mod := range s.components {
err = errors.Join(err, mod.Stop(cmd.Context()))
}
if err != nil {
cmd.PrintErrln("failed to stop servers:", err)
}
}()
return startFn(cmd, args)
}
}
// AddReactors adds p2p Reactors for all configured components to a CometBFT node.
// When passed to StartCmdOptions this will be run in start(), after components are initialized in PreRun.
func (s *ServerAux) AddReactors(cmt *node.Node) {
for _, mod := range s.components {
if reactormod, ok := mod.(HasP2PReactors); ok {
opt := node.CustomReactors(reactormod.P2PReactors())
opt(cmt)
}
}
}
+65
View File
@@ -0,0 +1,65 @@
package server
// The utilities in this file are copied from cosmos-sdk server/v2
import (
"fmt"
"github.com/mitchellh/mapstructure"
"github.com/spf13/viper"
)
type ConfigMap map[string]any
// ReadConfig returns a viper instance of the config file
func ReadConfig(configPath string) (*viper.Viper, error) {
v := viper.New()
v.SetConfigType("toml")
v.SetConfigName("config")
v.AddConfigPath(configPath)
if err := v.ReadInConfig(); err != nil {
return nil, fmt.Errorf("failed to read config: %s: %w", configPath, err)
}
v.SetConfigName("app")
if err := v.MergeInConfig(); err != nil {
return nil, fmt.Errorf("failed to merge configuration: %w", err)
}
v.WatchConfig()
return v, nil
}
// UnmarshalSubConfig unmarshals the given (sub) config from the main config (given as a map) into the target.
// If subName is empty, the main config is unmarshaled into the target.
func UnmarshalSubConfig(cfg map[string]any, subName string, target any) error {
var sub any
if subName != "" {
if val, ok := cfg[subName]; ok {
sub = val
}
} else {
sub = cfg
}
// Create a new decoder with custom decoding options
decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
DecodeHook: mapstructure.ComposeDecodeHookFunc(
mapstructure.StringToTimeDurationHookFunc(),
mapstructure.StringToSliceHookFunc(","),
),
Result: target,
WeaklyTypedInput: true,
})
if err != nil {
return fmt.Errorf("failed to create decoder: %w", err)
}
// Decode the sub-configuration
if err := decoder.Decode(sub); err != nil {
return fmt.Errorf("failed to decode sub-configuration: %w", err)
}
return nil
}
+29
View File
@@ -0,0 +1,29 @@
package distsig
import (
"fmt"
"git.vdb.to/cerc-io/laconicd/server"
)
type Config struct {
Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable distributed Schnorr signatures"`
LongtermKey string `mapstructure:"longterm-key" toml:"longterm-key" comment:"The long-term key used in distributed signatures"`
// TODO: set this in genesis
ThresholdRatio float64 `mapstructure:"threshold-ratio" toml:"threshold-ratio" comment:"The ratio of signers required to sign a message"`
}
func DefaultConfig() *Config {
return &Config{
Enable: false,
ThresholdRatio: 4. / 7,
}
}
func UnmarshalConfig(cfg map[string]any) (*Config, error) {
config := DefaultConfig()
if err := server.UnmarshalSubConfig(cfg, componentName, config); err != nil {
return nil, fmt.Errorf("failed to unmarshal %T: %w", config, err)
}
return config, nil
}
+175
View File
@@ -0,0 +1,175 @@
package distsig
import (
"errors"
"math/big"
"testing"
"cosmossdk.io/log"
"git.vdb.to/cerc-io/chain-signatures/ethschnorr"
sdktestutil "github.com/cosmos/cosmos-sdk/testutil"
"github.com/stretchr/testify/require"
"git.vdb.to/cerc-io/laconicd/testutil"
)
func NewTestManager(t *testing.T) (*Manager, Point) {
logger := log.NewTestLogger(t)
kr := testutil.NewKeyring()
accounts := sdktestutil.CreateKeyringAccounts(t, kr, 1)
cfg := DefaultConfig()
cfg.LongtermKey = accounts[0].Name
dsm, err := New(logger, cfg, kr)
require.NoError(t, err)
longterm, err := kr.Key(cfg.LongtermKey)
require.NoError(t, err)
longtermPoint, err := KeyRecordToPoint(longterm)
require.NoError(t, err)
return dsm, longtermPoint
}
type round struct {
name string
verify func(*Manager) error
tweak func([]PeerMessages)
}
var (
dkgRounds = []round{
{
name: "deal",
},
{
name: "response",
verify: func(m *Manager) error {
if !m.currentDkg().Certified() {
return errors.New("not certified")
}
return nil
},
},
{
name: "commit",
verify: func(m *Manager) error {
if !m.currentDkg().Finished() {
return errors.New("run not finished")
}
if m.currentDkg().share == nil {
return errors.New("dist key share is absent")
}
return nil
},
},
}
dssRounds = []round{
{
name: "sign",
verify: func(m *Manager) error {
dss := m.sigs[m.completeSigs[0]]
if dss.sig == nil {
return errors.New("signature is nil")
}
dkg, err := m.getDkg(dss.dkgID)
if err != nil {
return err
}
return ethschnorr.Verify(dkg.share.Public(), dss.Message(), dss.sig)
},
},
}
)
func runRound(t *testing.T, r round, members []*Manager) {
buf := make([]PeerMessages, len(members))
for i := range members {
buf[i] = members[i].FlushMessages()
}
if r.tweak != nil {
r.tweak(buf)
}
for i := range members {
for j := range members {
if i == j {
continue
}
require.NoError(t, members[i].ProcessMessages(&buf[j]),
"round=%s, i=%d, j=%d", r.name, i, j)
}
}
if r.verify != nil {
for i, m := range members {
require.NoError(t, r.verify(m), "round=%s, i=%d", r.name, i)
}
}
}
func TestDkgBasic(t *testing.T) {
numMembers := 2
blockHeight := int64(1)
members := make([]*Manager, numMembers)
pubkeys := make([]Point, numMembers)
for i := range members {
members[i], pubkeys[i] = NewTestManager(t)
}
t.Logf("DKG with %d members", numMembers)
for i, m := range members {
require.NoError(t, m.StartDKG(blockHeight, pubkeys), "i=%d", i)
}
for _, r := range dkgRounds {
runRound(t, r, members)
}
require.False(t, members[0].NeedDKG(pubkeys))
require.Error(t, members[0].StartDKG(blockHeight, pubkeys))
// add participants and refresh DKG
for len(members) < 7 {
blockHeight++
m, pub := NewTestManager(t)
members = append(members, m)
pubkeys = append(pubkeys, pub)
t.Logf("DKG with %d members", len(members))
for i, m := range members {
require.True(t, m.NeedDKG(pubkeys), "i=%d", i)
require.NoError(t, m.StartDKG(blockHeight, pubkeys), "i=%d", i)
}
for _, r := range dkgRounds {
runRound(t, r, members)
}
}
}
func TestSignatureBasic(t *testing.T) {
numMembers := 7
members := make([]*Manager, numMembers)
pubkeys := make([]Point, numMembers)
for i := range members {
members[i], pubkeys[i] = NewTestManager(t)
}
for _, m := range members {
require.NoError(t, m.StartDKG(1, pubkeys))
}
for _, r := range dkgRounds {
runRound(t, r, members)
}
msg := big.NewInt(42)
for _, m := range members {
require.NoError(t, m.StartSignature(m.currentDkgID, msg))
}
runRound(t, dssRounds[0], members)
require.Error(t, members[0].StartSignature(0, msg))
require.NoError(t, members[0].StartDKG(2, pubkeys[:3]))
require.Error(t, members[0].StartSignature(2, msg))
}
+19
View File
@@ -0,0 +1,19 @@
package distsig
import (
"fmt"
"github.com/spf13/pflag"
)
func prefix(f string) string {
return fmt.Sprintf("%s.%s", componentName, f)
}
var (
FlagLongtermKey = prefix("longterm-key")
)
func AddNitroFlags(flags *pflag.FlagSet) {
flags.String(FlagLongtermKey, "", "The long-term key used in distributed signatures")
}
+224
View File
@@ -0,0 +1,224 @@
package distsig
import (
"fmt"
dkg "go.dedis.ch/kyber/v3/share/dkg/rabin"
)
// DkgMessages collects local DKG messages that are pending broadcast.
type DkgMessages struct {
runID DkgRunID
messages []dkgMessage
}
// DKG steps (actions) that are executed by the DKG protocol
type dkgStep int
const (
dkg_deal dkgStep = iota
dkg_certify
dkg_commit
dkg_finish
dkg_done
)
type dkgRun struct {
*dkg.DistKeyGenerator
// runID RunID
msgBuffer []dkgMessage
step dkgStep
share *dkg.DistKeyShare
}
type dkgMessage interface {
send(*dkgRun) (dkgMessage, error)
from() uint32
target() uint32
}
// prepareMessages produces DKG state transitions that don't rely on peer inputs, i.e. the deal or
// commit steps. This is called during ExtendVote by all validators.
func (d *dkgRun) prepareMessages() error {
out, err := d.handleMessage(nil)
if err != nil {
return err
}
if out != nil {
d.msgBuffer = append(d.msgBuffer, out...)
}
return nil
}
func (d *dkgRun) flushMessages() []dkgMessage {
buf := d.msgBuffer
d.msgBuffer = nil
return buf
}
// processMessages processes incoming DKG messages and produces outgoing messages. This is called
// during VerifyVoteExtension by all validators (TODO: verify).
func (d *dkgRun) processMessages(in []dkgMessage) error {
for _, msg := range in {
out, err := d.handleMessage(msg)
if err != nil {
return err
}
if out != nil {
d.msgBuffer = append(d.msgBuffer, out...)
}
}
return nil
}
func (d *dkgRun) handleMessage(in dkgMessage) ([]dkgMessage, error) {
// fmt.Printf("[%d, %7s] handle: %T", d.index, d.step, in)
// if in != nil {
// fmt.Printf(" (from %d to %+v)", in.from(), in.target())
// }
// fmt.Println()
// nil input means we try to execute a step requiring no peer input
if in == nil {
var out []dkgMessage
switch d.step {
case dkg_deal:
deals, err := d.Deals()
if err != nil {
return nil, err
}
for index, deal := range deals {
out = append(out, msgDeal{index: uint32(index), msg: deal})
}
case dkg_commit:
sc, err := d.SecretCommits()
if err != nil {
return nil, err
}
out = []dkgMessage{msgSecretCommits{msg: sc}}
case dkg_done:
dks, err := d.DistKeyShare()
if err != nil {
return nil, err
}
d.share = dks
default:
return nil, fmt.Errorf("unexpected stage: %v", d.step)
}
d.step = nextStep(d.step)
return out, nil
}
var out []dkgMessage
if msg, err := in.send(d); err != nil {
return nil, err
} else if msg != nil {
out = []dkgMessage{msg}
}
if (d.step == dkg_certify && d.Certified()) ||
(d.step == dkg_finish && d.Finished()) {
d.step = nextStep(d.step)
msgs, err := d.handleMessage(nil)
if err != nil {
return nil, err
}
out = append(out, msgs...)
}
return out, nil
}
func nextStep(step dkgStep) dkgStep {
if step == dkg_done {
return dkg_done
}
return step + 1
}
type (
msgDeal struct {
msg *dkg.Deal
index uint32 // recipient index
}
msgResponse struct{ msg *dkg.Response }
msgJustification struct{ msg *dkg.Justification }
msgSecretCommits struct{ msg *dkg.SecretCommits }
msgComplaintCommits struct{ msg *dkg.ComplaintCommits }
msgReconstructCommits struct{ msg *dkg.ReconstructCommits }
)
func (m msgDeal) send(d *dkgRun) (dkgMessage, error) {
if m.index != uint32(d.Index()) {
return nil, nil
}
out, err := d.ProcessDeal(m.msg)
if err != nil {
return nil, err
}
return msgResponse{out}, nil
}
func (m msgResponse) send(d *dkgRun) (dkgMessage, error) {
if out, err := d.ProcessResponse(m.msg); err != nil {
return nil, err
} else if out != nil {
return msgJustification{out}, nil
}
return nil, nil
}
func (m msgJustification) send(d *dkgRun) (dkgMessage, error) {
return nil, d.ProcessJustification(m.msg)
}
func (m msgSecretCommits) send(d *dkgRun) (dkgMessage, error) {
if out, err := d.ProcessSecretCommits(m.msg); err != nil {
return nil, err
} else if out != nil {
return msgComplaintCommits{out}, nil
}
return nil, nil
}
func (m msgComplaintCommits) send(d *dkgRun) (dkgMessage, error) {
out, err := d.ProcessComplaintCommits(m.msg)
if err != nil {
return nil, err
}
return msgReconstructCommits{out}, nil
}
func (m msgReconstructCommits) send(d *dkgRun) (dkgMessage, error) {
return nil, d.ProcessReconstructCommits(m.msg)
}
func (d dkgStep) String() string {
switch d {
case dkg_deal:
return "deal"
case dkg_certify:
return "certify"
case dkg_commit:
return "commit"
case dkg_finish:
return "finish"
case dkg_done:
return "done"
default:
return "unknown"
}
}
// for debugging
func (m msgDeal) from() uint32 { return m.msg.Index }
func (m msgResponse) from() uint32 { return m.msg.Response.Index }
func (m msgJustification) from() uint32 { return m.msg.Justification.Index }
func (m msgSecretCommits) from() uint32 { return m.msg.Index }
func (m msgComplaintCommits) from() uint32 { return m.msg.Index }
func (m msgReconstructCommits) from() uint32 { return m.msg.Index }
func (m msgDeal) target() uint32 { return m.index }
func (m msgResponse) target() uint32 { return m.msg.Index }
func (m msgJustification) target() uint32 { return m.msg.Index }
func (m msgSecretCommits) target() uint32 { return 0 }
func (m msgComplaintCommits) target() uint32 { return m.msg.DealerIndex }
func (m msgReconstructCommits) target() uint32 { return m.msg.DealerIndex }
+268
View File
@@ -0,0 +1,268 @@
package distsig
import (
"context"
"fmt"
"math"
"math/big"
cmtcrypto "github.com/cometbft/cometbft/crypto"
"github.com/ethereum/go-ethereum/common"
dkg "go.dedis.ch/kyber/v3/share/dkg/rabin"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
clientdss "git.vdb.to/cerc-io/chain-signatures/ethdss"
"git.vdb.to/cerc-io/chain-signatures/ethschnorr"
"git.vdb.to/cerc-io/laconicd/server"
"git.vdb.to/cerc-io/laconicd/utils"
)
type (
DealMap = map[int]*dkg.Deal
DkgRunID int64
SigRunID string
)
const (
componentName = "distsig"
)
type Manager struct {
config *Config
logger log.Logger
keyring keyring.Keyring
longtermKey Scalar // only initialized after Start()
longtermPubKey cmtcrypto.PubKey
dkgs map[DkgRunID]*dkgRun
currentDkgID DkgRunID // zero indicates no current run
sigs map[SigRunID]*sigRun
completeSigs []SigRunID
}
type PeerMessages struct {
dkg *DkgMessages
dss []SigMessages
}
func New(logger log.Logger, globalConfig server.ConfigMap, kr keyring.Keyring) (*Manager, error) {
config, err := UnmarshalConfig(globalConfig)
if err != nil {
return nil, err
}
m := &Manager{
config: config,
keyring: kr,
dkgs: make(map[DkgRunID]*dkgRun),
sigs: make(map[SigRunID]*sigRun),
}
m.logger = logger.With(log.ModuleKey, m.Name())
return m, nil
}
func (*Manager) Name() string { return componentName }
func (m *Manager) Start(ctx context.Context) error {
if !m.config.Enable {
m.logger.Info(fmt.Sprintf("%s server is disabled via config", m.Name()))
return nil
}
if m.config.LongtermKey == "" {
return fmt.Errorf("missing longterm key")
}
longtermPrivKey, err := utils.ExtractPrivateKeyByUid(m.keyring, m.config.LongtermKey)
if err != nil {
return fmt.Errorf("failed to extract longterm key: %w", err)
}
m.longtermKey = suite.Scalar().SetBytes(longtermPrivKey.Bytes())
m.longtermPubKey = longtermPrivKey.PubKey()
return nil
}
func (*Manager) Stop(context.Context) error { return nil }
func (m *Manager) Config() any {
if m.config == nil {
return DefaultConfig()
}
return m.config
}
func (m *Manager) getDkg(runid DkgRunID) (*dkgRun, error) {
if runid == 0 {
// runid = m.currentDkg
return nil, fmt.Errorf("invalid run ID")
}
if run, ok := m.dkgs[runid]; ok {
return run, nil
}
return nil, fmt.Errorf("DKG not initialized for run: %v", runid)
}
func (m *Manager) currentDkg() *dkgRun {
run, err := m.getDkg(m.currentDkgID)
if err != nil {
panic(err)
}
return run
}
func (m *Manager) LongtermPublicKey() cmtcrypto.PubKey {
return m.longtermPubKey
}
func (m *Manager) LongtermEthAddress() common.Address {
pubkey, err := SuitePublicKeyFromBytes(m.LongtermPublicKey().Bytes())
if err != nil {
panic(fmt.Errorf("failed to parse longterm pubkey: %w", err))
}
return pubkey.Address()
}
func thresholdForRatio(m int, tr float64) int {
return int(math.Ceil(float64(m) * tr))
}
func (m *Manager) initDKG(members []Point) (*dkgRun, error) {
t := thresholdForRatio(len(members), m.config.ThresholdRatio)
keygen, err := dkg.NewDistKeyGenerator(suite.(dkg.Suite), m.longtermKey, members, t)
if err != nil {
return nil, err
}
return &dkgRun{DistKeyGenerator: keygen}, nil
}
// NeedDKG returns true if DKG needs to be run for the given participants.
func (m *Manager) NeedDKG(pubkeys []Point) bool {
return m.currentDkgID == 0 || !equalPoints(m.currentDkg().Participants(), pubkeys)
}
// StartDKG begins a new DKG run including the given participants.
func (m *Manager) StartDKG(block int64, pubkeys []Point) error {
// TODO: generate runid from block height and hash of pubkeys?
runid := DkgRunID(block)
if _, ok := m.dkgs[runid]; ok {
return fmt.Errorf("DKG run %v already exists", runid)
}
if len(pubkeys) < 2 {
m.currentDkgID = 0
m.logger.Debug("Too few participants for distributed signature")
return nil
}
run, err := m.initDKG(pubkeys)
if err != nil {
return err
}
m.dkgs[runid] = run
m.currentDkgID = runid
return run.prepareMessages()
}
func (m *Manager) initDSS(dkgid DkgRunID, msg *big.Int) (*sigRun, error) {
run, err := m.getDkg(dkgid)
if err != nil {
return nil, err
}
if !run.Finished() {
return nil, fmt.Errorf("DKG run has not finished: %v", dkgid)
}
random, err := run.DistKeyShare()
if err != nil {
return nil, err
}
dss, err := clientdss.NewDSS(clientdss.DSSArgs{
Secret: m.longtermKey,
Participants: run.Participants(),
Long: run.share,
Random: random,
Msg: msg,
T: run.Threshold(),
// Qualified: run.QUAL(),
})
if err != nil {
return nil, err
}
return &sigRun{DSS: dss, dkgID: dkgid}, nil
}
// StartSignature begins a DSS run for the given message and DKG state.
func (m *Manager) StartSignature(msg *big.Int) error {
if m.currentDkgID == 0 {
return fmt.Errorf("no distributed key prepared")
}
run, err := m.initDSS(m.currentDkgID, msg)
if err != nil {
return err
}
sigid := run.SigRunID()
m.sigs[sigid] = run
return run.prepareMessages()
}
func (m *Manager) CompletedSignatures() map[SigRunID]ethschnorr.Signature {
var ret map[SigRunID]ethschnorr.Signature
for _, id := range m.completeSigs {
run, ok := m.sigs[id]
if !ok {
panic(fmt.Errorf("DSS run not found: %v", id))
}
if run.sig == nil {
panic(fmt.Errorf("DSS signature not completed: %v", id))
}
// Deterministically pick a participant responsible for submitting the signature
session := new(big.Int).SetBytes(run.SessionID()[:8])
submitterIdx := session.Uint64() % uint64(len(run.Participants()))
if run.Index() == int(submitterIdx) {
ret[id] = run.sig
}
}
return ret
}
// FlushMessages flushes the message buffers for any active DKG and DSS runs.
func (m *Manager) FlushMessages() PeerMessages {
var ret PeerMessages
if buf := m.currentDkg().flushMessages(); len(buf) != 0 {
ret.dkg = &DkgMessages{runID: m.currentDkgID, messages: buf}
}
for id, run := range m.sigs {
if buf := run.flushMessages(); buf != nil {
ret.dss = append(ret.dss, SigMessages{id, buf})
}
}
return ret
}
// ProcessMessages processes DKG and DSS peer messages.
func (m *Manager) ProcessMessages(dm *PeerMessages) error {
if dkg := dm.dkg; dkg != nil {
run, err := m.getDkg(dkg.runID)
if err != nil {
return err
}
if err := run.processMessages(dkg.messages); err != nil {
return err
}
}
for _, dss := range dm.dss {
run, ok := m.sigs[dss.runID]
if !ok {
return fmt.Errorf("DSS not initialized for run: %v", dss.runID)
}
if err := run.processMessage(dss.messages); err != nil {
return err
}
if run.sig != nil {
m.completeSigs = append(m.completeSigs, dss.runID)
}
}
return nil
}
func (pm PeerMessages) Empty() bool {
return pm.dkg == nil && len(pm.dss) == 0
}
+61
View File
@@ -0,0 +1,61 @@
package distsig
import (
"fmt"
clientdss "git.vdb.to/cerc-io/chain-signatures/ethdss"
"git.vdb.to/cerc-io/chain-signatures/ethschnorr"
)
type SigMessages struct {
runID SigRunID
messages sigMessage
}
type sigStep int
const (
sig_partial sigStep = iota
sig_complete
)
type sigRun struct {
*clientdss.DSS
msgBuffer sigMessage
dkgID DkgRunID
step sigStep
sig ethschnorr.Signature
}
type sigMessage = *clientdss.PartialSig
func (d *sigRun) SigRunID() SigRunID {
return SigRunID(fmt.Sprintf("%020d-%x", d.dkgID, d.SessionID()[:8]))
}
func (d *sigRun) prepareMessages() error {
var err error
d.msgBuffer, err = d.PartialSig()
return err
}
func (d *sigRun) flushMessages() sigMessage {
buf := d.msgBuffer
d.msgBuffer = nil
return buf
}
func (d *sigRun) processMessage(in sigMessage) error {
err := d.ProcessPartialSig(in)
if err != nil {
return err
}
// return d.EnoughPartialSig(), nil
if d.EnoughPartialSig() {
d.sig, err = d.Signature()
return err
}
return nil
}
+39
View File
@@ -0,0 +1,39 @@
package distsig
import (
"fmt"
"git.vdb.to/cerc-io/chain-signatures/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/suites"
)
type (
Scalar = kyber.Scalar
Point = kyber.Point
PublicKey = secp256k1.PublicKey
)
var (
suite suites.Suite = secp256k1.NewBlakeKeccackSecp256k1()
NewScalar = suite.Scalar
NewPoint = suite.Point
// Note: the compressed encoding of pubkeys used by Cosmos SDK and our library (based on chainlink)
// are the same. See gitlab.com/yawning/secp256k1-voi/secec
SuitePublicKeyFromBytes = secp256k1.NewPublicKeyFromBytes
)
func KeyRecordToPoint(longterm *keyring.Record) (kyber.Point, error) {
pubkey, err := longterm.GetPubKey()
if err != nil {
return nil, fmt.Errorf("failed to access public key: %w", err)
}
suitePubkey, err := SuitePublicKeyFromBytes(pubkey.Bytes())
if err != nil {
return nil, fmt.Errorf("failed to decode public key: %w", err)
}
return suitePubkey.Point()
}
+13
View File
@@ -0,0 +1,13 @@
package distsig
func equalPoints(a, b []Point) bool {
if len(a) != len(b) {
return false
}
for i, p := range a {
if !p.Equal(b[i]) {
return false
}
}
return true
}
+36
View File
@@ -0,0 +1,36 @@
package server
import (
"context"
"cosmossdk.io/core/gas"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var _ gas.Service = gasService{}
// Placeholder gas service, in anticipation of future use
// https://github.com/cosmos/cosmos-sdk/pull/16310
type gasService struct{}
func NewGasService() gas.Service { return gasService{} }
func (gasService) GetGasMeter(ctx context.Context) gas.Meter {
c := sdk.UnwrapSDKContext(ctx)
return c.GasMeter()
}
func (gasService) WithGasMeter(ctx context.Context, meter gas.Meter) context.Context {
c := sdk.UnwrapSDKContext(ctx)
return c.WithGasMeter(meter)
}
// deprecated https://github.com/cosmos/cosmos-sdk/issues/19793
func (gasService) GetBlockGasMeter(context.Context) gas.Meter {
return nil
}
// deprecated https://github.com/cosmos/cosmos-sdk/issues/19793
func (gasService) WithBlockGasMeter(ctx context.Context, meter gas.Meter) context.Context {
return ctx
}
+230
View File
@@ -0,0 +1,230 @@
package nitro
import (
"fmt"
"math/big"
"runtime"
"strings"
"time"
"github.com/cometbft/cometbft/p2p"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
"github.com/statechannels/go-nitro/protocols"
nitrotypes "github.com/statechannels/go-nitro/types"
"git.vdb.to/cerc-io/laconicd/server/relay"
"git.vdb.to/cerc-io/laconicd/utils"
)
const txTimeoutDuration = 5 * time.Second
func GetServerFromCmd(cmd *cobra.Command) (*Server, error) {
s, err := utils.GetFromContext[Server](cmd.Context(), ServerContextKey)
if err != nil {
return nil, err
}
for !s.Ready() {
runtime.Gosched()
}
return s, nil
}
func delayAfterUpdate() {
// HACK: delay so remote server status is synced before we return
// TODO: correct solution is passing messages with consistency guarantees,
// i.e. using txs to pass nitro messages and integrating state into chain storage
time.Sleep(500 * time.Millisecond)
}
// waitForObjective waits for an objective to complete or fail using select pattern
func waitForObjective[Info any](
failedChan <-chan protocols.ObjectiveId,
objective protocols.ObjectiveId,
updateChan <-chan Info,
statusCheck func(Info) bool,
) error {
for {
select {
case update := <-updateChan:
if statusCheck(update) {
delayAfterUpdate()
return nil
}
case failedObjective := <-failedChan:
if failedObjective == objective {
return fmt.Errorf("objective failed for unspecified reason: %s", objective)
}
}
}
}
func submitNitroTx(
clientCtx client.Context,
cmd *cobra.Command,
msg MsgWrapper,
unordered bool,
) error {
if msg.SignerField != nil {
ac := utils.NewAddressCodec()
var err error
*msg.SignerField, err = ac.BytesToString(clientCtx.FromAddress)
if err != nil {
return err
}
}
factory, err := tx.NewFactoryCLI(clientCtx, cmd.Flags())
if err != nil {
return err
}
if unordered {
deadline := time.Now().Add(txTimeoutDuration)
factory = factory.WithUnordered(true).WithTimeoutTimestamp(deadline)
}
if err := tx.GenerateOrBroadcastTxWithFactory(clientCtx, factory, msg.Msg); err != nil {
return err
}
return nil
}
// setupNitroCommand sets up common infrastructure for nitro commands
func setupNitroCommand(cmd *cobra.Command) (*client.Context, *Server, func() error, error) {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return nil, nil, nil, err
}
s, err := GetServerFromCmd(cmd)
if err != nil {
return nil, nil, nil, err
}
relayServer, err := relay.GetServerFromCmd(cmd)
if err != nil {
return nil, nil, nil, err
}
sw, err := connectAsPeer(clientCtx, relayServer, s.P2PReactors())
if err != nil {
return nil, nil, nil, err
}
return &clientCtx, s, sw.Stop, nil
}
// setupNitroQueryCommand sets up infrastructure for nitro query commands (no tx context needed)
func setupNitroQueryCommand(cmd *cobra.Command, needp2p bool) (*Server, func() error, error) {
s, err := GetServerFromCmd(cmd)
if err != nil {
return nil, nil, err
}
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return nil, nil, err
}
if !needp2p {
return s, func() error { return nil }, nil
}
relayServer, err := relay.GetServerFromCmd(cmd)
if err != nil {
return nil, nil, err
}
sw, err := connectAsPeer(clientCtx, relayServer, s.P2PReactors())
if err != nil {
return nil, nil, err
}
return s, sw.Stop, nil
}
// resolveTokens resolves amount and asset address to Nitro funds
func resolveTokens(s *Server, amountStr, assetAddr string) (nitrotypes.Funds, error) {
var amount *big.Int
var asset common.Address
if assetAddr != "" {
// Parse asset address
if !common.IsHexAddress(assetAddr) {
return nitrotypes.Funds{}, fmt.Errorf("invalid asset address: %s", assetAddr)
}
asset = common.HexToAddress(assetAddr)
// A token specified by address must have an integer amount
amount = new(big.Int)
if _, ok := amount.SetString(amountStr, 10); !ok {
return nitrotypes.Funds{}, fmt.Errorf("invalid amount for token %s: %s", assetAddr, amountStr)
}
if amount.Sign() <= 0 {
return nitrotypes.Funds{}, fmt.Errorf("amount must be positive for token %s: %s", assetAddr, amountStr)
}
} else {
// Parse as (known) coins and convert
coins, err := sdk.ParseCoinsNormalized(amountStr)
if err != nil {
return nitrotypes.Funds{}, fmt.Errorf("failed to parse coins: %w", err)
}
if len(coins) != 1 {
return nitrotypes.Funds{}, fmt.Errorf("only one asset is supported")
}
// Convert denomination to token address
asset, err = denomToToken(coins[0].Denom)
if err != nil {
return nitrotypes.Funds{}, err
}
amount = coins[0].Amount.BigInt()
}
return nitrotypes.Funds{asset: amount}, nil
}
// map denoms to token addresses
// TODO nitro should control this mapping, and resolution should happen in the module logic
func denomToToken(denom string) (common.Address, error) {
_tokens := map[string]common.Address{
"eth": {},
}
token, ok := _tokens[strings.ToLower(denom)]
if !ok {
return common.Address{}, fmt.Errorf("unknown token %s", denom)
}
return token, nil
}
// connects as a peer to the relay server, initializing the P2P switch
func connectAsPeer(
clientCtx client.Context, relayServer *relay.Server, reactors map[string]p2p.Reactor,
) (*relay.Switch, error) {
// initialize the switch using the target's node info
status, err := clientCtx.Client.Status(clientCtx.CmdContext)
if err != nil {
return nil, err
}
nodeInfo := status.NodeInfo
sw, err := relayServer.GetSwitch(clientCtx.ChainID, nodeInfo.ProtocolVersion.Block)
if err != nil {
return nil, fmt.Errorf("error creating switch: %w", err)
}
for name, reactor := range reactors {
if err := sw.AddReactor(name, reactor); err != nil {
return nil, fmt.Errorf("error adding reactor: %w", err)
}
}
if err := sw.Start(); err != nil {
return nil, fmt.Errorf("error starting switch: %w", err)
}
peerAddr := p2p.IDAddressString(nodeInfo.ID(), nodeInfo.ListenAddr)
// s.logger.Debug("dialing peer", "peer", peerAddr)
if err := sw.Dial(peerAddr); err != nil {
return nil, fmt.Errorf("error dialing peer: %w", err)
}
return sw, nil
}
+80
View File
@@ -0,0 +1,80 @@
package nitro
import (
"errors"
"fmt"
"git.vdb.to/cerc-io/laconicd/server"
)
type Config struct {
Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable Nitro state channel functionality"`
EthKey string `mapstructure:"eth-key" toml:"eth-key" comment:"The private key used when interacting with the Ethereum chain and for our identity as a participant in the Nitro protocol."`
// UseDistsig bool `mapstructure:"use-distsig" toml:"use-distsig" comment:"Whether to use distributed signatures to authenticate Nitro actions."`
// EthChainID string
EthURL string `mapstructure:"eth-url" toml:"eth-url" comment:"The URL of the Ethereum node to connect to."`
EthAuthToken string `mapstructure:"eth-auth-token" toml:"eth-auth-token" comment:"The bearer token used for auth in requests to the Ethereum chain's RPC endpoint."`
EthStartBlock uint64 `mapstructure:"eth-start-block" toml:"eth-start-block" comment:"Ethereum block number to start listening for Nitro Adjudicator events."`
// TODO: move to module params?
EthNaAddress string `mapstructure:"eth-na-address" toml:"eth-na-address" comment:"Ethereum address of the Nitro Adjudicator contract."`
EthVpaAddress string `mapstructure:"eth-vpa-address" toml:"eth-vpa-address" comment:"Ethereum address of the Virtual Payment App contract."`
EthCaAddress string `mapstructure:"eth-ca-address" toml:"eth-ca-address" comment:"Ethereum address of the Consensus App contract."`
// P2P Rate Limiting
P2PRateLimitEnable bool `mapstructure:"p2p-rate-limit-enable" toml:"p2p-rate-limit-enable" comment:"Enable send-side rate limiting for P2P messages."`
P2PRateLimitRate float64 `mapstructure:"p2p-rate-limit-rate" toml:"p2p-rate-limit-rate" comment:"Maximum number of P2P messages per second (e.g., 10.0 for 10 messages/second)."`
P2PRateLimitBurst int `mapstructure:"p2p-rate-limit-burst" toml:"p2p-rate-limit-burst" comment:"Maximum burst size for P2P rate limiter."`
}
func DefaultConfig() *Config {
return &Config{
Enable: true,
// UseDistsig: false,
// EthURL: "ws://127.0.0.1:8545",
// Default rate limiting: 10 messages/second with burst of 20
P2PRateLimitEnable: true,
P2PRateLimitRate: 10.0,
P2PRateLimitBurst: 20,
}
}
func (c Config) Validate() error {
if !c.Enable {
return nil
}
if c.EthKey == "" {
return errors.New("nitro.eth-key must be set")
}
// TODO With distsig enabled, eth-key will be a mutually exclusive setting, and authentication
// for signing groups will be done using longterm key
//
// if c.UseDistsig && c.EthKey != "" {
// return errors.New("nitro.eth-key should not be set when distsig is enabled")
// }
// Validate rate limiting config
if c.P2PRateLimitEnable {
if c.P2PRateLimitRate <= 0 {
return errors.New("nitro.p2p-rate-limit-rate must be positive when rate limiting is enabled")
}
if c.P2PRateLimitBurst <= 0 {
return errors.New("nitro.p2p-rate-limit-burst must be positive when rate limiting is enabled")
}
}
return nil
}
func UnmarshalConfig(cfg map[string]any) (*Config, error) {
config := DefaultConfig()
if len(cfg) > 0 {
if err := server.UnmarshalSubConfig(cfg, serverName, config); err != nil {
return nil, fmt.Errorf("failed to unmarshal %T: %w", config, err)
}
}
return config, nil
}
+71
View File
@@ -0,0 +1,71 @@
package nitro
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConfigValidation(t *testing.T) {
tests := []struct {
name string
config Config
expectErr bool
}{
{
name: "valid config with rate limiting",
config: Config{
Enable: true,
EthKey: "test-eth-key",
P2PRateLimitEnable: true,
P2PRateLimitRate: 10.0,
P2PRateLimitBurst: 20,
},
expectErr: false,
},
{
name: "invalid rate - zero",
config: Config{
Enable: true,
EthKey: "test-eth-key",
P2PRateLimitEnable: true,
P2PRateLimitRate: 0,
P2PRateLimitBurst: 20,
},
expectErr: true,
},
{
name: "invalid burst - zero",
config: Config{
Enable: true,
EthKey: "test-eth-key",
P2PRateLimitEnable: true,
P2PRateLimitRate: 10.0,
P2PRateLimitBurst: 0,
},
expectErr: true,
},
{
name: "rate limiting disabled - no validation needed",
config: Config{
Enable: true,
EthKey: "test-eth-key",
P2PRateLimitEnable: false,
P2PRateLimitRate: 0, // Invalid but should be ignored
P2PRateLimitBurst: 0, // Invalid but should be ignored
},
expectErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.config.Validate()
if tt.expectErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
})
}
}

Some files were not shown because too many files have changed in this diff Show More