CosmWasm / wasmd

Basic cosmos-sdk app with web assembly smart contracts
Other
368 stars 400 forks source link

Invalid homeDir for export command #334

Closed whylee259 closed 3 years ago

whylee259 commented 3 years ago

The wasmd doesn't pass the homeDir properly when using export command. It passes always wasm as the homeDir.

Step to reproduce

wasmd export

                                                                          1 ↵
panic: Error calling the VM: Cache error: Error opening Wasm file for reading: No such file or directory (os error 2)

goroutine 1 [running]:
github.com/CosmWasm/wasmd/x/wasm/internal/keeper.ExportGenesis.func1(0x1, 0xc000fc5a80, 0x20, 0x20, 0xc000f6b950, 0x2b, 0x0, 0x0, 0x0, 0x0, ...)
    github.com/CosmWasm/wasmd/x/wasm/internal/keeper/genesis.go:67 +0x2b4
github.com/CosmWasm/wasmd/x/wasm/internal/keeper.Keeper.IterateCodeInfos(0x5bc7de0, 0xc001068210, 0x5c00260, 0xc000c80470, 0x5bc7de0, 0xc001068140, 0x5bf9c40, 0xc000c80470, 0x5bf9c40, 0xc000c80470, ...)
    github.com/CosmWasm/wasmd/x/wasm/internal/keeper/keeper.go:574 +0x287
github.com/CosmWasm/wasmd/x/wasm/internal/keeper.ExportGenesis(0x5be7be0, 0xc0000c8030, 0x5bfd860, 0xc0010809c0, 0x0, 0x0, 0x0, 0x0, 0x116, 0x0, ...)

debugging

ethanfrey commented 3 years ago

Thank you for the screen shot with captured variables.

Can you add which version you are using?

whylee259 commented 3 years ago

I have tried the code of master branch(576f620e4d14839da3098013fcaf7e50aead9685). I think it has been in since https://github.com/CosmWasm/wasmd/commit/ca040da925f44da99b3c9a9a5fb1bca12e494113

alpe commented 3 years ago

@whylee259 thanks a lot for reporting this issue. 💐 The code affected comes originally from the cosmos-sdk simapp which is a template for other chains. I will report this issue upstream so that it gets fixed there, too.