Skip to content
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

Query node time format #1378

Closed
bedeho opened this issue Sep 16, 2020 · 3 comments
Closed

Query node time format #1378

bedeho opened this issue Sep 16, 2020 · 3 comments
Assignees
Labels
idea An idea for a new feature in any part of the Joystream query-node

Comments

@bedeho
Copy link
Member

bedeho commented Sep 16, 2020

We want to start preserving query node state across chains, not only before mainnet, but possibly after. The problem with that is if we use block numbers, as we currently do, as the only way to time some event in our data models, then this breaks down across chains. One alternative solution is to just use block header timestamps, this could also simplify conversion to real time in some cases, in particular if block arrival times will end up being very irregular, or even explicitly changed at different points in time. The problem with them is that its hard to identify a specific block with that representation in lots of tools and apps. The most flexible solution could be to introduce some combined representation of block number, timestamp and a network identifier.

@bedeho bedeho added query-node idea An idea for a new feature in any part of the Joystream labels Sep 16, 2020
@bedeho
Copy link
Member Author

bedeho commented Oct 8, 2020

Here is an example implementation

enum Network {
Babylon,
Alexandria,
Rome,
...
}

type Membership @entity {
...
 created_in_block: BigInt!,
 created_at_timestamp: BigInt!,
 created_in_nework: Network!
}

@bedeho
Copy link
Member Author

bedeho commented Oct 8, 2020

Given that lots of different entities will want to re-use this three part description of a moment in time by introducing a new @field type, it would be better if we could do

enum Network {
Babylon,
Alexandria,
Rome,
...
}

type Moment @field {
 block: BigInt!,
 timestamp: BigInt!,
 nework: Network!
}

type Membership @entity {
...
 created_at: Moment!,
}

type MemberFiredEvent @entity {
...
 happened_at: Moment!,
}

@bedeho
Copy link
Member Author

bedeho commented Oct 8, 2020

A last variation that, at least in this particular case can sidestep the need for introducing new @field type

enum Network {
Babylon,
Alexandria,
Rome,
...
}

type Block @entity {
 block: BigInt!,
 timestamp: BigInt!,
 nework: Network!

 /* add lots of reverselookup meta fields here for checking everything that happened in a given block */
}

type Membership @entity {
...
 created_in: Block!,
}

type MemberFiredEvent @entity {
...
 happened_in: Block!,
}

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea An idea for a new feature in any part of the Joystream query-node
Projects
None yet
Development

No branches or pull requests

3 participants