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

Failing test #5

Closed
teseo opened this issue Feb 11, 2022 · 4 comments
Closed

Failing test #5

teseo opened this issue Feb 11, 2022 · 4 comments

Comments

@teseo
Copy link

teseo commented Feb 11, 2022

Before anything, I would like to appreciate this code and the article related.

I'm following line by line the article but I'm getting this error when running the second test Initialize program state

 anchor-escrow
    ✔ Initialize program state (5011ms)
Transaction simulation failed: Error processing Instruction 1: custom program error: 0xbc4
    Program 11111111111111111111111111111111 invoke [1]
    Program 11111111111111111111111111111111 success
    Program CL5TkCxmuTq47U2WGtTGhp3rPEVsYgDewXUyRJfqACzK invoke [1]
    Program log: Instruction: Initialize
    Program log: Custom program error: 0xbc4
    Program CL5TkCxmuTq47U2WGtTGhp3rPEVsYgDewXUyRJfqACzK consumed 6964 of 200000 compute units
    Program CL5TkCxmuTq47U2WGtTGhp3rPEVsYgDewXUyRJfqACzK failed: custom program error: 0xbc4
    1) Initialize escrow
    ✔ Exchange escrow state
    ✔ Initialize escrow and cancel escrow


  3 passing (5s)
  1 failing

  1) anchor-escrow
       Initialize escrow:
     Error: 3012: The program expected this account to be already initialized
      at Function.parse (node_modules/@project-serum/anchor/src/error.ts:41:14)
      at Object.rpc [as initialize] (node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:32:42)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

Any help would be much appreciated.

@ironaddicteddog
Copy link
Owner

ironaddicteddog commented Feb 12, 2022

Hi, let me reproduce this issue. Which network / anchor version are you using?

@teseo
Copy link
Author

teseo commented Feb 14, 2022

Hi @ironaddicteddog many thanks for your response. I'm using localnet and anchor-cli 0.20.1

@arunavo4
Copy link

@teseo I think you forgot to switch the network in the tests. You need to change the providers.

describe('anchor-escrow', () => {
  // const commitment: Commitment = 'processed';
  // const connection = new Connection('https://rpc-mainnet-fork.dappio.xyz', { commitment, wsEndpoint: 'wss://rpc-mainnet-fork.dappio.xyz/ws' });
  // const options = anchor.Provider.defaultOptions();
  // const wallet = NodeWallet.local();
  // const provider = new anchor.Provider(connection, wallet, options);

  // anchor.setProvider(provider);

  // Local Network
  const provider = anchor.Provider.env();
  anchor.setProvider(provider);

Comment out the Main net part and add a localnet for testing purposes

@teseo
Copy link
Author

teseo commented Feb 23, 2022

thanks @arunavo4

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

3 participants