anchor-spl v0.30.1 solana-spl 1.18.17 错误[E0308]:类型不匹配

问题描述 投票:0回答:1

我正在用anchor构建solana智能合约。 锚定版本是0.30.1 solana-cli 版本是 1.18.17 第一次,我构建并部署了智能合约,没有任何问题。 但是在我添加这两行之后,我得到了太长的错误。

use anchor_spl::token::{self, Token, TokenAccount, Mint, Transfer};
use std::cmp::min;

我不明白为什么会出现这种错误。 我该如何解决这个问题?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/instruction.rs:784:27
    |
784 |         instructions.push(verify_pubkey_validity(None, proof_data));
    |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |                      |
    |                      arguments to this method are incorrect
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
   --> /home/runner/work/platform-tools/platform-tools/out/rust/library/alloc/src/vec/mod.rs:1880:12

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/instruction.rs:887:27
    |
887 |         instructions.push(verify_zero_balance(None, proof_data));
    |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |                      |
    |                      arguments to this method are incorrect
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
   --> /home/runner/work/platform-tools/platform-tools/out/rust/library/alloc/src/vec/mod.rs:1880:12

error[E0308]: mismatched types
    --> src/extension/confidential_transfer/instruction.rs:1018:27
     |
1018 |         instructions.push(verify_withdraw(None, proof_data));
     |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found `solana_program::instruction::Instruction`
     |                      |
     |                      arguments to this method are incorrect
     |
     = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
    --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
    --> src/instruction.rs:329:1
     = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
    --> /home/runner/work/platform-tools/platform-tools/out/rust/library/alloc/src/vec/mod.rs:1880:12

error[E0308]: mismatched types
    --> src/extension/confidential_transfer/instruction.rs:1111:27
     |
1111 |         instructions.push(verify_transfer(None, proof_data));
     |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found `solana_program::instruction::Instruction`
     |                      |
     |                      arguments to this method are incorrect
     |
     = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
    --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
    --> src/instruction.rs:329:1
     = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
    --> /home/runner/work/platform-tools/platform-tools/out/rust/library/alloc/src/vec/mod.rs:1880:12

error[E0308]: mismatched types
    --> src/extension/confidential_transfer/instruction.rs:1204:27
     |
1204 |         instructions.push(verify_transfer_with_fee(None, proof_data));
     |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found `solana_program::instruction::Instruction`
     |                      |
     |                      arguments to this method are incorrect
     |
     = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
    --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
    --> src/instruction.rs:329:1
     = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
    --> /home/runner/work/platform-tools/platform-tools/out/rust/library/alloc/src/vec/mod.rs:1880:12

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:197:48
    |
197 |                         context_state_account: equality_proof_context_state_account_info.key,
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:198:50
    |
198 |                         context_state_authority: context_state_account_authority_info.key,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:200:21
    |
