Anna Shaleva
b77b412b04
core: refactor signature of (*NEO).dropCandidateIfZero
...
It never returns an error.
2022-04-29 16:10:04 +03:00
Anna Shaleva
c36448f27e
core: don't reset NEO's registerPrice cache
2022-04-29 16:10:04 +03:00
Anna Shaleva
adec635f0e
core: don't reset NEO's gasPerBlock cache
2022-04-29 16:10:04 +03:00
Anna Shaleva
35d160075d
core: keep Policy cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
78b584053d
core: keep Oracle cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
0f6bf33f86
core: keep Notary cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
27b0193da0
core: use native cache to check whether the same contract exists on deploy
2022-04-29 16:10:04 +03:00
Anna Shaleva
c0b490c7bf
core: keep Management cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
11ab42d91c
core: keep Designation cache always valid and up-to-date
...
Always use cache instead of DAO where possible. Update cache in-place
each time new designated node is chosen.
2022-04-29 16:10:04 +03:00
Anna Shaleva
c8bdd2ad1a
core: remove Persist from NativeCache interface
...
Lower native cache should be assigned to the upper's value during persist.
2022-04-29 16:10:04 +03:00
Anna Shaleva
8ec8511d9d
core: remove mutexes and atomic values from native cache
...
Native cache is always wrapped into independant layers, so concurrent
RW access is no-op.
2022-04-29 16:10:04 +03:00
Anna Shaleva
7b632c8ee8
core: refactor natives cache
...
1. Use layered natives cache. With layered cache the storeblock
process includes the following steps: create a wrapper over
current nativeCache, put changes into upper nativeCache layer,
persist (or discard) changes.
2. Split contract getters to read-only and read-and-change. Read-only
ones doesn't require the copy of an existing nativeCache item.
Read-and-change ones create a copy and after that change the copy.
2022-04-29 16:10:04 +03:00
Anna Shaleva
aa886f67ce
core: use dao-binded cache for native contracts
...
All native cached values are binded to DAO, so that it's possible
to properly handle historic calls.
2022-04-29 16:10:04 +03:00
Anna Shaleva
812fa3f76a
core: initialize NEO config cache in constructor
...
It isn't changed within the contract lifetime, thus initialisation can be
safely performed in constructor.
2022-04-29 16:10:04 +03:00
Anna Shaleva
e63d6aeff7
core: move natives cache initialisation to a separate method
2022-04-29 16:10:04 +03:00
Anna Shaleva
93fde3b4e6
core: fix typo in TestCreateBasicChain
2022-04-29 16:10:04 +03:00
Anna Shaleva
63c26ca270
core, rpc: support [invokefunction, invokescript, invokecontractverify]historic
2022-04-29 16:10:04 +03:00
Anna Shaleva
f8b5972f61
core: support Store interface over MPT
2022-04-29 16:10:04 +03:00
Anna Shaleva
0cf525d62e
core: add ability to traverse backwards for Billet
2022-04-29 16:10:04 +03:00
Roman Khimov
3ae1647940
Merge pull request #2447 from nspcc-dev/gettransactionsigners
...
core: add GetTransactionSigners method to native Ledger
2022-04-29 11:58:38 +03:00
Anna Shaleva
1762fd9128
core: add test to check GetTransactionSigners interop API
2022-04-29 11:34:26 +03:00
Anna Shaleva
8ca8a825ef
compiler: add compatibility test for GetTransactionSigners interop API
2022-04-29 11:34:22 +03:00
Anna Shaleva
441a3eb34c
interop: add API for getTransactionSigners
Ledger's method
2022-04-29 11:22:21 +03:00
Anna Shaleva
47d52bd9c5
core: add getTransactionSigners method to native Ledger
2022-04-29 11:18:58 +03:00
Anna Shaleva
aaf7c423b4
core: remove voter reward per committee properly
...
(*Simple).Seek cuts search prefix, thus to remove voterRewardPerCommittee
we need to append it again to the height value. May affect dumps.
2022-04-28 17:15:18 +03:00
Roman Khimov
10acdbe40e
Merge pull request #2453 from nspcc-dev/check-policy-for-committee-members
...
Check policy for committee members
2022-04-28 12:58:07 +03:00
Roman Khimov
ef93fd8cde
Merge pull request #2448 from nspcc-dev/rpc/fix-initialgas
...
rpc: support InitialGasDistribution response from older Neo-Go nodes
2022-04-27 23:13:24 +03:00
Roman Khimov
a8607e43b1
native: check candidates againt Policy blocked list
...
Follow neo-project/neo#2695 and neo-project/neo#2707 .
2022-04-27 22:58:52 +03:00
Roman Khimov
bf3415e2bc
emit: introduce CheckSig function
...
Which allows to create verification scripts without keys.PublicKey which is
convenient in some cases where we already have serialized key and don't want
to waste time decompressing it.
2022-04-27 22:57:10 +03:00
Anna Shaleva
9862b40f2c
rpc: support InitialGasDistribution response from old Neo-Go nodes
...
https://github.com/nspcc-dev/neo-go/pull/2435 breaks compatibility
between newer RPC clients and older RPC servers with the following
error:
```
failed to get network magic: json: cannot unmarshal string into Go struct field Protocol.protocol.initialgasdistribution of type int64
```
This behaviour is expected, but we can't allow this radical change.
Thus, the following solution is implemented:
1. RPC server responds with proper non-stringified
InitialGasDistribution value. The value represents an integral
of fixed8 multiplied by the decimals.
2. RPC client is able to distinguish older and newer responses. For
older one the stringified value without decimals part is
expected. For newer responses the int64 value with decimal part
is expected.
The cludge will be present in the code for a while until nodes of
version <=0.98.3 become completely absolete.
2022-04-27 19:00:46 +03:00
Roman Khimov
b8edf4ac73
Merge pull request #2450 from nspcc-dev/fix-ws
...
rpc: avoid panic during WSClient request after WS connection is closed
2022-04-27 17:02:45 +03:00
Anna Shaleva
c042c5bb63
Revert "rpc: adjust getversion
RPC response"
...
This reverts commit 1c6afe402f
.
2022-04-27 14:39:19 +03:00
Anna Shaleva
35d930951c
core: consider Rules witness scope as valid
2022-04-27 12:48:33 +03:00
Anna Shaleva
65dbe85ec5
rpc: avoid panic during request after WS connection is closed
...
Fix the following panic:
```
panic: assignment to entry in nil map
goroutine 131 [running]:
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).registerRespChannel(0xc00033c240, 0x0, 0xc00003e2a0)
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/wsclient.go:244 +0x96
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).makeWsRequest(0xc00033c240, 0xc002080000)
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/wsclient.go:264 +0x69
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).performRequest(0xc00033c240, {0xc9f173, 0xd}, {{0x13d09d0, 0x0, 0x0}}, {0xb44120, 0xc00147a000})
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/client.go:186 +0x15d
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).GetBlockCount(0xc001fb5440)
/home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/rpc.go:73 +0x69
...
```
2022-04-27 10:53:29 +03:00
Roman Khimov
8983d25f7f
Merge pull request #2445 from nspcc-dev/rpc-when-sync
...
Add StartWhenSynchronized option for RPC server
2022-04-26 14:20:00 +03:00
Roman Khimov
a2126b92e1
rpc/server: only log errors during Shutdown
...
Sending them down the errChan is not really helpful and it can lead to
deadlock. If an error happens during node shutdown, we're exiting anyway, if
it happens during service restart, the old server will be dead irrespective of
this error (if this affects new one in any way we'll know it soon).
2022-04-26 00:31:48 +03:00
Roman Khimov
53423b7c37
network: fix panic in blockqueue during shutdown
...
panic: send on closed channel
goroutine 116 [running]:
github.com/nspcc-dev/neo-go/pkg/network.(*blockQueue).putBlock(0xc00011b650, 0xc01e371200)
github.com/nspcc-dev/neo-go/pkg/network/blockqueue.go:129 +0x185
github.com/nspcc-dev/neo-go/pkg/network.(*Server).handleBlockCmd(0xc0002d3c00, {0xf69b7f?, 0xc001520010?}, 0xc02eb44000?)
github.com/nspcc-dev/neo-go/pkg/network/server.go:607 +0x6f
github.com/nspcc-dev/neo-go/pkg/network.(*Server).handleMessage(0xc0002d3c00, {0x121f4c8?, 0xc001528000?}, 0xc01e35cf80)
github.com/nspcc-dev/neo-go/pkg/network/server.go:1160 +0x6c5
github.com/nspcc-dev/neo-go/pkg/network.(*TCPPeer).handleIncoming(0xc001528000)
github.com/nspcc-dev/neo-go/pkg/network/tcp_peer.go:189 +0x98
created by github.com/nspcc-dev/neo-go/pkg/network.(*TCPPeer).handleConn
github.com/nspcc-dev/neo-go/pkg/network/tcp_peer.go:164 +0xcf
2022-04-26 00:31:48 +03:00
Roman Khimov
887fe0634d
rpc: add StartWhenSynchronized option, fix #2433
2022-04-26 00:31:48 +03:00
Roman Khimov
2593bb0535
network: extend Service with Name, use it to distinguish services
2022-04-26 00:31:48 +03:00
Anna Shaleva
1890e7cdc1
core: upgrade storage version
2022-04-22 18:38:05 +03:00
Anna Shaleva
8be6823cb1
core: fix broken stateroot storage
...
Store stateroot by DataMPTAux prefix instead of storing it by index only.
2022-04-22 18:37:56 +03:00
Roman Khimov
a10b1ad32d
rpc/server: make Server conform network.Service interface
...
With Start() and Shutdown() taking no parameters and returning no values.
2022-04-22 10:49:06 +03:00
Roman Khimov
4eee2f930e
rpc/server: make double-start a no-op
2022-04-22 10:33:52 +03:00
Anna Shaleva
d942940a82
core: support System.Runtime.GetAddressVersion syscall
2022-04-21 19:26:16 +03:00
Erik van den Brink
9fe3a86540
fix typo's
2022-04-20 14:00:12 +02:00
Roman Khimov
f73510b926
Merge pull request #2432 from nspcc-dev/fix-fees
...
core: use proper BaseExecFee and StoragePrice for interop context
2022-04-14 15:10:22 +03:00
Anna Shaleva
1c6afe402f
rpc: adjust getversion
RPC response
...
Reference implementation includes `initialgasdistribution` as integer
value with decimals.
C# response:
```
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"nonce": 1677922561,
"protocol": {
"addressversion": 53,
"initialgasdistribution": 5200000000000000,
"maxtraceableblocks": 2102400,
"maxtransactionsperblock": 512,
"maxvaliduntilblockincrement": 5760,
"memorypoolmaxtransactions": 50000,
"msperblock": 15000,
"network": 860833102,
"validatorscount": 7
},
"tcpport": 10333,
"useragent": "/Neo:3.1.0/",
"wsport": 10334
}
}
```
Neo-Go response:
```
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"network": 860833102,
"nonce": 2847278838,
"protocol": {
"addressversion": 53,
"initialgasdistribution": "52000000",
"maxtraceableblocks": 2102400,
"maxtransactionsperblock": 512,
"maxvaliduntilblockincrement": 5760,
"memorypoolmaxtransactions": 50000,
"msperblock": 15000,
"network": 860833102,
"validatorscount": 7
},
"tcpport": 10333,
"useragent": "/NEO-GO:0.98.2/"
}
}
```
2022-04-14 13:51:30 +03:00
Anna Shaleva
51a54fa248
core: return default BaseExecFee if blockchain height is 0
...
For (bc *Blockchain).GetBaseExecFee().
2022-04-08 14:28:30 +03:00
Anna Shaleva
d3672eb14a
core: use BaseExecFee from InteropContext instead of Blockchain's one
...
The InteropContext's one contains all relevant fee changes applied in
the prevouse transactions of the current block.
2022-04-08 12:56:46 +03:00
Anna Shaleva
544f2c2cb2
core: use proper storage price within the whole interop context
...
We shouldn't use StoragePrice from Blockchain because its dao doesn't
contain the whole set of changes from previouse transactions in the
current block. Instead, we should use an updated storage price for
each transaction and retrieve the price from cached DAO.
2022-04-08 12:50:56 +03:00
Anna Shaleva
91a4bc5beb
core: use proper DAO to get ExecFeeFactor
...
The usage of the Blockchain's one leads to the same ExecFeeFactor within
a single block. What we need is to update ExecFeeFactor after each
transaction invocation, thus, cached DAO should be used as it contains
all relevant changes.
2022-04-08 12:50:50 +03:00
Roman Khimov
6ff11baa1b
Merge pull request #2427 from nspcc-dev/add-hash-to-debug-info
...
Add hash to debug info and use absolute path
2022-04-06 16:11:47 +03:00
Roman Khimov
f5d5019b70
compiler: use absolute paths for debug data
...
It's not a perfect thing, but neo-debugger just doesn't work at all with
relative pathes. Notice that `saveSequencePoint` still used absolute ones
leading to invalid debug.json data, but fixing it there doesn't help,
neo-debugger can't load source code using relatives.
2022-04-06 15:46:54 +03:00
Roman Khimov
e390981747
compiler: add hash field to debug info
...
New debugger won't work without it.
2022-04-06 15:27:01 +03:00
Roman Khimov
017326dca4
Merge pull request #2417 from nspcc-dev/interop-update
...
*: natives update
2022-04-05 19:02:59 +03:00
Roman Khimov
bdcb527ead
Merge pull request #2420 from nspcc-dev/fix-ws
...
rpc: avoid panic on double-call to *WSClient.Close()
2022-04-05 16:41:51 +03:00
Anna Shaleva
850f56b367
rpc: avoid panic on double-call to *WSClient.Close()
...
Although it's the caller's duty to avoid WSClient re-closing, we
still can handle it.
Fixes the following neofs-node error:
```
panic: close of closed channel
goroutine 98 [running]:
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).Close(...)
github.com/nspcc-dev/neo-go@v0.98.3-pre.0.20220321144433-3b639f518ebb/pkg/rpc/client/wsclient.go:120
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber.(*subscriber).Close(0x13)
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber/subscriber.go:108 +0x29
github.com/nspcc-dev/neofs-node/pkg/morph/event.listener.Stop(...)
github.com/nspcc-dev/neofs-node/pkg/morph/event/listener.go:573
created by github.com/nspcc-dev/neofs-node/pkg/innerring.(*Server).Stop
github.com/nspcc-dev/neofs-node/pkg/innerring/innerring.go:285 +0x12f
```
2022-04-05 16:31:51 +03:00
Anna Shaleva
5771bbb52a
services: fix changing of main tx size of Notary request
2022-04-05 16:00:12 +03:00
Anna Shaleva
72ec354039
compiler: add test for murmur32 interop API
2022-04-05 10:51:12 +03:00
Anna Shaleva
16f952270c
core: add murmur32 to CryptoLib native contract
...
Close #2415 .
2022-04-05 10:46:52 +03:00
Anna Shaleva
0e8bf83dda
compiler: add tests for GetTransactionVMState
2022-04-05 10:46:52 +03:00
Anna Shaleva
b431e47d2a
core: add GetTransactionVMState to native Ledger contract
...
Close #2343 .
2022-04-05 10:37:02 +03:00
Anna Shaleva
4254407a9b
dao: add GetTxExecResult method
2022-04-05 10:36:50 +03:00
Anna Shaleva
18c5f638b9
dao: adjust usages of Internal DB inconsistency
error
2022-04-04 19:16:58 +03:00
Anna Shaleva
2972569a0a
vm: make byte representation of VMState compatible with C#
2022-04-04 13:52:29 +03:00
Anna Shaleva
6343720adf
dao: return ErrKeyNotFound from GetAppExecResults for dummy txs
...
Otherwise decoding error may be returned which can be misleading.
2022-04-04 12:49:52 +03:00
Roman Khimov
7b3cc27b5f
LICENSE.md: add NSPCC copyright
2022-04-04 12:34:18 +03:00
Anna Shaleva
9a41356a3b
core: add getUint256FromItem helper to native ledger
2022-04-04 12:33:29 +03:00
Roman Khimov
3f57ff76ab
interop: add a physical copy of LICENSE.md
...
Seems like pkg.go.dev can't pick it up from the symlink.
2022-04-04 12:32:17 +03:00
Roman Khimov
2d60d4021b
Merge pull request #2413 from nspcc-dev/smartcontract-big-numbers
...
smartcontract: allow to use `*big.Int` numbers for integers
2022-04-01 10:38:33 +03:00
Roman Khimov
4e375fd8f4
Merge pull request #2414 from nspcc-dev/eliminate-getstorageitems
...
Eliminate GetStorageItems
2022-04-01 09:16:42 +03:00
Evgeniy Stratonikov
739db259e3
smartcontract: remove unused ParameterFromStackItem
...
It is exists from the times we used `smartcontract.Parameter` somewhere
in the `NotificationEvent`/`ApplicationLog`. `stackitem.ToJSON` now
handles this.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
fe0cd5fe32
smartcontract: remove EncodeBinary
for Parameter
...
It seems, we don't use it anywhere.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
0b0d39f797
smartcontract: allow to use *big.Int
numbers for integers
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:34 +03:00
Roman Khimov
c12a3b71d4
dao: drop GetStorageItems* APIs
...
They're just adding another useless caching layer to the Seek.
2022-03-31 19:18:51 +03:00
Roman Khimov
60375e9db3
core: drop GetStorageItems interface
...
It's not used and not useful.
2022-03-31 16:46:41 +03:00
Roman Khimov
3ab2ab5cba
core: drop outdated comment from storageFind
2022-03-31 16:39:11 +03:00
Anna Shaleva
8965441288
core: rebase core tests onto neotest
2022-03-30 19:00:53 +03:00
Anna Shaleva
35ef58a47e
core: move Oracle response script creation to a separate function
2022-03-30 18:59:43 +03:00
Anna Shaleva
a4dab3a5ba
core: adjust error message of native call
2022-03-30 12:18:01 +03:00
Anna Shaleva
59f3fa1ef1
neotest: adapt framework to work with *testing.B
2022-03-30 12:17:55 +03:00
Anna Shaleva
ff13af804d
core: adjust persist-related Blockchain tests
...
`newTestChain` runs blockchain, so persist is likely already happened
before the first test iteration. Explicit call to persist makes no sence
here.
2022-03-30 11:46:44 +03:00
Anna Shaleva
28e936eb95
core: export GetMaxNotValidBeforeDelta blockchain API
...
Mostly for tests, but it can also be useful as a separate API.
2022-03-30 11:46:44 +03:00
Anna Shaleva
e0ab4ec6f0
core: adjust helper test contract
...
Method is allowed to have single return value on stack after its invocation.
Make sure that test contract follows this rule.
2022-03-30 11:46:44 +03:00
Anna Shaleva
13252bb941
core: refactor helper test contracts generation
...
* Move generator to a separate package.
* Move loader to a separate package and get rid of the code duplications.
2022-03-30 11:46:29 +03:00
Anna Shaleva
889a7ec378
rpc: regenerate basic chain and adjust RPC server tests
2022-03-30 11:32:30 +03:00
Anna Shaleva
4a74c117ee
*: refactor TestCreateBasicChain and its dependencies
...
Close #2355
2022-03-30 11:32:26 +03:00
AnnaShaleva
3b45325319
neotest: extend multichain constructor
2022-03-29 15:01:10 +03:00
Anna Shaleva
150041d25e
core: unexport native Management's GetMinimumDeploymentFee
...
This method is used only from Management contract. We also have
neotest-based tests for `getMinimumDeploymentFee`, it should be enough.
2022-03-29 15:01:10 +03:00
Anna Shaleva
bedfd75086
neotest: port fix from 91350c3a48
2022-03-29 15:01:07 +03:00
Roman Khimov
c039133acf
Merge pull request #2408 from nspcc-dev/improve-examples
...
Improve examples&documentation
2022-03-25 18:16:50 +03:00
Roman Khimov
52893d6a00
Merge pull request #2409 from nspcc-dev/network-message
...
network: check compressed payload size in `decompress`
2022-03-24 21:22:53 +03:00
Evgeniy Stratonikov
34b1b52784
network: check compressed payload size in decompress
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-24 17:22:55 +03:00
Roman Khimov
be7527409c
compiler: fix panic in notification check
...
Options is a pointer, so it can be nil:
--- FAIL: TestCompiler (0.23s)
--- FAIL: TestCompiler/TestCompile (0.21s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x960374]
goroutine 8861 [running]:
testing.tRunner.func1.2({0xa604c0, 0x112c230})
/usr/lib64/go/1.18/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
/usr/lib64/go/1.18/src/testing/testing.go:1392 +0x39f
panic({0xa604c0, 0x112c230})
/usr/lib64/go/1.18/src/runtime/panic.go:838 +0x207
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).processNotify(0xc0000eba40, 0xc000233ae0?, {0xc00044ae90, 0x1, 0x1})
/home/rik/dev/neo-go/pkg/compiler/inline.go:134 +0xd4
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).processStdlibCall(0xc0000eba40?, 0xc000233ae0, {0xc00044ae90, 0x1, 0x1})
/home/rik/dev/neo-go/pkg/compiler/inline.go:124 +0xda
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).inlineCall(0xc0000eba40, 0xc000233ae0, 0xc0001fe5c0)
/home/rik/dev/neo-go/pkg/compiler/inline.go:35 +0x1fa
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36bf8?, 0xc0001fe5c0?})
/home/rik/dev/neo-go/pkg/compiler/codegen.go:932 +0x152c
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36bf8?, 0xc0001fe5c0?})
/usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36db0?, 0xc00044aeb0?})
/usr/lib64/go/1.18/src/go/ast/walk.go:207 +0x1154
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36ba8?, 0xc0001cce70?})
/home/rik/dev/neo-go/pkg/compiler/codegen.go:1155 +0x54cd
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36ba8?, 0xc0001cce70?})
/usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36f68?, 0xc0001fe600?})
/home/rik/dev/neo-go/pkg/compiler/codegen.go:733 +0x2e30
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36f68?, 0xc0001fe600?})
/usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36ba8?, 0xc0001ccea0?})
/home/rik/dev/neo-go/pkg/compiler/codegen.go:1155 +0x54cd
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36ba8?, 0xc0001ccea0?})
/usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertFuncDecl(0xc0000eba40, {0xd36e28, 0xc000256700}, 0xc0001cced0, 0xc00041b68c?)
/home/rik/dev/neo-go/pkg/compiler/codegen.go:502 +0x97d
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile.func2(0xc000256700, 0xc0001c64b0)
/home/rik/dev/neo-go/pkg/compiler/codegen.go:2129 +0x1f9
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile.func1(0xc000254a00)
/home/rik/dev/neo-go/pkg/compiler/compiler.go:102 +0x96
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc0000eba40, 0xc0002f3c68)
/home/rik/dev/neo-go/pkg/compiler/compiler.go:93 +0xdb
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile(0xa1f700?, 0xc000448f90?)
/home/rik/dev/neo-go/pkg/compiler/compiler.go:99 +0x4d
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc0000eba40, 0xc00022c390, 0x1?)
/home/rik/dev/neo-go/pkg/compiler/codegen.go:2116 +0x3d6
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc00022c390)
/home/rik/dev/neo-go/pkg/compiler/codegen.go:2167 +0x373
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc000c525a0?, 0x16?}, {0x0?, 0x0?}, 0x0)
/home/rik/dev/neo-go/pkg/compiler/compiler.go:218 +0x7d
github.com/nspcc-dev/neo-go/pkg/compiler.Compile({0xc000c525a0?, 0xc000304340?}, {0x0?, 0x0?})
/home/rik/dev/neo-go/pkg/compiler/compiler.go:203 +0x34
github.com/nspcc-dev/neo-go/pkg/compiler_test.compileFile(...)
/home/rik/dev/neo-go/pkg/compiler/compiler_test.go:89
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestCompiler.func2(0x6a2a89?)
/home/rik/dev/neo-go/pkg/compiler/compiler_test.go:61 +0x133
testing.tRunner(0xc000304340, 0xc7f5b0)
/usr/lib64/go/1.18/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
/usr/lib64/go/1.18/src/testing/testing.go:1486 +0x35f
2022-03-24 16:34:18 +03:00
Roman Khimov
7fe462a65d
neotest/chain: improve comments
2022-03-23 23:11:39 +03:00
Roman Khimov
f6094c8c4e
neotest: use public constants for default configuration
...
And be more consistent about MaxTraceableBlocks use.
2022-03-23 23:11:27 +03:00
Roman Khimov
208e38803c
neotest: add some high-level documentation
2022-03-23 22:48:41 +03:00
Roman Khimov
479eda6786
interop: add LICENSE.md into the package
...
Otherwise pkg.go.dev refuses to display the documentation.
2022-03-23 18:26:02 +03:00
Roman Khimov
9d5b8d606a
server: quote method in logs, fix CodeQL warnings
...
CWE-117:
Log entries created from user input
If unsanitized user input is written to a log entry, a malicious user may be able to forge new log entries.
2022-03-22 16:05:06 +03:00
Roman Khimov
0a338ea94b
rpc/server: register ws calls in Prometheus
...
They were completely missing.
2022-03-21 23:18:00 +03:00
Roman Khimov
d5a9af5860
Revert "Revert "interop: use All flags for management deploy and update calls""
...
This reverts commit 526c423a61
, heading to 3.2.0.
2022-03-21 17:41:37 +03:00
Roman Khimov
526c423a61
Revert "interop: use All flags for management deploy and update calls"
...
This reverts commit 37ca96c20b
and a part of
7945097543
, we need 0.98.2 release to be
3.1.0-compatible and this one breaks the testnet.
2022-03-21 14:32:11 +03:00
Roman Khimov
ad1dd3ebb7
Merge pull request #2399 from nspcc-dev/fuzz-tests
...
vm: add some Fuzz tests
2022-03-21 12:00:55 +03:00
Evgeniy Stratonikov
3f65473f64
vm: add some Fuzz tests
...
Both `IsScriptCorrect` and `VM.Run` should never panic.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-18 16:13:39 +03:00
Roman Khimov
906d99571b
Merge pull request #2369 from nspcc-dev/goshechka
...
*: go 1.18 support 🎉 😍 🎊 🍰 🥂
2022-03-18 15:07:20 +03:00
Roman Khimov
4869049965
Merge pull request #2398 from nspcc-dev/trim-micro
...
block/dao: simplify trimming, avoid allocations
2022-03-18 12:39:53 +03:00
Roman Khimov
5616585697
block/dao: simplify trimming, avoid allocations
...
The only user of (*Block).Trim() is in DAO and it already has a nice buffer
usually, so creating another one makes no sense. It also simplifies error
handling a lot.
2022-03-18 10:49:25 +03:00
Roman Khimov
c2845852ae
Merge pull request #2397 from nspcc-dev/is-script-correct-panic
...
vm: avoid panic in `IsScriptCorrect`
2022-03-18 10:08:39 +03:00
Evgeniy Stratonikov
ef28308dbf
vm: avoid panic in IsScriptCorrect
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-17 20:12:50 +03:00
AnnaShaleva
a4d402da86
compiler: revert a part of ad65d1fa1f
...
Close #2335 .
2022-03-17 19:39:18 +03:00
Anna Shaleva
753d604784
network: use net.ErrClosed to check network connection was closed
...
Close #1765 .
2022-03-17 19:39:18 +03:00
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +03:00
Roman Khimov
df3eb76aa2
Merge pull request #2396 from nspcc-dev/fuzz-script-panic
...
Return error on negative instruction pointer in `Context.Next`
2022-03-17 19:13:20 +03:00
Evgeniy Stratonikov
492c91b4c5
vm: disallow negative offset in (*Context).Next()
...
Currently the only known reason this can happen is processing
ENDFINALLY opcode before the corresponding ENDTRY.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-17 18:52:48 +03:00
Roman Khimov
5cbf28a104
Merge pull request #2372 from nspcc-dev/jsonpath-oom
...
jsonpath: restrict amount of intermediate objects
2022-03-17 12:34:49 +03:00
Roman Khimov
5379ef75bb
Merge pull request #2391 from nspcc-dev/fix-reverse
...
vm: fix integer conversions
2022-03-10 12:27:10 +03:00
Evgeniy Stratonikov
32f4404954
vm: allow HASKEY on byte-arrays
...
Current neo-vm master has them https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/ExecutionEngine.cs#L1157
Were silently added in
029466fa9d
.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-10 10:34:13 +03:00
Evgeniy Stratonikov
39866b8512
vm: fix integer conversions
...
As can be seen in https://dotnetfiddle.net/s7eg21 (int) conversions
result in an exception in C# code.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-10 10:21:34 +03:00
Evgeniy Stratonikov
a8d2df874f
stackitem: limit JSON size in ToJSONWithTypes
...
Also do not limit depth. It was introduced in e34fa2e915
as a simple
solution to OOM problem. In this commit we do exactly the refactoring
described there. Maximum size is the same as stack item size and
can be changed if needed withouth significat refactoring.
`1 MiB` seems sufficient, though.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-09 10:29:23 +03:00
Roman Khimov
6ece74a7c7
Merge pull request #2383 from nspcc-dev/oracle-redirection
...
services: check Oracle response redirections
2022-03-04 22:19:22 +03:00
Anna Shaleva
5ace840cc7
services: improve Oracle redirection check
...
Move IP check to later stage and do not resolve URI manually.
2022-03-04 19:27:52 +03:00
Roman Khimov
96cd415384
Merge pull request #2382 from nspcc-dev/compiler-optimize
...
compiler: optimize tests
2022-03-04 18:55:40 +03:00
Evgeniy Stratonikov
0e86073a77
compiler: group small tests in a single file
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-04 17:55:33 +03:00
AnnaShaleva
537de18ac3
services: check Oracle response redirections
...
1. Move redirections check to the tcp level. Manually resolve request address
and create connection for the first suitable resolved address.
2. Remove URIValidator. Redirections checks are set in the custom http client,
so the user should take care of validation by himself when customizing the
client.
2022-03-04 13:10:22 +03:00
AnnaShaleva
3d5b1d8d17
rpc: add Rules signer scope to request parameters
2022-03-03 12:18:19 +03:00
Roman Khimov
ff60571869
Merge pull request #2378 from nspcc-dev/notary-adjustments
...
*: several Notary subsystem adjustments, part 1
2022-03-02 11:58:36 +03:00
AnnaShaleva
3996b3abb7
interop: extend native Notary interop API
2022-03-01 19:08:22 +03:00
AnnaShaleva
49e228ddf8
rpc: fix Client's GetOraclePrice
2022-03-01 19:08:22 +03:00
AnnaShaleva
92282c70cb
*: support customisable NotaryServiceFeePerKey value
...
* Add corresponding methods to Notary contract.
* Extend RPC Client API.
* Adjust tests.
2022-03-01 19:08:16 +03:00
Roman Khimov
473d11d24e
Merge pull request #2370 from nspcc-dev/nonzero-blockchain-start
...
core: add tests for non-zero blockchain start
2022-03-01 16:39:17 +03:00
Anna Shaleva
49c995ec06
core: add tests for blockchain initialisation
...
Close #1577 .
2022-02-28 19:00:43 +03:00
AnnaShaleva
8e3f2417f4
core: add check for native activations history
...
It should be consistent with storage states.
2022-02-28 18:49:18 +03:00
Anna Shaleva
032d9749c2
core: improve blockchain error messages
2022-02-28 18:49:18 +03:00
Anna Shaleva
a57c3f4842
core: fix InitWithIncompleteStateJump test
2022-02-28 18:49:18 +03:00
Anna Shaleva
9adcefc2ef
core: gracefully wrap Seek error if failed to retrieve header hases
2022-02-28 18:49:18 +03:00
Anna Shaleva
8d6aa1782d
core: fix StateRootInHeader error message for (*Blockchain).init()
2022-02-28 18:49:18 +03:00
Anna Shaleva
ad0c53c067
core: unify the format of error messages for (*Blockchain).init()
2022-02-28 18:49:12 +03:00
Evgeniy Stratonikov
a2cef15932
compiler: emit bindings configuration
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-28 15:36:14 +03:00
Evgeniy Stratonikov
422a80f483
jsonpath: restrict amount of intermediate objects
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-28 13:18:34 +03:00
Anna Shaleva
21515e1835
core: refactor Level store creation for tests
...
We don't need to create the whole DB configuration structure.
2022-02-25 12:14:17 +03:00
Anna Shaleva
339bec1632
core: adjust TestDumpAndRestore test
...
`with state root` test should consider StateRootInHeader set to true.
2022-02-25 11:47:13 +03:00
Roman Khimov
870fd024c9
Merge pull request #2367 from nspcc-dev/rpc/thread-safe
...
rpc: take care of RPC clients
2022-02-24 20:11:15 +03:00
Anna Shaleva
1f255e756f
rpc: add a note to RPC clients about thread-safeness
2022-02-24 19:01:21 +03:00
Anna Shaleva
2896c0a83a
rpc: add test for concurrent WSClient access and request IDs generation
2022-02-24 19:01:21 +03:00
AnnaShaleva
0d8723527c
rpc: refactor WSClient initialisation
...
Fix the following linter warning:
```
pkg/rpc/client/wsclient.go:99:18 govet copylocks: literal copies lock value from *cl: github.com/nspcc-dev/neo-go/pkg/rpc/client.Client contains sync.RWMutex
```
2022-02-24 19:01:21 +03:00
AnnaShaleva
8991ee91cd
rpc: make RPC WSClient thread-safe
...
Add ability to use unique request IDs for RPC requests.
2022-02-24 19:01:12 +03:00
Roman Khimov
b65ab011fe
Merge pull request #2349 from nspcc-dev/codegen-contract
...
cli/smartcontract: generate bindings to an existing contract
2022-02-24 15:51:33 +03:00
Anna Shaleva
0357d9f4f4
smartcontract: add hash check to paramcontext
...
Close #2344 .
2022-02-24 10:21:08 +03:00
Evgeniy Stratonikov
da03d895de
cli/smartcontract: generate bindings to an existing contract
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-23 15:40:06 +03:00
AnnaShaleva
5b2e88b916
rpc: protect supscriptions of RPC WSClient from concurrent access
2022-02-22 15:40:08 +03:00