Skip to content

Commit 950a43c

Browse files
Merge branch 'PE-6474-initial-madr' into PE-6431
2 parents 411cef3 + 9b333a2 commit 950a43c

File tree

5 files changed

+174
-89
lines changed

5 files changed

+174
-89
lines changed

.prettierrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"semi": true,
44
"printWidth": 80,
55
"singleQuote": true,
6-
"trailingComma": "all"
6+
"trailingComma": "all",
7+
"proseWrap": "always"
78
}

docs/madr/1-intial.md

+84-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Asset resolution by way of an ANT Registry
1+
# An event driven ANT registration system in AO to optimize ANT listings by access role
22

33
- Status: accepted
44
- Deciders: [Dylan], [Ariel], [Phil]
@@ -7,7 +7,32 @@
77

88
## Context and Problem Statement
99

10-
Performance of loading a user’s registered name is slow with the current method of loading all of the ArNS ecosystem (all ArNS names and ANTs registered to them). There is no way to quickly identify ownership of an ANT, let alone any AO process.
10+
Listing all ANTs registered to ArNS names and owned by a specific owner or
11+
owners becomes more computationally expensive as more ArNS names are registered.
12+
Additionally, its computationally infeasible to find ANTs not registered to an
13+
ArNS. GraphQL-based approaches cannot currently support either of these
14+
scenarios.
15+
16+
We need to provide owner-based lookups that perform better than O(N).
17+
18+
This is done both on the client side via [AoConnect], or as inter-process
19+
communication (like in the [ArNS Resolver](#arns-resolver)).
20+
21+
### Additional Background
22+
23+
The ArNS AO Process is responsible for recording which ANTs are registered to
24+
each ArNS name. It does not store or track additional information about the
25+
owner of the ANT. This reduces the amount of state managed, providing more
26+
concurrency in the operations in the overall name system's design, (e.g.
27+
individual ANT's activities do not impact performance of the ArNS Process).
28+
29+
The downside of this separation is that listing all the ANTs for any owner is
30+
computationally expensive. You need to retrieve every ArNS record and perform a
31+
lookup of each associated ANT's owner, then filter the resulting owner map by
32+
the owner(s) in question - an O(N) operation where N is the total number of
33+
registered names. An additional downside is that unregistered (from an ArNS
34+
perspective) ANTs that one owns are not discoverable via this expensive
35+
algorithm.
1136

1237
## Decision Drivers
1338

@@ -18,78 +43,111 @@ The main drivers for this decision revolve around:
1843
- **Scalability**
1944
- We cannot load the entire ArNS ecosystem client-side if it grows.
2045
- **Ecosystem Integrations**
21-
- Having this utility process solely for ANT contract indexing provides integration points for other applications and reduces our reliance on other teams/products (e.g., Bazar profile processes).
46+
- Having this utility process solely for ANT contract indexing provides
47+
integration points for other applications and reduces our reliance on other
48+
teams/products (e.g., Bazar profile processes).
2249
- **Maintainability**
2350
- Since we control the registry process, we can drive its maintenance.
2451

2552
## Considered Options
2653

27-
### ANT Registry
54+
### Dedicated ANT Registry Process
55+
56+
An AO Process that allows for permissionless reporting of the existence of ANTs
57+
by their Process ID that is capable of asynchronously, by way of AO messaging,
58+
retrieving, or being notified about, and then caching indexable information
59+
about ANTs, namely their owners and Controllers.
2860

2961
- **Pros:**
3062
- Dedicated registry for ANTs.
3163
- Event-driven updates from ANTs.
32-
- Separate state and compute from the resolver process.
64+
- Separate state and compute from the resolver process, thus preserving system
65+
concurrency while providing for better UX in the system.
66+
- **Can support permissionless registration, thus allowing us to pre-register
67+
every ANT we've previously created during our migration to AO AND allowing
68+
3rd party Processes to create and register ANTs on behalf of users.**
3369
- **Cons:**
3470
- Additional maintenance required.
71+
- Permissionlessness may invite spamming or DOSing
72+
- Gas management requirements since the ANT Registry will have to send
73+
messages to ANT processes
3574

36-
### ArNS Resolver
75+
### Polling-based ArNS Resolver
76+
77+
The ArNS Resolver is an AOS process that acts as an indexer for the entire ArNS
78+
ecosystem - it tracks owner and controller relationship by maintaining a state
79+
of all ANTs registered to ArNS names, thereby allowing efficient lookups of
80+
relational data from a central process.
3781

3882
- **Pros:**
3983
- Capable of resolving records and ANTs.
4084
- **Cons:**
41-
- Does not resolve ANTs that are not registered.
85+
- **Does not resolve ANTs that are not registered.**
4286
- Complexity increases with integration of ANT updates.
87+
- Performs unnecessary work for ANTs that have not changed
88+
- **Potentially shoulders all the gas burden for fetching ANT information**
4389

4490
### Adding Ownership Info to the Network Process
4591

92+
This would entail updates to the Network Process, either to make it so the ANT
93+
associated with an ArNS name can send it a state update (like the pattern the
94+
[ANT Registry](#dedicated-ant-registry-process) implements) on role changes (eg
95+
ANT is transferred or a controller is added to it), or removing said role
96+
changes from happening on the ANT and applying those handlers to the Network
97+
process to allow the owner of the domain to manage those fields directly on the
98+
Network process.
99+
46100
- **Pros:**
47101
- Centralized control.
48102
- **Cons:**
49103
- Increases complexity of the Network process.
50-
- Reduces flexibility of ANT processes.
104+
- **Reduces flexibility of ANT processes.**
105+
- **Massively increases computational load and process memory - i.e. reduction
106+
in system concurrency**
51107

52108
### Bazar Profile Processes and Profile Registry
53109

110+
[Bazar Profiles] are AOS processes that implement asset tracking and account abstraction,
111+
whereby the profile itself owns the assets it is tracking, and the profile is owned
112+
by the user. This allows for event driven portfolio management. The Profile Registry
113+
is a similar organism to the ANT Registry, therein tracking existing profiles that
114+
register themselves to at, allowing for profile discovery by user address.
115+
54116
- **Pros:**
55117
- Promising technology.
56118
- Future integration potential.
57119
- **Cons:**
58-
- Currently in rapid development.
120+
- **Currently in rapid development.**
59121
- Managed by another team.
60122
- Complicates ownership resolution due to account abstraction.
61123

62124
## Decision Outcome
63125

64-
It was decided to use an ANT registry due to the following downsides of other avenues:
65-
66-
#### ArNS Resolver
67-
68-
The ArNS Resolver interacts with the Network contract and is capable of resolving the records as well as the ANTs; however, it does not resolve ANTs that are not registered, only those that are registered. The ANT registry can implement event-driven updates from ANTs while separating the state and compute from the resolver process.
69-
70-
#### Adding Ownership Info to the Network Process
71-
72-
Part of the point of using the ANT processes for ownership control is to keep the state separated from the Network process. Adding this to the Network process would add complexity and reduce the flexibility of ANTs.
73-
74-
#### Bazar Profile Processes and Profile Registry
75-
76-
This tech is promising but still quite young and in rapid development at the time of writing, in the hands of another team making the architectural decisions. The profile process workflow is also an account abstraction, complicating the ownership resolution. With the ANT Registry, we should still be able to integrate with the profile processes in the future (since profile processes are, in fact, the owner of their listed assets).
126+
After weighing the pros and cons, it was decided to use an
127+
[ANT registry](#dedicated-ant-registry-process).
77128

78129
### Positive Consequences
79130

80-
- Asset discovery will be optimized, allowing easy querying for users' assets, specifically ANT processes, which can then be used to retrieve owned domains from the network process.
131+
- Asset discovery will be optimized, allowing easy querying for users' assets,
132+
specifically ANT processes, which can then be used to retrieve owned domains
133+
from the network process.
81134

82135
### Negative Consequences
83136

84-
- Maintenance: It is another process for us to maintain, though it seems necessary.
85-
- Future Redundancy: The problem this is solving may be solved in the future by more ecosystem-wide projects (e.g., Bazar profiles), making this redundant.
137+
- Maintenance: It is another process for us to maintain, though it seems
138+
necessary.
139+
- Future Redundancy: The problem this is solving may be solved in the future by
140+
more ecosystem-wide projects (e.g., Bazar profiles), making this redundant.
86141

87142
## Links
88143

89-
- [Bazar Profiles](https://github.com/permaweb/ao-permaweb/tree/main/services/profiles)
144+
- [Bazar Profiles]
90145

91146
---
92147

148+
[AoConnect]: (https://github.com/permaweb/ao/tree/main/connect)
149+
[Bazar Profiles]:
150+
(https://github.com/permaweb/ao-permaweb/tree/main/services/profiles)
93151
[ADR Template]: (https://adr.github.io/)
94152
[Atticus]: (https://github.com/atticusofsparta)
95153
[Dylan]: (https://github.com/dtfiedler)

docs/madr/2-sqlite.md

+34-25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Using aos-sqlite Module
1+
# Using aos-sqlite to manage data registered in the ANT Registry Process
22

33
- Status: proposed
44
- Deciders: [Dylan], [Ariel], [Phil]
@@ -7,18 +7,28 @@
77

88
## Context and Problem Statement
99

10-
The `aos-sqlite` module is a WebAssembly (Wasm) binary in the Arweave (ao) ecosystem that extends the functionality of the standard `aos` Wasm binary module. The `aos` module includes an `Eval` handler that consumes Lua strings and uses the `load` method of Lua to execute them. The `aos-sqlite` module is compiled with `lua-sqlite3` from C to Wasm, providing additional SQLite functionality. Given that directly using tables has demonstrated scalability issues, the SQLite implementation offers a potential solution. However, due to its novelty in the ecosystem, there are concerns about its stability in larger products. Therefore, using it here for the ANT Registry provides a suitable environment seperate from other products to test its stability.
10+
The `aos-sqlite` module, is a WebAssembly (Wasm) binary in the Arweave (ao)
11+
ecosystem, and extends the standard `aos` Wasm module. The `aos` module includes
12+
an `Eval` handler that executes Lua strings using the `load` method of the
13+
stdlib in Lua. The `aos-sqlite` module, compiled with `lua-sqlite3` from C to
14+
Wasm, adds SQLite functionality.
15+
16+
Directly using Lua tables has shown a need for better tooling in manipulating
17+
and searching data, making the SQLite implementation a potential solution.
18+
However, its novelty raises concerns about reliability in larger products.
1119

1220
## Decision Drivers
1321

1422
The main drivers for this decision are:
1523

1624
- **Scalability**
17-
- The current method of using tables has scalability issues that SQLite can potentially address.
25+
- The current method of using tables has scalability issues that SQLite can
26+
potentially address.
1827
- **Performance**
1928
- Improved performance in handling larger datasets with SQLite.
2029
- **Risk Management**
21-
- Mitigating risks in larger products by testing the module in a controlled environment first.
30+
- Mitigating risks in larger products by testing the module in a controlled
31+
environment first.
2232
- **Ecosystem Integration**
2333
- Exploring new modules and their potential benefits within the ao ecosystem.
2434

@@ -30,51 +40,50 @@ The main drivers for this decision are:
3040
- Known and stable.
3141
- No need for additional testing or integration.
3242
- **Cons:**
33-
- Demonstrated scalability issues.
43+
- Demonstrated scalability issues when attempting to retrieve 150k records in
44+
ANT's.
3445
- Limited performance with larger datasets.
35-
- Lack of strictness on data types
46+
- Lack of strictness on data types.
3647

3748
### Option 2: Use aos-sqlite Module
3849

3950
- **Pros:**
4051
- Addresses scalability issues with direct table usage.
4152
- Potential for improved performance with larger datasets.
4253
- Maintained by core team of AO
54+
- Additional flexibility in the ways we can store and query for data
4355
- **Cons:**
4456
- New and relatively untested in the ecosystem.
4557
- Potential stability issues in larger products.
4658

4759
## Decision Outcome
4860

49-
It was decided to use the `aos-sqlite` module to address scalability issues in a controlled environment. This approach allows us to test its effectiveness and performance before considering wider adoption in larger products.
50-
51-
### Implementation Details
52-
53-
#### aos-sqlite Module
54-
55-
- **Functionality:** Extends the `aos` module with SQLite functionality, compiled with `lua-sqlite3` from C to Wasm.
56-
- **Handler:** Includes an `Eval` handler that consumes Lua strings and executes them using the `load` method of Lua.
57-
58-
#### Testing and Scalability
59-
60-
- **Controlled Environment:** The module will be tested in a controlled environment to assess its scalability and performance.
61-
- **Risk Mitigation:** By testing in a smaller scope, we aim to mitigate the risks associated with its novelty and potential instability in larger products.
61+
It was decided to use the `aos-sqlite` module to address scalability issues in
62+
the controlled environment of the ANT Registry, since it stands apart from other
63+
mission critical products. This approach allows us to test its effectiveness and
64+
performance before considering wider adoption in larger products.
6265

6366
### Positive Consequences
6467

65-
- **Scalability Improvements:** Potential solution to scalability issues with direct table usage.
68+
- **Scalability Improvements:** Potential solution to scalability issues with
69+
direct table usage.
6670
- **Performance Benefits:** Improved performance handling larger datasets.
67-
- **Future Integration:** Provides insights into the module's potential for wider adoption.
71+
- **Future Integration:** Provides insights into the module's potential for
72+
wider adoption.
6873

6974
### Negative Consequences
7075

71-
- **Stability Concerns:** New module with potential stability issues in larger products.
72-
- **Testing Effort:** Requires additional testing and monitoring to ensure reliability.
76+
- **Stability Concerns:** New module with potential stability issues in larger
77+
products.
78+
- **Testing Effort:** Requires additional testing and monitoring to ensure
79+
reliability.
7380

7481
## Implementation Recommendations
7582

76-
- **Testing Framework:** Use a testing framework to evaluate the module's scalability and performance. ( eg with [AoLoader])
77-
- **Monitoring:** Implement monitoring tools like grafana to track the module's performance, stability, and resource usage.
83+
- **Testing Framework:** Use a testing framework to evaluate the module's
84+
scalability and performance. ( eg with [AoLoader])
85+
- **Monitoring:** Implement monitoring tools like grafana to track the module's
86+
performance, stability, and resource usage.
7887

7988
## Links
8089

0 commit comments

Comments
 (0)