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

[Protocol Versioning] Execution State Parameters in the Dynamic Protocol State #7000

Open
2 tasks
Tracked by #6999
AlexHentschel opened this issue Feb 7, 2025 · 0 comments
Open
2 tasks
Tracked by #6999
Assignees
Labels
Protocol Team: Issues assigned to the Protocol Pillar.

Comments

@AlexHentschel
Copy link
Member

AlexHentschel commented Feb 7, 2025

This is part of Epic #6999

Description

The goal of this issue is to in extend the Protocol State's data model to include the Execution Parameters outlined in
Execution State Parameters in the Dynamic Protocol State

ExecutionMeteringParameters Updatable[ExecutionMeteringParameters]
ExecutionComponentVersion   Updatable[MagnitudeOfChangeVersion]
CadenceComponentVersion     Updatable[MagnitudeOfChangeVersion]

(this is a flat representation of the protocol parameters described in Execution State Parameters in the Dynamic Protocol State, which Janez was fine with)

Note that the description in Execution State Parameters in the Dynamic Protocol State is simplified. Specifically, Janez wants that the protocol state reports the current version (described in the notion doc) but also the ability to schedule a future version change (not described in Janez' notion doc, because he isn't familiar with how that should be implemented). I think it would be necessary to track the current version and additionally include a ViewBasedActivator for scheduling future changes of the "current version".

type ExecutionMeteringParameters struct {
	ExecutionEffortParameters map[uint]uint64
	ExecutionMemoryParameters map[uint]uint64
	ExecutionMemoryLimit uint64
}

// MagnitudeOfChangeVersion is intended as an intuitive representation of the “magnitude of change”.
// 
// CAUTION: this versioning representation DEVIATES from established Semantic Versioning. Any two
// different versions of the Execution Stack are considered incompatible. In particular, two versions only
// differing in their minor, might be entirely downwards-INCOMPATIBLE. 
// We generally recommend to use Integer Versioning. The MagnitudeOfChangeVersion scheme should
// be only used when there is a clear advantage Integer Versioning which outweighs the risk of falsely 
// making compatibility assumptions by confusing this scheme with Semantic Versioning!
//
// MagnitudeOfChangeVersion helps with an intuitive representation of the “magnitude of change”. 
// For example, for the execution stack, bug fixes closing unexploited edge-cases will be a relatively
// frequent cause of upgrades. Those bug fixes could be reflected by minor version bumps, whose
// imperfect downwards compatibility might frequently suffice to warrant Access Nodes using the same
// version (higher minor) across version boundaries. In comparison, major version change would generally
// indicate broader non-compatibility (or larger feature additions) where it is very unlikely that the Access
// Node can use one implementation for versions with different major. 
// We emphasize again that this differentiation of “imperfect but good-enough downwards compatibility”
// is in no way reflected by the versioning scheme. Any automated decisions of compatibility for different
// versions are to be avoided (including versions where only the minor is different). 
// Engineering teams using this scheme must be aware that the MagnitudeOfChangeVersion is easily
// misleading wrt to incorrect assumptions about downwards compatibility. Avoiding problems (up to and
// including the possibility of mainnet outages) requires continued awareness of all engineers in the
// teams working with this version. The engineers in those teams must commit to diligently documenting
// all relevant changes, details regarding magnitude of changes and if applicable “imperfect but 
// good-enough downwards compatibility”. 
type MagnitudeOfChangeVersion struct {
	Major uint
	Minor uint
}

// Updatable represents some protocol parameters, which _always_ have a current value.
// Optionally, updates may be scheduled to overwrite the current value when reaching
// or exceeding a specified view.
type Updatable[T any] struct {
	// CurrentValue is the value that is active after constructing the block
	// that this Protocol State pertains to.
	CurrentValue T

	// Update is optional and is nil, if no value update has been scheduled yet.
	// This field will hold the last scheduled update until a newer update
	// directive is received, even if the value update has already happened.
	// The update should be applied when reaching or exceeding the ActivationView.
	Update *ViewBasedActivator[T]
}

There is a detailed documentation of the reasons for using the $\textnormal{\texttt{major.minor}}$ versioning convention given in the Execution State Parameters in the Dynamic Protocol State, section Decision on using versioning major.minor.

Definition of Done

  • Protocol State's data model extended to include the parameters above
  • API methods in KVStoreReader to query the current values and the Value Update (if one has been scheduled)

Service events to update the values and the state machine logic for actually applying or rejecting a request for scheduling an update are not part of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Protocol Team: Issues assigned to the Protocol Pillar.
Projects
None yet
Development

No branches or pull requests

2 participants