-
Notifications
You must be signed in to change notification settings - Fork 199
add operator config for execution result query Criteria #8048
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
Open
mts1715
wants to merge
3
commits into
onflow:feature/optimistic-sync
Choose a base branch
from
mts1715:taras/7879-add-operator-config-result-query-criteria
base: feature/optimistic-sync
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,48 +147,50 @@ import ( | |
// For a node running as a standalone process, the config fields will be populated from the command line params, | ||
// while for a node running as a library, the config fields are expected to be initialized by the caller. | ||
type AccessNodeConfig struct { | ||
supportsObserver bool // True if this is an Access node that supports observers and consensus follower engines | ||
pingEnabled bool | ||
nodeInfoFile string | ||
apiRatelimits map[string]int | ||
apiBurstlimits map[string]int | ||
rpcConf rpc.Config | ||
stateStreamConf statestreambackend.Config | ||
stateStreamFilterConf map[string]int | ||
ExecutionNodeAddress string // deprecated | ||
HistoricalAccessRPCs []access.AccessAPIClient | ||
logTxTimeToFinalized bool | ||
logTxTimeToExecuted bool | ||
logTxTimeToFinalizedExecuted bool | ||
logTxTimeToSealed bool | ||
retryEnabled bool | ||
rpcMetricsEnabled bool | ||
executionDataSyncEnabled bool | ||
publicNetworkExecutionDataEnabled bool | ||
executionDataDBMode string | ||
executionDataPrunerHeightRangeTarget uint64 | ||
executionDataPrunerThreshold uint64 | ||
executionDataPruningInterval time.Duration | ||
executionDataDir string | ||
executionDataStartHeight uint64 | ||
executionDataConfig edrequester.ExecutionDataConfig | ||
PublicNetworkConfig PublicNetworkConfig | ||
TxResultCacheSize uint | ||
executionDataIndexingEnabled bool | ||
registersDBPath string | ||
checkpointFile string | ||
scriptExecutorConfig query.QueryConfig | ||
scriptExecMinBlock uint64 | ||
scriptExecMaxBlock uint64 | ||
registerCacheType string | ||
registerCacheSize uint | ||
programCacheSize uint | ||
checkPayerBalanceMode string | ||
versionControlEnabled bool | ||
storeTxResultErrorMessages bool | ||
stopControlEnabled bool | ||
registerDBPruneThreshold uint64 | ||
scheduledCallbacksEnabled bool | ||
supportsObserver bool // True if this is an Access node that supports observers and consensus follower engines | ||
pingEnabled bool | ||
nodeInfoFile string | ||
apiRatelimits map[string]int | ||
apiBurstlimits map[string]int | ||
rpcConf rpc.Config | ||
stateStreamConf statestreambackend.Config | ||
stateStreamFilterConf map[string]int | ||
ExecutionNodeAddress string // deprecated | ||
HistoricalAccessRPCs []access.AccessAPIClient | ||
logTxTimeToFinalized bool | ||
logTxTimeToExecuted bool | ||
logTxTimeToFinalizedExecuted bool | ||
logTxTimeToSealed bool | ||
retryEnabled bool | ||
rpcMetricsEnabled bool | ||
executionDataSyncEnabled bool | ||
publicNetworkExecutionDataEnabled bool | ||
executionDataDBMode string | ||
executionDataPrunerHeightRangeTarget uint64 | ||
executionDataPrunerThreshold uint64 | ||
executionDataPruningInterval time.Duration | ||
executionDataDir string | ||
executionDataStartHeight uint64 | ||
executionDataConfig edrequester.ExecutionDataConfig | ||
PublicNetworkConfig PublicNetworkConfig | ||
TxResultCacheSize uint | ||
executionDataIndexingEnabled bool | ||
registersDBPath string | ||
checkpointFile string | ||
scriptExecutorConfig query.QueryConfig | ||
scriptExecMinBlock uint64 | ||
scriptExecMaxBlock uint64 | ||
registerCacheType string | ||
registerCacheSize uint | ||
programCacheSize uint | ||
checkPayerBalanceMode string | ||
versionControlEnabled bool | ||
storeTxResultErrorMessages bool | ||
stopControlEnabled bool | ||
registerDBPruneThreshold uint64 | ||
scheduledCallbacksEnabled bool | ||
executionResultAgreeingExecutorsCount uint | ||
executionResultRequiredExecutors []string | ||
} | ||
|
||
type PublicNetworkConfig struct { | ||
|
@@ -280,25 +282,27 @@ func DefaultAccessNodeConfig() *AccessNodeConfig { | |
RetryDelay: edrequester.DefaultRetryDelay, | ||
MaxRetryDelay: edrequester.DefaultMaxRetryDelay, | ||
}, | ||
executionDataIndexingEnabled: false, | ||
executionDataDBMode: execution_data.ExecutionDataDBModePebble.String(), | ||
executionDataPrunerHeightRangeTarget: 0, | ||
executionDataPrunerThreshold: pruner.DefaultThreshold, | ||
executionDataPruningInterval: pruner.DefaultPruningInterval, | ||
registersDBPath: filepath.Join(homedir, ".flow", "execution_state"), | ||
checkpointFile: cmd.NotSet, | ||
scriptExecutorConfig: query.NewDefaultConfig(), | ||
scriptExecMinBlock: 0, | ||
scriptExecMaxBlock: math.MaxUint64, | ||
registerCacheType: pstorage.CacheTypeTwoQueue.String(), | ||
registerCacheSize: 0, | ||
programCacheSize: 0, | ||
checkPayerBalanceMode: txvalidator.Disabled.String(), | ||
versionControlEnabled: true, | ||
storeTxResultErrorMessages: false, | ||
stopControlEnabled: false, | ||
registerDBPruneThreshold: 0, | ||
scheduledCallbacksEnabled: fvm.DefaultScheduledCallbacksEnabled, | ||
executionDataIndexingEnabled: false, | ||
executionDataDBMode: execution_data.ExecutionDataDBModePebble.String(), | ||
executionDataPrunerHeightRangeTarget: 0, | ||
executionDataPrunerThreshold: pruner.DefaultThreshold, | ||
executionDataPruningInterval: pruner.DefaultPruningInterval, | ||
registersDBPath: filepath.Join(homedir, ".flow", "execution_state"), | ||
checkpointFile: cmd.NotSet, | ||
scriptExecutorConfig: query.NewDefaultConfig(), | ||
scriptExecMinBlock: 0, | ||
scriptExecMaxBlock: math.MaxUint64, | ||
registerCacheType: pstorage.CacheTypeTwoQueue.String(), | ||
registerCacheSize: 0, | ||
programCacheSize: 0, | ||
checkPayerBalanceMode: txvalidator.Disabled.String(), | ||
versionControlEnabled: true, | ||
storeTxResultErrorMessages: false, | ||
stopControlEnabled: false, | ||
registerDBPruneThreshold: 0, | ||
scheduledCallbacksEnabled: fvm.DefaultScheduledCallbacksEnabled, | ||
executionResultAgreeingExecutorsCount: optimistic_sync.DefaultCriteria.AgreeingExecutorsCount, | ||
executionResultRequiredExecutors: optimistic_sync.DefaultCriteria.RequiredExecutors.Strings(), | ||
} | ||
} | ||
|
||
|
@@ -1436,6 +1440,14 @@ func (builder *FlowAccessNodeBuilder) extraFlags() { | |
"store-tx-result-error-messages", | ||
defaultConfig.storeTxResultErrorMessages, | ||
"whether to enable storing transaction error messages into the db") | ||
flags.UintVar(&builder.executionResultAgreeingExecutorsCount, | ||
"execution-result-agreeing-executors-count", | ||
defaultConfig.executionResultAgreeingExecutorsCount, | ||
"minimum number of execution receipts with the same result required for execution result queries") | ||
flags.StringSliceVar(&builder.executionResultRequiredExecutors, | ||
"execution-result-required-executors", | ||
defaultConfig.executionResultRequiredExecutors, | ||
"comma separated list of execution node IDs, one of which must have produced the execution result") | ||
// Script Execution | ||
flags.StringVar(&builder.rpcConf.BackendConfig.ScriptExecutionMode, | ||
"script-execution-mode", | ||
|
@@ -1603,6 +1615,9 @@ func (builder *FlowAccessNodeBuilder) extraFlags() { | |
if builder.rpcConf.BackendConfig.ExecutionConfig.MaxResponseMsgSize <= 0 { | ||
return errors.New("rpc-max-execution-response-message-size must be greater than 0") | ||
} | ||
if builder.executionResultAgreeingExecutorsCount <= 0 { | ||
return errors.New("execution-result-agreeing-executors-count must be greater than 0") | ||
} | ||
|
||
return nil | ||
}) | ||
|
@@ -2087,12 +2102,21 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | |
|
||
preferredENIdentifiers, err := flow.IdentifierListFromHex(backendConfig.PreferredExecutionNodeIDs) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to convert node id string to Flow Identifier for preferred EN map: %w", err) | ||
return nil, fmt.Errorf("failed to convert node id string to Flow Identifier for preferred EN list: %w", err) | ||
} | ||
|
||
fixedENIdentifiers, err := flow.IdentifierListFromHex(backendConfig.FixedExecutionNodeIDs) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to convert node id string to Flow Identifier for fixed EN map: %w", err) | ||
return nil, fmt.Errorf("failed to convert node id string to Flow Identifier for fixed EN list: %w", err) | ||
} | ||
|
||
requiredENIdentifiers, err := flow.IdentifierListFromHex(builder.executionResultRequiredExecutors) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to convert node id string to Flow Identifier for required EN list: %w", err) | ||
} | ||
operatorCriteria := optimistic_sync.Criteria{ | ||
AgreeingExecutorsCount: builder.executionResultAgreeingExecutorsCount, | ||
RequiredExecutors: requiredENIdentifiers, | ||
} | ||
|
||
builder.ExecNodeIdentitiesProvider = commonrpc.NewExecutionNodeIdentitiesProvider( | ||
|
@@ -2123,7 +2147,7 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | |
node.State, | ||
node.Storage.Receipts, | ||
execNodeSelector, | ||
optimistic_sync.DefaultCriteria, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
operatorCriteria, | ||
) | ||
|
||
// TODO: use real objects instead of mocks once they're implemented | ||
|
@@ -2179,7 +2203,6 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { | |
TxErrorMessageProvider: notNil(builder.txResultErrorMessageProvider), | ||
ExecutionResultInfoProvider: execResultInfoProvider, | ||
ExecutionStateCache: execStateCache, | ||
OperatorCriteria: optimistic_sync.DefaultCriteria, | ||
MaxScriptAndArgumentSize: config.BackendConfig.AccessConfig.MaxRequestMsgSize, | ||
ScheduledCallbacksEnabled: builder.scheduledCallbacksEnabled, | ||
}) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you add a validation to make sure the provided number is greater than or equal to 1? That should go in the
ValidateFlags
function