pub struct EncodeRequest {
pub path: PathInfo,
pub optimal_input: u128,
pub hop_outputs: Vec<u128>,
pub consumed_inputs: Vec<u128>,
pub opts: EncodeOptions,
}Expand description
The per-path encode intake (ADR-033): the path + the solver’s amount triple + the declared axes, as one unit.
Built exactly once at each producing site (the strategy’s candidate
projection; the declarative harness chain runners) and handed to
encode_cmd_stream together with an EncodeContext. A request
without its path is the shape that lets amounts be synthesized blind to
what the path constrains — so path and amounts are one unit.
The CL overfeed-clamp invariant (UO3JM4 / path-5000 EMPTY-HALT) attaches
to this value: consumed_inputs[i] is the executable input fed to hop
i. For a non-over-fed CL hop (and for V2/Balancer/Curve/Solidly hops) it
equals hop_outputs[i − 1]; for an over-fed CL hop the producer clamps it
to input_consumed − 1 (the solver’s clamp_cl_hop_capacity, whose bound
is the pools-layer exact_input_clamp_bound rule) so the on-chain
exact-in loop terminates on amountRemaining == 0 instead of marching
empty bitmap words. Building the request is where that invariant is owned;
it is not re-derived by the encoder.
Fields§
§path: PathInfoThe resolved path hops (the encode’s shape selector).
optimal_input: u128The flash/optimal input amount (u128; the cmd_executor int128
convention).
hop_outputs: Vec<u128>Per-hop output amounts. hop_outputs[i] = the output after hop i
([forward_out, final_output] for a 2-hop path).
consumed_inputs: Vec<u128>Per-hop executable input amounts (the CL-clamp swap-in — see the type doc for the invariant).
opts: EncodeOptionsThe declared per-path axes (funding / capture / bribe + the opcode toggles).
Implementations§
Source§impl EncodeRequest
impl EncodeRequest
Sourcepub fn new(
path: PathInfo,
optimal_input: u128,
hop_outputs: Vec<u128>,
consumed_inputs: Vec<u128>,
opts: EncodeOptions,
) -> Self
pub fn new( path: PathInfo, optimal_input: u128, hop_outputs: Vec<u128>, consumed_inputs: Vec<u128>, opts: EncodeOptions, ) -> Self
Build a request, checking the hop-alignment invariants.
hop_outputs and consumed_inputs are per-hop arrays: each must have
exactly one entry per hop in path, or the encode would index
misaligned amounts silently.
§Panics
If hop_outputs.len() or consumed_inputs.len() differs from
path.hops.len() (a programmer error — the arrays are per-hop, aligned
with the path). The panic names the mismatched arrays.
Trait Implementations§
Source§impl Clone for EncodeRequest
impl Clone for EncodeRequest
Source§fn clone(&self) -> EncodeRequest
fn clone(&self) -> EncodeRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EncodeRequest
impl RefUnwindSafe for EncodeRequest
impl Send for EncodeRequest
impl Sync for EncodeRequest
impl Unpin for EncodeRequest
impl UnsafeUnpin for EncodeRequest
impl UnwindSafe for EncodeRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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