Skip to main content

Questions tagged [anchor-test]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
25 views

Vec<Pubkey> sorting doesn't work

It's a bit Rust question, but the type I used was anchor's Vec<Pubkey> type, so came here to ask. Here is the code. pub fn set_tokens(&mut self, tokens: Vec<Pubkey>) -> Result<()&...
Jung Chun's user avatar
2 votes
0 answers
24 views

Access violation in unknown section at address 0x0 of size 8

I'm encountering Access violation in unknown section at address 0x0 of size 8 error when I call my initialize instruction. Here is the full error. Message: Transaction simulation failed: Error ...
Jung Chun's user avatar
0 votes
1 answer
32 views

anchor test fails at initialize instruction which initializes token 2022 accounts

I'm writing typescript anchor test code about my initialize instruction, it fails with this error. Is initialized!: Error: AnchorError caused by account: system_program. Error Code: ...
Jung Chun's user avatar
0 votes
3 answers
76 views

Anchor detecting wrong Rust version

Anchor keeps detecting my Rust version as 1.68.0-dev even though it is the newest one, any idea? jano@Jans-MacBook-Pro counter_2 % anchor test warning: /Users/jano/Desktop/projekty/programowanie/...
user21619's user avatar
0 votes
1 answer
30 views

Increase timeStamp during Anchor Test cases of TS(typescipt)

How to increase timeStamp during Anchor Test cases of TS(typescipt), I have use sinon pkg but It's not happening const clockStub = sinon.stub(Date, 'now').returns(Date.now() + (15 * 24 * 3600 * 1000))...
hammad ali's user avatar
0 votes
0 answers
15 views

Getting Error: 429 Too Many Requests on a local validator instance

This question is different than this one or this one as they relate to mainnet. Not sure what is causing it, few days ago I did not have this issue. I did not change my testing set-up, testing ...
mega_creamery's user avatar
1 vote
1 answer
116 views

Anchor build not working

When I try to run anchor build in my terminal, this is the result I am getting in the terminal. I have uninstalled and installed rust but I am still getting the same output.
Timilehin Israel's user avatar
0 votes
1 answer
15 views

my solana program keeps exeeding the allowed size limit for some reason. I've been dealing with this issue for days

