1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use BlockNumber;
use auto_impl;
use crate::;
/// Factory for creating block-specific external environment instances.
///
/// This trait is responsible for instantiating external oracles at a specific block height,
/// ensuring all oracle queries during EVM execution operate on a consistent snapshot of state.
///
/// # Design Pattern
///
/// External environments (SALT and Oracle) do not take block parameters in their methods.
/// Instead, the factory creates block-aware instances that encapsulate the block context,
/// allowing implementations to:
/// - Read state from the appropriate block height
/// - Cache block-specific data for the execution lifetime
/// - Ensure deterministic behavior across repeated executions
///
/// # Usage
///
/// This factory is typically called once per block when initializing the EVM. The returned
/// [`ExternalEnvs`] are then used throughout transaction execution within that block.