Skip to main content

Module revert_handlers

Module revert_handlers 

Source

Re-exportsΒ§

use crate::Error; πŸ”’
use crate::Result; πŸ”’
use alloy_primitives::Address; πŸ”’
use alloy_primitives::Bytes; πŸ”’
use alloy_primitives::hex; πŸ”’
use alloy_primitives::hex; πŸ”’
use alloy_sol_types::SolError; πŸ”’
use alloy_sol_types::SolValue; πŸ”’
use evm2::interpreter::InstrStop; πŸ”’
use foundry_common::ContractsByArtifact; πŸ”’
use foundry_evm_core::decode::RevertDecoder; πŸ”’
use spec::Vm; πŸ”’
use super::assume::AcceptableRevertParameters; πŸ”’
use super::assume::AssumeNoRevert; πŸ”’
use super::expect::ExpectedRevert; πŸ”’

ConstantsΒ§

DUMMY_CREATE_ADDRESS
Same reasoning as DUMMY_CALL_OUTPUT, but for creates.

StaticsΒ§

DUMMY_CALL_OUTPUT
For some cheatcodes we may internally change the status of the call, i.e. in expectRevert. Solidity will see a successful call and attempt to decode the return data. Therefore, we need to populate the return with dummy bytes so the decode doesn’t fail.

TraitsΒ§

RevertParameters πŸ”’
Common parameters for expected or assumed reverts. Allows for code reuse.

FunctionsΒ§

decode_revert πŸ”’
expect_revert_mismatch
Returns the error that a call reverting with retdata, first failing in reverted_by, ends with when it does not meet a vm.expectRevert of reason from reverter, or None when it meets it. With partial_match, only the first 4 bytes of reason are compared.
handle_assume_no_revert πŸ”’
handle_expect_revert πŸ”’
handle_revert πŸ”’
Core logic for handling reverts that may or may not be expected (or assumed).
stringify πŸ”’