Commit graph

127 commits

Author SHA1 Message Date
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
a6fc5d9fe4
Merge pull request #1998 from nspcc-dev/fix-calculatenetworkfee-result
rpc: wrap calculatenetworkfee result in a structure
2021-06-07 09:53:48 +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
Anna Shaleva
1dbf1d4310 rpc: allow to track notary requests via Notification subsystem 2021-06-01 16:29:04 +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
Roman Khimov
c4e084b0d8 *: fix whitespace errors
leading/trailing newlines
2021-05-12 22:51:41 +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
Anna Shaleva
2fbbadeb56 rpc: detalize submit* RPC validation error
These changes do not break the compatibility with the C# node response.

It is useful for the end-user to be aware of the failed validation reason.
Also, the `cause` will be displayed at the running node log.
2021-02-25 19:18:57 +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
Anna Shaleva
7ca93e76ac core, rpc: allow to store several AppExecResult for a single hash
It is required for we have several executions per block.
2020-11-12 16:24:39 +03:00
Anna Shaleva
20f8fe5699 rpc: use base64 for submitblock and sendrawtransaction
Changes ported from https://github.com/neo-project/neo-modules/pull/394.
2020-11-12 15:21:35 +03:00
Anna Shaleva
6ee919747f rpc: allow batch JSON-RPC requests
Close #1509
2020-11-06 17:06:20 +03:00
Anna Shaleva
474d2dfb65 rpc: add Magic to Version 2020-10-19 11:51:27 +03:00
Anna Shaleva
c50f3db6ad rpc, cli: encode script in base64 for Invoke* 2020-10-19 11:51:27 +03:00
Anna Shaleva
19a2e3bb91 rpc: add transaction field to InvokeResult 2020-10-17 00:42:39 +03:00
Anna Shaleva
9a493dd2a0 rpc: add FaultException to result.Invoke
Close #1440
2020-10-08 16:12:14 +03:00
Anna Shaleva
d27775acc5 rpc: remove json names from result.Invoke struct
We use invokeAux to marshal result.Invoke to JSON.
2020-10-05 16:00:15 +03:00
Roman Khimov
af17bbfeab rpc/server: encode answers more efficiently
We're at the point where even this code can clearly be seen in profiles. We
can save on some buffers (and CPU cycles) by encoding the answer once.

Another ~2% TPS for single node.
2020-09-09 20:46:31 +03:00
Roman Khimov
9187e2ab25 rpc/response: drop unused GetRawTx type 2020-09-09 20:46:31 +03:00
Anna Shaleva
27348973c3 rpc: fix JSON marshalling for Invoke result
We should return a quote string as JSON value in case of recursive
reference, otherwise json.Marshal returns an error.
2020-09-07 13:57:45 +03:00
Anna Shaleva
acacac1b24 rpc: use state.AppExecResult for ApplicationLog marshalling
Closes #1371
2020-09-07 13:38:32 +03:00
Roman Khimov
e7d13e6db2 *: fix misspellings found in Go Report Card 2020-08-14 12:16:24 +03:00
Anna Shaleva
0834661cac rpc: marshal getapplicationlog stack as []stackitem.Item
Following https://github.com/neo-project/neo-modules/issues/318
2020-08-13 17:16:31 +03:00
Roman Khimov
5ef08f60ae remove github.com/pkg/errors from dependencies
It's not needed any more with Go 1.13 as we have wrapping/unwrapping in base
packages. All errors.Wrap calls are replaced with fmt.Errorf, some strings are
improved along the way.
2020-08-07 12:21:52 +03:00
Evgenii Stratonikov
e5d538ed21 core: use raw stack items in application logs
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +03:00
Evgenii Stratonikov
9cba25616d rpc: use raw stack items in invoke* RPC
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +03:00