|
| 1 | +# Reassign ANT to Evolve Implementation Kickoff on the ArNS Portal |
| 2 | + |
| 3 | +- Status: Proposed |
| 4 | +- Approvers: [Ariel], [Dylan], [Atticus], [Phil], [David] |
| 5 | +- Date: [2025-01-30] |
| 6 | +- Authors: [Atticus] |
| 7 | + |
| 8 | +## Context and Problem Statement |
| 9 | + |
| 10 | +Currently to evolve the ANT we use AOS `Eval` - this introduces the problem of |
| 11 | +evaluating what the current version of the code is. If we maintain a variable in |
| 12 | +the state of the process containing a version number, that tells us only what |
| 13 | +that version number is. At any point the user - owner - of the ANT may `Eval` |
| 14 | +new code into the process resulting in changes to the process that may not |
| 15 | +reflect what we expect the version number we assigned to reflect. To overcome |
| 16 | +this we dryrun interactions on APIs and analyze the results to see if the APIs |
| 17 | +perform as expected - this is very inefficient as dry run calls to CU's are |
| 18 | +expensive in networking client side, as well as for the CU. |
| 19 | + |
| 20 | +And so it is proposed to leverage the `Reassign-Name` handler in conjunction |
| 21 | +with `_boot` to fork the process state to a whole new ANT, assign that new ANT |
| 22 | +as the registered ANT to the specified ArNS name in the registry, and using the |
| 23 | +module ID of the process to identify process version and capabilities, and |
| 24 | +solely the module ID. |
| 25 | + |
| 26 | +## Decision Drivers |
| 27 | + |
| 28 | +- Improve the performance of ANT loading client side. |
| 29 | +- Ensure the upgrade process is more robust by using immutable module IDs. |
| 30 | +- Reduce computational load on CU infra. |
| 31 | +- Mitigate risks associated with reassigning ANT state and ARNS records. |
| 32 | + |
| 33 | +## Considered Options |
| 34 | + |
| 35 | +1. **Current Approach (Baseline)** |
| 36 | + - Multiple dry runs per ANT. |
| 37 | + - ETH compatibility checked via handler analysis. |
| 38 | + - Upgrade involves loading Lua code. |
| 39 | +2. **Optimized Approach (Proposed Change)** |
| 40 | + - Use the module ID to evaluate process version. |
| 41 | + - Upgrade via spawning a new ANT and reassigning ARNS records. |
| 42 | + |
| 43 | +## Decision Outcome |
| 44 | + |
| 45 | +### Chosen Option: Optimized Approach |
| 46 | + |
| 47 | +The optimized approach reduces computational overhead and improves caching for |
| 48 | +better performance. It also shifts to a more robust upgrade mechanism using |
| 49 | +immutable module IDs rather than version detection heuristics. We can do this |
| 50 | +now that we compile and publish our own WASM binaries, rather than using an AOS |
| 51 | +binary and loading our code into it. |
| 52 | + |
| 53 | +### Positive Consequences |
| 54 | + |
| 55 | +- **Performance Improvement:** Reducing dry runs significantly speeds up ANT |
| 56 | + loading. |
| 57 | +- **Immutable Module Versioning:** Eliminates issues with heuristic version |
| 58 | + analysis. |
| 59 | +- **Reduced CU Load:** Fewer computations per ANT. |
| 60 | + |
| 61 | +### Negative Consequences |
| 62 | + |
| 63 | +- **Complicates Memory Usage on ANT Registry:** More ANTs means more state in |
| 64 | + the ANT registry, which currently doesn't have a cleanup process. |
| 65 | +- **Potential Integration Issues:** Existing integrations relying on fixed ANT |
| 66 | + IDs may break. |
| 67 | +- **State Limitations:** Large ANT states (e.g., >2000 undernames) may fail to |
| 68 | + bootstrap on spawn, meaning we need to understand the limitations there and |
| 69 | + decide what amounts we wish to support. |
| 70 | + |
| 71 | +## Pros and Cons of the Options |
| 72 | + |
| 73 | +### Current Approach |
| 74 | + |
| 75 | +- `+` Already implemented and functional. |
| 76 | +- `+` Ensures ETH compatibility via handler checks. |
| 77 | +- `-` Multiple dry runs increase computational cost. |
| 78 | +- `-` Upgrade process relies on mutable version checks. |
| 79 | + |
| 80 | +### Optimized Approach (Chosen) |
| 81 | + |
| 82 | +- `+` 3x faster ANT loading. |
| 83 | +- `+` Reduces CU consumption. |
| 84 | +- `+` Enables robust versioning. |
| 85 | +- `-` Introduces new risks related to state migration and memory management. |
| 86 | + |
| 87 | +## Links |
| 88 | + |
| 89 | +- [Ariel]: https://github.com/arielmelendez |
| 90 | +- [David]: https://github.com/djwhitt |
| 91 | +- [Dylan]: https://github.com/dtfiedler |
| 92 | +- [Atticus]: https://github.com/atticusofsparta |
| 93 | +- [Phil]: https://github.com/vilenarios |
| 94 | + |
| 95 | +## Notes |
| 96 | + |
| 97 | +- Further analysis is required for large ANT states. |
| 98 | + - Records |
| 99 | + - Controllers |
| 100 | +- Consider preemptive PRs for integration updates. |
| 101 | + - for example permaweb deploy |
| 102 | +- Implement observation tools to track stale ANTs in the ANT registry |
| 103 | + - Fastest solution is probably adding a `prune` handler to the ANT registry |
| 104 | + that consumes process IDs and removes them, then use a cron job in gh |
| 105 | + actions to pull the ArNS records and decide which ANT ids to prune |
0 commit comments