Return selector in the StrategyEncoder. This is needed for the ExecutorStrategyEncoder
--- don't change below this line ---
ENG-4088 Took 12 minutes
Took 13 seconds
This is unnecessary since we already have the executor address loaded at build time
--- don't change below this line ---
ENG-4088 Took 8 minutes
Took 7 seconds
This is necessary when we run tycho-execution in an environment that already has a runtime.
Make sure that if no runtime exists, like in the testing scenario inside tycho-execution, we save the new runtime in an attribute of permit2. If we don't do this, then the runtime just dies and our handle points to nothing at all and all tests fail
--- don't change below this line ---
ENG-4088 Took 17 minutes
Took 5 seconds
This way we don't have issues with paths and trying to read files that are at other locations after compile time
--- don't change below this line ---
ENG-4088 Took 44 seconds
Took 52 seconds
- This way this chain object contains everything we need, we don't need to worry about doing any transformation or calling any supplementary functions inside any of the encoders
- Needed to move our new Chain object to a higher level since this is used in the higher-level encoder traits. This required some weird default values in the constants in order to avoid using alloy's hex literal. I could have instead opted to make Bytes parse a string I think, though this would mean possibly returning an error at the constants level, which is not nice either.
Question:
- Do we want the user to be in charge of passing the native and wrapped token every single time? This may be a bit annoying for the user. For now, I have defaulted to those in constants.rs, this would take 5 mins to remove though if you don't like it, and it would get rid of this complicated bytes initialization.
- Tried not to leave a single public function undocumented, though did not double-document public function with obvious names
- Remove all mentions of the strategy selector in favour of the strategy registry (to avoid confusion)
Interface changes:
- Rename StrategySelector to StrategyEncoderRegistry
- Implement clone for SwapEncoder
The StrategyEncoderRegistry needs to be initialised at the highest level and the passed to the TychoEncoder.
The TychoEncoder doesn't hold the chain nor the signer_pk as attributes anymore
The StrategyEncoderRegistry does:
- Initialises the SwapEncoderRegistry
- Initialises all the strategies and saves them in a HashMap
- Later, the TychoEncoder only reads from this hashmap
The StrategyEncoder now each holds a SwapEncoderRegistry as an attribute and they use this to get the correct SwapEncoder instead of reading from the global SWAP_ENCODER_REGISTRY
Simplified the SwapEncoderRegistry to not need a Config (everything is done inside itself)
All SwapEncoders implement clone
Took 2 hours 29 minutes
Took 11 seconds
Took 2 minutes