-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
priority: criticalDrop everything - blocks releaseDrop everything - blocks releaserepo: interxstatus: in-progressActively being worked onActively being worked ontype: bugSomething is brokenSomething is broken
Description
Bug Description
The /api/transactions endpoint has several query parameters defined in QueryTxsParams struct that are either not implemented or have bugs:
address- Not implemented (parsed but ignored)directions- Not implementedend_date- Uses wrong variable (copy-paste bug)
Location
manager/gateway/cosmos_agregated3.go:352-444manager/types/cosmos.go:176-187
1. Address Filter Not Implemented
The address field is defined in the struct but never used in the query criteria.
Struct definition (types/cosmos.go:179):
type QueryTxsParams struct {
Address string `json:"address,omitempty"`
// ...
}Problem: No code adds address to the MongoDB query criteria.
Reproduction:
# Request with valid address
curl -s -X POST "http://<INTERX_HOST>:11000/api/transactions" \
-H "Content-Type: application/json" \
-d '{"address": "kira143q8vxpvuykt9pq50e6hng9s38vmy844n8k9wx"}' \
| jq '.transactions | length'Output: 3
# Request with non-existent address (should return 0)
curl -s -X POST "http://<INTERX_HOST>:11000/api/transactions" \
-H "Content-Type: application/json" \
-d '{"address": "kira1nonexistentaddress123456789"}' \
| jq '.transactions | length'Output: 3
Expected: 0
2. Directions Filter Not Implemented
The directions field is defined but never used.
Struct definition (types/cosmos.go:182):
Directions []string `json:"directions,omitempty"`Problem: No code processes or applies this filter.
3. EndDate Filter Uses Wrong Variable
Location: cosmos_agregated3.go:407-413
if request.EndDate > 0 {
criteria["timestamp"] = map[string]interface{}{
"$lt": request.StartDate, // BUG: should be request.EndDate
}
}Problem: Copy-paste error - uses request.StartDate instead of request.EndDate.
4. Date Filters Overwrite Each Other
If both start_date and end_date are provided, the second criteria overwrites the first:
// Line 399-405
if request.StartDate > 0 {
criteria["timestamp"] = map[string]interface{}{
"$gt": request.StartDate,
}
}
// Line 407-413 - OVERWRITES the above!
if request.EndDate > 0 {
criteria["timestamp"] = map[string]interface{}{
"$lt": request.StartDate,
}
}Should combine into single query:
if request.StartDate > 0 || request.EndDate > 0 {
timestampCriteria := map[string]interface{}{}
if request.StartDate > 0 {
timestampCriteria["$gt"] = request.StartDate
}
if request.EndDate > 0 {
timestampCriteria["$lt"] = request.EndDate
}
criteria["timestamp"] = timestampCriteria
}Summary of Required Fixes
| Parameter | Issue | Fix Required |
|---|---|---|
address |
Not implemented | Add address filtering logic |
directions |
Not implemented | Add directions filtering logic |
end_date |
Wrong variable | Change StartDate → EndDate at line 409 |
start_date + end_date |
Overwrite each other | Combine into single timestamp criteria |
Related
Closes #34
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: criticalDrop everything - blocks releaseDrop everything - blocks releaserepo: interxstatus: in-progressActively being worked onActively being worked ontype: bugSomething is brokenSomething is broken