Commit graph

132 commits

Author SHA1 Message Date
Roman Khimov
bb0efed8b7 rpc: move latest getversion compat to 0.98.3
Version 0.98.3 is officially released with the old behavior.
2022-05-07 22:34:40 +03:00
Roman Khimov
740488f7f3
Merge pull request #2442 from EliChin/feature/eng_review
English Check
2022-05-05 17:12:37 +03:00
Elizaveta Chichindaeva
28908aa3cf [#2442] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Roman Khimov
930c439900 rpc: signal JSON marshalling errors through exception
See neo-project/neo-modules#696. Unmarshaller is left unchanged to be
compatible.
2022-05-04 13:13:21 +03:00
Anna Shaleva
9862b40f2c rpc: support InitialGasDistribution response from old Neo-Go nodes
https://github.com/nspcc-dev/neo-go/pull/2435 breaks compatibility
between newer RPC clients and older RPC servers with the following
error:
```
failed to get network magic: json: cannot unmarshal string into Go struct field Protocol.protocol.initialgasdistribution of type int64
```

This behaviour is expected, but we can't allow this radical change.
Thus, the following solution is implemented:
1. RPC server responds with proper non-stringified
   InitialGasDistribution value. The value represents an integral
   of fixed8 multiplied by the decimals.
2. RPC client is able to distinguish older and newer responses. For
   older one the stringified value without decimals part is
   expected. For newer responses the int64 value with decimal part
   is expected.

The cludge will be present in the code for a while until nodes of
version <=0.98.3 become completely absolete.
2022-04-27 19:00:46 +03:00
Anna Shaleva
c042c5bb63 Revert "rpc: adjust getversion RPC response"
This reverts commit 1c6afe402f.
2022-04-27 14:39:19 +03:00
Anna Shaleva
1c6afe402f rpc: adjust getversion RPC response
Reference implementation includes `initialgasdistribution` as integer
value with decimals.

C# response:
```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "nonce": 1677922561,
        "protocol": {
            "addressversion": 53,
            "initialgasdistribution": 5200000000000000,
            "maxtraceableblocks": 2102400,
            "maxtransactionsperblock": 512,
            "maxvaliduntilblockincrement": 5760,
            "memorypoolmaxtransactions": 50000,
            "msperblock": 15000,
            "network": 860833102,
            "validatorscount": 7
        },
        "tcpport": 10333,
        "useragent": "/Neo:3.1.0/",
        "wsport": 10334
    }
}
```

Neo-Go response:
```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "network": 860833102,
        "nonce": 2847278838,
        "protocol": {
            "addressversion": 53,
            "initialgasdistribution": "52000000",
            "maxtraceableblocks": 2102400,
            "maxtransactionsperblock": 512,
            "maxvaliduntilblockincrement": 5760,
            "memorypoolmaxtransactions": 50000,
            "msperblock": 15000,
            "network": 860833102,
            "validatorscount": 7
        },
        "tcpport": 10333,
        "useragent": "/NEO-GO:0.98.2/"
    }
}
```
2022-04-14 13:51:30 +03:00
Roman Khimov
2e452df13a rpc/storage: add storage changes to invoke* diagnostics 2022-01-19 00:02:19 +03:00
Roman Khimov
d79d8324e0 rpc: add notifications into the invoke* result 2022-01-18 22:35:44 +03:00
Roman Khimov
44fd7af044 rpc/result: drop unnecessary blockchainer dependency 2022-01-14 19:57:16 +03:00
Roman Khimov
c01427ca65 rpc: add verbose parameter to invokefunction and invokescript 2021-11-20 21:57:41 +03:00
Roman Khimov
1375918b63 rpc: add client-side NEP-11 methods 2021-11-19 12:58:46 +03:00
Roman Khimov
7f48653e66 rpc: add server-side NEP-11 tracking API 2021-11-19 12:58:46 +03:00
Anna Shaleva
07cbe4d253 core: add finalizer functions to interop context
These functions are aimed to free the resources occupied by storage
iterator by the end of script execution or whenever Finilize is called.
2021-10-21 10:05:12 +03:00
Anna Shaleva
43ac4e1517 rpc: implement findstates RPC handler 2021-10-13 11:41:05 +03:00
Roman Khimov
b4e24bef14
Merge pull request #2202 from nspcc-dev/validatorscount
rpc: add validatorscount to getversion response
2021-09-29 11:55:59 +03:00
Roman Khimov
5a2b77238c rpc: add validatorscount to getversion response
See neo-project/neo-modules#642.
2021-09-28 10:10:26 +03:00
Anna Shaleva
5c97e0dcf2 rpc: move NotaryRequestEvent to the subscriptions pkg
It is used for subscriptions only, so move it to the subscriptions pkg.
2021-09-24 17:42:59 +03:00
Anna Shaleva
b3ea7504cb subscriptions: add container hash to notification event
External users make use of it. Close #2190.
2021-09-24 17:42:02 +03:00
Evgeniy Stratonikov
c465b18cb2 rpc: return protocol parameters in getversion, fix #2160
`StateRootInHeader` is duplicated similarly to `Network`.
It will be removed in future as it is surely a protocol parameter.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-10 21:45:59 +03:00
Anna Shaleva
ed9cdfe667 rpc: use core Header for getblockheader response
Nonce and Primary fields were missing from response.
2021-09-09 18:47:22 +03:00
Roman Khimov
a188d20fd1 rpc: fix getstateheight result compatibility
C#:
   "result" : {
      "localrootindex" : 11623,
      "validatedrootindex" : 11623
   }

Go:
   "result" : {
      "blockHeight" : 11627,
      "stateHeight" : 11627
   }
2021-07-22 21:13:44 +03:00
Roman Khimov
0cd9cd0c80 state/result: save/return real JSONization errors
Don't hide/obfuscate real problems.
2021-07-07 00:42:36 +03:00
Roman Khimov
6a61e86d12 rpc: wrap calculatenetworkfee result in a structure
C#:
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "networkfee": "1185120"
  }
}

Go:
{
  "id": 2,
  "jsonrpc": "2.0",
  "result": 1185120
}

Thanks @csmuller for finding it.
2021-06-04 23:38:35 +03:00
Roman Khimov
9d2712573f *: enable godot linter and fix all its warnings
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Evgeniy Stratonikov
23a4e25436 interop: remove System.Iterator.Create, fix #1935
There are now only storage iterators. Related #1933.
2021-05-11 12:13:30 +03:00
Anna Shaleva
9eeebf481c rpc: allow to marshal Iterators for invoke* results 2021-04-30 16:23:06 +03:00
Roman Khimov
438eb0c43a rpc: rename magic to network in JSON
Follow neo-modules/neo-core changes. We don't rename structure fields though
to stay compatible with current code (and we do have netmode.Magic to justify
that also).
2021-04-28 23:41:31 +03:00
Roman Khimov
d3ea720afb result: gofmt -s 2021-04-08 15:49:14 +03:00
Anna Shaleva
7f038bd465 mpt: split HashNode in two types
First type is non-empty HashNode, and the second one is an Empty node.
2021-04-01 10:19:57 +03:00
Anna Shaleva
b9927c39ee mpt: refactor nodes serialisation
It should be serialised with type in case if it's a children node.
The type can be either HashT or EmptyT.
2021-04-01 10:19:57 +03:00
Anna Shaleva
1ba7338b07 rpc: fix mpt-related responses serialisation
MPT structures should be serialized in base64.
2021-04-01 10:17:03 +03:00
Roman Khimov
d314f82db3 transaction: drop Network from Transaction
We only need it when signing/verifying.
2021-03-26 13:45:18 +03:00
Evgeniy Stratonikov
f83b376181 block: replace Base with Header 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
18911caa3a Revert "rpc: marshal GAS in getunclaimedgas as decimal"
This reverts commit df801a8539.
2021-02-09 11:37:25 +03:00
Evgeniy Stratonikov
b0fbd897ad Revert "rpc: marshal fees and GAS as Fixed8 decimal"
This reverts commit a79b12b4d4.
2021-02-09 11:16:52 +03:00
Evgenii Stratonikov
7368ff09ef rpc: marshal GAS correctly
When using ",string" in JSON struct tag, value is first unmarshaled to
a numeric value (float64 in our case), then to our real type via
`UnmarshalJSON()`, which can lead to rounding errors.
2020-12-10 15:32:00 +03:00
Evgenii Stratonikov
df801a8539 rpc: marshal GAS in getunclaimedgas as decimal 2020-12-09 11:19:25 +03:00
Evgenii Stratonikov
e4c3339c91 util: move Fixed8 to encoding/fixedn package 2020-12-09 11:18:18 +03:00
Evgenii Stratonikov
a79b12b4d4 rpc: marshal fees and GAS as Fixed8 decimal 2020-11-26 15:04:30 +03:00
Evgenii Stratonikov
7d91a3a89e pkg: move internal/ package to the root directory
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
8e60a65b55 rpc: implement verifyproof RPC
Test getproof and verifyproof together.
2020-11-20 18:06:22 +03:00
Evgenii Stratonikov
e38e8aa48a rpc: implement getproof RPC 2020-11-20 18:06:22 +03:00
Evgenii Stratonikov
6b42e9306a rpc/server: implement getstateheight RPC 2020-11-20 18:06:21 +03:00
Evgenii Stratonikov
1869d6d460 core: allow to use state root in header 2020-11-20 17:16:32 +03:00
Anna Shaleva
083879838c rpc: adjust getrawtransaction and gettransactionheight RPC call
We should return verbose transaction in case if it is in the mempool
from `getrawtransaction`. We also shouldn't return height from
`gettransactionheight` in case if transaction is in the mempool.
2020-11-16 13:25:42 +03:00
Anna Shaleva
31cf71fb62 rpc: use default Uint160 marshaller for result.NEP5Balance.Asset
To match C# behaviour we should marshal asset hash with `0x` prefix.
2020-11-13 12:28:31 +03:00
Roman Khimov
0f827ee6ba
Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
core, rpc: store multiple execution results for single hash
2020-11-12 19:05:22 +03:00
Anna Shaleva
0b15ca8bd0 rpc: add trigger parameter to getapplicationlog 2020-11-12 17:43:11 +03:00