fix: keep current values for omitted set-auto-renewed-config flags - #40
Open
owenwahlgren wants to merge 2 commits into
Open
fix: keep current values for omitted set-auto-renewed-config flags#40owenwahlgren wants to merge 2 commits into
owenwahlgren wants to merge 2 commits into
Conversation
Both --period and --auto-compound were required, so changing one meant restating the other. Restating it from memory risks overwriting it, since SetAutoRenewedValidatorConfigTx always rewrites both fields. Both flags are now optional and at least one is required. Omitted flags inherit the current on-chain value, read from the same getCurrentValidators call that already fetched the validator authority. A validator already set to exit keeps a zero next period when only --auto-compound changes.
CodeQL flagged the uint64 to time.Duration conversion (go/incorrect-integer-conversion, high). An oversized nextPeriod wrapped to a negative duration, which then slipped past the caller's minimum check because that only guards period > 0, so a bogus value could have been submitted as the next cycle length. Bound the value against the largest whole-second duration an int64 can hold and error out above it.
owenwahlgren
force-pushed
the
fix/set-auto-renewed-config-optional-auto-compound
branch
from
July 28, 2026 21:26
7e7ec0c to
8a808db
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
set-auto-renewed-configrequired both--periodand--auto-compound, so changing either one meant restating the other from memory.SetAutoRenewedValidatorConfigTxalways rewrites both fields, so a wrong guess silently overwrites the setting you were not trying to change.The exit case shows it most clearly: stopping renewal with
--period 0still forced you to supply an auto-compound percentage that is about to stop mattering.What changed
getCurrentValidatorscall that already fetched the validator authority, so this costs no extra request.--auto-compoundchanges, so tweaking the percentage cannot accidentally restart renewal.GetAutoRenewedValidatorAuthorityis kept as a thin wrapper over the newGetAutoRenewedValidatorConfigso existing callers and tests are unaffected.Verification
go build ./...,gofmt -l .clean, fullgo test ./...green. Three new tests cover parsing the current values, the already-exiting validator case, and an unparseable share count.docs/usage.mdupdated to match.