-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Implement read VM pool (#546)
* test purpose readvm pool implementation, still requiring tendermint RWMutex * fix lint * remove data race * remove replace * wrap pool logic with mutex * fix comment * enforce zero readvm config to use default config * bump cosmos-sdk to v0.44.1 * bump cosmwasm to v0.16.1 * cleanup go.mod * changelog update * prevent zero write vm cache * rename the functions * fix typo
- Loading branch information
yys
authored
Oct 6, 2021
1 parent
f3a1b82
commit 6e903ef
Showing
11 changed files
with
654 additions
and
70 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,8 @@ func (k Keeper) StoreCode(ctx sdk.Context, creator sdk.AccAddress, wasmCode []by | |
|
||
// MigrateCode uploads and compiles a WASM contract bytecode for the existing code id. | ||
// After columbus-5 update, all contract code will be removed from the store | ||
// due to in-compatibility between [email protected] and CosmWasm@v0.14.x | ||
// The migration only can be executed by once after columbus-5 update. | ||
// due to in-compatibility between [email protected] and CosmWasm@v0.16.x | ||
// The migration can be executed by once after columbus-5 update. | ||
// TODO - remove after columbus-5 update | ||
func (k Keeper) MigrateCode(ctx sdk.Context, codeID uint64, creator sdk.AccAddress, wasmCode []byte) error { | ||
codeInfo, err := k.GetCodeInfo(ctx, codeID) | ||
|
@@ -420,7 +420,7 @@ func (k Keeper) queryToStore(ctx sdk.Context, contractAddress sdk.AccAddress, ke | |
return prefixStore.Get(key) | ||
} | ||
|
||
func (k Keeper) queryToContract(ctx sdk.Context, contractAddress sdk.AccAddress, queryMsg []byte) ([]byte, error) { | ||
func (k Keeper) queryToContract(ctx sdk.Context, contractAddress sdk.AccAddress, queryMsg []byte, wasmVMs ...types.WasmerEngine) ([]byte, error) { | ||
defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "query-smart") | ||
ctx.GasMeter().ConsumeGas(types.InstantiateContractCosts(len(queryMsg)), "Loading CosmWasm module: query") | ||
|
||
|
@@ -430,7 +430,14 @@ func (k Keeper) queryToContract(ctx sdk.Context, contractAddress sdk.AccAddress, | |
} | ||
|
||
env := types.NewEnv(ctx, contractAddress) | ||
queryResult, gasUsed, err := k.wasmVM.Query( | ||
|
||
// when the vm is given, use that given vm | ||
wasmVM := k.wasmVM | ||
if len(wasmVMs) != 0 { | ||
wasmVM = wasmVMs[0] | ||
} | ||
|
||
queryResult, gasUsed, err := wasmVM.Query( | ||
codeInfo.CodeHash, | ||
env, | ||
queryMsg, | ||
|
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.