-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Off-Chain] ModuleParamsClient & Historical Params #543
Open
4 tasks
bryanchriswhite opened this issue
May 21, 2024
· 0 comments
· Fixed by #993 · 4 remaining pull requests
Open
4 tasks
[Off-Chain] ModuleParamsClient & Historical Params #543
bryanchriswhite opened this issue
May 21, 2024
· 0 comments
· Fixed by #993 · 4 remaining pull requests
Comments
14 tasks
7 tasks
9 tasks
Olshansk
modified the milestones:
Shannon Beta TestNet Launch,
Shannon Beta TestNet Support
Dec 3, 2024
This was referenced Dec 5, 2024
This was
linked to
pull requests
Dec 11, 2024
This was
linked to
pull requests
Dec 11, 2024
15 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Objective
Enable support for off-chain processes to cache on-chain parameters and react to parameter updates asynchronously.
Origin Document
Off-chain actors currently query the network much too frequently.
Observations made while working on [Protocol] Add a
NumBlocksPerSession
governance parameter #517. In order for off-chain processes to use the correct governance params in the appropriate places in the protocol, they MUST be aware of the most recent param values. In some cases, off-chain processes MUST also know the historical values of some params.Assumptions
Example
A param update message is committed in the middle of a session, modifying
num_blocks_per_session
&min_relay_difficulty_bits
by the time a proof is submitted & validated on-chain. Thenum_blocks_per_session
andmin_relay_difficulty_bits
at the time of the session to which the proof corresponds (i.e. will not be the current session) MUST be used. There may also be off-chain use cases (presently or in the future) which require previous values for params.Goals
ModuleParamsClient
(see: notion -ModuleParamsClient
)Design Choices
On-chain persistence of historical params
When a param update message is committed:
The corresponding on-chain params value(s) are updated on commit.
The previous param value(s), the current session number, & the height at which the param update message is committed are stored in the on-chain state. There are a couple of options for how to persist historical params that effect what their usage would look like:
History: map[updateHeight]Params{}
i. When an off-chain client queries for params, the response includes the current param values, as well as previous values, the last session number that each previous was set, and the height at which each previous value was updated (no longer valid after). An additional parameter would be introduced to determine the "retention block count" for (each or all?) param(s).
Pros
Cons
ii. An off-chain client could query would make distinct queries whether querying for current params or historical params. Historical param queries would take a height argument & MAY return an error if the requested height is older than the "retention block count"
Pros
params
module) to consolidate common behavior across modules.Cons
Another degree of freedom is open regarding whether or not to add methods for querying param values a specific height, and if so, whether those methods should be on-chain, off-chain, or both.
Keeper#Params()
&QueryParamsRequest
)Params
go protobuf struct itself)ModuleParamsClient
Use the respective module's
QueryClient
to query for the params initially, followed by subscribing to block events via aBlockClient
(or itsEventsReplayClient
deconstruction used withblock.UnmarshalNewBlockEvent()
) such that updated params may be emitted by an observable & a cache is accumulated over time. Params at height which are not in this cache MUST be queried for on-chain.Pros:
Cons:
block.CometNewBlockEvent
s (see: session_steps_test.go:131).Use a
BlockClient
& the respective module'sQueryClient
to query for the params at the start height of each session.Pros:
Cons:
Deliverables
Non-goals / Non-deliverables
General deliverables
Creator: @bryanchriswhite
The text was updated successfully, but these errors were encountered: