Created Analysis of newSuggestedRoutes()

This commit is contained in:
Samuel Hawksby-Robinson 2024-05-14 17:16:13 +01:00
parent e94afb52bf
commit a2a6428bee
3 changed files with 37 additions and 0 deletions

View File

@ -6,6 +6,7 @@
- I've analysed the main components of the wallet router, see here:
- [wallet/Router file analysis](./analysis/wallet_router.md)
- [wallet/Router struct usage](./analysis/wallet_router_usage.md)
- [wallet/Router `newSuggestedRoutes()`](./analysis/wallet_router_newSuggestedRoutes.md)
## Schedule
- I raised an axe to the crew meetings, swung hard and true. Toppled and prostrate they settled motionless. Tonight we revel in the light of their embers!

View File

@ -25,6 +25,12 @@
- Fetch balance of ERC20 or ERC1155 tokens respectively.
- `suggestedRoutes()`
- Suggests possible transaction routes based on constraints like disabled or preferred chain IDs, and calculates fees and estimated transaction times.
- **Exclusive Utility Functions:**
- `containsNetworkChainID()`
- Determines if a specified blockchain network's Chain ID is present within a given list of Chain IDs
- `newSuggestedRoutes()`
- newSuggestedRoutes function is a crucial part of the route selection and optimization process routing transactions across potentially complex network paths.
- [Detailed Analysis of `newSuggestedRoutes()`](./wallet_router_newSuggestedRoutes.md)
# Transaction Handling
- The code handles transactions through various bridges which abstract the different transaction types.

View File

@ -0,0 +1,30 @@
# `newSuggestedRoutes()`
A constructor function used to create and initialize a struct that represents a collection of suggested routes for a cross-chain transaction. This function aggregates relevant data for each route to determine the best possible paths for a transaction.
## Purpose and Role
The primary purpose of `newSuggestedRoutes` is to assemble a structured view of all potential transaction paths based on the criteria cost, speed, network preferences, and other operational parameters.
### Aggregates Routes:
Collects and organises routes that meet given criteria.
### Filters and Selects Routes:
Applies business logic or algorithms to select the most efficient or cost-effective routes.
### Provides Contextual Data:
Enriches routes with additional data such as cost estimates, gas fees, and estimated transaction times.
## Component Analysis
### `amountIn *big.Int`
The amount of tokens or currency to be transferred, influencing which paths are viable based on the maximum transferable amounts and balance restrictions.
### `candidates []*Path`
A list of potential paths that have been pre-determined as possible routes for the transaction.
### `fromLockedAmount map[uint64]*hexutil.Big`
A map indicating amounts locked or reserved on specific networks, possibly affecting the viability of certain paths.
### `filterRoutes` and `findBest`
Helper functions that might be used within `newSuggestedRoutes` to filter out infeasible paths and then select the optimal path based on the criteria. These functions represent core logic for determining the best routes from a set of candidates.
TODO Additional analysis is required for both of these.