简体   繁体   English

Solana metaplex-program-library 线程“主”在“代码不可解析:错误(“必须为 init 提供空间”)时出现恐慌

[英]Solana metaplex-program-library thread 'main' panicked at 'Code not parseable: Error("space must be provided with init")'

I am trying to compile and set up a local Solana node with Metaplex installed for local development.我正在尝试编译和设置安装了 Metaplex 的本地 Solana 节点以进行本地开发。 Right now when compiling with anchor build - I've been getting the following error:现在在使用锚构建进行编译时 - 我收到以下错误:

To deploy this program:
  $ solana program deploy /sol/metaplex/program-library/target/deploy/mpl_fixed_price_sale.so
The program address will default to this keypair (override with --program-id):
  /sol/metaplex/program-library/target/deploy/mpl_fixed_price_sale-keypair.json
thread 'main' panicked at 'Code not parseable: Error("space must be provided with init")', lang/syn/src/idl/file.rs:360:58
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1749:5
   3: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   4: anchor_syn::idl::file::parse_account_derives
   5: anchor_syn::idl::file::parse
   6: anchor_cli::extract_idl
   7: anchor_cli::build_cwd
   8: anchor_cli::build_all
   9: anchor_cli::build
  10: anchor_cli::entry
  11: anchor::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

It appears to originate in: fixed-price-sale/program/src/lib.rs inside pub struct Buy the following lines:它似乎起源于: fixed-price-sale/program/src/lib.rs inside pub struct Buy以下行:

pub struct Buy<'info> {
...
  #[account(init_if_needed, seeds=[HISTORY_PREFIX.as_bytes(), user_wallet.key().as_ref(), market.key().as_ref()], bump, payer=user_wallet)]
  trade_history: Box<Account<'info, TradeHistory>>,
...
}

When I comment these two lines out and comment out an entire fixed-price-sale/program/src/processor/buy.rs - it compiles with some warnings, but clearly there is now functionality missing.当我注释掉这两行并注释掉整个fixed-price-sale/program/src/processor/buy.rs时,它会编译并带有一些警告,但显然现在缺少功能。 What is missing here?这里缺少什么?

Looks like a bug.看起来像一个错误。 The space parameter is missing.缺少空间参数。

Need to change:需要改变:

...
#[account(
  init_if_needed, 
  seeds=[
    HISTORY_PREFIX.as_bytes(), 
    user_wallet.key().as_ref(), 
    market.key().as_ref()
  ], 
  bump, 
  payer=user_wallet
)]
trade_history: Box<Account<'info, TradeHistory>>,
...

to this:对此:

...
#[account(
  init_if_needed, 
  space=TradeHistory::LEN, // <-------------- Added this line
  seeds=[
    HISTORY_PREFIX.as_bytes(), 
    user_wallet.key().as_ref(), 
    market.key().as_ref()
  ], 
  bump,
  payer=user_wallet
)]
trade_history: Box<Account<'info, TradeHistory>>,
...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Metaplex Auction house execute_sale 函数抛出错误“程序日志:在&#39;index out of bounds: the len is 0 but index is 0&#39;” - Metaplex Auction house execute_sale function is throwing error " Program log: panicked at 'index out of bounds: the len is 0 but the index is 0'" `程序日志:您不能单方面验证另一个创建者,他们必须在 Metaplex 糖果机中签名`错误 - `Program log: You cannot unilaterally verify another creator, they must sign` error in Metaplex candy machine Solana 锚点部署错误。 初始化不应提供碰撞目标。 请使用没有目标的颠簸 - Solana Anchor deploy error. bump targets should not be provided with init. please use bump without a target 在 Solana devnet Metaplex v1.2.0 candy-machine-ui 上铸造 NFT 时收到错误 - Receiving error when minting NFT on Solana devnet Metaplex v1.2.0 candy-machine-ui 获取 Solana Metaplex 糖果机配置数据 - Getting Solana Metaplex Candy Machine Config Data Solana Metaplex Creator 拆分问题 - Solana Metaplex Creator Split issue Tokio宏在Solana程序中需要rt或rt-multi-thread - Tokio macro requires rt or rt-multi-thread in Solana program Metaplex 上传错误。 “路径”参数必须是字符串 - Metaplex uploading error. "path" argument must be string Solana图稿上传命令问题(metaplex) - Solana artwork upload command problem ( metaplex ) Metaplex - 如何监听 Solana 元数据 URI 的变化? - Metaplex - How to listen to changes of Solana Metadata URI?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM