Commit graph

742 commits

Author SHA1 Message Date
Anna Shaleva
e8bed184d5 core: implement dynamic NEP17 balances tracking
Request NEP17 balances from a set of NEP17 contracts instead of getting
them from storage. LastUpdatedBlock tracking remains untouched, because
there's no way to retrieve it dynamically.
2021-07-29 10:23:01 +03:00
Anna Shaleva
e46d76d7aa core: rename state.NEP17Balances to state.NEP17TransferInfo
Balances are to be removed from state.NEP17TransferInfo, so the remnant
fields are NextTransferBatch, NewBatch and a map of LastUpdatedBlocks.
These fields are more staff-related.

Also rename dao.[Get, Put, put]NEP17Balances and STNEP17Balances
preffix.

Also rename NEP17TransferInfo.Trackers to LastUpdatedBlockTrackers
because NEP17TransferInfo.Balances are to be removed.
2021-07-28 13:22:53 +03:00
Roman Khimov
7366d45985 rpc: add GetStateHeight to client 2021-07-22 21:13:44 +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
5bdcd4c241 client: add GetCandidateRegisterPrice method
It's important for clients.
2021-07-21 12:19:55 +03:00
Roman Khimov
a617390185 rpc/request: support passing accounts as addresses
Turns out, it's completely legal in C#, see neo-project/neo#2543.
2021-07-18 16:45:53 +03:00
Evgeniy Stratonikov
3a4e0caeb8 core/block: add Nonce field to header
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Roman Khimov
473a1fc24e rpc/server: fix sporadic test failures
It can still be "reading" after test end:

    subscription_test.go:24:
        	Error Trace:	subscription_test.go:24
        	            				asm_amd64.s:1374
        	Error:      	Received unexpected error:
        	            	set tcp 127.0.0.1:49874: use of closed network connection
        	Test:       	TestFilteredNotaryRequestSubscriptions

==================
WARNING: DATA RACE
Write at 0x00c000e28989 by goroutine 185:
  testing.tRunner()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1126 +0x21a

Previous write at 0x00c000e28989 by goroutine 192:
  testing.(*common).FailNow()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:731 +0x4f
  testing.(*T).FailNow()
      <autogenerated>:1 +0x44
  github.com/stretchr/testify/require.NoError()
      /home/runner/go/pkg/mod/github.com/stretchr/testify@v1.6.1/require/require.go:1038 +0x104
  github.com/nspcc-dev/neo-go/pkg/rpc/server.wsReader()
      /home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:24 +0x187

Goroutine 185 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1168 +0x5bb
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1439 +0xa6
  testing.tRunner()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1123 +0x202
  testing.runTests()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1437 +0x612
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1345 +0x3b3
  main.main()
      _testmain.go:89 +0x236

Goroutine 192 (finished) created at:
  github.com/nspcc-dev/neo-go/pkg/rpc/server.initCleanServerAndWSClient()
      /home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:65 +0x294
  github.com/nspcc-dev/neo-go/pkg/rpc/server.TestFilteredNotaryRequestSubscriptions()
      /home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:348 +0x68d
  testing.tRunner()
      /opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1123 +0x202
==================
    testing.go:1038: race detected during execution of test
2021-07-08 10:40:54 +03:00
Roman Khimov
23fb5dd420 rpc/server: properly shutdown things in subscription test
Chain is the last one to Close().
2021-07-07 20:47:34 +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
Evgeniy Stratonikov
aa76383fa7 compiler: extend permission check to runtime hashes
If a method is known at compile time we can still check
if it is present in the list of methods of at least one contract.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:49:30 +03:00
Anna Shaleva
50296975e2 crypto: allow to provide non-default scrypt parameters 2021-06-11 15:22:28 +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
Evgeniy Stratonikov
c8ddc790d9 rpc/request: handle bool parameters correctly 2021-05-25 11:24:28 +03:00
Anna Shaleva
2d20b0fa23 core: remove nnsrecords package from native
Use nns from examples instead.
2021-05-17 22:24:56 +03:00
Anna Shaleva
7180b2ce06 rpc: use non-native NNS instead of native NNS in testchain 2021-05-17 22:08:15 +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
Roman Khimov
a44376903a rpc: fix errcheck warnings in websocket code 2021-05-12 21:48:38 +03:00
Roman Khimov
e9cefc4bfc *: fix all errcheck warnings in testing code 2021-05-12 21:45:12 +03:00
Roman Khimov
601841ef35 *: drop unused structure fields
Found by structcheck:
 `good` is unused (structcheck)
and alike.
2021-05-12 19:41:23 +03:00
Roman Khimov
d15cacc1ba rpc/client: fix broken test code
SA1024: cutset contains duplicate characters (staticcheck)
2021-05-12 19:15:21 +03:00
Roman Khimov
333f778aa6 *: drop empty branches
Fix this warning from staticcheck: SA9003: empty branch
2021-05-12 19:10:31 +03:00
Roman Khimov
0178594850 *: simpilfy make() invocations
gosimple: S1019: should use make([]byte, 64) instead
2021-05-12 18:36:45 +03:00
Roman Khimov
8322607fd2 rpc/server: silence deadcode warning 2021-05-12 18:22:18 +03:00
Roman Khimov
cfc067dd24 *: remove dead code
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +03:00
Anna Shaleva
6d59689d9c core: rename Neo.Crypto.CheckMultisig interop 2021-05-11 18:38:14 +03:00
Anna Shaleva
366e79b9b8 core: rename Neo.Crypto.CheckSig interop 2021-05-11 18:37:55 +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
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +03:00
Evgeniy Stratonikov
bb039ef035 manifest: add features field 2021-05-04 13:10:46 +03:00
Anna Shaleva
e27c894338 rpc: add NEP11 commands which return iterator
These are Tokens (optional), TokensOf and OwnerOf (divisible).
2021-04-30 16:23:06 +03:00
Anna Shaleva
9eeebf481c rpc: allow to marshal Iterators for invoke* results 2021-04-30 16:23:06 +03:00
Anna Shaleva
35ba3d97e6 rpc: export createNEP11TransferTx
It'll be used from cli package.
2021-04-30 16:23:06 +03:00
Anna Shaleva
c3264c065d rpc: check token standard in nepTokenInfo 2021-04-30 16:23:04 +03:00
Anna Shaleva
40ae78cb88 wallet: add Standard field to Token
We need to distinguish NEP11 and NEP17 tokens preesnted in the wallet.
2021-04-30 15:58:27 +03:00
Anna Shaleva
bc3a3d103e rpc: fix (*Client)TransferNEP11D
Four args should be specified: from, to, amount and tokenID.
2021-04-30 11:38:11 +03:00
Anna Shaleva
2fb083bd37 rpc: add NEP11TokenInfo method 2021-04-30 11:38:11 +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
Evgeniy Stratonikov
da360be5b1 rpc/request: allow to provide bool parameters, fix #1919 2021-04-28 16:44:19 +03:00
Anna Shaleva
127d0ad2ba rpc: allow to provide cosigners for NEP11-transfer-related commands 2021-04-23 10:45:11 +03:00
Anna Shaleva
49c35dec20 rpc: allow to provide cosigners for NEP17-transfer-related commands 2021-04-23 10:29:40 +03:00
Anna Shaleva
1d6ba389c9 rpc: split SignAndPushInvocationTx in two parts
There are several places where constructed transaction need to be
signed and sent. Thus, we definitely need a separate method for signing
and sending constructed transaction to avoid code duplication.
2021-04-23 10:27:47 +03:00
Anna Shaleva
48ae1cc486 rpc: refactor SignAndPushInvocationTx
We have a set of accounts provided via `cosigners` argument, so we
should fill all transaction witnesses in (not only sender's witness).
If we can't properly construct witnesses for all of the signers then an
error should be returned.
2021-04-21 18:52:32 +03:00
Roman Khimov
881ed3065e
Merge pull request #1909 from nspcc-dev/cli/default-cosigner-scope
cli, rpc: use CalledByEntry as a default cosigner's scope
2021-04-19 14:43:31 +03:00
Anna Shaleva
8f4257639e rpc: use CalledByEntry as default cosigner's scope 2021-04-19 12:06:13 +03:00
Anna Shaleva
ae36523a61 rpc, internal: fix CodeQL int conversions warnings
```
Incorrect conversion of an integer with architecture-dependent bit
size from to a lower bit size type int32 without an upper bound
check.
```
2021-04-19 11:30:28 +03:00
Anna Shaleva
1d3a297a6b rpc: add Data field to NEP17 TransferTarget
It's a part of transfer, thus it should be passed along with the other
transfer parameters.
2021-04-16 13:54:23 +03:00