catapult-rest icon indicating copy to clipboard operation
catapult-rest copied to clipboard

Allow Integer filtering by block height

Open orisdorch opened this issue 3 years ago • 2 comments

Height is presently only filterable as a string. The ability to filter height as an integer would be more functional.

Sample use cases:

  • Querying the blockchain in ranged batches (i.e. for random audit data samples or batching large queries)
  • Queries limited to blocks greater or less than the prior query's block height (i.e. monitoring for new transactions or harvested blocks since last check, or checking for preceding transactions)
  • Excluding a subset of blocks from query results (i.e. first 1000 blocks from an implementation's stabilization or pilot period)

This would be particularly useful for blockchain monitoring when CLI installation isn't an option or adds unnecessary complexity - i.e. when attempting to integrate with SAAS or cloud based workflow automation platforms (like Microsoft Power Automate).

orisdorch avatar May 19 '21 00:05 orisdorch

Height on-chain is uint64, (long in java), the consideration is when the height reaches the max int32 we then have the problem. In rest, it is using nodejs's native Long type, basic arithmetic can be done, but agree that there are limitations for the current rest gateway.

rg911 avatar May 19 '21 08:05 rg911

Looks like this issue was worked around by adding fromHeight and toHeight to some calls (i.e. http://localhost:3000/statements/transaction - https://docs.symbolplatform.com/symbol-openapi/v1.0.0/#operation/searchReceipts), but not others (i.e. http://localhost:3000/statements/resolutions/address- https://docs.symbolplatform.com/symbol-openapi/v1.0.0/#operation/searchAddressResolutionStatements).

If this is the chosen solution, perhaps we can extend it to all requests that permit the height parameter?

orisdorch avatar May 19 '21 16:05 orisdorch