Skip to content
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

[Question] Can't manage to get wasm configured - panic: Could not lock exclusive.lock #2094

Open
Roc8Trppn opened this issue Jan 16, 2025 · 1 comment

Comments

@Roc8Trppn
Copy link

Hi,

Im using a clone of the interchain-security repo (https://github.com/cosmos/interchain-security) and try to incorporate the CosmWasm module.

Ive done the following:

  1. installed the package:
    go get go get github.com/CosmWasm/[email protected]

  2. Imported the packages into app.go:

package app

import (
...
wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
...
)
  1. Imported the module into the BasicManager
ModuleBasics = module.NewBasicManager(
  	...
  	wasm.AppModuleBasic{},
  )
  1. Defined the keeper in App struct:
type App struct {
	... ,
        WasmKeeper wasmkeeper.Keeper
}
  1. In the New method I added the Store Key:
keys := storetypes.NewKVStoreKeys(
		...,
		wasmtypes.StoreKey,
	)
  1. And in the same method a bit below created the keeper
        homeDir, dirErr := os.UserHomeDir()
	if dirErr != nil {
		panic(fmt.Sprintf("failed to get user home directory: %v", dirErr))
	}
	wasmDir := filepath.Join(homeDir, "tmp")
	nodeConfig, confErr := wasm.ReadNodeConfig(appOpts)
	if confErr != nil {
		panic(fmt.Sprintf("error while reading wasm config: %s", confErr))
	}
	app.WasmKeeper = wasmkeeper.NewKeeper(
		appCodec,
		runtime.NewKVStoreService(keys[wasmtypes.StoreKey]),
		app.AccountKeeper,
		app.BankKeeper,
		nil,
		nil,
		nil,
		app.IBCKeeper.ChannelKeeper,
		app.IBCKeeper.PortKeeper,
		nil,
		app.TransferKeeper,
		app.MsgServiceRouter(),
		app.GRPCQueryRouter(),
		wasmDir,
		nodeConfig,
		wasmtypes.VMConfig{},
		wasmkeeper.BuiltInCapabilities(),
		"authority",
) 
  1. Then I included the module in the NewManager method:
   app.MM = module.NewManager(
   	...
   	wasm.NewAppModule(appCodec, &app.WasmKeeper, nil, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
   )
  1. And finally I included the ModuleName into:
app.MM.SetOrderInitGenesis(
		...
		wasmtypes.ModuleName,
	)

When I then try to run the chain I always get the same error:

panic: Could not lock exclusive.lock. Is a different VM running in the same directory already?

goroutine 1 [running]:
github.com/CosmWasm/wasmd/x/wasm/keeper.NewKeeper({_, _}, {_, _}, {_, _}, {_, _}, {0x0, 0x0}, ...)
        /Users/name/go/pkg/mod/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/keeper_cgo.go:86 +0x1012
github.com/cosmos/interchain-security/v5/app/consumer.New({0x1130cd950, 0xc001b7cb60}, {0x11317fa00, 0xc0018cc048}, {0x0, 0x0}, 0x1, {0x113086620, 0xc0015fb6c0}, {0xc00191c460, ...})
...

Ive created a completely new directory where I am sure that no other VM is running but still I keep getting the same error...

Am I missing something in the configuration?

@chipshort
Copy link
Collaborator

I am not too familiar with integrating wasmd or the interchain-security repo, but the error you are getting results from this check.
The file is located in the wasm specific subfolder of the node's home directory. For example for wasmd that is ~/.wasmd/wasm/wasm/exclusive.lock. The check is to ensure that no two nodes with CosmWasm are running at the same time, trying to read and write modules to the folder.
Maybe try deleting the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants