feat: OpenAPI page#1853
Conversation
) * chore(deps): Bump bufbuild/buf-setup-action from 1.22.0 to 1.23.1 Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.22.0 to 1.23.1. - [Release notes](https://github.com/bufbuild/buf-setup-action/releases) - [Commits](bufbuild/buf-setup-action@v1.22.0...v1.23.1) --- updated-dependencies: - dependency-name: bufbuild/buf-setup-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
…1476) bindings-perp contract + remove sudo permissioning
* fix(proto): use correct proto package * fix(perp): check position changed event fields * refactor: clean up code * refactor: clean code * chore: linter
* refactor(oracle)!: use typed events for exchange rate changes * finish the move to typed events * changelog * refactor(oracle): rm unused constants file * refactor(oracle)!: use ExchangeRateTuples instead of strings in event * small typo in comments * refactor(oracle)!: prefer "Price" to "ExchangeRate" in events
* fix(test): position changed event comparison * refactor: use reflect.DeepEqual * chore: linter
* feat(perp); add `MsgPartialClose` * test(perp): partial close * fix(test): position changed event comparison * fix: margin to user assertion * refactor: use reflect.DeepEqual * chore: linter * test(perp): partial close * better error messaging * add more descriptive error message * test partial close with bad debt * test(perp): partial close short positions * feat(perp): partial close CLI * Update CHANGELOG.md * fix linter * fix: tests
* fix some non conventional issues on sudo module * linter * remove old handler * linter * linter * linter * use constants * linter
* add sudo root account cmd * add sudo root command into cobra cli * use make lint * replace set validator as sudoer into script localnet * add changelog
* ci: fix chaosnet for v0.21 * Update CHAOSNET.md * use different mnemonics for liquidator, pricefeeder, and faucet * Update chaosnet.sh
* chore(deps): Bump google.golang.org/grpc from 1.56.1 to 1.56.2 Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.56.1 to 1.56.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](grpc/grpc-go@v1.56.1...v1.56.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
* refactor: clean code * refactor: clean code * refactor: clean code * refactor: clean code * test(perp): fix RemoveMargin test * fix(perp): allow closing positions with bad debt * test(perp): close position tests * test(perp): close short position * test(perp): close long position with bad debt * chore: remove redundant ClosePosition tests * Update CHANGELOG.md * refactor: clean code * fix(perp): add bad debt check on partial close * refactor: add context to error messages * test(perp): partial close below maintenance margin ratio * test(perp); partial close below mmr * test(perp); partial close with bad debt * test(perp): partial close short position with bad debt * refactor: clean code * fix: use updated AMM when calculating the margin ratio
* fix(spot): wire msg server to module * chore(spot): remove handler * test(spot): join pool cmd * test(spot): create pool cmd * test(spot): create pool errors * refactor: rename testutil variables * test(spot): create pool errors * test(spot): create pool cmd * test(spot): join stable pool * test(spot): swap assets * test(spot): swap stable assets cmd * test(spot): exit pool cmd * test(spot): exit stable pool cmd * Update CHANGELOG.md * refactor(epoch): remove unused methods * refactor(inflation): remove unnecessary methods * refactor(perp): clean up module * refactor(spot): clean up module * refactor(stablecoin): clean up module * refactor(sudo): clean up module
* create msg change root proto * use test keeper only for tests * move convenience wrapper * move convenience wrapper * remove pb folder * move files where convention rules * split msg server from keeper * split querier from keeper * add message server change root command * change root cli command * add change root command * add changelog * add test trick for ordering
* remove commented code * test(perp): reverse market order with bad debt * test(perp): reverse market order with short position * test(perp): more test cases * Update CHANGELOG.md
* feat(proto): python buf template * docs: comments to help with running proto gen in python * feat(proto): python buf generation * feat(localnet.sh): (1) Makes script run while offline. (2) Adds --no-build option for external usage * changelog
Bumps [github.com/holiman/uint256](https://github.com/holiman/uint256) from 1.2.2 to 1.2.3. - [Release notes](https://github.com/holiman/uint256/releases) - [Commits](holiman/uint256@v1.2.2...v1.2.3) --- updated-dependencies: - dependency-name: github.com/holiman/uint256 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
) * chore(deps): Bump bufbuild/buf-setup-action from 1.23.1 to 1.24.0 Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.23.1 to 1.24.0. - [Release notes](https://github.com/bufbuild/buf-setup-action/releases) - [Commits](bufbuild/buf-setup-action@v1.23.1...v1.24.0) --- updated-dependencies: - dependency-name: bufbuild/buf-setup-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
* feat: add wasm oracle exchange rate query * chore: changelog * feat: let wasm contracts query exchange rates * wip * feat: adapt bindings types for the oracle price query --------- Co-authored-by: Unique-Divine <realuniquedivine@gmail.com>
* add ledger build suppport * update changelog
* chore(deps): Bump github.com/CosmWasm/wasmvm from 1.2.4 to 1.3.0 Bumps [github.com/CosmWasm/wasmvm](https://github.com/CosmWasm/wasmvm) from 1.2.4 to 1.3.0. - [Release notes](https://github.com/CosmWasm/wasmvm/releases) - [Changelog](https://github.com/CosmWasm/wasmvm/blob/main/CHANGELOG.md) - [Commits](CosmWasm/wasmvm@v1.2.4...v1.3.0) --- updated-dependencies: - dependency-name: github.com/CosmWasm/wasmvm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot * chore(build): update wasmvm static lib version to download * deps(build.mk): read the WASMVM_VERSION programattically with 'go list' * fix merge conflict --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com> Co-authored-by: Helder M <helder.moreira@voluzi.com> Co-authored-by: Unique-Divine <realuniquedivine@gmail.com>
* test: add test for perp amm types * test: simplify oneint onedec and add change reason and genesis tests * test: more cleaning of mustnewdecfromstr(1) * fix: revert removal of used functions * test: add market test * test: add msg tests * chore: changelog * test: add positions tests * test: add snapshot test * test: fix tests * test: more tests for msgs * test: fix tests for snapshot_test * test: add more position test for validate * test: remove bad test * test: add more amm tests
…gh maps in x/oracle (#1506) * refactor(oracle): Implement OrderedMap and use it for iterating through maps in x/oracle * doc comments fix * implement indexOf * chore(deps): Bump github.com/CosmWasm/wasmvm from 1.2.4 to 1.3.0 Bumps [github.com/CosmWasm/wasmvm](https://github.com/CosmWasm/wasmvm) from 1.2.4 to 1.3.0. - [Release notes](https://github.com/CosmWasm/wasmvm/releases) - [Changelog](https://github.com/CosmWasm/wasmvm/blob/main/CHANGELOG.md) - [Commits](CosmWasm/wasmvm@v1.2.4...v1.3.0) --- updated-dependencies: - dependency-name: github.com/CosmWasm/wasmvm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot * chore(build): update wasmvm static lib version to download * deps(build.mk): read the WASMVM_VERSION programattically with 'go list' * deps(build.mk): read the WASMVM_VERSION programattically with 'go list' * fix merge conflict * refactor: simplify data structure * typo --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com> Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com> Co-authored-by: Helder M <helder.moreira@voluzi.com>
* update post genesis commands * temp commit * add genmsg module * add genmsg module * bind genmsg into app.go * remove script * add init after wasm * revert localnet * add changelog --------- Co-authored-by: Matthias <97468149+matthiasmatt@users.noreply.github.com>
* feat(inflation): add burn method * Update CHANGELOG.md
* test(inflation): add negative burn tests * test(inflation): add total supply check to burn tests
) * chore(deps): Bump bufbuild/buf-setup-action from 1.29.0 to 1.30.0 Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.29.0 to 1.30.0. - [Release notes](https://github.com/bufbuild/buf-setup-action/releases) - [Commits](bufbuild/buf-setup-action@v1.29.0...v1.30.0) --- updated-dependencies: - dependency-name: bufbuild/buf-setup-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com>
* refactor: move Burn rpc method to x/tokenfactory * Update tx_msgs.go * feat: add burn native method to tokenfactory msg server * feat: add cli cmd * fix: validate msg * feat: add v1.2.0 upgrade handler * Update CHANGELOG.md * fix: register codec for MsgBurnNative * fix: test --------- Co-authored-by: Unique-Divine <realuniquedivine@gmail.com>
* feat: rest in peace * fix: fix e2e wasm test * fix: fix justfile and deplyo-wasm --------- Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com>
) * chore(deps): Bump bufbuild/buf-setup-action from 1.30.0 to 1.30.1 Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.30.0 to 1.30.1. - [Release notes](https://github.com/bufbuild/buf-setup-action/releases) - [Commits](bufbuild/buf-setup-action@v1.30.0...v1.30.1) --- updated-dependencies: - dependency-name: bufbuild/buf-setup-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: Unique-Divine <Unique-Divine@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
* feat(eth): protos, eth types, and evm module types * chore: changelog * feat(eth): unit tests for types, crypto, encoding (#1838) * feat(eth): unit tests for types, crypto, encoding ## Impl `go-ethereum` Adds `go-ethereum` fork with an `Interpreter` interface for running smart contracts in integration tests. ```go type Interpreter interface { // Run loops and evaluates the contract's code with the given input data and returns // the return byte-slice and an error if one occurred. Run(contract *Contract, input []byte, static bool) ([]byte, error) } ``` An `Interpreter` is used to run Ethereum based contracts and will utilize the passed environment to query external sources for state information. The Interpreter will run the byte code VM based on the passed configuration. Changes from go-ethereum v1.11: * Set `callcode` to use `readOnly` mode for precompiled calls. * Remove `IsStateful` function from the `PrecompiledContract` interface, as this remains unused. * Support stateful precompiled contracts. * Add `Address` function to `PrecompiledContract` interface. * Implement custom active precompiles for the EVM. * Define `Interpreter` interface for the EVM. * Move the `JumpTable` defaults to a separate function. * Refactor `Stack` implementation * chore: linter * docs(sample.go): PrivKeyEth * refactor: fix copyright lines and LICENSE entity * feat(eth): Collections encoders for bytes, Ethereum addresses, and Ethereum hashes (#1841)
* fix(docker-chaosnet): add copy step for geth dependency * chore: changelog * ci: conditional workflows should account for other go.mod and go.sum files * ci: changing docker changes the build, so it should be a dep * fix(docker): test builds locally with 'docker build -d nibi-test .'
* feat: rest in peace * fix: fix e2e wasm test * fix: fix justfile and deplyo-wasm * fix: update localnet * feat: rest in peace * fix(localnet.sh): change order of operations in genesis config * fix(localnet.sh): change order of operations in genesis config * rm unused file --------- Co-authored-by: Unique-Divine <realuniquedivine@gmail.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com>
* chore(deps): Bump golang.org/x/net from 0.20.0 to 0.23.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.20.0 to 0.23.0. - [Commits](golang/net@v0.20.0...v0.23.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210921155107-089bfa567519 to 0.17.0. - [Commits](https://github.com/golang/crypto/commits/v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production ... Signed-off-by: Unique Divine <realuniquedivine@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com>
…001d to 0.23.0 in /geth (#1849) * chore(deps): Bump golang.org/x/crypto in /geth Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210921155107-089bfa567519 to 0.17.0. - [Commits](https://github.com/golang/crypto/commits/v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): Bump golang.org/x/net in /geth Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220607020251-c690dde0001d to 0.23.0. - [Commits](https://github.com/golang/net/commits/v0.23.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com> Co-authored-by: Unique-Divine <realuniquedivine@gmail.com>
…154634-513d2456b344 to 0.3.11 in /geth (#1851) * chore(deps): Bump github.com/supranational/blst in /geth Bumps [github.com/supranational/blst](https://github.com/supranational/blst) from 0.3.8-0.20220526154634-513d2456b344 to 0.3.11. - [Release notes](https://github.com/supranational/blst/releases) - [Commits](https://github.com/supranational/blst/commits/v0.3.11) --- updated-dependencies: - dependency-name: github.com/supranational/blst dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
* chore(deps): Bump robinraju/release-downloader from 1.9 to 1.10 Bumps [robinraju/release-downloader](https://github.com/robinraju/release-downloader) from 1.9 to 1.10. - [Release notes](https://github.com/robinraju/release-downloader/releases) - [Commits](robinraju/release-downloader@v1.9...v1.10) --- updated-dependencies: - dependency-name: robinraju/release-downloader dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Updated changelog - dependabot --------- Signed-off-by: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Co-authored-by: Unique-Divine <Unique-Divine@users.noreply.github.com>
* ICA Host / Controller integration. Added upgrade constants. Added make format command * Fixed required message URLs * Code import fix * Fixed upgrade name * Fixed upgrade target * Changed version number * Update CHANGELOG.md --------- Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com> Co-authored-by: Kevin Yang <5478483+k-yang@users.noreply.github.com>
WalkthroughThe recent updates represent a significant restructuring of Swagger documentation and routing mechanisms in the application. The changes involve removing outdated HTTP and Swagger setup from the main app components, while introducing new scripts and configurations for generating and handling Swagger documentation for the Nibiru Chain gRPC Gateway. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
| // RegisterSwaggerAPI registers swagger route with API Server | ||
| func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { | ||
| statikFS, err := fs.New() | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
|
|
||
| staticServer := http.FileServer(statikFS) | ||
| rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) | ||
| } |
There was a problem hiding this comment.
Consider handling the error more gracefully instead of using panic. It's generally better to return an error and let the caller handle it, which could improve the robustness of the application.
- if err != nil {
- panic(err)
- }
+ if err != nil {
+ return fmt.Errorf("failed to create statikFS: %w", err)
+ }Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| // RegisterSwaggerAPI registers swagger route with API Server | |
| func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { | |
| statikFS, err := fs.New() | |
| if err != nil { | |
| panic(err) | |
| } | |
| staticServer := http.FileServer(statikFS) | |
| rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) | |
| } | |
| // RegisterSwaggerAPI registers swagger route with API Server | |
| func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) error { | |
| statikFS, err := fs.New() | |
| if err != nil { | |
| return fmt.Errorf("failed to create statikFS: %w", err) | |
| } | |
| staticServer := http.FileServer(statikFS) | |
| rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) | |
| return nil | |
| } |
| for dir in $proto_dirs; do | ||
| # generate swagger files (filter query files) | ||
| query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \)) | ||
| if [[ ! -z "$query_file" ]]; then |
There was a problem hiding this comment.
Improve the condition check by using -n instead of ! -z for clarity and consistency in bash scripting.
- if [[ ! -z "$query_file" ]]; then
+ if [[ -n "$query_file" ]]; thenCommittable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| if [[ ! -z "$query_file" ]]; then | |
| if [[ -n "$query_file" ]]; then |
| query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \)) | ||
| if [[ ! -z "$query_file" ]]; then | ||
| # echo $query_file | ||
| buf generate --template buf.gen.swagger.yaml $query_file |
There was a problem hiding this comment.
Ensure variables are double-quoted to prevent globbing and word splitting, which can lead to unexpected behavior or security issues.
- buf generate --template buf.gen.swagger.yaml $query_file
+ buf generate --template buf.gen.swagger.yaml "$query_file"Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| buf generate --template buf.gen.swagger.yaml $query_file | |
| buf generate --template buf.gen.swagger.yaml "$query_file" |
| ifeq ($(GO),) | ||
| $(error could not find go. Is it in PATH? $(GO)) | ||
| endif |
There was a problem hiding this comment.
Ensure that the error message is clear and helpful. Consider adding more details about how to resolve the issue if Go is not found in the PATH.
- $(error could not find go. Is it in PATH? $(GO))
+ $(error Could not find the Go executable. Please ensure that Go is installed and available in your PATH.)Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| ifeq ($(GO),) | |
| $(error could not find go. Is it in PATH? $(GO)) | |
| endif | |
| ifeq ($(GO),) | |
| $(error Could not find the Go executable. Please ensure that Go is installed and available in your PATH.) | |
| endif |
22fb261 to
ac05154
Compare
Purpose / Abstract
Creates an OpenAPI 2.0 (aka Swagger) page available at the LCD endpoint.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation