Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ Ledger uses independent state machines that can rebuild from blockchain events,
- Race detection enabled for concurrent code validation
- Benchmark tests for performance-critical paths

### Paginated Resource Lookups (`ledger/acctupdates.go`)
The `lookupAssetResources`, `lookupApplicationResources`, and `lookupBoxResources` functions follow the same pattern: walk in-memory deltas backwards, query the DB, then merge the two result sets. These functions must stay closely aligned — a bug fix or structural change in one almost certainly requires the same change in the others. They are candidates for future consolidation into shared generic logic.

Their corresponding `Ledger`-level wrappers in `ledger/ledger.go` (`LookupAssets`, `LookupApplications`, `LookupBoxes`) must each hold `trackerMu.RLock()`, matching every other method that accesses tracker state.

### Code Organization
- Interface-first design for testability and modularity
- Dependency injection for component assembly
Expand Down
4 changes: 2 additions & 2 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
"/v2/accounts/{address}/assets": {
"get": {
"description": "Lookup an account's asset holdings.",
"tags": ["public", "experimental"],
"tags": ["public", "nonparticipating"],
"produces": ["application/json"],
"schemes": ["http"],
"summary": "Get a list of assets held by an account, inclusive of asset params.",
Expand Down Expand Up @@ -329,7 +329,7 @@
"/v2/accounts/{address}/applications": {
"get": {
"description": "Lookup an account's application holdings (local state and params if the account is the creator).",
"tags": ["public", "experimental"],
"tags": ["public", "nonparticipating"],
"produces": ["application/json"],
"schemes": ["http"],
"summary": "Get a list of applications held by an account.",
Expand Down
4 changes: 2 additions & 2 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3411,7 +3411,7 @@
"summary": "Get a list of applications held by an account.",
"tags": [
"public",
"experimental"
"nonparticipating"
]
}
},
Expand Down Expand Up @@ -3667,7 +3667,7 @@
"summary": "Get a list of assets held by an account, inclusive of asset params.",
"tags": [
"public",
"experimental"
"nonparticipating"
]
}
},
Expand Down
548 changes: 227 additions & 321 deletions daemon/algod/api/server/v2/generated/experimental/routes.go

Large diffs are not rendered by default.

675 changes: 382 additions & 293 deletions daemon/algod/api/server/v2/generated/nonparticipating/public/routes.go

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions daemon/algod/api/server/v2/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,10 +1190,6 @@ func (v2 *Handlers) RawTransactionAsync(ctx echo.Context) error {
// AccountAssetsInformation looks up an account's asset holdings.
// (GET /v2/accounts/{address}/assets)
func (v2 *Handlers) AccountAssetsInformation(ctx echo.Context, address basics.Address, params model.AccountAssetsInformationParams) error {
if !v2.Node.Config().EnableExperimentalAPI {
return ctx.String(http.StatusNotFound, "/v2/accounts/{address}/assets was not enabled in the configuration file by setting the EnableExperimentalAPI to true")
}

var assetGreaterThan uint64 = 0
if params.Next != nil {
agt, err0 := strconv.ParseUint(*params.Next, 10, 64)
Expand Down Expand Up @@ -1274,10 +1270,6 @@ func (v2 *Handlers) AccountAssetsInformation(ctx echo.Context, address basics.Ad

// AccountApplicationsInformation returns application resources for a specific address.
func (v2 *Handlers) AccountApplicationsInformation(ctx echo.Context, address basics.Address, params model.AccountApplicationsInformationParams) error {
if !v2.Node.Config().EnableExperimentalAPI {
return ctx.String(http.StatusNotFound, "/v2/accounts/{address}/applications was not enabled in the configuration file by setting the EnableExperimentalAPI to true")
}

var appGreaterThan uint64 = 0
if params.Next != nil {
agt, err0 := strconv.ParseUint(*params.Next, 10, 64)
Expand Down
1 change: 0 additions & 1 deletion daemon/algod/api/server/v2/test/handlers_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ func setupTestForLargeResources(t *testing.T, acctSize, maxResults int, accountM

mockNode := makeMockNode(&ml, t.Name(), nil, cannedStatusReportGolden, false)
mockNode.config.MaxAPIResourcesPerAccount = uint64(maxResults)
mockNode.config.EnableExperimentalAPI = true
dummyShutdownChan := make(chan struct{})
handlers = v2.Handlers{
Node: mockNode,
Expand Down
Loading
Loading