Repository navigation
netmap: encode EigenTrustAlpha as a decimal string, matching the protocol - #899
Closed
roman-khimov with Copilot wants to merge 2 commits into
Closed
roman-khimov with Copilot wants to merge 2 commits into
roman-khimov with Copilot wants to merge 2 commits into
Conversation
Co-authored-by: roman-khimov <22092804+roman-khimov@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix EigenTrustAlpha config encoding to align with protocol
netmap: encode EigenTrustAlpha as a decimal string, matching the protocol
Oct 27, 2026
Member
|
Not needed, see issue. |
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.
NetworkInfowroteEigenTrustAlphaas 8 little-endian float64 bits. The API docs and running networks use a decimal string such as"0.1". As a result, the SDK read"0.123"from the network as1.08637830059e-312and sent a value other than the string form the network config uses. The issue discussion settled on following the protocol and fixing the SDK.SetEigenTrustAlphanow writesstrconv.FormatFloat(alpha, 'f', -1, 64).EigenTrustAlpha()parses the string and returns 0 when the parameter is unset, as before. It panics on an unparsable or out-of-range stored value, as before.FromProtoMessageandUnmarshalnow parse the value withstrconv.ParseFloatand reject NaN and values outside [0, 1].network_info_test.gonow use the string encoding, including the valid marshalledNetworkInfobytes.Compatibility: this is a wire-format change. Parameters in the old binary float64 form, as written by earlier SDK versions, now fail to unmarshal with a parse error.