ContractFileParseError

Enum ContractFileParseError 

Source
pub enum ContractFileParseError {
Show 14 variants FileTooLarge { file_size: usize, }, NoHeader, WrongMagicBytes, MetadataOutOfRange { offset: u32, size: u16, file_size: u32, }, MetadataDecoding, FileTooSmall { num_methods: u16, read_only_section_size: u32, file_size: u32, }, MethodOutOfRange { offset: u32, code_section_offset: u32, file_size: u32, }, HostCallFnOutOfRange { offset: u32, code_section_offset: u32, file_size: u32, }, InvalidHostCallFnPattern { first: Instruction, second: Instruction, }, InvalidReadOnlySizes { file_size: u32, memory_size: u32, }, InsufficientHeaderMethods { header_num_methods: u16, metadata_method_index: u16, }, MetadataNumMethodsMismatch { header_num_methods: u16, metadata_num_methods: u16, }, UnexpectedInstruction { instruction: Instruction, }, UnexpectedTrailingCodeBytes { num_bytes: usize, },
}
Expand description

Variants§

§

FileTooLarge

The file is too large, must fit into u32

Fields

§file_size: usize

Actual file size

§

NoHeader

The file does not have a header (not enough bytes)

§

WrongMagicBytes

The magic bytes in the header are incorrect

§

MetadataOutOfRange

The metadata section is out of bounds of the file

Fields

§offset: u32

Offset of the metadata section in bytes relative to the start of the file

§size: u16

Size of the metadata section in bytes

§file_size: u32

Size of the file in bytes

§

MetadataDecoding

Failed to decode metadata item

§

FileTooSmall

The file is too small

Fields

§num_methods: u16

Number of methods in the contract

§read_only_section_size: u32

Size of the read-only section in bytes as stored in the file

§file_size: u32

Size of the file in bytes

§

MethodOutOfRange

Method offset is out of bounds of the file

Fields

§offset: u32

Offset of the method in bytes relative to the start of the file

§code_section_offset: u32

Offset of the code section in bytes relative to the start of the file

§file_size: u32

Size of the file in bytes

§

HostCallFnOutOfRange

The host call function offset is out of bounds of the file

Fields

§offset: u32

Offset of the host call function in bytes relative to the start of the file

§code_section_offset: u32

Offset of the code section in bytes relative to the start of the file

§file_size: u32

Size of the file in bytes

§

InvalidHostCallFnPattern

Host call function doesn’t have auipc + jalr tailcall pattern

Fields

§first: Instruction

First instruction of the host call function

§second: Instruction

Second instruction of the host call function

§

InvalidReadOnlySizes

The read-only section file size is larger than the memory size

Fields

§file_size: u32

Size of the read-only section in bytes as stored in the file

§memory_size: u32

Size of the read-only section in bytes as will be written to memory during execution

§

InsufficientHeaderMethods

There are not enough methods in the header to match the number of methods in the actual metadata

Fields

§header_num_methods: u16

Number of methods in the header

§metadata_method_index: u16

Index of the method in the actual metadata that is missing from the header

§

MetadataNumMethodsMismatch

The number of methods in the header does not match the number of methods in the actual metadata

Fields

§header_num_methods: u16

Number of methods in the header

§metadata_num_methods: u16

Number of methods in the actual metadata

§

UnexpectedInstruction

Unexpected instruction encountered while parsing the code section

Fields

§instruction: Instruction

Instruction

§

UnexpectedTrailingCodeBytes

Unexpected trailing code bytes encountered while parsing the code section

Fields

§num_bytes: usize

Number of trailing bytes encountered

Trait Implementations§

Source§

impl Debug for ContractFileParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ContractFileParseError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ContractFileParseError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<MetadataDecodingError<'_>> for ContractFileParseError

Source§

fn from(error: MetadataDecodingError<'_>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more