I can help you write an article on Solana: the signature verification has failed with the missing signatures for public keys to joke with the anchor.
Title: SOLANA SIGNATURE VERIFICATION NOT COMMITTED: A guide to solving the problem in joke tests using anchoring
Introduction:
Solana is a quick and customizable blockchain platform that allows developers to quickly create decentralized applications (DAP). However, as with any other blockchain, it depends on the signatures to control transactions and maintain the integrity of the network. In this article, we will examine the reason why the signature test failed in our joke tests using an anchor and guarantee actions to prevent actions.
What is the control of the signature failed:
The failure to verify the signature occurs when the test tries to sign the transaction but cannot obtain the signing required on the proven public key. This can happen for a series of reasons, such as:
- Missing signatures (also known as “missing signatories”)
- Wronty private keys
- Questions about the rotation of the private key
Example of JEST TEST:
Let’s take a look at an example of how we could test this scenario using Jest and Anchor:
`Jsx
Import {Anchorconttract} from ‘@Coral-Byz/Enchor’;
Import {Program} from ‘@Coral-Byz/Anchor’;
Import {royaltynft} from ‘../target/types/royyty_nft’;
Constrator Conteggio = new anchor counts (Honorynft);
Describe (‘Control of the signature not succeeded’, () => {
(“He should launch an error when there are missing signatures”, Async () => {{{{
// Create a test account with a public key
Const Publem1 = ‘0x1234567890ABCDEF1234DEF567890ABFEDCBA’;
Const Privatekey1 = ‘0x …’; // Replace with the actual private key
// Create another test account with additional public key
Const Pubkey2 = ‘0x …’; // Replace with the actual private key
Attempt {
Wait for the contract.
Publickey1,
Privatekey1, // correct signature for the public key 1
Publickey2,
PrivateKey2 // Mancante signature for the public key 2
);
Launch a new bug (“imminent error”);
} Catch (error) {
Wait (error.message) .Tobe (‘lack of signature for public keys’);
}
});
});
`
In this example, we create two test accounts with different public keys. Let's try to sign the agreement using the first public key, but it will not be able to do it because of the missing signatures. In the declaration, "expected" checks if the error message is launched, stating that the second public key lacks signatures.
The setting of the signature verification has failed in the pressure tests:
You can take these steps to prevent this problem:
- Check the private keys : make sure that your test accounts have the right private keys.
- Update the "SignPublicKey" function : Edit the "SignuPublickey" function to accept the public signature keyboard and the missing signatures of the additional parameters.
3
Add errors processing
: wrap the trick of testing of the SignuPublickey call to capture errors that can be thrown out due to the missing signatures.
Here is an updated example:
Javascript
Import {Anchorconttract} from ‘@Coral-Byz/Enchor’;
Import {Program} from ‘@Coral-Byz/Anchor’;
Import {royaltynft} from ‘../target/types/royyty_nft’;
Constrator Conteggio = new anchor counts (Honorynft);
Describe (‘Control of the signature not succeeded’, () => {
(“He should launch an error when there are missing signatures”, Async () => {{{{
// Create a test account with a public key
Const Publem1 = ‘0x1234567890ABCDEF1234DEF567890ABFEDCBA’;
Const Privatekey1 = ‘0x …’; // Replace with the actual private key
Attempt {
Wait for the contract.