Skip to content

Commit

Permalink
fix: Restrict scope of most utils to pub(crate)...
Browse files Browse the repository at this point in the history
...so that they can only be used from within the crate.
This way we can reduce the interface, resulting in fewer breaking changes if we were to modify these util methods.
  • Loading branch information
TAMARA LIPOWSKI committed Dec 11, 2024
1 parent c5b945d commit e1fda7f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/evm/protocol/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use tycho_core::Bytes;
///
/// Checks the length of the `Bytes` before attempting to convert, and returns a `SimulationError`
/// if not 20 bytes long.
pub fn bytes_to_erc20_address(address: &Bytes) -> Result<Address, SimulationError> {
pub(crate) fn bytes_to_erc20_address(address: &Bytes) -> Result<Address, SimulationError> {
if address.len() == 20 {
Ok(Address::from_slice(address))
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/evm/protocol/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod erc20;
pub(crate) mod erc20;
pub mod safe_math;
pub mod u256_num;
pub mod uniswap_v2;
Expand Down
6 changes: 3 additions & 3 deletions src/evm/protocol/vm/erc20_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ impl ERC20Slots {
}
}

pub type Overwrites = HashMap<SlotId, U256>;
pub(crate) type Overwrites = HashMap<SlotId, U256>;

pub struct ERC20OverwriteFactory {
pub(crate) struct ERC20OverwriteFactory {
token_address: Address,
overwrites: Overwrites,
balance_slot: SlotId,
Expand Down Expand Up @@ -132,7 +132,7 @@ type U256Return = U256;
/// testing both compiler configurations.
/// - Once the balance slot is found, it uses the detected compiler to search for the allowance
/// slot, which is dependent on the balance slot.
pub fn brute_force_slots<D: EngineDatabaseInterface + Clone + Debug>(
pub(crate) fn brute_force_slots<D: EngineDatabaseInterface + Clone + Debug>(
token_addr: &Address,
block: &BlockHeader,
engine: &SimulationEngine<D>,
Expand Down
2 changes: 1 addition & 1 deletion src/evm/protocol/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pub mod state;
pub mod state_builder;
pub mod tycho_decoder;
mod tycho_simulation_contract;
pub mod utils;
pub(crate) mod utils;

0 comments on commit e1fda7f

Please sign in to comment.