Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions rust/tw_evm/src/evm_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Copyright © 2017 Trust Wallet.

use crate::abi::AbiResult;
use crate::abi::{AbiError, AbiErrorKind, AbiResult};
use crate::evm_context::EvmContext;
use crate::modules::abi_encoder::AbiEncoder;
use crate::modules::rlp_encoder::RlpEncoder;
Expand Down Expand Up @@ -47,7 +47,9 @@ pub trait EvmEntry {

/// Returns the function type signature, of the form "baz(int32,uint256)".
#[inline]
fn get_function_signature_from_proto(input: AbiProto::FunctionGetTypeInput<'_>) -> String {
fn get_function_signature_from_proto(
input: AbiProto::FunctionGetTypeInput<'_>,
) -> AbiResult<String> {
AbiEncoder::<Self::Context>::get_function_signature_from_proto(input)
}

Expand Down Expand Up @@ -78,7 +80,7 @@ pub trait EvmEntryExt {
fn decode_abi_params(&self, input: &[u8]) -> ProtoResult<Data>;

/// Returns the function type signature, of the form "baz(int32,uint256)".
fn get_function_signature_from_proto(&self, input: &[u8]) -> ProtoResult<String>;
fn get_function_signature_from_proto(&self, input: &[u8]) -> AbiResult<String>;

/// Returns the function type signature, of the form "baz(int32,uint256)".
fn get_function_signature_from_abi(&self, abi: &str) -> AbiResult<String>;
Expand Down Expand Up @@ -112,9 +114,11 @@ where
serialize(&output)
}

fn get_function_signature_from_proto(&self, input: &[u8]) -> ProtoResult<String> {
let input = deserialize(input)?;
Ok(<Self as EvmEntry>::get_function_signature_from_proto(input))
fn get_function_signature_from_proto(&self, input: &[u8]) -> AbiResult<String> {
let Ok(input) = deserialize(input) else {
return AbiError::err(AbiErrorKind::Error_decoding_data);
};
<Self as EvmEntry>::get_function_signature_from_proto(input)
}

fn get_function_signature_from_abi(&self, abi: &str) -> AbiResult<String> {
Expand Down
Loading
Loading