-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(x/wasm): add AllKeys query binding #185
feat(x/wasm): add AllKeys query binding #185
Conversation
# Conflicts: # contracts/contracts/sample/src/bin/schema.rs # contracts/contracts/sample/src/contract.rs # contracts/contracts/sample/src/msg.rs # contracts/packages/bindings/src/bin/schema.rs # contracts/packages/bindings/src/lib.rs # contracts/packages/bindings/src/msg.rs # warden/app/legacy.go
WalkthroughWalkthroughThe updates across various files introduce new functionalities and reorganize existing ones to enhance querying and handling of keys in the Warden protocol. Changes include new query types, enhanced message encoding for the Cosmos SDK, and structural improvements in contract management. These modifications aim to streamline interactions and data handling within the blockchain framework, focusing on efficiency and scalability. Changes
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (10)
Files skipped from review as they are similar to previous changes (6)
Additional Context UsedPath-based Instructions (4)
Additional comments not posted (4)
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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Actionable comments outside the diff hunks (2)
CHANGELOG.md (2)
Line range hint
41-41
: Remove excessive blank lines to maintain a clean and professional appearance of the changelog.There are multiple consecutive blank lines which should be reduced to a single blank line to keep the document tidy and consistent.
- - +
Line range hint
118-118
: Remove excessive blank lines to maintain a clean and professional appearance of the changelog.There are three consecutive blank lines which should be reduced to a single blank line to keep the document tidy and consistent.
- - - +
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
contracts/contracts/sample/README.md
Outdated
|
||
You can deploy it by itself, or you can use it as a starting point for your own contract. | ||
|
||
Not that this is a preview, so only limited functionality available right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the typo in "Not that this is a preview" to "Note that this is a preview."
- Not that this is a preview, so only limited functionality available right now.
+ Note that this is a preview, so only limited functionality available right now.
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.
Not that this is a preview, so only limited functionality available right now. | |
Note that this is a preview, so only limited functionality available right now. |
This crate provides bindings for the Warden Protocol blockchain core functionality. | ||
You can use it in your own contracts to interact with a Warden Protocol. | ||
|
||
Not that this is a preview, so only limited functionality available right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the typo in "Not that this is a preview" to "Note that this is a preview."
- Not that this is a preview, so only limited functionality available right now.
+ Note that this is a preview, so only limited functionality available right now.
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.
Not that this is a preview, so only limited functionality available right now. | |
Note that this is a preview, so only limited functionality available right now. |
Not that this is a preview, so only limited functionality available right now. | ||
You can execute `NewKeyRequest` and query `AllKeys`, but more on the way! | ||
|
||
To start using Warden Protocol from the CosmWasm contracts, please refer to sample contract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the missing article "the" before "sample contract."
- To start using Warden Protocol from the CosmWasm contracts, please refer to sample contract.
+ To start using Warden Protocol from the CosmWasm contracts, please refer to the sample contract.
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.
To start using Warden Protocol from the CosmWasm contracts, please refer to sample contract. | |
To start using Warden Protocol from the CosmWasm contracts, please refer to the sample contract. |
Ensure the file ends with a newline character to comply with POSIX standards.
contracts/README.md
Outdated
|
||
## Deploy a Contract | ||
|
||
We assume that your have a `wardend` executable's directory in your `$PATH` environment variable in order to perform following steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the typo "your" to "you" in the deployment instructions.
- We assume that your have a `wardend` executable's directory in your `$PATH` environment variable in order to perform following steps.
+ We assume that you have a `wardend` executable's directory in your `$PATH` environment variable in order to perform following steps.
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.
We assume that your have a `wardend` executable's directory in your `$PATH` environment variable in order to perform following steps. | |
We assume that you have a `wardend` executable's directory in your `$PATH` environment variable in order to perform following steps. |
contracts/README.md
Outdated
wardend query wasm list-contract-by-code 100 | ||
``` | ||
|
||
Let's assume it's address is `warden1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtn83hn` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct "it's address is" to "its address is" to use the correct possessive form.
- Let's assume it's address is `warden1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtn83hn`
+ Let's assume its address is `warden1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtn83hn`
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.
Let's assume it's address is `warden1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtn83hn` | |
Let's assume its address is `warden1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtn83hn` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Actionable comments outside the diff hunks (2)
CHANGELOG.md (2)
Line range hint
41-41
: Reduce consecutive blank lines to a single blank line to maintain consistency and readability.-
Line range hint
57-57
: Adjust the indentation of the unordered list to 2 spaces to match the standard used elsewhere in the document.- * x/warden can now resolve `warden.space.owners` in Intent definitions into the list of owners of the space + * x/warden can now resolve `warden.space.owners` in Intent definitions into the list of owners of the space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
contracts/contracts/sample/README.md
Outdated
You can deploy it by itself, or you can use it as a starting point for your own contract. | ||
|
||
Note that this is a preview, so only limited functionality available right now. | ||
The sample contract exposes `NewKeyRequest` transaction and `AllKeys` query, but more on the way! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the spelling mistake in "more on the way!" to ensure clarity and professionalism in documentation.
- but more on the way!
+ but more features are on the way!
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.
The sample contract exposes `NewKeyRequest` transaction and `AllKeys` query, but more on the way! | |
The sample contract exposes `NewKeyRequest` transaction and `AllKeys` query, but more features are on the way! |
This crate provides bindings for the Warden Protocol blockchain core functionality. | ||
You can use it in your own contracts to interact with a Warden Protocol. | ||
|
||
Note that this is a preview, so only limited functionality available right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the file ends with a newline character to comply with POSIX standards.
Note that this is a preview, so only limited functionality available right now. | ||
You can execute `NewKeyRequest` and query `AllKeys`, but more on the way! | ||
|
||
To start using Warden Protocol from the CosmWasm contracts, please refer to the sample contract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the missing article "the" before "sample contract" to improve readability and grammatical correctness.
- please refer to sample contract.
+ please refer to the sample contract.
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.
To start using Warden Protocol from the CosmWasm contracts, please refer to the sample contract. | |
To start using Warden Protocol from the CosmWasm contracts, please refer to the sample contract. |
contracts/README.md
Outdated
wardend tx wasm execute $contract '{ "new_key_request": { "space_id": 1, "keychain_id": 2, "key_type": 1, "btl": 888, "intent_id": 0 } }' --from alice -y --chain-id warden | ||
``` | ||
|
||
Note that `space_id` 1 and `keychain_id` 2 should already exist before your transaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the file ends with a newline character to comply with POSIX standards.
contracts/README.md
Outdated
|
||
# Interacting with Contract | ||
|
||
You can query it's state, for example, let's list all existing keys: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the misuse of "it's" to "its" to use the correct possessive form.
- You can query it's state, for example, let's list all existing keys:
+ You can query its state, for example, let's list all existing keys:
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.
You can query it's state, for example, let's list all existing keys: | |
You can query its state, for example, let's list all existing keys: |
|
||
pub fn query_warden_all_keys(deps: Deps<WardenProtocolQuery>, pagination: PageRequest, derive_wallets: Vec<WalletType>) -> StdResult<AllKeysResponse> { | ||
let querier = WardenQuerier::new(&deps.querier); | ||
let respnose = querier.query_warden_all_keys(pagination, derive_wallets)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let respnose = querier.query_warden_all_keys(pagination, derive_wallets)?; | |
let response = querier.query_warden_all_keys(pagination, derive_wallets)?; |
AllKeys { pagination: PageRequest, derive_wallets: Vec<WalletType> }, | ||
} | ||
|
||
pub type WalletType = i32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some changes so we don't have "wallets" anymore. This particular case has been replaced by "addresses" (in short: WalletType
became AddressType
).
Please update all the definitions in this file to reflect the new protobufs.
@@ -0,0 +1,47 @@ | |||
package wasm_interop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this replacing custom_msg/custom_msg.go
? I don't see any file deleted by this PR. Do we need both?
contracts/README.md
Outdated
|
||
cd ../.. | ||
|
||
# generate sapmle contract schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# generate sapmle contract schema | |
# generate sample contract schema |
contracts/README.md
Outdated
## Deploy a Contract | ||
|
||
We assume that you have a `wardend` executable's directory in your `$PATH` environment variable in order to perform following steps. | ||
Also, your account should be added to the `wardend`'s keychain. Following commands use `alice` name for such account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct. Anyone can request a key from any keychain.
contracts/README.md
Outdated
Also, your account should be added to the `wardend`'s keychain. Following commands use `alice` name for such account. | ||
|
||
```shell | ||
wardend tx wasm store artifacts/sample.wasm --from alice -y -b sync --chain-id warden --gas 2000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wardend tx wasm store artifacts/sample.wasm --from alice -y -b sync --chain-id warden --gas 2000000 | |
wardend tx wasm store artifacts/sample.wasm --from alice -y --chain-id warden --gas 2000000 |
deprecated flag
contracts/README.md
Outdated
wardend tx wasm store artifacts/sample.wasm --from alice -y -b sync --chain-id warden --gas 2000000 | ||
``` | ||
|
||
Now you should find an id that system assigned to your code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now you should find an id that system assigned to your code. | |
Now you should find the id that the system assigned to your code. |
contracts/README.md
Outdated
``` | ||
|
||
Now you should find an id that system assigned to your code. | ||
One of the methods to do this is simply list all stored code bundles and find the last one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the methods to do this is simply list all stored code bundles and find the last one. | |
One of the methods to do this is to list all stored code bundles and find the last one. |
let's avoid terms like "simply" as there's nothing simple about deploying a contract 😛
(https://justsimply.dev/)
contracts/README.md
Outdated
|
||
# Interacting with Contract | ||
|
||
You can query it's state, for example, let's list all existing keys: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can query it's state, for example, let's list all existing keys: | |
You can query its state, for example, let's list all existing keys: |
contracts/README.md
Outdated
You can query it's state, for example, let's list all existing keys: | ||
|
||
```shell | ||
wardend query wasm contract-state smart $contract '{ "warden_all_keys": {"pagination":{"limit":0,"reverse":false}, "derive_wallets":[]} }'--chain-id warden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wardend query wasm contract-state smart $contract '{ "warden_all_keys": {"pagination":{"limit":0,"reverse":false}, "derive_wallets":[]} }'--chain-id warden | |
wardend query wasm contract-state smart $contract '{ "warden_all_keys": {"pagination":{"limit":0,"reverse":false}, "derive_wallets":[]} }' |
no need for chain id in queries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Added the ability to call the AllKeys request of the warden module from contracts.
Summary by CodeRabbit
New Features
Refactor
Documentation