I am running such a basic script and it keeps throwing this error. I have been dealing with it for days and cant figure it out. please help me Lib.rs declare_id!("...
soleena's user avatar
2 votes
2 answers
66 views

Anchor Test has Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

So if I anchor build and then anchor deploy on the devnet and then use anchor test --skip-build --skip-deploy since I already built and deployed everything before, I find the first time around the all ...
Mark's user avatar
  • 45
2 votes
1 answer
47 views

({"err":{"InstructionError":[1,"PrivilegeEscalation"]}})

Got this error while buying NFT :- pub fn buy_nft(ctx: Context<BuyNft>) -> Result<()> { msg!("Buying nft"); let pda_account = &ctx.accounts.pda_account; ...
Aditya's user avatar
  • 157
0 votes
1 answer
43 views

Error running anchor test: Unable to get latest blockhash

I'm getting a random inability to fetch a blockhash halfway through my test cases in anchor. Can't see to find a patter to it. Can anyone help? Test results: solchan-faucet [DEBUG]: Starting before ...
michaelb's user avatar
0 votes
1 answer
51 views

Error: failed to get recent blockhash: TypeError: fetch failed when running anchor test

This is a small test that I want to run on the devnet. export async function createMintsTransaction( wallet: AnchorWallet ): Promise<anchor.web3.Transaction> { const [provider, program, ...
Yash Patil's user avatar
2 votes
1 answer
182 views

Error: failed to get recent blockhash: TypeError: fetch failed

Getting this error while trying to run my tests cases with anchor Error: failed to get recent blockhash: TypeError: fetch failed at Connection.getLatestBlockhash (/home/jimii/Documents/crew/stream-...
Jimii's user avatar
  • 3,967
0 votes
0 answers
28 views

Calling mint_to for second times error: ConstraintMintMintAuthority. Error Number: 2016. Error Message: A mint mint authority constraint was violated

Initialize and Mint token functions: pub fn init_token(ctx: Context<InitToken>, metadata: InitTokenParams) -> Result<()> { let authority = &ctx.accounts.payer; let ...
Lobo1897's user avatar
  • 153
1 vote
0 answers
36 views

Program returned error: "Overlapping copy"

I tried to mint NFT to someone , but it gives me a error "Error: Raw transaction 5A6sSQPmAUBTQXDkrz9DM1tkYnwp7mjFLLi2S2cUpVjxnkYXHaSvHLHq2fz7Z5ViDdghrAgKPwqBVDC5m7ud3oEK failed ({"err":{...
papi's user avatar
  • 89
0 votes
1 answer
40 views

Can't run local validator on MAC

Hello I'm getting the following error: Error: failed to start validator: Failed to create ledger at test-ledger: io error: Error checking to unpack genesis archive: Archive error: extra entry found: &...
Soldevrookie's user avatar
1 vote
0 answers
17 views

Try to create mint and ATAaccount shows Error:Transaction simulation failed:Error processing Instruction 0:Program failed to complete

Try to create mint and ATA account, When I run anchor test, it shows Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete here ...
papi's user avatar
  • 89
1 vote
1 answer
167 views

Error: target/idl/sol_404.json doesn't exist. Did you run `anchor build`?

I run anchor build , and it indeeded generate a sol404.json , but when I run the anchor test it shows /Users/brooke/Desktop/sol404/node_modules/.bin/ts-mocha -p ./tsconfig.json -t 1000000 'tests/**/*....
papi's user avatar
  • 89
2 votes
1 answer
138 views

"Unable to read keypair file" during 'anchor test', but ~/.config/solana/id.json is there

I have a project that fails with Unable to read keypair file when I run anchor test: anchor test Finished release [optimized] target(s) in 0.09s Found a 'test' script in the Anchor.toml. Running ...
mikemaccana's user avatar
  • 2,170
3 votes
0 answers
21 views

Anchor Test fails with version error [duplicate]

Issue: I installed everything needed to start developing on Solana. I am trying to test a simple contract but when i run: anchor test, it errors out the following: error: package `solana-program v1.18....
Dutch's user avatar
  • 31
0 votes
0 answers
11 views

I am Facing the error in the smart contract after setting up the project via command "anchor init project_name --solidity "

The error is in the smart contract of the project setup by anchor init command. This is the error { " Expected pragma, import directive or contract/interface/library/struct/enum/constant/function/...
Aditya Singh's user avatar
1 vote
1 answer
33 views

Anchor Test Error: Issue with Reading Relative Path

I'm currently working on a Solana project using Anchor and I've encountered an issue when running anchor test. The error message I'm receiving is: Error: Error reading (possibly relative) path: ../../...
alex will's user avatar
1 vote
0 answers
61 views

TokenAccountNotFoundError when trying to pass SPL tokens using anchor

I am trying to build an anchor project where I want to pass a specefic token from one address to another. The token was made using spl-token in cli. I am getting TokenAccountNotFoundError when running ...
Gopal Mathur's user avatar
2 votes
1 answer
92 views

How to get the types from compiled Idl in my tests?

So I'm able to run tests just fine and I know for a fact that the typescript is picking up the types from my compiled program. With that said, I have resorted to using let myAccount: Awaited<...
techiejd's user avatar
1 vote
1 answer
23 views

Define Anchor functions only for tests

I'm writing an Anchor program and would like to include a couple functions that modify certain values during tests in a way that would be tedious to do with the real program interface. I don't want to ...
Ahri's user avatar
  • 4,897
0 votes
0 answers
22 views

Anchor test case shows pending

I get 1 pending test case (0 passing, 0 failed) when running anchor test on the following code: const [trader, nftMint] = Array.from({ length: 2 }, () => Keypair.generate()); anchor.setProvider(...
samuelshix's user avatar
1 vote
2 answers
374 views

Error: IDL for program `loss_harvester` does not have `metadata.address` field

When running anchor test on my solana program it complains that the IDL is missing the metadata.address field. But when I add it, it disappears again after running anchor test. My program built fine. ...
samuelshix's user avatar
1 vote
0 answers
159 views

Failed to get validator identity over RPC: HTTP status server error (502 Bad Gateway) for url (http://127.0.0.1:8899/) while testing with anchor [closed]

I just want to have a simple test with anchor. So I use anchor init to build up a simple program, without changing any code. When I try to run anchor test, the terminal seems to stop here: warning: ...
Hikari's user avatar
  • 13
3 votes
0 answers
200 views

How to increase the system clock timestamp in tests?

This is potentially related to Mocking the Clock sysvar in solana_program_test, but I didn't find a sufficient answer/discussion there. I have a program instruction that contains logic such that ...
Ammon Werner's user avatar
0 votes
0 answers
21 views

spl-token library failing to fetch rent exemption minumum?

I'm working with the @solana/spl-token lib, and when running createMint, I keep getting hit with TypeError: fetch failed. I have narrowed this down to the getMinimumBalanceForRentExemptMint function ...
Morgandril's user avatar
1 vote
1 answer
58 views

NFTs on anchor tests

I'm trying to use this guide to create an NFT to test with my anchor program. When I attempt to mint the NFT, I am met with the following error. FailedToSendTransactionError: The transaction could not ...
Morgandril's user avatar
2 votes
1 answer
61 views

Signer issues with anchor tests

i'm getting a weird signer error when running my tests; Error: Signature verification failed. Missing signature for public key [`6jAudYFBbfQS59oPNjYcMkqr9MqBf312T7oP6WSYRjsg`]. In this case, ...
Morgandril's user avatar
1 vote
1 answer
669 views

What is the meaning of "custom program error: 0x1771" erro?

what is the meaning of custom program error: 0x1771 error?
blackhorse's user avatar
1 vote
1 answer
80 views

Token2022 testing interest bearing token doesn't update balance and freeze when updateRate

I need some help/insight to fix/make the tests work. I'm trying to test locally a complete case of Token2022 with interest, but I have 2 problems locally (in devnet everything works as expected). The ...
Shelvak's user avatar
  • 11
0 votes
1 answer
226 views

Localnet transaction stuck finalizing

I attempted to run my test using anchor on Localnet but got my test stuck like this ⠤ [0/1] Finalizing transaction ...
Kombi's user avatar
  • 11
2 votes
1 answer
445 views

What is the meaning of custom program error code 0xc?

I am trying to test my program but I am getting Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0xc Can someone suggest the ...
blackhorse's user avatar
0 votes
1 answer
89 views

I get "yarn: error: no such option: -p" when try run tests

When I attempt to run anchor tests through anchor test I get the following error: warning: `hello` (lib) generated 1 warning (run `cargo fix --lib -p hello` to apply 1 suggestion) Finished release ...
Amir reza Riahi's user avatar
3 votes
2 answers
229 views

No tests running when running `anchor test`

I cloned my anchor repo but after installing the modules and building, testing the program results in 0 of the test cases running. Here are the logs Found a 'test' script in the Anchor.toml. Running ...
Jimii's user avatar
  • 3,967
1 vote
0 answers
163 views

Getting error "An account required by the instruction is missing" while creating associated token address

I am trying to create associated token address on solana program with below configuration #[derive(Accounts)] #[instruction(params: TokenParams)] pub struct MintToken<'info> { /// CHECK: ...
blackhorse's user avatar
2 votes
1 answer
33 views

canonical method of calling programs functions in script format

I have a couple deployed programs on Devnet. Is there a standard way of calling functions on a deployed program, assuming I have the IDL? Obviously I could write a test but a test typically deploys a ...
AceGravity's user avatar
2 votes
1 answer
76 views

How can I fix Error Code: InstructionFallbackNotFound?

Today I had this error that took me a while to determine what was happening. 1) Create suscription Is initialized!: Error: AnchorError occurred. Error Code: InstructionFallbackNotFound. ...
Mateo Lafalce's user avatar
1 vote
1 answer
132 views

How to convert Vec<u8> to typescript bytes?

In my rust solana smart contact, build with anchor framework, there is one of my variable that is of type in below format struct X { a: Vec<u8> } while building the contract with anchor ...
blackhorse's user avatar
1 vote
1 answer
189 views

Error: unknown signer for SPL Token Transfer

i'm writing an SPL token in anchor for learning but am running into issues when transferring my test SPL token from a newly created anchor keypair. the transfer works for provider.wallet signer (which ...
AceGravity's user avatar
1 vote
1 answer
2k views

Transaction simulation failed: Error processing Instruction 0: Program failed to complete

I'm trying to get an example lottery project to run in my local environment. Anchor test projects and all that work for me. Anchor build - deploy - test all runs well. However on this https://github....
vonyi's user avatar
  • 13
3 votes
2 answers
216 views

Creating Address Lookup Table in localnet fails with "invalid instruction data" error

As the title says, I'm unable to create an Address Lookup Table in localnet. I'm trying to create it in an anchor test and using the following code (which works in devnet/mainnet): const slot = await ...
meditatingsloth's user avatar
2 votes
1 answer
170 views

Multiple Signers on Anchor

I'm writing some tests for an anchor program. I'm passing into the program 2 signers because it seems like the IDL is asking for it, but I don't quite understand how / why this works. Any help in ...
AceGravity's user avatar
1 vote
1 answer
75 views

Custom Program Error 0x0 When Running Test

I've looked around and I see this is a common error that devs run into based on the fact that an account was already initialized. I'm just wondering how to fix it so that I can run tests without ...
Brian M.'s user avatar
  • 121
1 vote
1 answer
81 views

Account data is not persisting for a really simple instruction

I am calling an Anchor instruction (see below) from my tests to extend the lock date for this account. Here is the Anchor code: #[derive(Accounts)] #[instruction(duration: u64)] pub struct ExtendLock&...
mmelvin0x's user avatar
2 votes
1 answer
259 views

What does anchor error `2003` mean

What does the error for A raw constraint was violated mean? errorCode: { code: 'ConstraintRaw', number: 2003 }, errorMessage: 'A raw constraint was violated',
Jimii's user avatar
  • 3,967
0 votes
0 answers
32 views

Problem with testing a name service smart contract written in Solang

I'm trying to run a benchmark for a Solana node using this name service I wrote in Solang within an Anchor project. This is the Solang smart contract. import 'solana'; contract eclipse_ns { ...
Pratham Prasoon's user avatar