Skip to content

Commit ed970bc

Browse files
committed
decode_exact
1 parent 15ef4d0 commit ed970bc

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

  • crates/precompiles/src/account_keychain

crates/precompiles/src/account_keychain/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub mod dispatch;
1111
use std::collections::HashSet;
1212

1313
use alloy::sol_types::SolCall;
14-
use alloy_rlp::Decodable;
1514
use tempo_contracts::precompiles::{AccountKeychainError, AccountKeychainEvent, ITIP20};
1615
pub use tempo_contracts::precompiles::{
1716
IAccountKeychain,
@@ -587,12 +586,8 @@ impl AccountKeychain {
587586
) -> Result<()> {
588587
self.storage.deduct_gas(rlp_input_cost(call.scopes.len()))?;
589588

590-
let mut encoded_scopes = call.scopes.as_ref();
591-
let scopes = Vec::<RlpCallScope>::decode(&mut encoded_scopes)
589+
let scopes: Vec<RlpCallScope> = alloy_rlp::decode_exact(call.scopes.as_ref())
592590
.map_err(|_| AccountKeychainError::invalid_call_scope())?;
593-
if !encoded_scopes.is_empty() {
594-
return Err(AccountKeychainError::invalid_call_scope().into());
595-
}
596591
let scopes: Vec<CallScope> = scopes.into_iter().map(Into::into).collect();
597592
if scopes.is_empty() {
598593
return Err(AccountKeychainError::invalid_call_scope().into());

0 commit comments

Comments
 (0)