Commit graph

554 commits

Author SHA1 Message Date
Roman Khimov
a9dddf893a
Merge pull request #1525 from nspcc-dev/rpc/base64
rpc: return bse64 bytes from `getblock`, `getblockheader`, `getrawtx`
2020-11-09 10:48:28 +03:00
Anna Shaleva
6bb81d9b51 rpc: return bse64 bytes from getblock, getblockheader, getrawtx
Close #1522
2020-11-09 10:29:33 +03:00
Anna Shaleva
6ee919747f rpc: allow batch JSON-RPC requests
Close #1509
2020-11-06 17:06:20 +03:00
Anna Shaleva
b8a88f9378 rpc: allow to use address, id or name instead of scripthash [Client]
... for getcontractstate RPC client method.
2020-11-03 17:58:24 +03:00
Anna Shaleva
d3daaafbe4 rpc: allow to get contract scripthash from address, id or name [Server]
... for `invokefunction` RPC method.
2020-11-03 17:25:46 +03:00
Anna Shaleva
15a939b1da rpc: allow to getcontractstate by address, id or name
close #1423
2020-11-03 17:23:49 +03:00
Roman Khimov
eaa260474f trigger/core: split System trigger into OnPerist and PostPersist
Follow neo-project/neo#2022.
2020-10-29 19:17:07 +03:00
Roman Khimov
d4da811d12
Merge pull request #1507 from nspcc-dev/conflicts_attr
core: implement Conflicts transaction attribute
2020-10-29 16:54:58 +03:00
Anna Shaleva
ec63d5c456 core: add conflicts attribute
Close #1491
2020-10-29 10:57:31 +03:00
Anna Shaleva
0da01fde7f core: refactor blocked accounts logic 2020-10-23 11:42:30 +03:00
Roman Khimov
8be7cd4bff
Merge pull request #1489 from nspcc-dev/rpc/invoke_with_base64
rpc, cli: use base64 script encoding for Invoke* calls; add Magic to `getversion` RPC call
2020-10-19 16:17:06 +03:00
Anna Shaleva
590be7a58d rpc, cli: remove Network from RPC client and cli 2020-10-19 16:11:11 +03:00
Anna Shaleva
64d1946fbb rpc: fix Matches and marshalling for notification events
Close #1494. Marshalling went wrong due to the incorrect pointers usage.
Reproduced and fixed.
2020-10-19 13:44: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
ceb7ea9737 rpc: allow both base58 and hex for Uint160 RPC server parameters
`getunclaimedgas` RPC-call allows to use both base58 and hex
representations for uint160.
2020-10-17 00:42:45 +03:00
Anna Shaleva
19a2e3bb91 rpc: add transaction field to InvokeResult 2020-10-17 00:42:39 +03:00
Roman Khimov
6025c13a6d
Merge pull request #1471 from nspcc-dev/rpc-server-logging-improvement
server: don't always Sprintf params for logger
2020-10-08 16:45:30 +03:00
Roman Khimov
c8ba155d47 server: don't always Sprintf params for logger
Add Stringer to Params, if we're not printing Debug messages (which usually is
the case), it won't be called at all. Micro-optimization.
2020-10-08 16:37:28 +03:00
Roman Khimov
8c2fd91c5c
Merge pull request #1462 from nspcc-dev/rpc/exceptions
rpc, core: add FaultException to AppExecResult and Invoke* results
2020-10-08 16:20:38 +03:00
Anna Shaleva
9a493dd2a0 rpc: add FaultException to result.Invoke
Close #1440
2020-10-08 16:12:14 +03:00
Evgenii Stratonikov
9733a6f394 core: move CalculateNetworkFee to a separate package 2020-10-07 10:04:19 +03:00
Evgenii Stratonikov
b2a3a0851e emit: accept multiple opcodes in Opcode() 2020-10-06 18:03:25 +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
0e5a2f34c0
Merge pull request #1449 from nspcc-dev/rpc/client/getcvalidators_fix
rpc: getvalidators -> getnextblockvalidators
2020-10-02 13:30:58 +03:00
Anna Shaleva
fa0bd9f46b rpc: getvalidators -> getnextblockvalidators
We don't have `getvalidators` RPS call, there's only
`getnextblockvalidators` in the reference implementation.
2020-10-01 17:09:14 +03:00
Roman Khimov
991089593f
Merge pull request #1450 from nspcc-dev/fix/witnessscope
transaction: rename FeeOnly to None
2020-10-01 16:46:07 +03:00
Evgenii Stratonikov
fa09b9af7b transaction: rename FeeOnly to None
Follow missed change from neo-project/neo#1816 .
`None` may be used for any signer. Currently it is used
for sender to only pay fees, or to sign tx attributes.
2020-10-01 15:28:19 +03:00
Anna Shaleva
43390fe91d rpc: check VM state in (*Client).CreateTXFromScript
We should also pay attention to the VM state before adding system fee to
the transaction. We shouldn't allow to add system fee in case if
transaction script is bad.
2020-10-01 13:48:40 +03:00
Anna Shaleva
e34e367a7b core: take into account size fee during verifyTxWitnesses
GasLimit for transaction scripts verification should not include fee for
transaction size.
2020-09-30 21:40:04 +03:00
Roman Khimov
8d3e06498c rpc/client: handle tx creation error
Fix
neo-go  contract invokefunction -w wallets/neofs1.json -a NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 -r http://main_chain.neofs.devenv:30333 af5dc5f7e6a6efc64d679098f328027591a2e518 deposit 12b97a2206ae4b10c7e0194b7b655c32cc912057 int:50 bytes: -- 12b97a2206ae4b10c7e0194b7b655c32cc912057
Enter account NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 password >
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x934bbc]

goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/core/transaction.(*Transaction).GetSignedPart(0x0, 0x1028200, 0xc00013c000, 0xc0001a2680)
	github.com/nspcc-dev/neo-go/pkg/core/transaction/transaction.go:208 +0x13c
github.com/nspcc-dev/neo-go/pkg/wallet.(*Account).SignTx(0xc0000ef880, 0x0, 0x40, 0x80)
	github.com/nspcc-dev/neo-go/pkg/wallet/account.go:105 +0x61
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).SignAndPushInvocationTx(0xc0001a0180, 0xc00008e280, 0x40, 0x80, 0xc0000ef880, 0xc140c6, 0x0, 0xc000218b90, 0x1, 0x1, ...)
	github.com/nspcc-dev/neo-go/pkg/rpc/client/rpc.go:449 +0xfe
github.com/nspcc-dev/neo-go/cli/smartcontract.invokeInternal(0xc0000acb00, 0x1, 0x0, 0x0)
	github.com/nspcc-dev/neo-go/cli/smartcontract/smart_contract.go:493 +0xa4d
github.com/nspcc-dev/neo-go/cli/smartcontract.invokeFunction(0xc0000acb00, 0x10100, 0xc0000acb00)
	github.com/nspcc-dev/neo-go/cli/smartcontract/smart_contract.go:418 +0x30
github.com/urfave/cli.HandleAction(0xc76cc0, 0xf175d0, 0xc0000acb00, 0xc00007ef00, 0x0)
	github.com/urfave/cli@v1.20.0/app.go:490 +0xc8
github.com/urfave/cli.Command.Run(0xdbcc3c, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd9659, 0x2a, 0xde821b, ...)
	github.com/urfave/cli@v1.20.0/command.go:210 +0x9e8
github.com/urfave/cli.(*App).RunAsSubcommand(0xc00021e000, 0xc0000ac840, 0x0, 0x0)
	github.com/urfave/cli@v1.20.0/app.go:379 +0x88b
github.com/urfave/cli.Command.startApp(0xdb803f, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd7472, 0x28, 0x0, ...)
	github.com/urfave/cli@v1.20.0/command.go:298 +0x81a
github.com/urfave/cli.Command.Run(0xdb803f, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd7472, 0x28, 0x0, ...)
	github.com/urfave/cli@v1.20.0/command.go:98 +0x1219
github.com/urfave/cli.(*App).Run(0xc00009bd40, 0xc000030100, 0x10, 0x10, 0x0, 0x0)
	github.com/urfave/cli@v1.20.0/app.go:255 +0x741
main.main()
	command-line-arguments/main.go:18 +0x4b
2020-09-28 16:53:35 +03:00
Evgenii Stratonikov
c5cdaae87a native: support postPersist method
It should be called for NEO contract to distribute
committee bounties.
2020-09-23 14:47:09 +03:00
Evgenii Stratonikov
e8eb177c64 rpc/server: fix small bug in subscription test 2020-09-23 14:42:13 +03:00
Evgenii Stratonikov
43b3e15330 native: send GAS to a committee member on persist 2020-09-23 14:42:12 +03:00
Evgenii Stratonikov
7d90d79ae6 core: update claimable GAS calculation 2020-09-23 14:12:42 +03:00
Roman Khimov
1ff1cd797e
Merge pull request #1419 from nspcc-dev/port-from-2.x
Port from 2.x
2020-09-22 21:56:29 +03:00
Roman Khimov
b958b5c9af rpc/client: update GetNEP5Transfers call 2020-09-22 16:55:20 +03:00
Roman Khimov
6b7ca0ce3f rpc/server: limit the maximum number of elements for get*transfers 2020-09-22 16:45:01 +03:00
Roman Khimov
970de84130 rpc: add paging to getnep5transfers call
And add some tests.
2020-09-22 16:40:29 +03:00
Evgenii Stratonikov
3bba853c3e rpc/client: use standard errors package in tests 2020-09-22 11:28:27 +03:00
Roman Khimov
c50ff7f20e rpc/server: refactor parameter parsing for getnep5transfers 2020-09-21 22:38:59 +03:00
Roman Khimov
e4b52d3947 core/rpc: add continue flag to iterating functions
Most of the time we don't need to get all transfers from the DB and
deserialize them.
2020-09-21 22:23:34 +03:00
Roman Khimov
6902003044 rpc/server: add limit to get*transfers calls
Return only N transfers requested.
2020-09-21 18:03:59 +03:00
Anna Shaleva
770c8d774c core, rpc: add GetCommittee method
Closes #1414
2020-09-21 15:56:25 +03:00
Anna Shaleva
c6f099294b core: do not marshal block hash in application log
Closes #1388
2020-09-21 14:08:15 +03:00
Roman Khimov
1608fbff87
Merge pull request #1378 from nspcc-dev/tests/cli
Implement tests for CLI
2020-09-19 17:02:34 +03:00
Evgenii Stratonikov
e0f406fd3a rpc/client: add constant to ValidUntilBlock
There are 2 problems:
1. `getvalidators` RPC can return empty list.
2. `+1` in single node can be too resrictive.
Proper solution for (1) may require requesting
standby validators. Here we add constant
to fix occasional test failures.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
758a88a813 rpc: exit from Start after Listener is running
If port is dynamically allocated, `(*Server).Addr` will contain
0 port. This commit executes listener before exiting from `Start()`
and sets Addr to the actual address.
2020-09-18 12:05:31 +03:00
Roman Khimov
6f3aff76a4
Merge pull request #1405 from nspcc-dev/rework-block-verifications
Rework block verifications a bit
2020-09-16 14:27:24 +03:00
Roman Khimov
93be4bbeee rpc/server: fix "websocket: bad handshake" during testing
I think it's caused by connection limits server-side, we never close
connection on the client.
2020-09-16 12:51:59 +03:00