Module utils

Source

Structs§

ArcRLock
A special version of Arc<RwLock<T>> that can only be read from.

Functions§

block_on
calculate_eth_cost
Calculates the cost of a transaction in ETH.
create_debug_output
Creates a [DebugCall] from a [L2Tx], [VmExecutionResultAndLogs] and a list of [Call]s.
format_int_exp
Formats a U256 number to string, adding an exponential notation hint.
format_uint_exp
Formats a U256 number to string, adding an exponential notation hint if it is larger than 10_000, with a precision of 4 figures, and trimming the trailing zeros.
h256_to_u64
Converts h256 value as BE into the u64
internal_error
read_json_file
Reads the JSON file at the specified path and deserializes it into the provided type. Returns an error if the file cannot be read or deserialization fails.
to_exp_notation
Returns the number expressed as a string in exponential notation with the given precision (number of significant figures), optionally removing trailing zeros from the mantissa.
to_human_size
Takes long integers and returns them in human friendly format with “_”. For example: 12_334_093
to_real_block_number
Returns the actual [U64] block number from [BlockNumber].
utc_datetime_from_epoch_ms
Converts a timestamp in milliseconds since epoch to a DateTime in UTC.
write_json_file
Writes the given serializable object as JSON to the specified file path using pretty printing. Returns an error if the file cannot be created or if serialization/writing fails.