-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Messages] Reception and confirmation times #267
Conversation
Depends on #265. |
9b8e5b8
to
141b617
Compare
141b617
to
f5313c0
Compare
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed. Co-authored-by: Mike Hukiewitz <70762838+MHHukiewitz@users.noreply.github.com>
Problem: if an invalid message somehow managed to reach the pending message collection, the message would be retried indefinitely logging exceptions on each run. Solution: drop invalid messages.
Problem: some dependencies were missing from the requirements, and letting pip sort it out led to dependency conflicts. Solution: add the dependencies to setup.cfg.
Some variable assignments were useless.
Problem: the "/api/v0/posts.json" endpoint returns a 500 error because of an invalid parameter being used in a function (an attempt to remove the MongoDB object ID from the endpoint). Solution: remove the object ID directly in the aggregate query. Added a simple test to verify that the endpoint is at least working a little bit.
Problem: the /api/v0/aggregates/{address}.json endpoint was not tested enough. Solution: add tests.
Use a Pydantic model instead of manual validation.
We now store the entire context of the transaction in the confirmations array of messages. This means that two additional fields are now preserved: the transaction block timestamp and the publisher. As we need to re-fetch this data from chain data, a new migration script resets the chain height to re-process all transactions. We reset the confirmation status of all messages to unconfirmed and deleted their confirmations array to let the node automatically migrate to the new format. Renamed some fields of the `TxContext` class in order to use the same format in all DB collections and to avoid a breaking change in the messages confirmation format.
Added two new fields to the messages collection. We now store the initial time of reception of a message in the `reception_time` field, and the earliest on-chain confirmation time in the `confirmation_time` field. These fields will be used to order messages more precisely/securely and to compute metrics, for example the propagation time of a message on the network. The `time` field of messages is now deprecated, as it is defined by users and not signed. If you need the user time, use `content.time`.
f5313c0
to
d70793f
Compare
try: | ||
updates[k].update(v) | ||
except KeyError: | ||
updates[k] = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is just merging dictionaries ?
updates.update(confirmation_updates)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's merging two dicts of dicts. Could be written a bit cleaner, maybe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Yes, there should be a cleaner way. Else at least a dedicated testable function to do just that.
d9f920c
to
3d016e0
Compare
Integrated in work on Postgres. |
Added two new fields to the messages collection. We now store
the initial time of reception of a message in the
reception_time
field, and the earliest on-chain confirmation time in
the
confirmation_time
field.These fields will be used to order messages more precisely/securely
and to compute metrics, for example the propagation time of a message
on the network.
The
time
field of messages is now deprecated, as it is definedby users and not signed. If you need the user time, use
content.time
.