Skip to content

Commit

Permalink
Clippy + update documentation for TxValidationError::BoxSizeExceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
SethDusek committed May 4, 2024
1 parent 517f683 commit 0fdf2d2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ergo-lib/src/chain/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ pub fn verify_tx_input_proof(
let ctx = Rc::new(make_context(state_context, tx_context, input_idx)?);
let verifier = TestVerifier;
// Try spending in storage rent, if any condition is not satisfied fallback to normal script validation
match try_spend_storage_rent(&input, state_context, &ctx) {
match try_spend_storage_rent(input, state_context, &ctx) {
Some(()) => Ok(VerificationResult {
result: true,
cost: 0,
Expand Down
2 changes: 1 addition & 1 deletion ergo-lib/src/chain/transaction/ergo_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub enum TxValidationError {
/// When using sigma-rust where heights are always unsigned, this error may be because creation height was set to be >= 2147483648
NegativeHeight,
#[error("Output box size {0} > maximum {}", ErgoBox::MAX_BOX_SIZE)]
/// Box size is > [ErgoBox::MAX_SCRIPT_SIZE]
/// Box size is > [ErgoBox::MAX_BOX_SIZE]
BoxSizeExceeded(usize),
#[error("Output box size {0} > maximum {}", ErgoBox::MAX_SCRIPT_SIZE)]
/// Script size is > [ErgoBox::MAX_SCRIPT_SIZE]
Expand Down
2 changes: 1 addition & 1 deletion ergo-lib/src/wallet/tx_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<T: ErgoTransaction> TransactionContext<T> {
.map(|(i, b)| (b.box_id(), i as u16))
.collect();
for (i, unsigned_input) in spending_tx.inputs_ids().iter().enumerate() {
if !box_index.contains_key(&unsigned_input) {
if !box_index.contains_key(unsigned_input) {
return Err(TransactionContextError::InputBoxNotFound(i));
}
}
Expand Down
5 changes: 2 additions & 3 deletions ergotree-interpreter/src/eval/scoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ pub(crate) static INDEX_OF_EVAL_FN: EvalFn = |_env, _ctx, obj, args| {
.try_extract_into::<i32>()?
.max(0);

let index_of = normalized_input_vals
normalized_input_vals
.into_iter()
.skip(from as usize)
.position(|it| it == target_element)
.map(|idx| idx as i32 + from)
.unwrap_or(-1);
index_of
.unwrap_or(-1)
}))
};

Expand Down

0 comments on commit 0fdf2d2

Please sign in to comment.