-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor 08-wasm with improvements after 02-client refactor (#6088)
* tests: move tests from client state to light client module for 08-wasm. * Remove usage of globals from 08-wasm (#6103) * Move functionality from client state methods to light client module methods. - Yank all statements and delete functions as needed. - Make any required functions from types/ public. - Add the vm in the 08-wasm keeper. - Update documentation to include documentation of deleted functions. * Remove global VM, introspection to retrieve client identifier. - Refactor signatures to explicitly pass vm, client identifier for time being. - Refactor tests to conform with new signatures. - Replace occurences of `ibcwasm.GetVM` in other keeper functions. * Move migrateContract from clientState to keeper method. - Matches moves for other functions. - Move is required to address future circular dependency for state management (keeper would import types and types would import keeper) - Rm migrate_contract(test).go files. * Move state management to keeper. - Remove globals for state (Checksums) - Move access functions from types to keeper, move tests. - Update calls using global to instead go through keeper. * Make InitializePinnedCodes a method on the keeper. * Remove pending todo in test for migrate contract. This previously was testing a function that didn't set the client state after calling the contract (invoking through the keeper always sets a client state after contract invocation). Hence, even if we don't set explicitly in the migrateFn callback, we _still_ get a client state in the end. * Move vm entrypoint functions in keeper/ package. * feat: move vm entry points to keeper. * chore: simplify signatures. * test: add amended tests for contact keeper. * refactor: move querier to keeper package. * lint: you'll never fix me. * refactor: remove queryRouter global variable - Move into the func for creating new plugins, pass it to acceptStargateQuery directly. This is probably what wasmd did (see they don't accept a query router now?). Since we don't use the get elsewhere, this was the smallest diff for a globa. - Preemptively ran make lint-fix, gotcha linting crybaby. * refactor: remove global for query plugins. * nit: rename to queryPlugins. * refactor: remove QueryPluginsI interface. * refactor: make queryHandler a private type. * Make migrateContractCode a private function, clean up uneeded export in export_test.go for types/. * refactor: Move vm entrypoints to keeper. - Remove generic types and do unmarshalling in light client methods. - Move all functions onto keeper and adjust call sites. * chore: address some testing todos. Move testing unmarshal failure case to light client tests. * chore: additional tiny nits. - Consistently use wasmClientKeeper as local var name. - Reorg keeper fields slightly. - Rm 'vm.go' which was already empty. * chore: restructure definitions to make diff more readable. * d'oh: rm vm arg from instantiate. * nit: Space out keeper fields. Remove TODO for method name. * chore: address remaining TODOs. * nit: don't hold ref to schema after building it. * Update modules/light-clients/08-wasm/types/gas_register.go Co-authored-by: Damian Nolan <[email protected]> * lint: shut up --------- Co-authored-by: Damian Nolan <[email protected]>
- Loading branch information
1 parent
89fdb1e
commit ebabc1c
Showing
42 changed files
with
2,325 additions
and
2,863 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
160 changes: 68 additions & 92 deletions
160
modules/light-clients/08-wasm/types/vm.go → ...clients/08-wasm/keeper/contract_keeper.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package keeper | ||
|
||
import sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
// MigrateContractCode is a wrapper around k.migrateContractCode to allow the method to be directly called in tests. | ||
func (k Keeper) MigrateContractCode(ctx sdk.Context, clientID string, newChecksum, migrateMsg []byte) error { | ||
return k.migrateContractCode(ctx, clientID, newChecksum, migrateMsg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.