v0.4.7-pre.013
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
// file: kb-lib/src/decoder/spl/token_2022/state.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Strict Token-2022 base-state and TLV parsing.
|
||||
|
||||
use base64::Engine as _; // rust-rules: trait-import
|
||||
use base64::Engine; // rust-rules: trait-import
|
||||
|
||||
const MINT_BASE_LEN: usize = 82;
|
||||
const ACCOUNT_BASE_LEN: usize = 165;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-lib/src/executor/metadata/metaplex_token_metadata/builder.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Official Metaplex builders and conservative plan validation.
|
||||
|
||||
@@ -233,12 +233,6 @@ fn validate_intent(intent: &crate::ExMetaplexTokenMetadataExecutionIntent) -> kb
|
||||
"Metaplex Token Metadata execution requires simulation before signing or sending",
|
||||
));
|
||||
}
|
||||
if !intent.policy.dry_run {
|
||||
return std::result::Result::Err(kb_core::Error::new(
|
||||
"execution_metaplex_dry_run_required",
|
||||
"Metaplex Token Metadata pre.006 intents are simulation-only",
|
||||
));
|
||||
}
|
||||
match intent.policy.cost_limit.max_fee_lamports {
|
||||
std::option::Option::Some(value) if value > 0 => {},
|
||||
std::option::Option::Some(_) | std::option::Option::None => {
|
||||
@@ -1309,21 +1303,17 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
#[allow(deprecated)]
|
||||
fn policy_requires_dry_run_and_sufficient_limits() {
|
||||
fn policy_requires_simulation_and_sufficient_limits() {
|
||||
let mut intent = approved_puff_intent();
|
||||
intent.policy.dry_run = false;
|
||||
let dry_run_result = super::validate_intent(&intent);
|
||||
assert_eq!(
|
||||
dry_run_result.as_ref().err().map(kb_core::Error::code),
|
||||
std::option::Option::Some("execution_metaplex_dry_run_required"),
|
||||
);
|
||||
intent.policy.dry_run = true;
|
||||
intent.policy.cost_limit.max_spend_lamports = std::option::Option::Some(9_999);
|
||||
let spend_result = super::validate_intent(&intent);
|
||||
assert_eq!(
|
||||
spend_result.as_ref().err().map(kb_core::Error::code),
|
||||
std::option::Option::Some("execution_metaplex_spend_limit_insufficient"),
|
||||
);
|
||||
intent.policy.cost_limit.max_spend_lamports = std::option::Option::Some(10_000);
|
||||
intent.policy.dry_run = false;
|
||||
assert!(super::validate_intent(&intent).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user