Checking Solana Program with Soteria Docker Image

Hi, I’m trying to run the soteria docker image to do a few security checks on the prorgam. When I run

cargo build-bpf

I get the following errors:

 error[E0107]: this type alias takes 1 generic argument but 2 generic arguments were supplied
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/stable-swap-anchor-1.6.8/src/state.rs:49:54
   |
49 |     fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self, ProgramError> {
   |                                                      ^^^^^^       ------------ help: remove this generic argument
   |                                                      |

I assume that these are due to some version mismatch, outside of the image the program compiles fine, for some reason it can’t compare

 stable-swap-anchor = "1.6.7"

Here’re the dependencies in the cargo.toml:

 
[dependencies]
anchor-lang = "0.20.1"
anchor-spl = "0.20.1"
solana-program = "1.8.12"
spl-token = { version = "3.1.4", features = ["no-entrypoint"] }
stable-swap-anchor = "1.6.7"

Any help would be much appreciated,

Hi @qPouya and welcome to the forum! :wave:

Could you post a link to the code you’re trying to build so I can take a look at it?

You might need to try and build it with the anchor CLI and run anchor verify if you are trying to make sure that the deployed contract matches the source code.

Thanks @zicklag for the answer,

It turns out that I had to run the commands from a different directory (noob mistake) which solved the issue weirdly. Soteria works fine now. Here’s what made it work


docker run -v $PWD/{project_name}/:/workspace -it greencorelab/soteria:latest /bin/bash

cargo build-bpf
cd programs/{project_name}
soteria -analyzeAll .
1 Like

Awesome, glad you got it working!

1 Like