-
Notifications
You must be signed in to change notification settings - Fork 39
Implement AppChain CLI management and split param setting from update #1182
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
| if err != nil { | ||
| logger.Error("could not setup parameter admin", zap.Error(err)) | ||
| return err | ||
| } |
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.
If all provided --key values are empty or whitespace, the command exits successfully without any output, which is confusing and masks invalid input.
The loop skips over empty keys due to the continue on trimmed empty strings, and there’s no check after the loop to ensure at least one valid key was processed.
Consider tracking the number of successfully processed keys and returning an error if none were valid, so users get clear feedback when their input contains only empty or whitespace keys.
+ processed := 0
for _, k := range opts.Keys {
k = strings.TrimSpace(k)
if k == "" {
continue
}
+ processed++
+ val, gerr := paramAdmin.GetRawParameter(ctx, k)
if gerr != nil {
logger.Error("get parameter failed", zap.String("key", k), zap.Error(gerr))
return gerr
}
logger.Info("parameter",
zap.String("key", k),
zap.String("bytes32", "0x"+common.Bytes2Hex(val[:])),
)
}
+ if processed == 0 {
+ return fmt.Errorf("no valid --key values provided")
+ }🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
| client *ethclient.Client, | ||
| signer TransactionSigner, | ||
| contractsOptions config.ContractsOptions, | ||
| ) (IParameterAdmin, error) { |
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.
If ParameterRegistryAddress is empty or not a valid hex address, the zero address is used and subsequent parameter registry calls will fail at runtime.
This happens because NewAppChainParameterAdmin passes contractsOptions.AppChain.ParameterRegistryAddress directly into common.HexToAddress without any checks.
Consider validating that contractsOptions.AppChain.ParameterRegistryAddress is non-empty (and optionally a valid hex address via common.IsHexAddress) before calling NewAppChainRegistryAdapter, returning a descriptive error if validation fails.
+ if contractsOptions.AppChain.ParameterRegistryAddress == "" {
+ return nil, fmt.Errorf("app chain parameter registry address is required")
+ }🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
Implement AppChain CLI management and refactor blockchain admins to update on-chain state from parameter registries, splitting parameter setting from update operations across app and settlement components
This change replaces setter-style admin methods with
Update*operations that read pending values from parameter registries, introduces registry adapters and interfaces to support both AppChain and Settlement registries, and updates the CLI to manage parameters directly and trigger updates separately. It also adds raw parameter get/set and a bridge command for sending parameters from Settlement to App.IParameterAdminandIParameterRegistry, renameSet*toUpdate*without explicit values, and read state directly from contracts; adjust payload size getters to returnuint32in app_chain_admin.go and settlement_chain_admin.goparamssubtree for raw parameter get/set and bridging, and convert existing app/settlement admin commands from set to update semantics in commandsappChainParameterRegistryand CLI flag/env for the AppChain Parameter Registry in blockchain.go, options.go, and validation.goparamAdminthen callUpdate*methods, and adjust helpers to construct app/settlement-specific parameter admins across affected test files📍Where to Start
Start with the admin API changes in
IAppChainAdminandISettlementChainAdminin app_chain_admin.go and settlement_chain_admin.go, then review registry abstraction in parameter_registry_admin.go and registry_adapters.go.Macroscope summarized ee2c284.