-
Notifications
You must be signed in to change notification settings - Fork 410
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
Get Contracts by Creator Address #1021
Conversation
We need to provide a migration for this so that chains upgrading can build the initial index. |
Codecov Report
@@ Coverage Diff @@
## main #1021 +/- ##
==========================================
- Coverage 59.29% 59.25% -0.04%
==========================================
Files 52 53 +1
Lines 6630 6718 +88
==========================================
+ Hits 3931 3981 +50
- Misses 2408 2442 +34
- Partials 291 295 +4
|
I'm going to make this. Thanks for your suggestion. |
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.
Thanks a lot for driving this forward. 👏 🏄
It looks very good already! Just some minor comments that should be easy to address!
m.keeper.addToContractCreatorThirdIndex(ctx, creator, contractAddress) | ||
} | ||
return nil | ||
} |
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.
A test for the migration is required.
Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>
Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>
@alpe thanks for the clear suggestions. I'm making it |
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.
Good progress and tests. Thanks for your contribution! 💐
Still some changes are mandatory. No rush. I would let you handle this but please let me know if you don't have enough capacity or want somebody to jump in.
I made this PR to draft and will be ready when I complete your suggested change. Thank you again, @alpe, I learned many things from your reviews. |
@@ -51,7 +51,8 @@ func GetContractAddressKey(addr sdk.AccAddress) []byte { | |||
|
|||
// GetContractsByCreatorPrefix returns the contracts by creator prefix for the WASM contract instance | |||
func GetContractsByCreatorPrefix(addr sdk.AccAddress) []byte { | |||
return append(ContractsByCreatorPrefix, addr...) | |||
bz := address.MustLengthPrefix(addr) |
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.
👍 thanks!
* main: Bump actions/checkout from 3.0.2 to 3.1.0 Revert module version to 1 as there is no migration Doc ante handler Fix: typos
Thanks a log for your work on this. This was really helping. 💯 |
* add query to query.proto * add ContractsByCreatorPrefix in keys.go * add ContractCreatorThirdIndex to keeper.go * add querier * cli * fix test * linting * add key test * no need to change creator when migrate * add query test * minor * add migrate logic * add more test * register migration * minor * Update x/wasm/client/cli/query.go Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * nits * remove IterateAllContract * Update x/wasm/keeper/genesis_test.go Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * nit * nit: func name * change key * improve TestIteratorContractByCreator * fix test * use IterateContractInfo in migrate2to3 * minor * move key * improve test case * add pagReq in ContractsByCreator query * ordering query * add migrate test * Make ContractsByCreator plural; formatting and minor updates * Comment why AbsoluteTxPositionLen makes sense * Migrate 1 to 2 * Set module version Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> Co-authored-by: khanh-notional <50263489+catShaark@users.noreply.github.com>
* add query to query.proto * add ContractsByCreatorPrefix in keys.go * add ContractCreatorThirdIndex to keeper.go * add querier * cli * fix test * linting * add key test * no need to change creator when migrate * add query test * minor * add migrate logic * add more test * register migration * minor * Update x/wasm/client/cli/query.go Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * nits * remove IterateAllContract * Update x/wasm/keeper/genesis_test.go Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * nit * nit: func name * change key * improve TestIteratorContractByCreator * fix test * use IterateContractInfo in migrate2to3 * minor * move key * improve test case * add pagReq in ContractsByCreator query * ordering query * add migrate test * Make ContractsByCreator plural; formatting and minor updates * Comment why AbsoluteTxPositionLen makes sense * Migrate 1 to 2 * Set module version Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> Co-authored-by: khanh-notional <50263489+catShaark@users.noreply.github.com>
* add query to query.proto * add ContractsByCreatorPrefix in keys.go * add ContractCreatorThirdIndex to keeper.go * add querier * cli * fix test * linting * add key test * no need to change creator when migrate * add query test * minor * add migrate logic * add more test * register migration * minor * Update x/wasm/client/cli/query.go Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * nits * remove IterateAllContract * Update x/wasm/keeper/genesis_test.go Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * nit * nit: func name * change key * improve TestIteratorContractByCreator * fix test * use IterateContractInfo in migrate2to3 * minor * move key * improve test case * add pagReq in ContractsByCreator query * ordering query * add migrate test * Make ContractsByCreator plural; formatting and minor updates * Comment why AbsoluteTxPositionLen makes sense * Migrate 1 to 2 * Set module version Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> Co-authored-by: khanh-notional <50263489+catShaark@users.noreply.github.com>
Closes : #998
What in this PR:
Add a new index for getting contracts by creator address.
Create a migration to build the initial index.