AmbireTech / adex-validator

AdEx validator stack reference implementation: sentry, validator worker
https://www.adex.network
GNU Affero General Public License v3.0
8 stars 11 forks source link

API docs for channel list inconsistency #154

Closed elpiel closed 5 years ago

elpiel commented 5 years ago

@Ivshti @samparsky I saw that the docs/api.md have inconsistency with the code https://github.com/AdExNetwork/adex-validator-stack-js/blob/master/routes/channel.js#L64.

I would like to know which is relevant and which is not, so we can update it, but also include it in the Rust implementation.

Also I would like to know how should we order the channels for the list, because as I see we have the validUntil & created, but I don't see that we order them in any way at the moment, so I guess it's by order of insertion (aka created but indirectly)

campaign spec Also if the Specs can change, what should be a valid way of representing it if we are in a Database like postgres? And last but not least we use timestamp for all the DateTime fields, but this can be altered to a DateTime representation or not? + There are some recommendations for withdrawPeriodStart, are they recommendations only or we need to implement them as Domain rules, i.e. don't allow somebody to even create the spec if it's in the past (a sane value should be lower than channel.validUntil * 1000 and higher than created)?

Ivshti commented 5 years ago

Re order: it’s created, but again, not mentioned in the docs

Re spec shape: I think domain rules is over engineering in that case; how about storing it as a JSON blob and deserializing via serde? Postgre also has some handy functionality to query/index data inside JSON blobs and using serde-json to parse the data within the Sentry has numerous advantages such as guaranteed consistency with other code, flexibility and having to write less serialization/deserialization code