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

Get execution version from snapshot instead of state #6867

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

janezpodhostnik
Copy link
Contributor

No description provided.

@janezpodhostnik janezpodhostnik self-assigned this Jan 10, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 38.79781% with 112 lines in your changes missing coverage. Please review.

Project coverage is 41.16%. Comparing base (72adf9e) to head (33bde51).
Report is 34 commits behind head on master.

Files with missing lines Patch % Lines
fvm/environment/mock/get_version_beacon_func.go 0.00% 28 Missing ⚠️
fvm/environment/mock/execution_version_provider.go 0.00% 27 Missing ⚠️
fvm/mock/protocol_state_snapshot_provider.go 0.00% 19 Missing ⚠️
fvm/context.go 26.31% 14 Missing ⚠️
fvm/environment/minimum_required_version.go 66.66% 6 Missing and 3 partials ⚠️
engine/execution/testutil/fixtures.go 71.42% 4 Missing and 2 partials ⚠️
fvm/errors/execution.go 0.00% 5 Missing ⚠️
cmd/access/node_builder/access_node_builder.go 0.00% 1 Missing ⚠️
cmd/execution_builder.go 0.00% 1 Missing ⚠️
cmd/observer/node_builder/observer_builder.go 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6867      +/-   ##
==========================================
- Coverage   41.18%   41.16%   -0.02%     
==========================================
  Files        2109     2111       +2     
  Lines      185660   185681      +21     
==========================================
- Hits        76460    76438      -22     
- Misses     102788   102832      +44     
+ Partials     6412     6411       -1     
Flag Coverage Δ
unittests 41.16% <38.79%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@janezpodhostnik janezpodhostnik force-pushed the janez/execution-version-from-snapshot branch 3 times, most recently from fa1e7df to 168376a Compare January 10, 2025 20:34
@janezpodhostnik janezpodhostnik force-pushed the janez/execution-version-from-snapshot branch from 168376a to 33bde51 Compare January 10, 2025 20:42
)

// protocolStateWrapper implements `EntropyProviderPerBlock`
var _ fvm.ProtocolStateSnapshotProvider = protocolStateWrapper{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var _ fvm.ProtocolStateSnapshotProvider = protocolStateWrapper{}
var _ fvm.ProtocolStateSnapshotProvider = (*protocolStateWrapper)(nil)


// SnapshotSubset is a subset of the protocol state snapshot that is needed by the FVM
// for execution.
type SnapshotSubset interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we define it in state/protocol/snapshot.go? And maybe embed into Snapshot interface?

return func(ctx Context) Context {
ctx.ReadVersionFromNodeVersionBeacon = enabled
// `protocol.Snapshot` implements `EntropyProvider` interface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// `protocol.Snapshot` implements `EntropyProvider` interface
// `protocol.SnapshotSubset` implements `EntropyProvider` interface

// However, at this stage, snapshot reference block should be known and the QC should also be known,
// so no error is expected in normal operations, as required by `EntropyProvider`.
fvm.WithEntropyProvider(e.protocolState.AtBlockID(blockId)),
fvm.WithProtocolStateSnapshot(e.protocolState.AtBlockID(blockHeader.ID())),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fvm.WithProtocolStateSnapshot(e.protocolState.AtBlockID(blockHeader.ID())),
fvm.WithProtocolStateSnapshot(e.protocolState.AtBlockID(blockID)),

// However, at this stage, snapshot reference block should be known and the QC should also be known,
// so no error is expected in normal operations, as required by `EntropyProvider`.
fvm.WithEntropyProvider(e.protocolState.AtBlockID(blockId)),
fvm.WithProtocolStateSnapshot(e.protocolState.AtBlockID(blockHeader.ID())),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fvm.WithProtocolStateSnapshot(e.protocolState.AtBlockID(blockHeader.ID())),
fvm.WithProtocolStateSnapshot(e.protocolState.AtBlockID(blockID)),

@@ -216,15 +211,6 @@ func (computer ExecutionParametersComputer) getExecutionParameters() (
return overrides, err
}

executionVersion, err := GetMinimumRequiredExecutionVersion(computer.log, computer.ctx, env)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, this is the key change to remove the dependency on the execution state in order to prevent program cache to invalidated, right?

I wonder why program cache would be invalidated if the operation is a read (reading the minimum required execution version), instead of a write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants