From 067e66fb2ee58670535ec1f01f08347cd1853772 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Tue, 12 Mar 2024 19:53:46 -0500 Subject: [PATCH] okay so.. technically this fixes test. --- .gitignore | 2 ++ app/app.go | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 225aeb2..a520079 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ cache state configs/logs.json + +exclusive.lock \ No newline at end of file diff --git a/app/app.go b/app/app.go index 1418e5d..84d5380 100644 --- a/app/app.go +++ b/app/app.go @@ -4,9 +4,12 @@ import ( "encoding/json" "fmt" "io" + "math/rand" "os" + "path" "path/filepath" "sort" + "time" wasmd "github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/x/wasm" @@ -609,7 +612,9 @@ func NewApp( // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks - // availableCapabilities := strings.Join(AllCapabilities(), ",") + + const charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + app.WasmKeeper = wasmkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), @@ -624,7 +629,7 @@ func NewApp( app.TransferKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), - wasmDir, + path.Join(wasmDir, StringWithCharset(12, charset)), // for testing wasmConfig, append(wasmd.AllCapabilities(), "token_factory"), govModAddress, @@ -1182,3 +1187,13 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(wasmtypes.ModuleName) return paramsKeeper } + +var seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano())) + +func StringWithCharset(length int, charset string) string { + b := make([]byte, length) + for i := range b { + b[i] = charset[seededRand.Intn(len(charset))] + } + return string(b) +}