OpenAPI TxOutItem struct leaves out Aggregator information
Full context:
!3515 (comment 1865836645)
In particular:
https://gitlab.com/thorchain/thornode/-/blob/v1.130.0/x/thorchain/querier.go
https://gitlab.com/thorchain/thornode/-/blob/v1.130.0/x/thorchain/types/querier.go
In V130 (before the nearly-full querier switchover to OpenAPI structs in V131),
type QueryTxOutItem
was used exclusively in the queryScheduledOutbound
and queryPendingOutbound
endpoints.
This had the effect of hiding Aggregator information in the outbound queues, which I currently view to be undesirable,
particularly in the context of seeing whether a (stuck for instance) item in the queue has had its Aggregator fields dropped on reschedule
(which may not happen if needsNewVault
correctly or incorrectly returns false
).
https://gitlab.com/thorchain/thornode/-/blob/v1.131.0/x/thorchain/manager_slasher_current.go#L452-457
toi.Aggregator = ""
toi.AggregatorTargetAsset = ""
toi.AggregatorTargetLimit = nil
voter.Actions[i].Aggregator = ""
voter.Actions[i].AggregatorTargetAsset = ""
voter.Actions[i].AggregatorTargetLimit = nil
Before the querier switchover the Aggregator fields could still be viewed in an ObservedTxInVoter's Actions slice,
which I believe used the THORNode TxOutItem struct in conflict with the Swagger documentation,
but now that too uses the OpenAPI specifications which leave out all the Aggregator information.
(Initial proposal in collapsible section)
I thus currently propose that
(to allow TxOutItem information to be fully viewable in querier endpoints)
assertJSONStructTagsMatch(c, types.TxOutItem{}, gen.TxOutItem{})
be added to openapi_test.go
,
that the OpenAPI TxOutItem schema be updated to include the Aggregator fields,
and that castTxOutItem
(currently necessary to satisfy OpenAPI structs' pointer format) similarly be updated for the Aggregator fields.
The struct tags test without other changes:
32203892
FAIL: <autogenerated>:1: Test.TestJSONSpec
openapi_test.go:65:
c.Assert(specType.NumField(), Equals, thorType.NumField(), comment)
... obtained int = 11
... expected int = 14
... thorType=TxOutItem; specType=TxOutItem
OOPS: 0 passed, 1 FAILED
--- FAIL: TestPackage (0.00s)
Update: After looking closer, I note that the useful Height field in the querier
(reflecting the height from which the scheduled TxOut was gotten)
is something not (yet) present in the THORNode TxOutItem itself,
thus the structs cannot be equal until that is included.
In that case, my initial proposal is modified to only add the Aggregator fields to the OpenAPI TxOutItem struct
(to allow TxOutItem Aggregator information to be fully viewable in querier endpoints)
while perhaps leaving a TODO:
comment in the openapi_test.go
file.
Specifically: !3518
'Add Aggregator fields to OpenAPI TxOutItem schema'.