Roman Khimov
1ac60ada19
cli: move tests to subpackages
...
Refs. #2379 , but not completely solves it, one package seriously outweights
others:
? github.com/nspcc-dev/neo-go/cli [no test files]
ok github.com/nspcc-dev/neo-go/cli/app 0.036s coverage: 100.0% of statements
ok github.com/nspcc-dev/neo-go/cli/cmdargs 0.011s coverage: 60.8% of statements
ok github.com/nspcc-dev/neo-go/cli/flags 0.009s coverage: 97.7% of statements
? github.com/nspcc-dev/neo-go/cli/input [no test files]
ok github.com/nspcc-dev/neo-go/cli/options 0.033s coverage: 50.0% of statements
? github.com/nspcc-dev/neo-go/cli/paramcontext [no test files]
ok github.com/nspcc-dev/neo-go/cli/query 2.155s coverage: 45.3% of statements
ok github.com/nspcc-dev/neo-go/cli/server 1.373s coverage: 67.8% of statements
ok github.com/nspcc-dev/neo-go/cli/smartcontract 8.819s coverage: 94.3% of statements
ok github.com/nspcc-dev/neo-go/cli/util 0.006s coverage: 10.9% of statements
? github.com/nspcc-dev/neo-go/cli/vm [no test files]
ok github.com/nspcc-dev/neo-go/cli/wallet 72.103s coverage: 88.2% of statements
Still a nice thing to have.
2022-10-06 09:21:26 +03:00
Roman Khimov
1c376ffa62
Merge pull request #2724 from nspcc-dev/rpc-options
...
rpcsrv: handle preflight OPTIONS with CORS kludge, fix #2721
2022-10-05 17:02:55 +07:00
Roman Khimov
b48d02f4a6
rpcsrv: handle preflight OPTIONS with CORS kludge, fix #2721
2022-10-05 11:09:45 +03:00
Roman Khimov
8893163803
smartcontract: define parameter lengths as constants and use them
2022-10-05 10:46:21 +03:00
Roman Khimov
317dd42513
*: use uint*Size and SignatureLen constants where appropriate
2022-10-05 10:45:52 +03:00
Roman Khimov
79887f9d78
runtime: check notifications against ABI
...
Related to #2703 , just a logged thing for now.
2022-10-04 17:52:38 +03:00
Roman Khimov
7d0840d5d5
Merge pull request #2720 from nspcc-dev/notifications-check
...
compiler: enforce runtime.Notify parameters cast to proper type
2022-10-01 03:02:29 +07:00
Anna Shaleva
554e48e7b7
compiler: enforce runtime.Notify parameters cast
...
If notification parameters type can be defined in a compile time then enforce
parameter cast to the desired type got from manifest.
2022-09-30 14:42:43 +03:00
Anna Shaleva
80f71a4e6e
compiler: do not enforce variadic event args check on ellipsis usage
...
In case of ellipsis usage compiler defines argument type as ArrayT
(which is correct, because it's a natural representation of the last
argument, it represents the array of interface{}).
Here goes the problem:
```
=== RUN TestEventWarnings/variadic_event_args_via_ellipsis
compiler_test.go:251:
Error Trace: compiler_test.go:251
Error: Received unexpected error:
event 'Event' should have 'Integer' as type of 1 parameter, got: Array
Test: TestEventWarnings/variadic_event_args_via_ellipsis
```
Parsing the last argument in this case is a separate complicated problem
due to the fact that we need to grab types of elements of []interface{} inside the
fully qualified ast node which may looks like:
```
runtime.Notify("Event", (append([]interface{}{1, 2}, (([]interface{}{someVar, 4}))...))...)
```
Temporary solution is to exclude such notifications from analysis until we're
able to properly resolve element types of []interface{}.
2022-09-30 08:42:48 +03:00
Anna Shaleva
08427f23b6
compiler: do not check Any event parameter for compliance
...
It's possible that declared manifest event has parameter of AnyT for
those cases when parameter type differs from method to method. If so,
then we don't need to enforce type check after compilation.
2022-09-30 08:40:55 +03:00
Roman Khimov
b7be4edf7f
Merge pull request #2718 from nspcc-dev/ok-conversion
...
compiler: prohibit to compile type assertion with two return values
2022-09-29 02:54:03 +07:00
Anna Shaleva
b98848bf49
compiler: prohibit to compile type assertion with two return values
...
Close #2692 .
2022-09-28 11:27:13 +03:00
Anna Shaleva
1828e79412
compiler: add test for foreign function inlining
2022-09-27 15:36:06 +03:00
Anna Shaleva
24c107e3a2
interop: refactor address.FromHash160 code
...
Make it more simple.
2022-09-27 15:32:57 +03:00
Anna Shaleva
5d578fdd95
compiler: consider inlined types info on "append" handling
...
We need to search for "append" argument type info not only inside local
package type info map, but also inside the inlined type info map.
Close #2696 .
2022-09-27 15:32:51 +03:00
Anna Shaleva
ea08a81726
interop: add CallWithVersion helper
2022-09-21 17:38:42 +03:00
Anna Shaleva
df802b6fc6
vm: adjust emit.AppCall comment
...
There's no APPCALL anymore.
2022-09-21 17:25:45 +03:00
Anna Shaleva
8d5f97a699
interop: adjust Iterator documentation
...
The only way to get Iterator is as a result of storage.Find.
2022-09-20 17:09:48 +03:00
Roman Khimov
5a7ab2054d
Merge pull request #2698 from nspcc-dev/address-helpers
...
interop: add a couple of `interop.Hash160` encoding helpers
2022-09-20 17:07:00 +07:00
Anna Shaleva
293dbf3d1b
compiler: adjust test's checkInstrCount
...
Remove unnecessary code.
2022-09-20 09:45:07 +03:00
Anna Shaleva
7e13140b04
interop: add Hash160 encoder\decoder helper
...
Close #2690 .
2022-09-20 09:37:04 +03:00
Roman Khimov
1b753cd4bc
native: add some tests for stdlib's atoi
...
See neo-project/neo#2804 and neo-project/neo#2813 . We're already compatible.
2022-09-19 16:18:53 +03:00
Roman Khimov
18ed26194f
smartcontract: add Len to Builder
...
Which is useful in some cases.
2022-09-14 10:25:10 +03:00
Roman Khimov
5979138306
stateroot: fix panic on shutdown
...
Stateroot service is always active, but it might have no wallet.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xc57d41]
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/wallet.(*Wallet).Close(...)
github.com/nspcc-dev/neo-go/pkg/wallet/wallet.go:175
github.com/nspcc-dev/neo-go/pkg/services/stateroot.(*service).Shutdown(0xc000105880?)
github.com/nspcc-dev/neo-go/pkg/services/stateroot/validators.go:77 +0x81
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Shutdown(0xc000105880)
github.com/nspcc-dev/neo-go/pkg/network/server.go:271 +0x205
github.com/nspcc-dev/neo-go/cli/server.startServer(0xc0002702c0)
github.com/nspcc-dev/neo-go/cli/server/server.go:641 +0x2675
github.com/urfave/cli.HandleAction({0xe456e0?, 0x1155f20?}, 0x4?)
github.com/urfave/cli@v1.22.5/app.go:524 +0x50
github.com/urfave/cli.Command.Run({{0xfca38b, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xfd6a46, 0x10}, {0xffebe3, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x65b
github.com/urfave/cli.(*App).Run(0xc000272000, {0xc00003e180, 0x3, 0x3})
github.com/urfave/cli@v1.22.5/app.go:277 +0x8a7
main.main()
./main.go:21 +0x33
2022-09-13 13:18:13 +03:00
Roman Khimov
31792e3132
Merge pull request #2686 from nspcc-dev/drop-at-block-rpcs
...
rpcclient: simplify historic API
2022-09-09 15:18:27 +03:00
Roman Khimov
d40eb79975
rpcclient: simplify historic API
...
util.Uint256 is util.Uint256 and it's same RPC behind the scenes, so we can
make it a bit easier to digest. See #2545 also.
2022-09-09 13:41:45 +03:00
Roman Khimov
f78a065230
vm/cli: generate Go 1.17 go.mods
2022-09-08 21:18:51 +03:00
Roman Khimov
541d4b49e1
context: define a constant for transaction context type
2022-09-08 14:33:04 +03:00
Roman Khimov
6be9367f03
rpcclient/notary: add OnNEP17PaymentData and an example
...
Update documentation as well to mention it and not mention outdated APIs. We
can't link them yet, this will be done after the release.
2022-09-08 14:33:04 +03:00
Roman Khimov
4fb4f5a1ac
smartcontract: make *util.Uint160 and *util.Uint256 usable for parameters
...
Use Any type for NULL.
2022-09-08 14:33:04 +03:00
Roman Khimov
1e54b422cd
emit: make *util.Uint160 and *util.Uint256 emittable
...
They can be nil or can be regular uint types we're used to.
2022-09-08 14:33:04 +03:00
Roman Khimov
3c02177d3c
rpcclient: improve comments for some methods
2022-09-08 14:33:04 +03:00
Roman Khimov
3e8e6857e5
rpcclient; deprecate more methods
...
They make little sense now.
2022-09-08 14:33:04 +03:00
Roman Khimov
c4ddf80742
rpcclient: correct Init requirement in documentation
2022-09-08 14:33:04 +03:00
Roman Khimov
ee55e95c28
rpcclient: add examples for nep11/nep17/neo
...
GAS doesn't need any, so just mention nep17 package there.
2022-09-08 14:33:04 +03:00
Roman Khimov
a1c9871d95
nns: it's NEP-11, so make NEP-11 methods available too
2022-09-08 14:33:04 +03:00
Roman Khimov
186e5c19b6
rpcclient: update documentation, mention subpackages
...
Drop TODOs (we have relevant GitHub issues), drop verbosity comment (we have
*Verbose APIs for that).
2022-09-08 14:33:04 +03:00
Roman Khimov
cb1a1f8532
actor: extend documentation, add example
2022-09-08 14:33:04 +03:00
Roman Khimov
e1fe76137e
rpcclient: use separate reader/writer structs in nep11 and nep17
...
Which greatly simplifies reuse of these packages (and they're expected to be
reused since real tokens implement standards and also add something of their
own) and allows to avoid effects like
doc_test.go:68:28: ambiguous selector neoContract.BalanceOf
when neo.Contract is used. Avoids duplication in NEP-11 implementation as
well.
2022-09-08 14:33:03 +03:00
Roman Khimov
00a9376311
invoker: update documentation, add example
2022-09-08 14:33:03 +03:00
Roman Khimov
ea92f3d716
smartcontract: add some notes on API limitations
2022-09-08 13:27:07 +03:00
Roman Khimov
69176168c3
smartcontract: modernize Builder example
...
And make it a bit more useful.
2022-09-07 22:40:25 +03:00
Roman Khimov
aca8ce0d28
unwrap: provide ErrNoSessionID, add some explanations
2022-09-07 22:40:25 +03:00
Roman Khimov
97193cf337
golangci: add predeclared linter
...
These can be confusing.
2022-09-02 18:36:26 +03:00
Roman Khimov
63f212f4b3
golangci: enable/fix misspell
2022-09-02 18:36:26 +03:00
Roman Khimov
4f3ffe7290
golangci: enable errorlint and fix everything it found
2022-09-02 18:36:23 +03:00
Roman Khimov
c703ac6805
golangci: enable contextcheck linter, fix WSClient
...
pkg/rpcclient/wsclient.go:93:30 contextcheck Function `Dial` should pass the context parameter
2022-09-02 18:35:54 +03:00
Roman Khimov
3c009271f8
golangci: enable bodyclose checker and fix related code
...
It has found an issue in the oracle code, so I think it's worth doing.
2022-09-02 18:35:54 +03:00
Roman Khimov
3da8b98fc3
Merge pull request #2672 from nspcc-dev/private-key-cleanup
...
Private key cleanup
2022-09-02 16:20:39 +03:00
Roman Khimov
eb67145f81
keys: check length first, then do things in WIFDecode
...
Otherwise we can easily panic there on bad input.
2022-09-02 14:44:32 +03:00
Roman Khimov
3c722a9498
keys: clean temporary data during key imports
...
Don't leak anything this way.
2022-09-02 14:44:32 +03:00
Roman Khimov
74bf4a8e3f
slice: add Clean microfunction
...
To be used for various cleaning purposes, one line is better than three lines.
2022-09-02 14:44:32 +03:00
Roman Khimov
58dc8d0c9b
*: always close the wallet after use
...
Fix #2631 .
2022-09-02 14:44:32 +03:00
Roman Khimov
ee5f8b6c21
consensus: update dbft, drop marshaling from private key
...
dbft doesn not need this and we must not leak the key in any way.
2022-09-02 14:44:18 +03:00
Roman Khimov
cad0d7f00d
wallet: add some warnings to Decrypt and PrivateKey docs
2022-09-02 14:44:18 +03:00
Roman Khimov
e164625a7f
wallet: provide (*Account).SignHashable API
...
Make PrivateKey() less used and less useful.
2022-09-02 14:44:01 +03:00
Roman Khimov
e569edc841
wallet: add ScriptHash() to Account
...
It allows to simplify a lot of code and avoid getting a PrivateKey in some
cases.
2022-09-02 14:43:34 +03:00
Roman Khimov
fd8da6fdb9
*: do not get private key from Account to check if it CanSign()
...
We have this API now to performs checks.
2022-09-02 14:43:34 +03:00
Roman Khimov
8d33206bb8
*: don't get private key from account if just public one is needed
...
Add PublicKey() API to the Account and use it as appropriate, avoid creating
additional references to the private key.
2022-09-02 14:43:28 +03:00
Roman Khimov
f79672c4c3
Merge pull request #2624 from nspcc-dev/optimize-unused-globals
...
compiler: do not emit initialisation code for unused global vars
2022-09-02 14:28:44 +03:00
Roman Khimov
62be6f959c
keys/wallet: add Destroy/Close/Close
...
PrivateKey can be destroyed and Account/Wallet can be closed (destroying keys
in the process).
2022-09-01 17:07:00 +03:00
Roman Khimov
a30e73a0d7
wallet: drop publicKey from Account
...
It's not very useful and it's only available when we have a private key
anyway.
2022-09-01 17:07:00 +03:00
Roman Khimov
53edbd569f
wallet: don't allow to ConvertMultisig a locked account
...
This stretched the definition of Locked somewhat, but still makes sense to
me, locked accounts better not be touched.
2022-09-01 17:07:00 +03:00
Roman Khimov
0090577446
wallet: don't permanently store wif in the Account
...
It's useless and it's just another copy of the key. If really needed, it can
be derived from the key.
2022-09-01 17:07:00 +03:00
Roman Khimov
411ebdf51e
cli: add complete support for offline signing, fix #2662
...
See documentation update for an example. Some code is made generic as well,
GetCompleteTransaction can now be used directly on ParameterContext.
2022-09-01 15:30:34 +03:00
Roman Khimov
773bcc3a59
context: make error messages a bit less cryptic
...
Refs. #2664 .
2022-09-01 15:30:33 +03:00
Roman Khimov
58707c2b1e
context: handle the case when we have more sigs than needed
...
We can technically have more signatures in the file than we need and it's OK,
this case should be handled.
2022-09-01 15:30:33 +03:00
Anna Shaleva
7f613e63aa
compiler: add test for #2661
2022-09-01 13:39:22 +03:00
Anna Shaleva
800321db06
compiler: rename named unused global vars to "_"
...
So that (*codegen).Visit is able to omit code generation for these
unused global vars. The most tricky part is to detect unused global
variables, it is done in several steps:
1. Collect the set of named used/unused global vars.
2. Collect the set of globally declared expressions that contain
function calls.
3. Pick up global vars from the set made at step 2.
4. Traverse used functions and puck up those global vars that are used
from these functions.
5. Rename all globals that are presented in the set made at step 1
but are not presented in the set made on step 3 or step 4.
2022-09-01 13:39:19 +03:00
Anna Shaleva
1e6b70d570
compiler: adjust TestInline template
...
Move all auxiliary function declaration after Main, so that INITSLOT
instructions counter works properly. `vmAndCompileInterop` loads program
and moves nextIP to the Main function offset if there's no _init
function. If _init is there, then nextIP will be moved to the start of
_init. In TestInline we don't handle instructions properly (CALL/JMP
don't change nextIP), we just perform instruction traversal from the
start point via Next(), thus INITSLOT counter value depends on the
starting instruction, which depends on _init presence.
2022-09-01 09:19:20 +03:00
Anna Shaleva
91b36657d6
compiler: do not emit code for unnamed unused variables
...
If variable is unnamed and does not contain function call then it's
treated as unused and code generation may be omitted for it
initialization/declaration.
2022-09-01 09:18:56 +03:00
Anna Shaleva
1dcbdb011a
compiler: emit code for unnamed global var decls more careful
...
In case if global var is unnamed (and, as a consequence, unused) and
contains a function call inside its value specification, we need to emit
code for this var to be able to call the function as it can have
side-effects. See the example:
```
package foo
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"
var A = f()
func Main() int {
return 3
}
func f() int {
runtime.Notify("Valuable notification", 1)
return 2
}
```
2022-09-01 09:18:07 +03:00
Roman Khimov
314cd3341b
Merge pull request #2667 from nspcc-dev/rpc-nep-token-info
...
Drop NEPXXTokenInfo from the RPC client
2022-08-30 14:41:30 +03:00
Roman Khimov
673c8954cc
Merge pull request #2665 from nspcc-dev/notary-rpcclient
...
Notary RPC client
2022-08-30 12:43:13 +03:00
Roman Khimov
07f3023e84
rpcclient: add notary.Actor for seamless notary experience
2022-08-30 11:47:56 +03:00
Roman Khimov
ed6ed61712
neptoken: add Info to replace old NEPXXTokenInfo methods
...
I'm still not sure it's good to have this exposed from neptoken at all, but
let's try it this way.
2022-08-29 22:52:27 +03:00
Roman Khimov
ac5c609063
core: add a bit more data into NVB errors
...
It's not always obvious what they mean and the NVB value is.
2022-08-29 15:08:37 +03:00
Roman Khimov
a95984febf
actor: allow providing default attributes/hooks to be used
...
Which expands Actor use cases greatly.
2022-08-29 15:08:37 +03:00
Roman Khimov
a3f32bf306
neptoken: move BalanceOf implementation to Base from nep11/nep17
...
It's the same, even though standards define parameter name in a bit different
way.
2022-08-26 21:52:19 +03:00
Roman Khimov
0d9158bd79
rpcclient: add enough of NNS into nns to deprecate NNS methods
2022-08-26 19:45:37 +03:00
Roman Khimov
fe50879bb7
wallet: add (*Account).CanSign API
2022-08-26 18:21:58 +03:00
Roman Khimov
8b132cba0c
wallet: respect user-locked accounts, don't sign with them
...
NEP-6 has a notion of locked acccounts and SignTx must respect this user's
choice. For some reason this setting was inappropriately used by our RPC
client tests (probably a different kind of lock was meant).
2022-08-26 18:21:58 +03:00
Roman Khimov
54c5fd61df
wallet: make SignTx more precise and accurate
...
* each account must have an appropriate signer, if there is no signer for
this account in the tx it's an error
* we can only safely append to Scripts when account belongs to the next
signer (we don't have appropriate verification scripts for other signers)
* when contract has one parameter, the signature shouldn't be appended to
other data
I think these rules allow to handle more cases and do that safer. We have more
complex scenarios though, like non-signature parameters or mixed-parameter
invocation scripts, but that's out of scope for now.
2022-08-26 18:21:58 +03:00
Roman Khimov
7a930a8e11
wallet: don't fail in SignTx when no contract provided
...
Unfortunately valid NEP-6 can have no contract inside of account, so this
should be accounted for.
2022-08-26 18:21:58 +03:00
Roman Khimov
2f8896f7a1
rpcclient: add notary subpackage with the notary contract wrapper
2022-08-26 18:21:58 +03:00
Roman Khimov
bf06b32278
Merge pull request #2658 from nspcc-dev/calculate-network-fee-fixes
...
calculatenetworkfee improvements
2022-08-24 10:24:53 +03:00
Roman Khimov
03cc9b2762
rpcsrv: execute all witnesses for calculatenetworkfee
...
Try to get as much data as possible, fix #2654 .
2022-08-23 15:34:18 +03:00
Roman Khimov
a2c4a7f611
rpcsrv: adjust for paid attritbutes in calculatenetworkfee
...
calculatenetworkfee MUST calculate complete proper network fee, if we have
some extensions enabled and some attributes should be paid for that they're a
part of the equation too.
2022-08-23 15:34:18 +03:00
Evgeniy Stratonikov
9712be78fd
vm: optimize refcounter
...
```
name old time/op new time/op delta
RefCounter_Add-8 9.47ns ± 4% 2.75ns ± 1% -70.92% (p=0.000 n=10+9)
RefCounter_AddRemove-8 88.9ns ±20% 5.5ns ± 4% -93.78% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
RefCounter_Add-8 0.00B 0.00B ~ (all equal)
RefCounter_AddRemove-8 48.0B ± 0% 0.0B -100.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
RefCounter_Add-8 0.00 0.00 ~ (all equal)
RefCounter_AddRemove-8 2.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
```
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-08-23 13:18:06 +03:00
Evgeniy Stratonikov
59fbc689e4
vm/bench: extend refcounter benchmarks
...
Adding an array multiple times leads to the fast update via `IncRC`.
This hides the allocation that is there on the first addition. In this
commit add another benchmark which measures Add/Remove together, to
ensure that `switch` in `refCounter.Add` is entered. Benchmark results
are meaningful, because `Add`/`Remove` have almost identical implementation.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-08-23 13:08:42 +03:00
Anna Shaleva
fb8a3973f1
smartcontract: remove empty method parameter handling
...
It's prohibited by the manifest validness checker, thus should not be
supported by bindings generator.
2022-08-22 15:01:38 +03:00
Anna Shaleva
15732580eb
smartcontract: improve manifest validness errors
...
It should be clear from error what's wrong with ABI
(specify bad method/event/parameter identifier).
2022-08-22 14:59:28 +03:00
Roman Khimov
f3d83c90b1
rpcsrv: allow invalid contract signatures in calculatenetworkfee
...
See #2805 , it allows to cover more cases like Notary contract that can use
CalculateNetworkFee now instead of AddNetworkFee RPC client API.
2022-08-22 14:55:45 +03:00
Roman Khimov
98dfe66466
rpcsrv: simplify calculatenetworkfee
...
We're dealing with a transaction here and it can't be decoded successfully
unless it has an appropriate number of witness scripts (matching the number of
signers) with appropriate hashes (matching signers). So this iterations make
no sense at all, we know exactly where to look for the
verification/invocation scripts.
2022-08-22 14:47:30 +03:00
Roman Khimov
9916832e2e
core: set Tx for interop.Context when verifying witnesses
...
Notary contract uses it in the verification context and it's not harmful to
have it always be there when it's there.
2022-08-22 13:38:43 +03:00
Roman Khimov
606597b9a1
Merge pull request #2652 from nspcc-dev/shutdown-fixes
...
Shutdown sequence fixes
2022-08-22 10:22:54 +03:00
Roman Khimov
779a5c070f
network: wait for exit in discoverer
...
And synchronize other threads with channels instead of mutexes. Overall this
scheme is more reliable.
2022-08-19 22:23:47 +03:00
Roman Khimov
eeeb0f6f0e
core: accept two-side channels for sub/unsub, read on unsub
...
Blockchain's notificationDispatcher sends events to channels and these
channels must be read from. Unfortunately, regular service shutdown procedure
does unsubscription first (outside of the read loop) and only then drains the
channel. While it waits for unsubscription request to be accepted
notificationDispatcher can try pushing more data into the same channel which
will lead to a deadlock. Reading in the same method solves this, any number of
events can be pushed until unsub channel accepts the data.
2022-08-19 22:08:40 +03:00
Roman Khimov
dea75a4211
network: wait for the relayer thread to finish on shutdown
...
Unsubscribe and drain first, then return from the Shutdown method. It's
important wrt to subsequent chain shutdown process (normally it's closed right
after the network server).
2022-08-19 22:08:40 +03:00
Roman Khimov
3402b870c8
fixedn: add a test for empty string
...
Ensure it fails.
2022-08-19 21:52:43 +03:00
Roman Khimov
b2524a3ba9
actor: add Sender helper method
2022-08-19 21:52:43 +03:00
Roman Khimov
c034f94a94
nep17: provide out of the box multitransfer capability
...
It can't replicate the old multitransfer methods in ability to transfer
multiple tokens, but it at the same time can do multiple senders.
2022-08-19 21:52:43 +03:00
Roman Khimov
155089f4e5
network: drop cleanup from TestVerifyNotaryRequest
...
It never runs the server, so 746644a4eb
was a
bit wrong with this.
2022-08-19 20:54:06 +03:00
Roman Khimov
194933a5cc
rpcclient: provide nep11 package for NEP-11 tokens
...
Unfortunately Go doesn't allow to easily reuse readers in full packages, still
we can have this wrapper with a little overhead (the alternative is to move
specific methods into types of their own, but I'm not sure how it's going to
be accepted user-side).
2022-08-19 10:37:22 +03:00
Roman Khimov
d0702c2cf9
unwrap: provide ArrayOfUint160
...
It's a popular type as well.
2022-08-19 10:36:44 +03:00
Roman Khimov
8cd4948e06
Merge pull request #2650 from nspcc-dev/neo-wrapper
...
NEO RPC wrapper
2022-08-19 10:34:41 +03:00
Roman Khimov
06f50630ac
Merge pull request #2644 from nspcc-dev/fix-gen-decl
...
compiler: allow multi-return variables declaration
2022-08-18 17:44:50 +03:00
Roman Khimov
6082383e3c
Merge pull request #2649 from nspcc-dev/fix-unnamed-rcvr
...
compiler: fix nil method receiver handling
2022-08-18 12:23:17 +03:00
Roman Khimov
e23fc11da5
Merge pull request #2648 from nspcc-dev/restrict-multi-ret
...
compiler: adjust restrictions imposed on manifest functions
2022-08-17 22:03:21 +03:00
Roman Khimov
f011b3c3dd
rpcclient: introduce NEO wrapper
...
Notice that int64 types are used for gas per block or registration price
because the price has to fit into the system fee limitation and gas per block
value can't be more than 10 GAS. We use int64 for votes as well in other types
since NEO is limited to 100M.
2022-08-17 22:03:09 +03:00
Anna Shaleva
16dbb35bd8
compiler: fix nil method receiver handling
...
An attempt to compile the following code leads to runtime panic:
```
package foo
type CustomInt int
func Main() int {
var i CustomInt
i = 5
return i.Do(2)
}
func (CustomInt) Do(arg int) int {
return arg
}
```
The panic:
```
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 22 [running]:
testing.tRunner.func1.2({0xa341c0, 0xc0001606d8})
/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0xa341c0, 0xc0001606d8})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertFuncDecl(0xc00015e3c0, {0xc753b8, 0xc000152c80}, 0xc000266300, 0x30)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:497 +0x10b3
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile.func2(0xc000152c80, 0xc00023c410)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2153 +0x3f8
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile.func1(0xc000229b80)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:102 +0x82
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc00015e3c0, 0xc000189bb0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:93 +0xc6
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile(0x999a20, 0xc000130d80)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:99 +0x45
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc00015e3c0, 0xc0002669f0, 0x1)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2140 +0x445
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc0002669f0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2191 +0x353
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xa6f39a, 0x50b6b3}, {0xc6d1a0, 0xc0002421e0}, 0x0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/compiler_test.vmAndCompileInterop(0x5648df, {0xa9bf23, 0x94})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:75 +0x113
github.com/nspcc-dev/neo-go/pkg/compiler_test.eval(0xc0002421c0, {0xa9bf23, 0x61be8c7}, {0xa68880, 0xc0002421c0})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:36 +0x2d
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestUnnamedMethodReceiver(0x4079f9)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/function_call_test.go:400 +0x4f
testing.tRunner(0xc000204b60, 0xbcebb0)
/usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1306 +0x35a
```
The solution is to use the same approach as for unnamed function
parameters handling introduced in #2204 . (c *funcScope).newVariable is
able to properly handle "_" receiver.
2022-08-17 17:44:57 +03:00
Roman Khimov
79051f21c1
invoker: expand the interface with iterator wrappers
...
We need them for iterator-based interfaces. Invoker hides the difference
between different (session/expanded) iterators here.
2022-08-17 16:38:03 +03:00
Anna Shaleva
9b9d72937b
compiler: restrict return values count for manifest methods
...
Exported functions from main package shouldn't have more than one return
value.
2022-08-17 15:42:56 +03:00
Anna Shaleva
171364f07f
compiler: allow unnamed params for exported methods
...
Adjust the result of #2601 .
2022-08-17 15:41:19 +03:00
Roman Khimov
689331b960
unwrap: perform consistency check in SessionIterator
...
C# servers with SessionEnabled=false will return iterator IDs and no session
IDs which can be reported as an error immediately because the iterator can't
be traversed.
2022-08-17 15:08:24 +03:00
Roman Khimov
37619743ad
unwrap: add ArrayOfPublicKeys()
...
This type of result is also popular in the NEO contract.
2022-08-17 12:45:46 +03:00
Roman Khimov
cdc2a762a1
Merge pull request #2646 from nspcc-dev/more-native-contract-rpc-wrappers
...
More native contract RPC wrappers
2022-08-17 12:40:17 +03:00
Roman Khimov
0dbe8b6ce2
rpcclient: add oracle package for OracleContract
2022-08-17 11:42:20 +03:00
Roman Khimov
5c8f3a99dc
rpcclient: add management wrapper for ContractManagement
2022-08-17 11:42:20 +03:00
Anna Shaleva
0bca027f99
compiler: avoid panic on empty package list
...
An attempt to compile unexisting file via neo-go-vm CLI leads to the following
panic:
```
NEO-GO-VM > loadgo ./1-print.go
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000047300)
github.com/nspcc-dev/neo-go/pkg/compiler/codegen.go:2188 +0x60c
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc000047300, 0xf66c92}, {0x0, 0x0}, 0xc0003a0000)
github.com/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/vm/cli.handleLoadGo(0xc0000f5340)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:480 +0x1a5
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d61d0}, 0x6)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf632f0, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf9915b, 0x38}, {0xf6a57b, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0002c2000, {0xc00036c330, 0x3, 0x3})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
github.com/nspcc-dev/neo-go/pkg/vm/cli.(*VMCLI).Run(0xc000290890)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:694 +0x317
github.com/nspcc-dev/neo-go/cli/vm.startVMPrompt(0xc0001b9e40)
github.com/nspcc-dev/neo-go/cli/vm/vm.go:29 +0x92
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d5d10}, 0x2)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf60a2f, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf7880b, 0x19}, {0x0, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001c8fc0, {0xc000116020, 0x2, 0x2})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main()
./main.go:21 +0x33
```
2022-08-17 11:29:28 +03:00
Roman Khimov
f7c5ab4f43
state: check for array length in (*Contract).FromStackItem
...
Panicing here is not appropriate.
2022-08-16 17:19:47 +03:00
Anna Shaleva
07ee7f7e12
compiler: allow multi-return variables declaration
...
Problem: an attempt to compile the following code leads to a runtime
panic:
```
package foo
var a, b = f()
func Main() int {
return a + b
}
func f() (int, int) {
return 1, 2
}
```
```
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 22 [running]:
testing.tRunner.func1.2({0xa341c0, 0xc0001647f8})
/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0xa341c0, 0xc0001647f8})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0001623c0, {0xc75520, 0xc000155d80})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:591 +0x6559
go/ast.Walk({0xc6c4e0, 0xc0001623c0}, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:50 +0x5f
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertGlobals.func1({0xc75520, 0xc000155d80})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:359 +0x70
go/ast.inspector.Visit(0xc000229740, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:375 +0x31
go/ast.Walk({0xc6d920, 0xc000229740}, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:50 +0x5f
go/ast.walkDeclList({0xc6d920, 0xc000229740}, {0xc000155e80, 0x3, 0x120})
/usr/local/go/src/go/ast/walk.go:36 +0x87
go/ast.Walk({0xc6d920, 0xc000229740}, {0xc75458, 0xc000156c80})
/usr/local/go/src/go/ast/walk.go:355 +0x15c5
go/ast.Inspect(...)
/usr/local/go/src/go/ast/walk.go:387
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertGlobals(0xc0001623c0, 0xc000156c80, 0xc000254280)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:354 +0x71
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).traverseGlobals.func2(0xc000254280)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/analysis.go:86 +0x16e
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc0001623c0, 0xc000191b98)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:93 +0xc6
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).traverseGlobals(0xc0001623c0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/analysis.go:82 +0x22c
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc0001623c0, 0xc000274d20, 0x1)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2118 +0x17c
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000274d20)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2191 +0x353
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xa6f39a, 0xc00023cee0}, {0xc6d240, 0xc00024a460}, 0x0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/compiler_test.vmAndCompileInterop(0x5648df, {0xa9989f, 0x7d})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:75 +0x113
github.com/nspcc-dev/neo-go/pkg/compiler_test.eval(0xc00024a440, {0xa9989f, 0x129f366e}, {0xa68880, 0xc00024a440})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:36 +0x2d
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestGenDeclWithMultiRet.func2(0x4079f9)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/global_test.go:36 +0x4f
testing.tRunner(0xc00022e9c0, 0xbce760)
/usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1306 +0x35a
```
Solution:
Allow using multi-return function calls as general variable declaration
value. It was supported for assignment statements, so do the same for
*ast.GenDecl if it's a variable under the hood.
2022-08-16 15:33:44 +03:00
Roman Khimov
5d5455312a
rpcclient: add policy package for the PolicyContract contract
...
And test it with the RPC server.
Notice that getters still return int64 instead of *big.Int, that's because
these values are very limited and technically could even fit into an int (but
that seems to be too dangerous to use for long-term compatibility).
2022-08-16 12:43:25 +03:00
Roman Khimov
ee72b2fa29
rpcclient: add gas package for the GAS contract
...
Test it with the RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
ee84a4ab32
rpcclient: add rolemgmt pkg for RoleManagement contract
...
And test it with RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
a1a5db8fcd
state: add more convenient method to get native contract hashes
2022-08-15 10:54:29 +03:00
Roman Khimov
c967005216
rpcclient: add deprecation notices
...
And fix test code using old APIs to pass linter checks.
2022-08-12 18:21:02 +03:00
Roman Khimov
be74cc6b55
cli: use nep17 wrapper to implement commands
2022-08-12 18:21:02 +03:00
Roman Khimov
309358c85b
rpcclient: add new NEP-17 wrapper
2022-08-12 18:21:02 +03:00
Anna Shaleva
94e84f0364
core: fix native Management's hasMethod signature
...
Affects states, see
28ab45a6ec/src/Neo/SmartContract/Native/ContractManagement.cs (L155)
.
2022-08-11 16:10:01 +03:00
Roman Khimov
509cdec981
Merge pull request #2639 from nspcc-dev/oracle-fix
...
Oracle fix
2022-08-11 10:02:02 +03:00
Roman Khimov
bc3bffea53
native: fix oracle.finish reentrancy bug
...
See neo-project/neo#2795 .
2022-08-10 19:02:36 +03:00
Roman Khimov
8d170a1eb8
native: add Oracle.finish reentrancy test
2022-08-10 19:02:36 +03:00
Roman Khimov
f155a7f161
rpcclient: move result processing code into unwrap package
...
Which will be reused by upper-layer packages. It can be extended with more
types in future.
2022-08-09 17:38:47 +03:00
Roman Khimov
593fa4cac8
Merge pull request #2632 from nspcc-dev/rpcclient-actor
...
RPC client Actor interface
2022-08-09 17:21:24 +03:00
Roman Khimov
f3d7656b44
Merge pull request #2634 from nspcc-dev/go-1-19-upd
...
*: go 1.19 support
2022-08-09 16:33:08 +03:00
Anna Shaleva
916f2293b8
*: apply go 1.19 formatter heuristics
...
And make manual corrections where needed. See the "Common mistakes
and pitfalls" section of https://tip.golang.org/doc/comment .
2022-08-09 15:37:52 +03:00
Roman Khimov
ff72ed5715
actor: take ValidatorsHistory into account for CalculateValidUntilBlock
...
Which makes permanent result.Version caching safe for all cases.
2022-08-09 15:36:40 +03:00
Roman Khimov
95b72db707
rpcsrv: return more configuration data to the client
...
These are extensions, but they're important for the client to make various
decisions.
2022-08-09 15:36:40 +03:00
Anna Shaleva
bb751535d3
*: bump minimum supported go version
...
Close #2497 .
2022-08-08 13:59:32 +03:00
Roman Khimov
afef8b85d9
rpcclient: add deprecation warnings
2022-08-08 09:51:51 +03:00
Roman Khimov
260bcc0f49
wallet: fix wallet version to conform to NEP-6
...
See neo-project/neo#2390 . Can't see it there? No wonder, that's why we have
this bug for a year and a half. Not critical, we don't care about versions,
but _very_ annoying.
2022-08-07 22:41:40 +03:00
Roman Khimov
f369c2a359
wallet: allow pre-filled contract-based scripts in SignTx
...
They're allowed already for regular accounts (see below), but parameterless
accounts always add a script which is wrong.
2022-08-07 22:33:56 +03:00
Roman Khimov
aa2dbe9caf
smartcontract: accept Parameter in NewParameterFromValue
...
While it makes little sense, there can be a situation where this function will
get predefined Parameters in some way.
2022-08-07 22:33:56 +03:00
Roman Khimov
c0705e45c9
rpcclient: add actor package
...
Somewhat similar to invoker, but changing the state (or just creating a
transaction). Transaction creation could've been put into a structure of its
own, but it seems to be less convenient to use this way.
2022-08-07 22:33:56 +03:00
Roman Khimov
b8a4a6dc5b
Merge pull request #2613 from nspcc-dev/exec-changes-3.4.0
...
Exec changes for 3.4.0
2022-08-05 15:04:35 +03:00
Roman Khimov
e8d2277fe5
contract/vm: only push NULL after call in dynamic contexts
...
And determine the need for Null dynamically. For some reason the only dynamic
context is Contract.Call. CALLT is not dynamic and neither is a call from
native contract, go figure...
2022-08-05 14:35:00 +03:00
Roman Khimov
99e2681d3a
interop/vm: use more robust CalledByEntry check
...
Directly check contexts.
2022-08-05 14:35:00 +03:00
Roman Khimov
13f5fdbe8a
vm: extract shared parts of the Context
...
Local calls reuse them, cross-contract calls create new ones. This allows to
avoid some allocations and use a little less memory.
2022-08-05 14:26:25 +03:00
Roman Khimov
ab7743d78d
Merge pull request #2619 from nspcc-dev/script-oob-and-hasmethod-3.4.0
...
Script OOB checks and HasMethod for 3.4.0
2022-08-04 12:41:43 +03:00
Roman Khimov
25bd941d6f
Merge pull request #2601 from nspcc-dev/disallow-unnamed-parameters
...
compiler: disallow unnamed parameters for exported methods of the main package
2022-08-02 18:04:11 +03:00
Anna Shaleva
725e8779a1
compiler: always ensure manifest passes base check
2022-08-02 17:37:43 +03:00
Anna Shaleva
94f6a9ee61
compiler: disallow unnamed parameters for exported methods
2022-08-02 17:19:33 +03:00
Roman Khimov
d4292ed532
Merge pull request #2621 from nspcc-dev/sc-params
...
Smartcontract Parameters and Invoker interface
2022-08-02 14:18:34 +03:00
Roman Khimov
cfd2a35172
Merge pull request #2612 from nspcc-dev/fancy-service-restart
...
Fancy service restart
2022-08-02 14:11:44 +03:00
Roman Khimov
9b0ea2c21b
network/consensus: always process dBFT messages as high priority
...
Move category definition from consensus to payload, consensus service is the
one of its kind (HP), so network.Server can be adjusted accordingly.
2022-08-02 13:07:18 +03:00
Roman Khimov
ff93a680eb
metrics: don't Panic on bad shutdown
...
Just log the error.
2022-08-02 13:06:10 +03:00
Roman Khimov
94a8784dcb
network: allow to drop services and solve concurrency issues
...
Now that services can come and go we need to protect all of the associated
fields and allow to deregister them.
2022-08-02 13:05:39 +03:00
Roman Khimov
5a7fa2d3df
cli: restart consensus service on USR2
...
Fix #1949 . Also drop wallet from the ServerConfig since it's not used in any
meaningful way after this change.
2022-08-02 13:05:07 +03:00
Roman Khimov
bf92966633
cli: reload state root service on USR1
...
It's a bit special since it's _always_ present to catch stateroots from the
network.
2022-08-02 13:02:36 +03:00
Roman Khimov
31c9ae6339
rpcclient: add CallAndExpandIterator to Invoker
...
And deprecate Client.InvokeAndPackIteratorResults.
2022-08-01 21:31:23 +03:00
Roman Khimov
b52282c3c7
rpcclient: use Invoker internally for external APIs
...
It's not a big improvement, but it allows to test Invoker better.
2022-08-01 21:31:23 +03:00
Roman Khimov
fee7e2f223
rpcclient: add invoker package and structure
2022-08-01 21:31:23 +03:00
Roman Khimov
55164132df
smartcontract: provide NewParametersFromValues for convenience as well
2022-08-01 21:31:23 +03:00
Roman Khimov
92a931c145
smartcontract: provide interface{}->Parameter conversion
...
Which is almost like a NeoFS's toStackParameter() on steroids (except it
doesn't mess with noderoles package, it can be casted to int). RPC client's
Invoke* functions expect Parameters, so make it easy to create them.
2022-08-01 21:31:23 +03:00
Roman Khimov
a8a2f2ed5a
smartcontract: make CreateCallAndUnwrapIteratorScript accept Go types
...
Parameter is for the RPC client, all other CreateXXXScript functions deal with
regular types.
2022-08-01 21:31:23 +03:00
Roman Khimov
848d68fba8
smartcontract: improve package documentation
2022-08-01 21:31:23 +03:00
Roman Khimov
3c5a720e3a
smartcontract: drop Params type and TryParse methods
...
They were first introduced in a058598ecc
and
then carefully moved in 648e0bb242
, but it looks
like they were never used by any external code. This code can be useful on the
server, but the server has its own params package to deal with
parameters. Clients usually create Parameters and then get results as
stackitem.Items, so they don't use this code either. So there is zero point in
keeping it.
2022-08-01 21:31:23 +03:00
Roman Khimov
9341bb6628
cli: restart notary service on USR1
2022-07-28 19:05:56 +03:00
Roman Khimov
2adcf406d3
cli: reload Oracle service on USR1
...
Which allows to enable/disable the service, change nodes, keys and other
settings. Unfortunately, atomic.Value doesn't allow Store(nil), so we have to
store a pointer there that can point to nil interface.
2022-07-28 19:05:56 +03:00
Roman Khimov
98e2c5568c
rpcsrv: don't init Oracle in New, drop oracle dependency
...
The only thing rpcsrv needs is AddResponse callback.
2022-07-28 19:05:56 +03:00
Roman Khimov
61cfbbd33f
Revert "vm/core: revert out-of-bounds script checks"
...
This reverts commit bd5644aa02
restoring changes
from #2538 .
2022-07-28 17:01:23 +03:00
Roman Khimov
55f910777e
Revert "native/interop: revert management.hasMethod()"
...
This reverts commit 6c7a401f77
, introducing
changes from #2598 again.
2022-07-28 17:00:34 +03:00
Roman Khimov
4e98ca3358
Merge pull request #2616 from nspcc-dev/rollback-to-3.3.1
...
Rollback to 3.3.1
2022-07-28 16:00:49 +03:00
Roman Khimov
6c7a401f77
native/interop: revert management.hasMethod()
...
This reverts commits
* f50bcf617a
* 4f184498bc
* ab3330564a
because they're 3.4.0-compatible while we need 3.3.1.
2022-07-27 23:26:24 +03:00
Roman Khimov
bd5644aa02
vm/core: revert out-of-bounds script checks
...
This reverts commits 1005c1f7db
and
a5b5f88fe2
which are 3.4.0-compatible changes
while we need a 3.3.1-compatible release.
2022-07-27 23:25:23 +03:00
Roman Khimov
8e9bd3e28f
native: trigger committee update on candidate registration
...
It can change the committee even if noone voted. Fixes state diff at block
390726 of T5 testnet where there are no transactions, but committee changes
because there were some registrations in previous 21 blocks.
2022-07-27 23:21:21 +03:00
Roman Khimov
e5c59f8ddd
interop/runtime: disable notifications in dynamic scripts
...
That are only entry scripts today. See neo-project/neo#2796 .
2022-07-27 14:49:53 +03:00
Roman Khimov
df24c1268e
cli: restart pprof and prometheus on HUP
2022-07-27 12:30:08 +03:00
Roman Khimov
94099de3c3
cli: also check new ApplicationConfiguration for consistency
...
Most of the settings can't be changed, only services can.
2022-07-27 12:30:08 +03:00
Roman Khimov
3fca3352d8
cli: read new config on signal and check ProtocolConfiguration
...
ProtocolConfiguration must remain the same, any errors mean that the signal
will be ignored.
2022-07-27 12:30:08 +03:00
Roman Khimov
c8ff489287
native: use CreateOracleResponseScript directly
...
It wasn't possible way back when this test was written
(CreateOracleResponseScript was a method), now we can simplify things.
2022-07-26 12:19:49 +03:00
Roman Khimov
f749aaff3c
*: reuse smartcontract package to create standard entry scripts
2022-07-26 12:19:49 +03:00
Roman Khimov
32ebb4a90d
smartcontract: add Builder, method invocation helpers and doc
...
Move the last remaining script-related things out of the rpcclient.
2022-07-25 22:49:47 +03:00
Roman Khimov
1b6f4051d8
smartcontract: move CreateCallAndUnwrapIteratorScript there
...
RPC client shouldn't build scripts and this function can be useful as a
reusable building block.
2022-07-25 15:46:20 +03:00
Roman Khimov
88542630ac
blockchainer: drop the package completely
...
It's not an ideal solution, but at least it solves the problem for
now. Caveats:
* consensus only needs one method, so it's mirrored to Blockchain
* rpcsrv uses core.* definition of the StateRoot (so technically it might as
well not have an internal Ledger), but it uses core already unfortunately
2022-07-25 11:58:13 +03:00
Roman Khimov
5ee7ea34b1
blockchainer: drop Blockchainer completely
...
It's only used by the RPC server now, so it can be internalized.
2022-07-25 11:58:13 +03:00
Roman Khimov
284335a4d2
blockchainer: strip unused methods
2022-07-25 11:58:13 +03:00
Roman Khimov
fcbda00f8a
blockchainer/services: drop this package
...
It doesn't add any value.
2022-07-25 11:58:13 +03:00
Roman Khimov
3a6626f21f
blockchainer: drop unused services
dependency
2022-07-25 11:58:13 +03:00
Roman Khimov
5b49636ebe
neotest: use real *core.Blockchain
...
Hiding it behind blockchainer.Blockchain doesn't improve the testing system,
there is no other implementation of it that can fulfil all the needs of the
neotest and at the same time this limits the functions available to tests.
2022-07-25 11:58:13 +03:00
Roman Khimov
b3c25b5a1f
neorpc/result: move NotaryRequestEvent to this package
...
Not worth a package of its own.
2022-07-25 11:58:13 +03:00
Roman Khimov
4acd1688a1
subscriptions: move NotificationEvent to state
...
1. It's not good for pkg/core to import anything from pkg/neorpc.
2. The type is closely tied to the state package, even though it's not stored
in the DB
2022-07-25 11:58:13 +03:00
Roman Khimov
8e70cd3596
rpc: move rpc.Config to pkg/config, remove pkg/rpc
...
Makes no sense keeping it as is and TLS can be reused in the future.
2022-07-25 11:58:13 +03:00
Roman Khimov
1e0750e3cd
rpc: merge response and request under pkg/neorpc
...
Move result there also.
2022-07-25 11:57:53 +03:00
Roman Khimov
2e27c3d829
metrics: move package to services
...
Where it belongs.
2022-07-21 23:38:23 +03:00
Roman Khimov
8c668765d2
rpc/client: move to pkg/rpcclient
...
Better package name, closer to user.
2022-07-21 22:39:53 +03:00
Roman Khimov
43a59adbd0
rpc/server: move to services/rpcsrv
...
`server` is not a good package name and it's an internal service, so it can be
just about anywhere.
2022-07-21 22:14:12 +03:00
Roman Khimov
03b559bd44
block: JSONize tx-less block as []
instead of null
...
Improve C# compatibility.
2022-07-21 13:15:31 +03:00
Alex Vanin
d3f0b12ca2
rpc: fix deprecated magic field description
2022-07-15 15:01:59 +03:00
Roman Khimov
ed53fd3221
Merge pull request #2600 from nspcc-dev/handle-mptdata
...
network: allow to handle GetMPTData with KeepOnlyLatestState on
2022-07-15 13:13:31 +03:00
Roman Khimov
e46ec978d3
docs: improve some phasing, fix spelling
2022-07-15 12:52:21 +03:00
Anna Shaleva
1ae601787d
network: allow to handle GetMPTData with KeepOnlyLatestState on
...
And adjust documentation along the way.
2022-07-14 14:33:20 +03:00
Roman Khimov
f50bcf617a
compiler: add test for hasMethod, update all go.mods
2022-07-13 18:22:05 +03:00
Roman Khimov
4f184498bc
interop: add management.HasMethod()
2022-07-13 17:54:17 +03:00
Roman Khimov
ab3330564a
native: add hasMethod, fix #2588
...
Yet another state change.
2022-07-13 17:29:46 +03:00
Evgeniy Stratonikov
17329eea64
compiler: remove jumps to the next instruction
...
In case there are no returns in the inlined function, jumps point to the
next instruction and can be omitted. This optimization can be extended
to handle other cases, here we just make sure that already existing code
stays the same.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-12 16:17:31 +03:00
Evgeniy Stratonikov
05efc57485
compiler: reduce instructions in 2 stages
...
First replace parts to be removed with NOPs, then actually remove.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-12 13:16:33 +03:00
Evgeniy Stratonikov
ce24451fde
compiler: allow to use conditional returns in inlined functions
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-12 12:43:31 +03:00
Roman Khimov
9414538309
Merge pull request #2593 from nspcc-dev/fix-compiler
...
compiler: allow to call methods on return values
2022-07-12 11:55:41 +03:00
Evgeniy Stratonikov
e1a581be0e
compiler: allow to call methods on return values
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-07-11 19:28:15 +03:00
Roman Khimov
31a559e784
Merge pull request #2591 from nspcc-dev/interop/equality
...
interop: add equality helpers
2022-07-11 18:43:08 +03:00
Roman Khimov
125c2805d3
storage: reduce lock time in (*MemoryStore).Seek
...
It makes a copy of the resulting set, so the lock can be released
earlier. This helps a lot with iterators that keep Seek() unfinished for a
long time,
2022-07-11 16:15:14 +03:00
Roman Khimov
07f58abe3d
result: provide (*Iterator).UnmarshalJSON
...
It makes Iterator more symmetric and simplifies (*Invoke).UnmarshalJSON
code. No functional changes.
2022-07-11 16:15:14 +03:00
Roman Khimov
0c45ff8f51
rpc: simplify result.Invoke creation, remove needless deps
...
Change stack items before marshaling them which makes code in result package
much simpler and not requiring interop, iterator and storage dependencies that
clients shouldn't care about.
This also changes SessionBackedByMPT behavior, now instead of waiting for
traverseiterator call it'll rerun the script immediately if a new session is
created.
2022-07-11 16:15:14 +03:00
Anna Shaleva
78e5f16573
interop: add equality helpers
2022-07-11 15:59:24 +03:00
Roman Khimov
96c4e61063
storage: move Operation into package of its own
...
Don't use storage.* types in rpc/response/result.
2022-07-08 23:30:30 +03:00
Roman Khimov
1e62474514
vm: move InvocationTree into a package of its own
...
result.Invoke shouldn't depend on vm.
2022-07-08 23:30:30 +03:00
Roman Khimov
8cd7b93208
limits: new package with storage limits
...
Packages like core/state or core/mpt shouldn't import whole core/storage just
to get some constant value, it's not a good dependency.
2022-07-08 23:30:30 +03:00
Roman Khimov
9987afea4c
storage: move DB configuration into a package on its own
...
Lightweight thing to import anywhere, pkg/config should not be dependent on
Level/Bolt/anything else.
2022-07-08 23:30:30 +03:00
Roman Khimov
dc59dc991b
config: move metrics.Config into config.BasicService
...
Config package should be as lightweight as possible and now it depends on the
whole metrics package just to get one structure from it.
2022-07-08 23:30:30 +03:00
Roman Khimov
fab8dfb9f8
vm: move State type into a package of its own
...
It's used a lot in other places that need it, but don't need whole VM at the
same time.
2022-07-08 18:34:52 +03:00
Roman Khimov
4333ad4949
result: drop NewBlock/NewHeader/LedgerAux
...
Client's don't care about any of these.
2022-07-08 18:32:31 +03:00
Roman Khimov
04fc737e2e
rpc: drop NewTransactionOutputRaw, move it server-side
2022-07-08 18:30:01 +03:00
Roman Khimov
9462ed71d8
rpc: drop useless RawParams type
...
It doesn't add anything useful to regular Go types and actually native types
are always better to use in the Client. Especially given that this type is
not used by any code outside of the Client itself.
2022-07-08 17:56:20 +03:00
Roman Khimov
113cb0fac3
rpc: rename RawParams to Params in Raw, add comments
...
We've got parameters here and usually we name them Raw when they're
represented by json.RawMessage which is not the case here, so make it a bit
more friendly (the type itself is only used in client internals, so rename is
not a huge problem).
2022-07-08 17:38:56 +03:00
Roman Khimov
9aecfb7c94
rpc/client: correct ID unmarshaling in wsclient
...
We always use uint64 IDs in the client, so we should parse them as such and
not just ints that then are casted to uint64.
2022-07-08 17:38:56 +03:00
Roman Khimov
adab83496c
rpc: move Request, Params and related code server-side
...
It's absolutely irrelevant for the client and request/response packages should
only contain code that is useful on both sides of the conversation. It's OK
for client tests to reuse this code, but the package is used by external
developers and they shouldn't be bothered with it. Nothing changed
functionally here except WSClient simplification. Fixes #2236 .
2022-07-08 17:38:53 +03:00
Anna Shaleva
ef114d6274
rpc: fail invoke.Result unmarshalling on stack unmarshalling error
2022-07-08 17:05:18 +03:00
Anna Shaleva
445cca114a
rpc: restrict the amount of concurrently running iterator sessions
2022-07-08 17:05:18 +03:00
Anna Shaleva
8f73ce08c8
rpc: move session maintenance related code out of the result.Invoke
...
It's server who should be responsible for iterator ID creation and
iterator registration.
2022-07-08 17:05:18 +03:00
Anna Shaleva
4581cc386b
rpc: restrict max number of iterator items for createIteratorUnwrapperScript
2022-07-08 17:05:18 +03:00
Anna Shaleva
9bdd8151af
rpc: restrict (*Client).TraverseIterator with single RPC call
...
Do not unwrap the whole set of iterator values even on demand.
2022-07-08 17:05:18 +03:00
Anna Shaleva
fad061f3d9
rpc: extend iterator-related client functionality
...
Create a set of functions that are able to work with both session-based
iterators, default unpacked iterators and client-side unpacked
iterators.
2022-07-08 17:05:18 +03:00
Anna Shaleva
47ffc1f3e8
rpc: restrict default SessionExpirationTime
2022-07-08 17:05:18 +03:00
Anna Shaleva
b5d39a3ffd
rpc: add configuration extension for MPT-backed iterator sessions
...
Add ability to switch between current blockchain storage and MPT-backed
storage for iterator traversing process. It may be useful because
iterator implementation traverses underlying backed storage (BoltDB,
LevelDB) inside DB's Seek which is blocking operation for BoltDB:
```
Opening a read transaction and a write transaction in the same goroutine
can cause the writer to deadlock because the database periodically needs
to re-mmap itself as it grows and it cannot do that while a read transaction
is open.
If a long running read transaction (for example, a snapshot transaction)
is needed, you might want to set DB.InitialMmapSize to a large enough
value to avoid potential blocking of write transaction.
```
So during bbolt re-mmaping, standard blockchain DB operations (i.e. persist)
can be blocked until iterator resourses release. The described behaviour
is tested and confirmed on four-nodes privnet with BoltDB and
`SessionExpirationTime` set to be 180 seconds. After new iterator session
is added to the server, the subsequent persist took ~5m21s, see the log
record `2022-06-17T18:58:21.563+0300`:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ ./bin/neo-go node -p
2022-06-17T18:52:21.535+0300 INFO initial gas supply is not set or wrong, setting default value {"InitialGASSupply": "52000000"}
2022-06-17T18:52:21.535+0300 INFO MaxBlockSize is not set or wrong, setting default value {"MaxBlockSize": 262144}
2022-06-17T18:52:21.535+0300 INFO MaxBlockSystemFee is not set or wrong, setting default value {"MaxBlockSystemFee": 900000000000}
2022-06-17T18:52:21.535+0300 INFO MaxTransactionsPerBlock is not set or wrong, using default value {"MaxTransactionsPerBlock": 512}
2022-06-17T18:52:21.535+0300 INFO MaxValidUntilBlockIncrement is not set or wrong, using default value {"MaxValidUntilBlockIncrement": 5760}
2022-06-17T18:52:21.535+0300 INFO Hardforks are not set, using default value
2022-06-17T18:52:21.543+0300 INFO no storage version found! creating genesis block
2022-06-17T18:52:21.546+0300 INFO ExtensiblePoolSize is not set or wrong, using default value {"ExtensiblePoolSize": 20}
2022-06-17T18:52:21.546+0300 INFO service is running {"service": "Prometheus", "endpoint": ":2112"}
2022-06-17T18:52:21.547+0300 INFO starting rpc-server {"endpoint": ":20331"}
2022-06-17T18:52:21.547+0300 INFO rpc-server iterator sessions are enabled
2022-06-17T18:52:21.547+0300 INFO service hasn't started since it's disabled {"service": "Pprof"}
2022-06-17T18:52:21.547+0300 INFO node started {"blockHeight": 0, "headerHeight": 0}
_ ____________ __________
/ | / / ____/ __ \ / ____/ __ \
/ |/ / __/ / / / /_____/ / __/ / / /
/ /| / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/ \____/\____/
/NEO-GO:0.99.1-pre-53-g7ccb646e/
2022-06-17T18:52:21.548+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 1}
2022-06-17T18:52:21.550+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 1475228436}
2022-06-17T18:52:22.575+0300 INFO persisted to disk {"blocks": 65, "keys": 1410, "headerHeight": 65, "blockHeight": 65, "took": "28.193409ms"}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 2}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 3}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 4}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 5}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 6}
2022-06-17T18:52:24.549+0300 INFO started protocol {"addr": "127.0.0.1:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 3444438498}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 7}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 8}
2022-06-17T18:52:24.550+0300 INFO node reached synchronized state, starting services
2022-06-17T18:52:24.550+0300 INFO started protocol {"addr": "127.0.0.1:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 2435677826}
2022-06-17T18:52:24.550+0300 INFO starting state validation service
2022-06-17T18:52:24.550+0300 INFO RPC server already started
2022-06-17T18:52:24.550+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:52:24.550+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 10}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 9}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 7}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 6}
2022-06-17T18:52:24.550+0300 INFO started protocol {"addr": "127.0.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 970555896}
2022-06-17T18:52:24.551+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 7}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 6}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 5}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 4}
2022-06-17T18:52:29.564+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 66, "blockHeight": 66, "took": "12.51808ms"}
2022-06-17T18:52:44.558+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 67, "blockHeight": 67, "took": "1.563137ms"}
2022-06-17T18:55:21.549+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "ping/pong timeout", "peerCount": 3}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "ping/pong timeout", "peerCount": 2}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "ping/pong timeout", "peerCount": 1}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "ping/pong timeout", "peerCount": 0}
2022-06-17T18:55:21.553+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 1}
2022-06-17T18:55:21.554+0300 INFO started protocol {"addr": "127.0.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 970555896}
2022-06-17T18:55:24.554+0300 INFO new peer connected {"addr": "172.200.0.4:20333", "peerCount": 2}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "172.200.0.3:20334", "peerCount": 3}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "10.78.13.84:59876", "peerCount": 4}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 5}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "172.200.0.254:20332", "peerCount": 6}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 7}
2022-06-17T18:55:24.556+0300 INFO started protocol {"addr": "172.200.0.4:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 76, "id": 3444438498}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "172.200.0.1:20335", "peerCount": 8}
2022-06-17T18:55:24.558+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 1475228436}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 9}
2022-06-17T18:55:24.558+0300 INFO started protocol {"addr": "172.200.0.3:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 2435677826}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 10}
2022-06-17T18:55:24.559+0300 WARN peer disconnected {"addr": "172.200.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 10}
2022-06-17T18:55:24.560+0300 INFO new peer connected {"addr": "172.200.0.2:20336", "peerCount": 11}
2022-06-17T18:55:24.560+0300 WARN peer disconnected {"addr": "172.200.0.254:20332", "error": "identical node id", "peerCount": 10}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 9}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 10}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "10.78.13.84:59876", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "172.200.0.2:20336", "error": "unexpected empty payload: CMDVersion", "peerCount": 7}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 9}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 10}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 11}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 12}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 11}
2022-06-17T18:55:24.562+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 12}
2022-06-17T18:55:24.562+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 13}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 12}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 11}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 10}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.563+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 10}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 9}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 7}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "max peers reached", "peerCount": 6}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 5}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "max peers reached", "peerCount": 4}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 3}
2022-06-17T18:57:21.551+0300 WARN peer disconnected {"addr": "172.200.0.4:20333", "error": "ping/pong timeout", "peerCount": 2}
2022-06-17T18:57:21.552+0300 WARN peer disconnected {"addr": "172.200.0.3:20334", "error": "ping/pong timeout", "peerCount": 1}
2022-06-17T18:57:21.552+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "ping/pong timeout", "peerCount": 0}
2022-06-17T18:57:21.553+0300 INFO new peer connected {"addr": "172.200.0.4:20333", "peerCount": 1}
2022-06-17T18:57:21.554+0300 INFO new peer connected {"addr": "10.78.13.84:20332", "peerCount": 2}
2022-06-17T18:57:21.555+0300 INFO started protocol {"addr": "172.200.0.4:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 3444438498}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 3}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "10.78.13.84:46076", "peerCount": 4}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "172.200.0.1:20335", "peerCount": 5}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "172.200.0.254:20332", "peerCount": 6}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "10.78.13.84:59972", "peerCount": 7}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 8}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "172.200.0.2:20336", "peerCount": 10}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 11}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 12}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "172.200.0.3:20334", "peerCount": 13}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 14}
2022-06-17T18:57:21.557+0300 INFO started protocol {"addr": "127.0.0.1:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 2435677826}
2022-06-17T18:57:21.557+0300 WARN peer disconnected {"addr": "172.200.0.2:20336", "error": "max peers reached", "peerCount": 13}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 14}
2022-06-17T18:57:21.558+0300 INFO started protocol {"addr": "172.200.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 970555896}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "172.200.0.254:20332", "error": "identical node id", "peerCount": 13}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 14}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "max peers reached", "peerCount": 13}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "10.78.13.84:46076", "error": "identical node id", "peerCount": 12}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 13}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 14}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 15}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "10.78.13.84:59972", "error": "identical node id", "peerCount": 14}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 13}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "10.78.13.84:20332", "error": "unexpected empty payload: CMDVersion", "peerCount": 12}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 11}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "172.200.0.3:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 10}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 8}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 7}
2022-06-17T18:57:21.559+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 1475228436}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 6}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 5}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 4}
2022-06-17T18:58:21.561+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 68, "blockHeight": 68, "took": "5m21.993873018s"}
2022-06-17T18:58:21.563+0300 INFO persisted to disk {"blocks": 8, "keys": 111, "headerHeight": 76, "blockHeight": 76, "took": "2.243347ms"}
2022-06-17T18:58:22.567+0300 INFO persisted to disk {"blocks": 10, "keys": 135, "headerHeight": 86, "blockHeight": 86, "took": "5.637669ms"}
2022-06-17T18:58:25.565+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 87, "blockHeight": 87, "took": "1.879912ms"}
2022-06-17T18:58:40.572+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 88, "blockHeight": 88, "took": "1.560317ms"}
2022-06-17T18:58:55.579+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 89, "blockHeight": 89, "took": "1.925225ms"}
2022-06-17T18:59:10.587+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 90, "blockHeight": 90, "took": "3.118073ms"}
2022-06-17T18:59:25.592+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 91, "blockHeight": 91, "took": "1.607248ms"}
2022-06-17T18:59:40.600+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 92, "blockHeight": 92, "took": "931.806µs"}
2022-06-17T18:59:55.610+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 93, "blockHeight": 93, "took": "2.019041ms"}
```
2022-07-08 17:05:18 +03:00
Anna Shaleva
cbd20eb959
rpc: implement iterator sessions
2022-07-08 17:05:18 +03:00
Roman Khimov
251c9bd89b
block: push PrevStateRoot data into stack item, fix #2551
...
And add compiler/interop support for this.
2022-07-07 15:10:29 +03:00
Roman Khimov
6deb77a77a
compiler: make interface{}() conversions possible
2022-07-07 15:10:29 +03:00
Roman Khimov
ec3d1fae59
compiler: allow to find appropriate methods via selectors
...
c.funcs contains function names using base types, while methods can be defined
on pointers and the value returned from c.getFuncNameFromSelector will have an
asterisk. We can't have the same name used for (*T) and (T) methods, so just
stripping the asterisk allows to get the right one.
2022-07-07 15:10:29 +03:00
Roman Khimov
b57dd2cad6
compiler: properly inline methods, use receiver
...
Notice that this doesn't differentiate between (*T) and (T) receivers always
treating them as is. But we have the same problem with arguments now and the
number of inlined calls is limited, usually we want this behavior.
2022-07-07 15:10:29 +03:00
Roman Khimov
6014dd720f
compiler: don't push X onto the stack for inlined method calls
...
Regular methods need this, because it'll be packed into parameters, but
inlined ones should deal with it in inlining code itself because method
receiver will be some local (aliased) variable anyway.
2022-07-06 18:18:21 +03:00
Roman Khimov
2ba9017207
Merge pull request #2581 from nspcc-dev/sym-dec-in-getnep17balances
...
rpc: add decimals/name/symbol data to getNEPXXBalance
2022-07-05 12:45:50 +03:00
Roman Khimov
ccc820505d
Merge pull request #2554 from nspcc-dev/improve-ws-err
...
rpc: adjust cases when WS connection close error is returned
2022-07-05 12:45:31 +03:00
Roman Khimov
3fbc1331aa
Merge pull request #2582 from nspcc-dev/fix-server-sync
...
network: adjust the way (*Server).IsInSync() works
2022-07-05 12:28:20 +03:00
Roman Khimov
9f05009d1a
Merge pull request #2580 from nspcc-dev/service-review
...
Service review
2022-07-05 12:23:25 +03:00
Anna Shaleva
0835581fa9
network: adjust the way (*Server).IsInSync() works
...
Always return true if sync was reached once. Fix #2564 .
2022-07-05 12:20:31 +03:00
Anna Shaleva
8f53c7d78a
rpc: adjust cases when WS connection close error is returned
...
Do not return error in case of (*WSClient).Close() method was the
initiator of connection closing.
2022-07-05 11:23:29 +03:00
Roman Khimov
3e2eda6752
*: add some comments to service Start/Shutdown methods
2022-07-04 23:03:50 +03:00
Roman Khimov
593f4e8734
Merge pull request #2559 from nspcc-dev/cli/wallet-config
...
cli: allow to specify wallet via configuration file
2022-07-04 19:24:23 +03:00
Anna Shaleva
5f36a7ca0f
*: do not call wallet.Close() explicitly
...
NewWallet and NewWalletFromFile close underlying io.Closer by itself,
no need to close it manually. Introduced in #2184 .
2022-07-04 19:09:48 +03:00
Roman Khimov
c356c14741
rpc: add decimals/name/symbol data to getNEPXXBalance
...
See neo-project/neo-modules#738 and neo-project/neo-modules#741 .
2022-07-04 18:28:27 +03:00
Roman Khimov
926b082d39
Merge pull request #2538 from nspcc-dev/restrict-out-of-bounds
...
core: check methods offsets while contract deploying
2022-07-04 12:54:32 +03:00
Roman Khimov
4afdb9fd89
Merge pull request #2578 from nspcc-dev/getcandidates
...
GetCandidates
2022-07-04 11:13:57 +03:00
Roman Khimov
36d4c17a15
stateroot: wait for the service to stop un Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
58b9ac41e2
stateroot: handle double start/shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
bf462a81fe
notary: wait for the service to finish on Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
0d627c947f
notary: control start/stop state
...
Don't start/stop twice, don't do anything in callbacks if not started.
2022-07-04 11:12:17 +03:00
Roman Khimov
73e34514a5
oracle: wait for the service to stop during Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
cab633ffed
oracle: make double-Shutdown a no-op
2022-07-04 11:12:17 +03:00
Roman Khimov
6b2fc5e056
rpc/client: add Close method
...
Allow to close unused network connections and use it during RPC broadcaster
shutdown, because otherwise we leak them.
2022-07-04 11:12:17 +03:00
Roman Khimov
649fe58550
rpcbroadcaster: properly stop broadcaster
...
Drain channels, wait for everything to stop.
2022-07-04 11:12:17 +03:00
Roman Khimov
c096f32a32
rpc/server: make double Shutdown a no-op
2022-07-01 22:01:04 +03:00
Roman Khimov
527505ea5e
consensus: drain messages and transactions on exit as well
...
There might be some threads blocked on these channels.
2022-07-01 21:55:41 +03:00
Roman Khimov
cd4f46247d
consensus: make double-call to Shutdown a no-op
2022-07-01 21:49:40 +03:00
Roman Khimov
039fcdab5a
rpc: implement getcandidates call, fix #2571
2022-07-01 18:46:44 +03:00
Roman Khimov
0da0bb21ee
rpc: make getnextvalidators behavior compliant with C# node
...
Turns out, our getnextvalidators implementation already works the way
getcandidates is supposed to work, but original getnextvalidators works a bit
differently. It only returns validators, it doesn't return Active flag (all
of them are active) and it represents votes as a number. So for the maximum
compatibility:
* drop non-validator keys from getnextvalidators server-side
* drop Active flag client-side (sorry, it doesn't exist)
* allow unmarshalling old answers along with the new one
This technically breaks `query candidates` CLI command, but it'll be fixed
when getcandidates are to be introduced.
2022-07-01 14:52:02 +03:00
Roman Khimov
c26a962b55
*: use localhost address instead of 127.0.0.1, fix #2575
2022-06-30 16:19:07 +03:00
Anna Shaleva
8ab422da66
*: properly unsubscribe from Blockchain events
2022-06-28 19:09:25 +03:00
Roman Khimov
a748298564
Merge pull request #2567 from nspcc-dev/check-consensus-start
...
consensus: check whether server is started before transaction handling
2022-06-28 18:48:22 +03:00
Anna Shaleva
de203b5c76
consensus: check whether server is started before transaction handling
...
consensus.OnTransaction is a callback, so it can be called at any time.
We need to check whether service (and dBFT) is started before the
subsequent transaction handling like it is done inside the OnPayload
callback.
2022-06-28 18:42:12 +03:00
Roman Khimov
ea69b72cd8
Merge pull request #2560 from nspcc-dev/rpc/extend-logging
...
rpc: extend error log message for failed RPC requests
2022-06-27 09:42:54 +03:00
Roman Khimov
299d55e539
Merge pull request #2558 from nspcc-dev/rpc/fix-signature-decoding
...
rpc: fix compatibility issues of `CreateFunctionInvocationScript`
2022-06-27 08:18:36 +03:00
Anna Shaleva
9488756437
rpc: extend error log message for failed RPC requests
...
Message is always non-empty; Data is allowed to be empty.
2022-06-24 12:44:10 +03:00
Anna Shaleva
a15e52ee3d
rpc: adjust TestInvocationScriptCreationGood testcase
...
Although neo-go can handle both ByteArray and ByteString parameter
types, C# node can't, so let's use the common one for tests. Compat
test:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteString", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1271 0 1070 100 201 2860 537 --:--:-- --:--:-- --:--:-- 3398
{
"jsonrpc" : "2.0",
"id" : 1,
"error" : {
"message" : "Requested value 'ByteString' was not found.",
"data" : " at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)\n at System.Enum.TryParseUInt32Enum(RuntimeType enumType, ReadOnlySpan`1 value, UInt32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, UInt32& result)\n at System.Enum.TryParse[TEnum](ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at System.Enum.TryParse[TEnum](String value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at Neo.SmartContract.ContractParameter.FromJson(JObject json)\n at Neo.Plugins.RpcServer.<>c.<InvokeFunction>b__43_0(JObject p)\n at System.Linq.Enumerable.SelectIListIterator`2.ToArray()\n at Neo.Plugins.RpcServer.InvokeFunction(JArray _params)\n at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)",
"code" : -2147024809
}
}
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteArray", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 507 0 307 100 200 161 105 0:00:01 0:00:01 --:--:-- 266
{
"result" : {
"gasconsumed" : "104526",
"notifications" : [],
"stack" : [],
"script" : "DCEDAS1H52IQrsc745qz0YbgpA/o2Gv6PU+r/aV7oTuI+WoRwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f"
},
"id" : 1,
"jsonrpc" : "2.0"
}
```
2022-06-24 12:37:25 +03:00
Anna Shaleva
aa3a5fc492
rpc: adjust script creation with empty parameters list
...
Always use NEWARRAY0 where possible, see
26d04a642a/src/neo/VM/Helper.cs (L41)
.
Compatibility is tested:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 370 0 248 100 122 127 62 0:00:01 0:00:01 --:--:-- 190
{
"result" : {
"notifications" : [],
"stack" : [],
"script" : "wh8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"gasconsumed" : "98403",
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f"
},
"jsonrpc" : "2.0",
"id" : 1
}
```
2022-06-24 12:37:22 +03:00
Anna Shaleva
171af36ead
rpc: fix Signature parameter unmarshalling
...
It is based64 encoded and decoded, see
5108d1c2c7/pkg/smartcontract/parameter.go (L78)
and
26d04a642a/src/neo/SmartContract/ContractParameter.cs (L150)
and
26d04a642a/src/neo/SmartContract/ContractParameter.cs (L79)
.
Also, TestInvocationScriptCreationGood is extended and compatibility
is tested with the following C# node requests:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "Signature", "value": "4edf5005771de04619235d5a4c7a9a11bb78e008541f1da7725f654c33380a3c87e2959a025da706d7255cb3a3fa07ebe9c6559d0d9e6213c68049168eb1056f"}]] }' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 665 0 381 100 284 197 147 0:00:01 0:00:01 --:--:-- 344
{
"jsonrpc" : "2.0",
"id" : 1,
"result" : {
"notifications" : [],
"stack" : [],
"script" : "DGDh51/nTTnvvV17TjrX3bfl3lrhztr1rXVtvvx7TTznjV/V1rvvbl/rnhzfffzRrdzzt7b3n1rTbl1rvTp3vbnlxvdrd9rTt5t71zrnn13R317rbXdzrzTj3Xrx5vXTnp8RwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f",
"state" : "FAULT",
"gasconsumed" : "104526"
}
}
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "Signature", "value": "Tt9QBXcd4EYZI11aTHqaEbt44AhUHx2ncl9lTDM4CjyH4pWaAl2nBtclXLOj+gfr6cZVnQ2eYhPGgEkWjrEFbw=="}]] }' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 591 0 347 100 244 794 558 --:--:-- --:--:-- --:--:-- 1352
{
"jsonrpc" : "2.0",
"result" : {
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f",
"gasconsumed" : "104526",
"notifications" : [],
"stack" : [],
"script" : "DEBO31AFdx3gRhkjXVpMepoRu3jgCFQfHadyX2VMMzgKPIfilZoCXacG1yVcs6P6B+vpxlWdDZ5iE8aASRaOsQVvEcAfDAFhDBRvRZFizuskiwcewVfZ5Pb9Jv2+UEFifVtS"
},
"id" : 1
}
```
2022-06-22 16:05:14 +03:00
Anna Shaleva
464061c7c1
rpc: refactor TestInvocationScriptCreationGood
...
Convert expected script from hex to base64 in order to match
`invokefunction` RPC response script encoding. No functional
changes.
2022-06-22 16:05:14 +03:00
Anna Shaleva
7c48edaccb
core, rpc: fix height-related issue of historic call functionality
...
Specifying a certain stateroot R as `invoke*historic` RPC-call
parameter, we're willing to perform historic call based on the storage
state of root R. Thus, next block should be of the height h(R)+1. This
allows to use historic functionality for the current blockchain height.
2022-06-20 19:05:22 +03:00
Roman Khimov
5108d1c2c7
Merge pull request #2539 from nspcc-dev/rollback-methods-sorting
...
core: sort native methods in ASCII-compatible way
2022-06-14 22:09:23 +03:00
Roman Khimov
6e475856aa
Merge pull request #2544 from nspcc-dev/rpc/remove-cause
...
rpc: remove Cause field from RPC error
2022-06-10 19:12:13 +03:00
Anna Shaleva
ea6ddbee5b
rpc: get rid of erverError type
...
Retrieve error's HTTP code in a separate method.
2022-06-10 16:47:57 +03:00
Anna Shaleva
6434404081
rpc: extend the list of predefined RPC errors
...
Add a few the most common ones.
2022-06-10 16:47:42 +03:00
Anna Shaleva
ef9eca7cce
rpc: unexport ServerError
...
It's internal server thing that is not for the outside users.
2022-06-10 16:38:41 +03:00
Anna Shaleva
0687924e87
rpc: split response.Error into server/client side
2022-06-10 16:35:51 +03:00
Anna Shaleva
5803923f68
rpc: remove Cause field from RPC error
...
We can use Data field for the same purposes.
2022-06-10 16:35:48 +03:00
Roman Khimov
7b88aedb27
transaction: add fuzz-test, refs. #2374
2022-06-09 13:43:22 +03:00
Roman Khimov
9919fd2cc9
Merge pull request #2548 from nspcc-dev/shuffle-tests
...
Shuffle tests and some other code
2022-06-09 12:28:03 +03:00
Evgeniy Stratonikov
0431e26659
wallet: export SavePretty
method
...
Client code can make use of it, see nspcc-dev/neofs-node#1498 .
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-06-09 09:47:18 +03:00
Roman Khimov
1b7c8f262b
core: add some comment for TestDesignate_DesignateAsRole
...
Closes #1472 at last.
2022-06-08 23:11:14 +03:00
Roman Khimov
ef50518b83
core: move notary tests into the notary package
2022-06-08 23:07:28 +03:00
Roman Khimov
5d573895ad
core: move oracle tests into oracle service
2022-06-08 23:04:47 +03:00
Roman Khimov
017cd558cb
core: move statesync tests into the statesync package
2022-06-08 22:57:48 +03:00
Roman Khimov
ff75e67610
core: move stateroot tests into services/stateroot
...
They test both module and service which is a bit wrong, but separating these
tests will lead to some duplication, so it's OK for now to have them in the
higher-order package (service imports module).
2022-06-08 22:53:09 +03:00
Roman Khimov
167bb72424
core: move Policy contract tests to native
2022-06-08 22:44:25 +03:00
Roman Khimov
a1eccc16e6
core: move benchmarks into bench_test.go
...
They share some functions and they're benchmarks, so let's have them here.
2022-06-08 22:39:57 +03:00
Roman Khimov
2e2d886a2f
core: move Management contract test into native
2022-06-08 22:34:09 +03:00
Roman Khimov
8057c096c6
core: move native invocation tests into native
2022-06-08 22:26:24 +03:00
Roman Khimov
2086bca303
core: move storage-related interop code into the storage package
2022-06-08 22:26:24 +03:00
Roman Khimov
f0d7a1da2a
core: move contract-related tests to the contract package
2022-06-08 19:01:34 +03:00
Roman Khimov
e7e80fda64
core: move TestNativeGetMethod to the native package
2022-06-08 18:51:27 +03:00
Roman Khimov
2127cc4146
core: move Runtime tests to runtime package
2022-06-08 18:46:49 +03:00
Roman Khimov
0055b18a8a
core: export CreateGenesisBlock
...
Nothing bad with it being public.
2022-06-08 18:20:34 +03:00
Roman Khimov
d70caf1da1
core: move GetScriptContainer to runtime
...
It also brings ToStackItem to Block and Transaction, previously this was
avoided to separate block and transaction packages from VM. But turns out
`transaction` depends on `stackitem` already, so this makes little sense (but
can be shuffled in another way if needed).
Context.Container is still a hash.Hashable because we have a number of
occasions (header or MPT root verification) where there is no ToStackItem
implementation possible. Maybe they can go with `nil` Container, but I don't
want to have this risk for now.
2022-06-08 18:12:41 +03:00
Roman Khimov
cdb55740ea
core: move ContractCreate*Account tests into the contract pkg
...
No functional changes.
2022-06-08 16:56:06 +03:00
Roman Khimov
ff1545b7eb
core: move TestContractCall into the contract package
...
It belongs there and now it can be moved. No functional changes.
2022-06-08 16:53:01 +03:00
Roman Khimov
bb021d0778
native: unbind PutContractState from Management
...
It doesn't need Management's state, ID can't really change.
2022-06-08 16:41:28 +03:00
Roman Khimov
209b977e9a
core: move contract-related interop code into appropriate package
...
And move one of the tests with it.
2022-06-08 16:02:07 +03:00
Roman Khimov
10f94e6119
core: move chain dump test into its own package
2022-06-08 15:28:08 +03:00
Roman Khimov
c2b3ee3d8e
core: move basic chain creation into a package of its own
...
This allows to reuse it across different packages.
testchain can't be used because of circular dependencies.
Init() is not changed except for filepath.Join() use instead of direct string
appends which is a better approach anyway. rootpath is required because
current directory will change from package to package.
2022-06-08 15:25:27 +03:00
Roman Khimov
8673d2a79c
Merge pull request #2543 from nspcc-dev/perf-new
...
Minor allocation improvements
2022-06-07 11:04:59 +03:00
Roman Khimov
19ad31dc52
vm: optimize IsSignatureContract
...
We use it a lot in (*Blockchain).IsTxStillRelevant().
name old time/op new time/op delta
IsSignatureContract-8 19.1ns ± 5% 1.2ns ± 4% -93.81% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
IsSignatureContract-8 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
IsSignatureContract-8 0.00 0.00 ~ (all equal)
2022-06-07 10:29:13 +03:00
Roman Khimov
92c94f265c
interop/vm: make VM reusable and use on VM for all in-block execs
...
Avoid allocating again and again. Increases TPS by about 3%.
2022-06-07 10:05:47 +03:00
Roman Khimov
bdc6624c9d
interop: unify VM price getter setting
2022-06-06 22:00:16 +03:00
Roman Khimov
638b04b29a
interop: wrap contract.LoadToken in context.LoadToken
...
Creating a closure in runtime is a relatively costly thing, but it can easily
be avoided.
2022-06-06 21:53:03 +03:00
Anna Shaleva
7612ad1195
rpc: adjust test data
2022-06-06 13:02:29 +03:00
Anna Shaleva
7dcbfcbbdb
rpc: improve WS connection closure error a bit
...
Ref.
https://github.com/nspcc-dev/neofs-node/pull/1480#issuecomment-1147256917 .
2022-06-06 12:58:42 +03:00
Anna Shaleva
1005c1f7db
vm: forbid jumping out of the script bounds
2022-06-06 12:18:19 +03:00
Anna Shaleva
a5b5f88fe2
core: doesn't allow to deploy contract with invalid method offset
...
This commit partially reverts 16bf7c1426
.
2022-06-06 12:18:16 +03:00
Anna Shaleva
bc85f00cc7
Partially revert "core: fix native NEO ABI"
...
This partially reverts commit ca127f1615
.
2022-06-06 12:08:52 +03:00
Roman Khimov
799394192b
state: create buffer/io writer once per TokenTransferLog
...
name old time/op new time/op delta
TokenTransferLog_Append-8 93.0µs ±170% 46.8µs ±152% ~ (p=0.053 n=10+9)
name old alloc/op new alloc/op delta
TokenTransferLog_Append-8 53.8kB ± 4% 38.6kB ±39% -28.26% (p=0.004 n=8+10)
name old allocs/op new allocs/op delta
TokenTransferLog_Append-8 384 ± 0% 128 ± 0% -66.67% (p=0.000 n=10+10)
2022-06-04 00:11:11 +03:00
Roman Khimov
1e5825c4af
core: don't allocate another int for notification handler
...
It'll be serialized anyway.
2022-06-03 23:39:46 +03:00
Roman Khimov
7a2199c495
Merge pull request #2535 from nspcc-dev/drop-hf-prefix
...
config: s/HF_Aspidochelone/Aspidochelone/
2022-06-03 11:59:53 +03:00
Roman Khimov
b6829f36fd
config: s/HF_Aspidochelone/Aspidochelone/
...
HF_ prefix makes zero sense to me. If it's "hardfork", then it's in the
"Hardforks" section already. If it's "hotfix", then it made some sense back
when it was HF_2712_FixSyscallFees, but now it's codenamed anyway. So we can
drop it and have a cleaner config.
2022-06-03 11:53:18 +03:00
Anna Shaleva
629567717f
compiler: make TestNativeHelpersCompile test more verbose
2022-06-03 11:37:50 +03:00
Anna Shaleva
ca519492fc
rpc: adjust test data
2022-06-03 11:37:50 +03:00
Anna Shaleva
d3b15a60a2
core: add test for ABI checks on deploy
...
Make sure it compatible with the reference implementation, see
736c346b9d/src/neo/SmartContract/Helper.cs (L83)
.
2022-06-03 11:37:50 +03:00
Anna Shaleva
16bf7c1426
core: adjust contract script check on deploy
...
Reference implementation doesn't panic if the method offset is out of
the contract script bounds, see:
736c346b9d/src/neo/SmartContract/Helper.cs (L82)
and
a65487fa56/src/Neo.VM/Script.cs (L146)
.
This commit fixes T5 statediff at block #125000 . Neo-go node FAULTed the
deploying transaction:
```
{
"version" : 0,
"sysfee" : "1000106065",
"validuntilblock" : 130758,
"script" : "DdMDeyJuYW1lIjoiTmVwMTdUb2tlbiIsImdyb3VwcyI6W10sImZlYXR1cmVzIjp7fSwic3VwcG9ydGVkc3RhbmRhcmRzIjpbIk5FUC0xNyJdLCJhYmkiOnsibWV0aG9kcyI6W3sibmFtZSI6InN5bWJvbCIsInBhcmFtZXRlcnMiOltdLCJyZXR1cm50eXBlIjoiU3RyaW5nIiwib2Zmc2V0IjoyMiwic2FmZSI6dHJ1ZX0seyJuYW1lIjoiZGVjaW1hbHMiLCJwYXJhbWV0ZXJzIjpbXSwicmV0dXJudHlwZSI6IkludGVnZXIiLCJvZmZzZXQiOjIyLCJzYWZlIjp0cnVlfSx7Im5hbWUiOiJ0b3RhbFN1cHBseSIsInBhcmFtZXRlcnMiOltdLCJyZXR1cm50eXBlIjoiSW50ZWdlciIsIm9mZnNldCI6MjIsInNhZmUiOnRydWV9LHsibmFtZSI6ImJhbGFuY2VPZiIsInBhcmFtZXRlcnMiOlt7Im5hbWUiOiJvd25lciIsInR5cGUiOiJIYXNoMTYwIn1dLCJyZXR1cm50eXBlIjoiSW50ZWdlciIsIm9mZnNldCI6MjIsInNhZmUiOnRydWV9LHsibmFtZSI6InRyYW5zZmVyIiwicGFyYW1ldGVycyI6W3sibmFtZSI6ImZyb20iLCJ0eXBlIjoiSGFzaDE2MCJ9LHsibmFtZSI6InRvIiwidHlwZSI6Ikhhc2gxNjAifSx7Im5hbWUiOiJhbW91bnQiLCJ0eXBlIjoiSW50ZWdlciJ9LHsibmFtZSI6ImRhdGEiLCJ0eXBlIjoiQW55In1dLCJyZXR1cm50eXBlIjoiQm9vbGVhbiIsIm9mZnNldCI6MjIsInNhZmUiOmZhbHNlfV0sImV2ZW50cyI6W3sibmFtZSI6IlRyYW5zZmVyIiwicGFyYW1ldGVycyI6W3sibmFtZSI6ImZyb20iLCJ0eXBlIjoiSGFzaDE2MCJ9LHsibmFtZSI6InRvIiwidHlwZSI6Ikhhc2gxNjAifSx7Im5hbWUiOiJhbW91bnQiLCJ0eXBlIjoiSW50ZWdlciJ9XX1dfSwicGVybWlzc2lvbnMiOlt7ImNvbnRyYWN0IjoiKiIsIm1ldGhvZHMiOiIqIn1dLCJ0cnVzdHMiOltdLCJleHRyYSI6eyJlbWFpbCI6ImRldmVsb3BlckBuZW8ub3JnIiwiYXV0aG9yIjoibGF6eW5vZGUiLCJkZXNjcmlwdGlvbiI6IkEgU2ltcGxlIE5lcC0xNyBDb250cmFjdCJ9fQyyTkVGM25lb21sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOaHR0cHM6Ly9naXRodWIuY29tL2xhenlub2RlL25lb21sL2Jsb2IvZGV2L2V4YW1wbGVzL2EuZnVuY3Rpb24uc2ltcGxlbmVwMTcueG1sAAAAABYMBU5lb01MQBhAAgDh9QVAATkFQBFAkA456BLAHwwGZGVwbG95DBT9o/pDRupTKiWPxJfdrdtkN8n9/0FifVtS",
"hash" : "0x40302bcf2021f63a1c24f6009e154c3200f73ad2fe1462d7d599145823dbfa7e",
"witnesses" : [
{
"verification" : "DCECExn08eznGBdguHbcwI+R2//EtVdDx4qf6CeizHqOJgBBVuezJw==",
"invocation" : "DEBtoq+T9NrammQjuYnifco7KHCTk2v+woEJqJCUMr9IscS7PaZaN3FNzSt11yUglIi3T0CJ17KwArBOBvJ8kwq2"
}
],
"attributes" : [],
"signers" : [
{
"scopes" : "None",
"account" : "0x13a192c56738900f9918d7f1ec07d9d8c278b804"
}
],
"size" : 1360,
"nonce" : 1829882407,
"sender" : "NLLvsqs7AyBNmQT6NThUxYWDFwV5b1evaK",
"netfee" : "234352"
}
```
Transaction script contains malformed contract manifest (all methods
offsets are set to be 22, while the contract script lenght is 22):
```
{
"name" : "Nep17Token",
"groups" : [],
"extra" : {
"description" : "A Simple Nep-17 Contract",
"email" : "developer@neo.org",
"author" : "lazynode"
},
"permissions" : [
{
"contract" : "*",
"methods" : "*"
}
],
"features" : {},
"supportedstandards" : [
"NEP-17"
],
"abi" : {
"events" : [
{
"parameters" : [
{
"name" : "from",
"type" : "Hash160"
},
{
"type" : "Hash160",
"name" : "to"
},
{
"name" : "amount",
"type" : "Integer"
}
],
"name" : "Transfer"
}
],
"methods" : [
{
"safe" : true,
"offset" : 22,
"name" : "symbol",
"returntype" : "String",
"parameters" : []
},
{
"returntype" : "Integer",
"parameters" : [],
"safe" : true,
"offset" : 22,
"name" : "decimals"
},
{
"parameters" : [],
"returntype" : "Integer",
"name" : "totalSupply",
"safe" : true,
"offset" : 22
},
{
"parameters" : [
{
"name" : "owner",
"type" : "Hash160"
}
],
"returntype" : "Integer",
"name" : "balanceOf",
"offset" : 22,
"safe" : true
},
{
"name" : "transfer",
"offset" : 22,
"safe" : false,
"parameters" : [
{
"type" : "Hash160",
"name" : "from"
},
{
"name" : "to",
"type" : "Hash160"
},
{
"name" : "amount",
"type" : "Integer"
},
{
"name" : "data",
"type" : "Any"
}
],
"returntype" : "Boolean"
}
]
},
"trusts" : []
}
```
2022-06-03 11:37:50 +03:00
Anna Shaleva
1472c271e6
core: fix native NEO's getCandidateVote
signature
...
This commit fixes T5 statediff at block #0 . Management's storage item
differs between neo-go and C# nodes, the reason in native NEO contract
state.
The parameter should have `pubKey` name, unlike the other `pubkey`
arguments in this contract.
2022-06-03 11:37:50 +03:00
Anna Shaleva
ca127f1615
core: fix native NEO ABI
...
This commit fixes T5 statediff at block #0 . The reason in Management's
storage state. The diff occurs because of inconsistent NEO methods
order. See
https://github.com/neo-project/neo/issues/2766#issue-1257870089 .
The current solution is to preserve C#'s order of methods to be
compatible with current testnet.
See also
https://docs.microsoft.com/ru-ru/dotnet/api/system.stringcomparer?view=net-6.0
and
https://stackoverflow.com/questions/28638714/easiest-method-to-orderby-a-string-using-stringcomparison-ordinal
for more details.
2022-06-03 11:37:41 +03:00
Roman Khimov
edb6ca8926
Merge pull request #2531 from nspcc-dev/perf
...
Minor performance improvements
2022-06-03 10:40:56 +03:00
Roman Khimov
400cbde32c
state: optimize allocations in (*NEP17Transfer).EncodeBinary
2022-06-02 15:38:39 +03:00
Roman Khimov
54f75bb999
consensus: don't use WriteArray for PrepareRequests
...
It's convenient, but it's not efficient due to reflection use.
2022-06-02 15:38:39 +03:00
Roman Khimov
b0744c2b21
util: optimize MarshalJSON allocations
...
name old time/op new time/op delta
Uint256MarshalJSON-8 230ns ± 6% 83ns ±13% -63.78% (p=0.000 n=8+10)
name old alloc/op new alloc/op delta
Uint256MarshalJSON-8 320B ± 0% 80B ± 0% -75.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
Uint256MarshalJSON-8 5.00 ± 0% 1.00 ± 0% -80.00% (p=0.000 n=10+10)
2022-06-02 15:38:39 +03:00
Roman Khimov
9a06995460
bigint: don't allocate in ToPreallocatedBytes
...
Turns out, it's almost always allocating because we're mostly dealing with
small integers while the buffer size is calculated in 8-byte chunks here, so
preallocated buffer is always insufficient.
name old time/op new time/op delta
ToPreallocatedBytes-8 28.5ns ± 7% 19.7ns ± 5% -30.72% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
ToPreallocatedBytes-8 16.0B ± 0% 0.0B -100.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
ToPreallocatedBytes-8 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
Fix StorageItem reuse at the same time. We don't copy when getting values from
the storage, but we don when we're putting them, so buffer reuse could corrupt
old values.
2022-06-02 15:38:39 +03:00
Roman Khimov
c3d989ebda
stackitem: reusable serialization context
...
We serialize items a lot and this allows to avoid a number of allocations.
2022-06-02 15:38:39 +03:00
Anna Shaleva
3bec6657f5
core: adjust notary-related attributes encoding
2022-06-01 15:09:06 +03:00
Anna Shaleva
1b80215415
core: adjust types of NVB, Conflicts and NotaryAssisted attributes
2022-06-01 15:09:06 +03:00
Anna Shaleva
c4f3a92485
rpc: regenerate testchain
2022-06-01 15:09:02 +03:00
Anna Shaleva
d540f16e37
core: adjust noderoles package usages
...
Don't use interop roles package for internal tests.
2022-06-01 15:03:29 +03:00
Anna Shaleva
56d5839a72
core: log stateroot N20 hash inside TestCreateBasicChain
2022-06-01 15:03:29 +03:00
AnnaShaleva
4291efc8f0
services: fix typo in method description
2022-06-01 15:03:29 +03:00
AnnaShaleva
50157b31cd
core: add maximum constraint to setNotaryServiceFeePerKey
2022-06-01 15:03:29 +03:00
AnnaShaleva
d7afb7bb2f
core: adjust value of P2PNotary node role
2022-06-01 15:03:29 +03:00
AnnaShaleva
9008cc500c
core: adjust Notary contract ID
2022-06-01 15:03:29 +03:00
Roman Khimov
3d4076ca36
vm: microoptimize new estack creation
...
Subslice won't reach element -1, but it can reuse the same buffer space more
effectively.
2022-05-31 18:53:05 +03:00
Roman Khimov
10110d4e70
bigint: correct MaxBytesLen
...
It can't be 33, positive signed int256 all fit into 32 bytes (no need for
leading zero), negative ones fit into 32 bytes as well.
2022-05-31 16:51:19 +03:00
Roman Khimov
3945e81857
bigint: don't allocate in ToPreallocatedBytes() for negative numbers
...
In-place modifications are somewhat dangerous, but yet another allocation is
quite costly.
2022-05-31 12:45:34 +03:00
Roman Khimov
3509523baf
contract: tune isolation logic
...
Wrap when we have outer exception handler and the method is not
safe. Otherwise we wrap almost always, since non-readonly methods are very
common.
2022-05-31 11:44:12 +03:00
Roman Khimov
e1607e23c2
Merge pull request #2525 from nspcc-dev/immutable-items
...
vm: implement immutable stackitems
2022-05-31 10:36:56 +03:00