regolith-labs / steel

Solana smart contract framework.
146 stars 32 forks source link

cargo test-sbf not working for template program(counter) #15

Closed Perelyn-sama closed 3 weeks ago

Perelyn-sama commented 4 weeks ago

I ran steel new demo and cargo build-sbf and everything worked fine but when I tried to run cargo test-sbf I get these errors:

Screenshot 2024-10-19 at 2 31 01 PM

thearyanag commented 3 weeks ago

hey, not sure why it's throwing that, can you please include these scripts in a package.json and run from them, these are recommended settings by https://github.com/solana-developers/program-examples

"scripts": {
      "test": "pnpm ts-mocha -p ./tsconfig.json -t 1000000 ./tests/test.ts",
      "build-and-test": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./tests/fixtures && pnpm test",
      "build": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./program/target/so",
      "deploy": "solana program deploy ./program/target/so/counter_program.so"
    }

and tsconfig.json can look like this,

    {
    "compilerOptions": {
      "types": ["mocha", "chai", "node"],
      "typeRoots": ["./node_modules/@types"],
      "lib": ["es2015"],
      "module": "commonjs",
      "target": "es6",
      "esModuleInterop": true
    }
  }

and example working program is also here, https://github.com/thearyanag/solana-program-examples/tree/main/basics/counter/steel

Perelyn-sama commented 3 weeks ago

I got the same error when I ran your version :/

Perelyn-sama commented 3 weeks ago

@HardhatChad please help :/

Perelyn-sama commented 3 weeks ago

found a solution, use base64 insteaed of bs64

program/cargo.toml 

# bs64 = "0.1.2"
base64 = "0.21"
Perelyn-sama commented 3 weeks ago

Also, this might be just an m1 issue.

@thearyanag I'm assuming you're not on an m1, right? Since the tests work for you

HardhatChad commented 3 weeks ago

found a solution, use base64 insteaed of bs64

Did this resolve the issue? Do we need to update the template with this for it to build on M1?

Perelyn-sama commented 3 weeks ago

Did this resolve the issue?

yes, it did