195 |                 &zk_token_proof_instruction::close_context_state(
    |                  ----------------------------------------------- arguments to this function are incorrect
...
200 |                     lamport_destination_account_info.key,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/zk_token_proof_instruction.rs:364:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:195:17
    |
194 |               invoke(
    |               ------ arguments to this function are incorrect
195 | /                 &zk_token_proof_instruction::close_context_state(
196 | |                     ContextStateInfo {
197 | |                         context_state_account: equality_proof_context_state_account_info.key,
198 | |                         context_state_authority: context_state_account_authority_info.key,
199 | |                     },
200 | |                     lamport_destination_account_info.key,
201 | |                 ),
    | |_________________^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/program.rs:132:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:213:48
    |
213 |                           context_state_account: ciphertext_validity_proof_context_state_account_info
    |  ________________________________________________^
214 | |                             .key,
    | |________________________________^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:215:50
    |
215 |                         context_state_authority: context_state_account_authority_info.key,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:217:21
    |
211 |                 &zk_token_proof_instruction::close_context_state(
    |                  ----------------------------------------------- arguments to this function are incorrect
...
217 |                     lamport_destination_account_info.key,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/zk_token_proof_instruction.rs:364:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:211:17
    |
210 |               invoke(
    |               ------ arguments to this function are incorrect
211 | /                 &zk_token_proof_instruction::close_context_state(
212 | |                     ContextStateInfo {
213 | |                         context_state_account: ciphertext_validity_proof_context_state_account_info
214 | |                             .key,
...   |
217 | |                     lamport_destination_account_info.key,
218 | |                 ),
    | |_________________^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/program.rs:132:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:230:48
    |
230 |                         context_state_account: range_proof_context_state_account_info.key,
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:231:50
    |
231 |                         context_state_authority: context_state_account_authority_info.key,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:233:21
    |
228 |                 &zk_token_proof_instruction::close_context_state(
    |                  ----------------------------------------------- arguments to this function are incorrect
...
233 |                     lamport_destination_account_info.key,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/zk_token_proof_instruction.rs:364:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:228:17
    |
227 |               invoke(
    |               ------ arguments to this function are incorrect
228 | /                 &zk_token_proof_instruction::close_context_state(
229 | |                     ContextStateInfo {
230 | |                         context_state_account: range_proof_context_state_account_info.key,
231 | |                         context_state_authority: context_state_account_authority_info.key,
232 | |                     },
233 | |                     lamport_destination_account_info.key,
234 | |                 ),
    | |_________________^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/program.rs:132:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:373:48
    |
373 |                         context_state_account: equality_proof_context_state_account_info.key,
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:374:50
    |
374 |                         context_state_authority: context_state_account_authority_info.key,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:376:21
    |
371 |                 &zk_token_proof_instruction::close_context_state(
    |                  ----------------------------------------------- arguments to this function are incorrect
...
376 |                     lamport_destination_account_info.key,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/zk_token_proof_instruction.rs:364:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:371:17
    |
370 |               invoke(
    |               ------ arguments to this function are incorrect
371 | /                 &zk_token_proof_instruction::close_context_state(
372 | |                     ContextStateInfo {
373 | |                         context_state_account: equality_proof_context_state_account_info.key,
374 | |                         context_state_authority: context_state_account_authority_info.key,
375 | |                     },
376 | |                     lamport_destination_account_info.key,
377 | |                 ),
    | |_________________^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/program.rs:132:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:390:29
    |
390 | ...                   transfer_amount_ciphertext_validity_proof_context_state_account_info.key,
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:391:50
    |
391 |                         context_state_authority: context_state_account_authority_info.key,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:393:21
    |
387 |                 &zk_token_proof_instruction::close_context_state(
    |                  ----------------------------------------------- arguments to this function are incorrect
...
393 |                     lamport_destination_account_info.key,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/zk_token_proof_instruction.rs:364:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:387:17
    |
386 |               invoke(
    |               ------ arguments to this function are incorrect
387 | /                 &zk_token_proof_instruction::close_context_state(
388 | |                     ContextStateInfo {
389 | |                         context_state_account:
390 | |                             transfer_amount_ciphertext_validity_proof_context_state_account_info.key,
...   |
393 | |                     lamport_destination_account_info.key,
394 | |                 ),
    | |_________________^ expected `Instruction`, found `solana_program::instruction::Instruction`
    |
    = note: `solana_program::instruction::Instruction` and `Instruction` have similar names, but are actually distinct types
note: `solana_program::instruction::Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:332:1
note: `Instruction` is defined in crate `solana_program`
   --> src/instruction.rs:329:1
    = note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
   --> src/program.rs:132:8

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:406:48
    |
406 |                         context_state_account: fee_sigma_proof_context_state_account_info.key,
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:407:50
    |
407 |                         context_state_authority: context_state_account_authority_info.key,
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `solana_program::pubkey::Pubkey`, found `Pubkey`
    |
    = note: `Pubkey` and `solana_program::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:88:1
note: `solana_program::pubkey::Pubkey` is defined in crate `solana_program`
   --> src/pubkey.rs:96:1
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> src/extension/confidential_transfer/verify_proof.rs:409:21
    |
404 |                 &zk_token_proof_instruction::close_context_state(
    |                  ----------------------------------------------- arguments to this function are incorrect

...

我认为这是因为版本匹配问题。 为什么我的锚点出现这个问题?

anchor smartcontracts solana anchor-solana
1个回答
0
投票

要解决此问题,您可以通过手动编辑锁定文件或简单地运行来降级 Solana v2 依赖项:

cargo update -p [email protected] --precise 1.18.17
© www.soinside.com 2019 - 2024. All rights reserved.