Skip to content

netmap: encode EigenTrustAlpha as a decimal string, matching the protocol - #899

Closed
roman-khimov with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-eigentrustalpha-config-encoding
Closed

roman-khimov with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-eigentrustalpha-config-encoding

Conversation

Copilot AI commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

NetworkInfo wrote EigenTrustAlpha as 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 as 1.08637830059e-312 and sent a value other than the string form the network config uses. The issue discussion settled on following the protocol and fixing the SDK.

  • Encoding
    • SetEigenTrustAlpha now writes strconv.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.
  • Validation
    • FromProtoMessage and Unmarshal now parse the value with strconv.ParseFloat and reject NaN and values outside [0, 1].
  • Tests
    • Fixtures and error expectations in network_info_test.go now use the string encoding, including the valid marshalled NetworkInfo bytes.
var n netmap.NetworkInfo
n.SetEigenTrustAlpha(0.1) // wire value: []byte("0.1")

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.

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
Copilot AI requested a review from roman-khimov October 27, 2026 09:51
@roman-khimov

Copy link
Copy Markdown
Member

Not needed, see issue.

@roman-khimov
roman-khimov deleted the copilot/fix-eigentrustalpha-config-encoding branch October 27, 2026 11:50
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.

netmap: EigenTrustAlpha config encoding diverges from the protocol

2 participants