diff --git a/go.mod b/go.mod index b0296ed26..ab267f25a 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,6 @@ module github.com/nspcc-dev/neo-go require ( github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e - github.com/coreos/go-semver v0.3.0 github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 github.com/google/uuid v1.2.0 diff --git a/go.sum b/go.sum index 16af10655..41edc8073 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/pkg/neorpc/result/version.go b/pkg/neorpc/result/version.go index 9f9102949..aea901da4 100644 --- a/pkg/neorpc/result/version.go +++ b/pkg/neorpc/result/version.go @@ -2,11 +2,7 @@ package result import ( "encoding/json" - "fmt" - "strings" - "github.com/coreos/go-semver/semver" - "github.com/nspcc-dev/neo-go/pkg/config" "github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" ) @@ -15,17 +11,11 @@ type ( // Version model used for reporting server version // info. Version struct { - // Magic contains network magic. - // Deprecated: use Protocol.Network instead - Magic netmode.Magic - TCPPort uint16 - WSPort uint16 - Nonce uint32 - UserAgent string - Protocol Protocol - // StateRootInHeader is true if state root is contained in the block header. - // Deprecated: use Protocol.StateRootInHeader instead - StateRootInHeader bool + TCPPort uint16 `json:"tcpport"` + WSPort uint16 `json:"wsport,omitempty"` + Nonce uint32 `json:"nonce"` + UserAgent string `json:"useragent"` + Protocol Protocol `json:"protocol"` } // Protocol represents network-dependent parameters. @@ -52,19 +42,6 @@ type ( // ValidatorsHistory stores height:size map of the validators count. ValidatorsHistory map[uint32]int } -) - -type ( - // versionMarshallerAux is an auxiliary struct used for Version JSON marshalling. - versionMarshallerAux struct { - Magic netmode.Magic `json:"network"` - TCPPort uint16 `json:"tcpport"` - WSPort uint16 `json:"wsport,omitempty"` - Nonce uint32 `json:"nonce"` - UserAgent string `json:"useragent"` - Protocol protocolMarshallerAux `json:"protocol"` - StateRootInHeader bool `json:"staterootinheader,omitempty"` - } // protocolMarshallerAux is an auxiliary struct used for Protocol JSON marshalling. protocolMarshallerAux struct { @@ -83,125 +60,49 @@ type ( StateRootInHeader bool `json:"staterootinheader,omitempty"` ValidatorsHistory map[uint32]int `json:"validatorshistory,omitempty"` } - - // versionUnmarshallerAux is an auxiliary struct used for Version JSON unmarshalling. - versionUnmarshallerAux struct { - Magic netmode.Magic `json:"network"` - TCPPort uint16 `json:"tcpport"` - WSPort uint16 `json:"wsport,omitempty"` - Nonce uint32 `json:"nonce"` - UserAgent string `json:"useragent"` - Protocol protocolUnmarshallerAux `json:"protocol"` - StateRootInHeader bool `json:"staterootinheader,omitempty"` - } - - // protocolUnmarshallerAux is an auxiliary struct used for Protocol JSON unmarshalling. - protocolUnmarshallerAux struct { - AddressVersion byte `json:"addressversion"` - Network netmode.Magic `json:"network"` - MillisecondsPerBlock int `json:"msperblock"` - MaxTraceableBlocks uint32 `json:"maxtraceableblocks"` - MaxValidUntilBlockIncrement uint32 `json:"maxvaliduntilblockincrement"` - MaxTransactionsPerBlock uint16 `json:"maxtransactionsperblock"` - MemoryPoolMaxTransactions int `json:"memorypoolmaxtransactions"` - ValidatorsCount byte `json:"validatorscount"` - InitialGasDistribution json.RawMessage `json:"initialgasdistribution"` - - CommitteeHistory map[uint32]int `json:"committeehistory,omitempty"` - P2PSigExtensions bool `json:"p2psigextensions,omitempty"` - StateRootInHeader bool `json:"staterootinheader,omitempty"` - ValidatorsHistory map[uint32]int `json:"validatorshistory,omitempty"` - } ) -// latestNonBreakingVersion is a latest NeoGo revision that keeps older RPC -// clients compatibility with newer RPC servers (https://github.com/nspcc-dev/neo-go/pull/2435). -var latestNonBreakingVersion = *semver.New("0.98.5") +// MarshalJSON implements the JSON marshaler interface. +func (p Protocol) MarshalJSON() ([]byte, error) { + aux := protocolMarshallerAux{ + AddressVersion: p.AddressVersion, + Network: p.Network, + MillisecondsPerBlock: p.MillisecondsPerBlock, + MaxTraceableBlocks: p.MaxTraceableBlocks, + MaxValidUntilBlockIncrement: p.MaxValidUntilBlockIncrement, + MaxTransactionsPerBlock: p.MaxTransactionsPerBlock, + MemoryPoolMaxTransactions: p.MemoryPoolMaxTransactions, + ValidatorsCount: p.ValidatorsCount, + InitialGasDistribution: int64(p.InitialGasDistribution), -// MarshalJSON implements the json marshaller interface. -func (v *Version) MarshalJSON() ([]byte, error) { - aux := versionMarshallerAux{ - Magic: v.Magic, - TCPPort: v.TCPPort, - WSPort: v.WSPort, - Nonce: v.Nonce, - UserAgent: v.UserAgent, - Protocol: protocolMarshallerAux{ - AddressVersion: v.Protocol.AddressVersion, - Network: v.Protocol.Network, - MillisecondsPerBlock: v.Protocol.MillisecondsPerBlock, - MaxTraceableBlocks: v.Protocol.MaxTraceableBlocks, - MaxValidUntilBlockIncrement: v.Protocol.MaxValidUntilBlockIncrement, - MaxTransactionsPerBlock: v.Protocol.MaxTransactionsPerBlock, - MemoryPoolMaxTransactions: v.Protocol.MemoryPoolMaxTransactions, - ValidatorsCount: v.Protocol.ValidatorsCount, - InitialGasDistribution: int64(v.Protocol.InitialGasDistribution), - - CommitteeHistory: v.Protocol.CommitteeHistory, - P2PSigExtensions: v.Protocol.P2PSigExtensions, - StateRootInHeader: v.Protocol.StateRootInHeader, - ValidatorsHistory: v.Protocol.ValidatorsHistory, - }, - StateRootInHeader: v.StateRootInHeader, + CommitteeHistory: p.CommitteeHistory, + P2PSigExtensions: p.P2PSigExtensions, + StateRootInHeader: p.StateRootInHeader, + ValidatorsHistory: p.ValidatorsHistory, } return json.Marshal(aux) } -// UnmarshalJSON implements the json unmarshaller interface. -func (v *Version) UnmarshalJSON(data []byte) error { - var aux versionUnmarshallerAux +// UnmarshalJSON implements the JSON unmarshaler interface. +func (p *Protocol) UnmarshalJSON(data []byte) error { + var aux protocolMarshallerAux err := json.Unmarshal(data, &aux) if err != nil { return err } - v.Magic = aux.Magic - v.TCPPort = aux.TCPPort - v.WSPort = aux.WSPort - v.Nonce = aux.Nonce - v.UserAgent = aux.UserAgent - v.Protocol.AddressVersion = aux.Protocol.AddressVersion - v.Protocol.Network = aux.Protocol.Network - v.Protocol.MillisecondsPerBlock = aux.Protocol.MillisecondsPerBlock - v.Protocol.MaxTraceableBlocks = aux.Protocol.MaxTraceableBlocks - v.Protocol.MaxValidUntilBlockIncrement = aux.Protocol.MaxValidUntilBlockIncrement - v.Protocol.MaxTransactionsPerBlock = aux.Protocol.MaxTransactionsPerBlock - v.Protocol.MemoryPoolMaxTransactions = aux.Protocol.MemoryPoolMaxTransactions - v.Protocol.ValidatorsCount = aux.Protocol.ValidatorsCount - v.Protocol.CommitteeHistory = aux.Protocol.CommitteeHistory - v.Protocol.P2PSigExtensions = aux.Protocol.P2PSigExtensions - v.Protocol.StateRootInHeader = aux.Protocol.StateRootInHeader - v.Protocol.ValidatorsHistory = aux.Protocol.ValidatorsHistory - v.StateRootInHeader = aux.StateRootInHeader - if len(aux.Protocol.InitialGasDistribution) == 0 { - return nil - } - - if strings.HasPrefix(v.UserAgent, config.UserAgentWrapper+config.UserAgentPrefix) { - ver, err := userAgentToVersion(v.UserAgent) - if err == nil && ver.Compare(latestNonBreakingVersion) <= 0 { - err := json.Unmarshal(aux.Protocol.InitialGasDistribution, &v.Protocol.InitialGasDistribution) - if err != nil { - return fmt.Errorf("failed to unmarshal InitialGASDistribution into fixed8: %w", err) - } - return nil - } - } - var val int64 - err = json.Unmarshal(aux.Protocol.InitialGasDistribution, &val) - if err != nil { - return fmt.Errorf("failed to unmarshal InitialGASDistribution into int64: %w", err) - } - v.Protocol.InitialGasDistribution = fixedn.Fixed8(val) + p.AddressVersion = aux.AddressVersion + p.Network = aux.Network + p.MillisecondsPerBlock = aux.MillisecondsPerBlock + p.MaxTraceableBlocks = aux.MaxTraceableBlocks + p.MaxValidUntilBlockIncrement = aux.MaxValidUntilBlockIncrement + p.MaxTransactionsPerBlock = aux.MaxTransactionsPerBlock + p.MemoryPoolMaxTransactions = aux.MemoryPoolMaxTransactions + p.ValidatorsCount = aux.ValidatorsCount + p.CommitteeHistory = aux.CommitteeHistory + p.P2PSigExtensions = aux.P2PSigExtensions + p.StateRootInHeader = aux.StateRootInHeader + p.ValidatorsHistory = aux.ValidatorsHistory + p.InitialGasDistribution = fixedn.Fixed8(aux.InitialGasDistribution) return nil } - -func userAgentToVersion(userAgent string) (*semver.Version, error) { - verStr := strings.Trim(userAgent, config.UserAgentWrapper) - verStr = strings.TrimPrefix(verStr, config.UserAgentPrefix) - ver, err := semver.NewVersion(verStr) - if err != nil { - return nil, fmt.Errorf("can't retrieve neo-go version from UserAgent: %w", err) - } - return ver, nil -} diff --git a/pkg/neorpc/result/version_test.go b/pkg/neorpc/result/version_test.go index a5b3a5e88..d0388cca0 100644 --- a/pkg/neorpc/result/version_test.go +++ b/pkg/neorpc/result/version_test.go @@ -28,7 +28,6 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) { "wsport": 10334 }` responseFromGoNew := `{ - "network": 860833102, "nonce": 1677922561, "protocol": { "addressversion": 53, @@ -63,7 +62,6 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) { "wsport": 10334 }` v := &Version{ - Magic: 860833102, TCPPort: 10333, WSPort: 10334, Nonce: 1677922561, @@ -81,7 +79,6 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) { InitialGasDistribution: fixedn.Fixed8FromInt64(52000000), StateRootInHeader: false, }, - StateRootInHeader: false, } t.Run("MarshalJSON", func(t *testing.T) { actual, err := json.Marshal(v) @@ -92,11 +89,7 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) { t.Run("Go node response", func(t *testing.T) { t.Run("old RPC server", func(t *testing.T) { actual := &Version{} - require.NoError(t, json.Unmarshal([]byte(responseFromGoOld), actual)) - expected := new(Version) - *expected = *v - expected.UserAgent = "/NEO-GO:0.98.2/" - require.Equal(t, expected, actual) + require.Error(t, json.Unmarshal([]byte(responseFromGoOld), actual)) }) t.Run("new RPC server", func(t *testing.T) { actual := &Version{} @@ -110,34 +103,7 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) { expected := new(Version) *expected = *v expected.UserAgent = "/Neo:3.1.0/" - expected.Magic = 0 // No magic in C#. require.Equal(t, expected, actual) }) }) } - -func TestVersionFromUserAgent(t *testing.T) { - type testCase struct { - success bool - cmpWithBreaking int - } - var testcases = map[string]testCase{ - "/Neo:3.1.0/": {success: false}, - "/NEO-GO:0.98.7": {success: true, cmpWithBreaking: 1}, - "/NEO-GO:0.98.7-pre-12344/": {success: true, cmpWithBreaking: 1}, - "/NEO-GO:0.98.6/": {success: true, cmpWithBreaking: 1}, - "/NEO-GO:0.98.6-pre-123/": {success: true, cmpWithBreaking: 1}, - "/NEO-GO:0.98.5/": {success: true, cmpWithBreaking: 0}, - "/NEO-GO:0.98.5-pre-12345/": {success: true, cmpWithBreaking: -1}, - "/NEO-GO:123456": {success: false}, - } - for str, tc := range testcases { - ver, err := userAgentToVersion(str) - if tc.success { - require.NoError(t, err) - require.Equal(t, ver.Compare(latestNonBreakingVersion), tc.cmpWithBreaking, str) - } else { - require.Error(t, err) - } - } -} diff --git a/pkg/rpcclient/client.go b/pkg/rpcclient/client.go index e061eab6e..bd35073d8 100644 --- a/pkg/rpcclient/client.go +++ b/pkg/rpcclient/client.go @@ -167,10 +167,6 @@ func (c *Client) Init() error { c.cache.network = version.Protocol.Network c.cache.stateRootInHeader = version.Protocol.StateRootInHeader - if version.Protocol.MillisecondsPerBlock == 0 { - c.cache.network = version.Magic - c.cache.stateRootInHeader = version.StateRootInHeader - } for _, ctr := range natives { c.cache.nativeHashes[ctr.Manifest.Name] = ctr.Hash } diff --git a/pkg/rpcclient/rpc_test.go b/pkg/rpcclient/rpc_test.go index a7c6dc80a..815798f4b 100644 --- a/pkg/rpcclient/rpc_test.go +++ b/pkg/rpcclient/rpc_test.go @@ -982,14 +982,16 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{ invoke: func(c *Client) (interface{}, error) { return c.GetVersion() }, - serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"network":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}`, + serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}`, result: func(c *Client) interface{} { return &result.Version{ - Magic: netmode.UnitTestNet, TCPPort: uint16(20332), WSPort: uint16(20342), Nonce: 2153672787, UserAgent: "/NEO-GO:0.73.1-pre-273-ge381358/", + Protocol: result.Protocol{ + Network: netmode.UnitTestNet, + }, } }, }, @@ -1858,7 +1860,7 @@ func wrapInitResponse(r *params.In, resp string) string { var response string switch r.Method { case "getversion": - response = `{"id":1,"jsonrpc":"2.0","result":{"network":42,"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}` + response = `{"id":1,"jsonrpc":"2.0","result":{"protocol":{"network":42},"tcpport":20332,"wsport":20342,"nonce":2153672787,"useragent":"/NEO-GO:0.73.1-pre-273-ge381358/"}}` case "getnativecontracts": response = `{"jsonrpc":"2.0","id":1,"result":[{"id":-1,"hash":"0xfffdc93764dbaddd97c48f252a53ea4643faa3fd","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1110259869},"manifest":{"name":"ContractManagement","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"deploy","parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"}],"returntype":"Array","offset":0,"safe":false},{"name":"deploy","parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"},{"name":"data","type":"Any"}],"returntype":"Array","offset":7,"safe":false},{"name":"destroy","parameters":[],"returntype":"Void","offset":14,"safe":false},{"name":"getContract","parameters":[{"name":"hash","type":"Hash160"}],"returntype":"Array","offset":21,"safe":true},{"name":"getMinimumDeploymentFee","parameters":[],"returntype":"Integer","offset":28,"safe":true},{"name":"setMinimumDeploymentFee","parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","offset":35,"safe":false},{"name":"update","parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"}],"returntype":"Void","offset":42,"safe":false},{"name":"update","parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"},{"name":"data","type":"Any"}],"returntype":"Void","offset":49,"safe":false}],"events":[{"name":"Deploy","parameters":[{"name":"Hash","type":"Hash160"}]},{"name":"Update","parameters":[{"name":"Hash","type":"Hash160"}]},{"name":"Destroy","parameters":[{"name":"Hash","type":"Hash160"}]}]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-2,"hash":"0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1325686241},"manifest":{"name":"StdLib","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"atoi","parameters":[{"name":"value","type":"String"}],"returntype":"Integer","offset":0,"safe":true},{"name":"atoi","parameters":[{"name":"value","type":"String"},{"name":"base","type":"Integer"}],"returntype":"Integer","offset":7,"safe":true},{"name":"base58CheckDecode","parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","offset":14,"safe":true},{"name":"base58CheckEncode","parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","offset":21,"safe":true},{"name":"base58Decode","parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","offset":28,"safe":true},{"name":"base58Encode","parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","offset":35,"safe":true},{"name":"base64Decode","parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","offset":42,"safe":true},{"name":"base64Encode","parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","offset":49,"safe":true},{"name":"deserialize","parameters":[{"name":"data","type":"ByteArray"}],"returntype":"Any","offset":56,"safe":true},{"name":"itoa","parameters":[{"name":"value","type":"Integer"}],"returntype":"String","offset":63,"safe":true},{"name":"itoa","parameters":[{"name":"value","type":"Integer"},{"name":"base","type":"Integer"}],"returntype":"String","offset":70,"safe":true},{"name":"jsonDeserialize","parameters":[{"name":"json","type":"ByteArray"}],"returntype":"Any","offset":77,"safe":true},{"name":"jsonSerialize","parameters":[{"name":"item","type":"Any"}],"returntype":"ByteArray","offset":84,"safe":true},{"name":"memoryCompare","parameters":[{"name":"str1","type":"ByteArray"},{"name":"str2","type":"ByteArray"}],"returntype":"Integer","offset":91,"safe":true},{"name":"memorySearch","parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"}],"returntype":"Integer","offset":98,"safe":true},{"name":"memorySearch","parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"},{"name":"start","type":"Integer"}],"returntype":"Integer","offset":105,"safe":true},{"name":"memorySearch","parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"},{"name":"start","type":"Integer"},{"name":"backward","type":"Boolean"}],"returntype":"Integer","offset":112,"safe":true},{"name":"serialize","parameters":[{"name":"item","type":"Any"}],"returntype":"ByteArray","offset":119,"safe":true},{"name":"stringSplit","parameters":[{"name":"str","type":"String"},{"name":"separator","type":"String"}],"returntype":"Array","offset":126,"safe":true},{"name":"stringSplit","parameters":[{"name":"str","type":"String"},{"name":"separator","type":"String"},{"name":"removeEmptyEntries","type":"Boolean"}],"returntype":"Array","offset":133,"safe":true}],"events":[]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-3,"hash":"0x726cb6e0cd8628a1350a611384688911ab75f51b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":1592866325},"manifest":{"name":"CryptoLib","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"ripemd160","parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","offset":0,"safe":true},{"name":"sha256","parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","offset":7,"safe":true},{"name":"verifyWithECDsa","parameters":[{"name":"message","type":"ByteArray"},{"name":"pubkey","type":"ByteArray"},{"name":"signature","type":"ByteArray"},{"name":"curve","type":"Integer"}],"returntype":"Boolean","offset":14,"safe":true}],"events":[]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-4,"hash":"0xda65b600f7124ce6c79950c1772a36403104f2be","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":529571427},"manifest":{"name":"LedgerContract","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"currentHash","parameters":[],"returntype":"Hash256","offset":0,"safe":true},{"name":"currentIndex","parameters":[],"returntype":"Integer","offset":7,"safe":true},{"name":"getBlock","parameters":[{"name":"indexOrHash","type":"ByteArray"}],"returntype":"Array","offset":14,"safe":true},{"name":"getTransaction","parameters":[{"name":"hash","type":"Hash256"}],"returntype":"Array","offset":21,"safe":true},{"name":"getTransactionFromBlock","parameters":[{"name":"blockIndexOrHash","type":"ByteArray"},{"name":"txIndex","type":"Integer"}],"returntype":"Array","offset":28,"safe":true},{"name":"getTransactionHeight","parameters":[{"name":"hash","type":"Hash256"}],"returntype":"Integer","offset":35,"safe":true}],"events":[]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":588003825},"manifest":{"name":"NeoToken","groups":[],"features":{},"supportedstandards":["NEP-17"],"abi":{"methods":[{"name":"balanceOf","parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","offset":0,"safe":true},{"name":"decimals","parameters":[],"returntype":"Integer","offset":7,"safe":true},{"name":"getAccountState","parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","offset":14,"safe":true},{"name":"getCandidates","parameters":[],"returntype":"Array","offset":21,"safe":true},{"name":"getCommittee","parameters":[],"returntype":"Array","offset":28,"safe":true},{"name":"getGasPerBlock","parameters":[],"returntype":"Integer","offset":35,"safe":true},{"name":"getNextBlockValidators","parameters":[],"returntype":"Array","offset":42,"safe":true},{"name":"getRegisterPrice","parameters":[],"returntype":"Integer","offset":49,"safe":true},{"name":"registerCandidate","parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","offset":56,"safe":false},{"name":"setGasPerBlock","parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","offset":63,"safe":false},{"name":"setRegisterPrice","parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","offset":70,"safe":false},{"name":"symbol","parameters":[],"returntype":"String","offset":77,"safe":true},{"name":"totalSupply","parameters":[],"returntype":"Integer","offset":84,"safe":true},{"name":"transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","offset":91,"safe":false},{"name":"unclaimedGas","parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","offset":98,"safe":true},{"name":"unregisterCandidate","parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","offset":105,"safe":false},{"name":"vote","parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","offset":112,"safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]}]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-6,"hash":"0xd2a4cff31913016155e38e474a2c06d08be276cf","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":2663858513},"manifest":{"name":"GasToken","groups":[],"features":{},"supportedstandards":["NEP-17"],"abi":{"methods":[{"name":"balanceOf","parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","offset":0,"safe":true},{"name":"decimals","parameters":[],"returntype":"Integer","offset":7,"safe":true},{"name":"symbol","parameters":[],"returntype":"String","offset":14,"safe":true},{"name":"totalSupply","parameters":[],"returntype":"Integer","offset":21,"safe":true},{"name":"transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","offset":28,"safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]}]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-7,"hash":"0xcc5e4edd9f5f8dba8bb65734541df7a1c081c67b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":3443651689},"manifest":{"name":"PolicyContract","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"blockAccount","parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","offset":0,"safe":false},{"name":"getExecFeeFactor","parameters":[],"returntype":"Integer","offset":7,"safe":true},{"name":"getFeePerByte","parameters":[],"returntype":"Integer","offset":14,"safe":true},{"name":"getStoragePrice","parameters":[],"returntype":"Integer","offset":21,"safe":true},{"name":"isBlocked","parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","offset":28,"safe":true},{"name":"setExecFeeFactor","parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","offset":35,"safe":false},{"name":"setFeePerByte","parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","offset":42,"safe":false},{"name":"setStoragePrice","parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","offset":49,"safe":false},{"name":"unblockAccount","parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","offset":56,"safe":false}],"events":[]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-8,"hash":"0x49cf4e5378ffcd4dec034fd98a174c5491e395e2","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0A=","checksum":983638438},"manifest":{"name":"RoleManagement","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"designateAsRole","parameters":[{"name":"role","type":"Integer"},{"name":"nodes","type":"Array"}],"returntype":"Void","offset":0,"safe":false},{"name":"getDesignatedByRole","parameters":[{"name":"role","type":"Integer"},{"name":"index","type":"Integer"}],"returntype":"Array","offset":7,"safe":true}],"events":[{"name":"Designation","parameters":[{"name":"Role","type":"Integer"},{"name":"BlockIndex","type":"Integer"}]}]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]},{"id":-9,"hash":"0xfe924b7cfe89ddd271abaf7210a80a7e11178758","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":2663858513},"manifest":{"name":"OracleContract","groups":[],"features":{},"supportedstandards":[],"abi":{"methods":[{"name":"finish","parameters":[],"returntype":"Void","offset":0,"safe":false},{"name":"getPrice","parameters":[],"returntype":"Integer","offset":7,"safe":true},{"name":"request","parameters":[{"name":"url","type":"String"},{"name":"filter","type":"String"},{"name":"callback","type":"String"},{"name":"userData","type":"Any"},{"name":"gasForResponse","type":"Integer"}],"returntype":"Void","offset":14,"safe":false},{"name":"setPrice","parameters":[{"name":"price","type":"Integer"}],"returntype":"Void","offset":21,"safe":false},{"name":"verify","parameters":[],"returntype":"Boolean","offset":28,"safe":true}],"events":[{"name":"OracleRequest","parameters":[{"name":"Id","type":"Integer"},{"name":"RequestContract","type":"Hash160"},{"name":"Url","type":"String"},{"name":"Filter","type":"String"}]},{"name":"OracleResponse","parameters":[{"name":"Id","type":"Integer"},{"name":"OriginalTx","type":"Hash256"}]}]},"permissions":[{"contract":"*","methods":"*"}],"trusts":[],"extra":null},"updatehistory":[0]}]}` case "getcontractstate": diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index b0dd254b4..536966c05 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -700,11 +700,9 @@ func (s *Server) getVersion(_ params.Params) (interface{}, *neorpc.Error) { cfg := s.chain.GetConfig() return &result.Version{ - Magic: s.network, - TCPPort: port, - Nonce: s.coreServer.ID(), - UserAgent: s.coreServer.UserAgent, - StateRootInHeader: cfg.StateRootInHeader, + TCPPort: port, + Nonce: s.coreServer.ID(), + UserAgent: s.coreServer.UserAgent, Protocol: result.Protocol{ AddressVersion: address.NEO3Prefix, Network: cfg.Magic,