[英]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.