netmap: EigenTrustAlpha config encoding diverges from the protocol #249

Open
opened 2025-12-28 18:07:34 +00:00 by sami · 4 comments
Owner

Originally created by @cthulhu-rider on GitHub (Dec 9, 2024).

Describe the solution you'd like

backport changes to API docs

Describe alternatives you've considered

harder way:

  • follow current protocol and fix encoding
  • fix config in the running networks

Additional context

Client testing

Originally created by @cthulhu-rider on GitHub (Dec 9, 2024). ## Is your feature request related to a problem? Please describe. * [`API`](https://github.com/nspcc-dev/neofs-api/blob/e66b25d4bf2afc4472023e1e2c2467f694f5a0e1/netmap/types.proto#L285C10-L288) * [`code`](https://github.com/nspcc-dev/neofs-sdk-go/blob/335d9fe90f24494944c2888ef385f06f5f81dcfc/netmap/network_info.go#L436) ## Describe the solution you'd like backport changes to API docs ## Describe alternatives you've considered harder way: - follow current protocol and fix encoding - fix config in the running networks ## Additional context `Client` testing
Author
Owner

@roman-khimov commented on GitHub (Dec 9, 2024):

I think our networks are all configured with string-based values and I'd also check for reader code, probably it works with text-based ones as well. Overall I'd expect for API to win here.

@roman-khimov commented on GitHub (Dec 9, 2024): I think our networks are all configured with string-based values and I'd also check for _reader_ code, probably it works with text-based ones as well. Overall I'd expect for API to win here.
Author
Owner

@cthulhu-rider commented on GitHub (Dec 9, 2024):

func TestEigenTrustAlpha(t *testing.T) {
	m := &protonetmap.NetworkInfo{
		NetworkConfig: &protonetmap.NetworkConfig{
			Parameters: []*protonetmap.NetworkConfig_Parameter{
				{
					Key:   []byte("EigenTrustAlpha"),
					Value: []byte("0.123"),
				},
			},
		},
	}
	b, err := proto.Marshal(m)
	require.NoError(t, err)
	var n netmap.NetworkInfo
	require.NoError(t, n.Unmarshal(b))
	require.EqualValues(t, 0.123, n.EigenTrustAlpha())
}
=== RUN   TestEigenTrustAlpha
    network_info_test.go:524: 
        	Error Trace:	/home/ll/projects/neofs/sdk/netmap/network_info_test.go:524
        	Error:      	Not equal: 
        	            	expected: 0.123
        	            	actual  : 1.08637830059e-312
        	Test:       	TestIk
--- FAIL: TestIk (0.00s)

$ neo-go contract testinvokefunction -r https://rpc1.morph.fs.neo.org:40341 7c5bdb23e36cc7cce95bf42f3ab9e452c2501df1 config string:EigenTrustAlpha
{
  "state": "HALT",
  "gasconsumed": "2849820",
  "script": "DA9FaWdlblRydXN0QWxwaGERwB8MBmNvbmZpZwwU8R1QwlLkuTov9FvpzMds4yPbW3xBYn1bUg==",
  "stack": [
    {
      "type": "ByteString",
      "value": "MC4x"
    }
  ],
  "exception": null,
  "notifications": []
}

which is 0.1

@cthulhu-rider commented on GitHub (Dec 9, 2024): ```go func TestEigenTrustAlpha(t *testing.T) { m := &protonetmap.NetworkInfo{ NetworkConfig: &protonetmap.NetworkConfig{ Parameters: []*protonetmap.NetworkConfig_Parameter{ { Key: []byte("EigenTrustAlpha"), Value: []byte("0.123"), }, }, }, } b, err := proto.Marshal(m) require.NoError(t, err) var n netmap.NetworkInfo require.NoError(t, n.Unmarshal(b)) require.EqualValues(t, 0.123, n.EigenTrustAlpha()) } ``` ``` === RUN TestEigenTrustAlpha network_info_test.go:524: Error Trace: /home/ll/projects/neofs/sdk/netmap/network_info_test.go:524 Error: Not equal: expected: 0.123 actual : 1.08637830059e-312 Test: TestIk --- FAIL: TestIk (0.00s) ``` --- ``` $ neo-go contract testinvokefunction -r https://rpc1.morph.fs.neo.org:40341 7c5bdb23e36cc7cce95bf42f3ab9e452c2501df1 config string:EigenTrustAlpha { "state": "HALT", "gasconsumed": "2849820", "script": "DA9FaWdlblRydXN0QWxwaGERwB8MBmNvbmZpZwwU8R1QwlLkuTov9FvpzMds4yPbW3xBYn1bUg==", "stack": [ { "type": "ByteString", "value": "MC4x" } ], "exception": null, "notifications": [] } ``` which is `0.1`
Author
Owner

@roman-khimov commented on GitHub (Dec 9, 2024):

nspcc-dev/neofs-node@3129bdeadc/pkg/morph/client/netmap/config.go (L106-L113)
I think it's only SDK that does it wrong.

@roman-khimov commented on GitHub (Dec 9, 2024): https://github.com/nspcc-dev/neofs-node/blob/3129bdeadc87017c95d4877b82c57e64db5539f8/pkg/morph/client/netmap/config.go#L106-L113 I think it's only SDK that does it wrong.
Author
Owner

@cthulhu-rider commented on GitHub (Dec 9, 2024):

$ neofs-cli netmap netinfo -r grpcs://st1.storage.fs.neo.org:8082
Epoch: 28043
Network magic: [net 0x572dfa5] 91414437
Time per block: 15s
NeoFS network configuration (system)
  Audit fee: 50000000
  Storage price: 100000
  Container fee: 1000000000
  Container alias fee: 200
  EigenTrust alpha: 0.1
  Number of EigenTrust iterations: 4
  Epoch duration: 240
  Inner Ring candidate fee: 10000000000
  Maximum object size: 67108864
  Withdrawal fee: 100000000
  Homomorphic hashing disabled: false
  Maintenance mode allowed: true
NeoFS network configuration (other)

interpretation is OK, incorrectly transmitted

@cthulhu-rider commented on GitHub (Dec 9, 2024): ``` $ neofs-cli netmap netinfo -r grpcs://st1.storage.fs.neo.org:8082 Epoch: 28043 Network magic: [net 0x572dfa5] 91414437 Time per block: 15s NeoFS network configuration (system) Audit fee: 50000000 Storage price: 100000 Container fee: 1000000000 Container alias fee: 200 EigenTrust alpha: 0.1 Number of EigenTrust iterations: 4 Epoch duration: 240 Inner Ring candidate fee: 10000000000 Maximum object size: 67108864 Withdrawal fee: 100000000 Homomorphic hashing disabled: false Maintenance mode allowed: true NeoFS network configuration (other) ``` interpretation is OK, incorrectly transmitted
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-sdk-go#249
No description provided.