Commit graph

231 commits

Author SHA1 Message Date
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
a1a5db8fcd state: add more convenient method to get native contract hashes 2022-08-15 10:54:29 +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
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
f749aaff3c *: reuse smartcontract package to create standard entry scripts 2022-07-26 12:19:49 +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
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
Anna Shaleva
cbd20eb959 rpc: implement iterator sessions 2022-07-08 17:05:18 +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
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
2127cc4146 core: move Runtime tests to runtime package 2022-06-08 18:46:49 +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
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
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
bc85f00cc7 Partially revert "core: fix native NEO ABI"
This partially reverts commit ca127f1615.
2022-06-06 12:08:52 +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
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
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
Anna Shaleva
42a051e55a core: DeepCopy notifiction event args inside System.Runtime.Notify 2022-05-31 08:07:53 +03:00
Anna Shaleva
7296f0c913 vm: support immutable compound types 2022-05-31 08:07:50 +03:00
Roman Khimov
502cdd68ab
Merge pull request #2508 from nspcc-dev/snapshot-isolation
core, vm: implement snapshot isolation
2022-05-27 12:44:06 +03:00
Anna Shaleva
8055952bbc core: rename hardfork HF_2712_FixSyscallFees
Fantastic Beasts and Where to Find Them
2022-05-26 14:20:48 +03:00
Anna Shaleva
c4ad434f20 core: adjust System.Runtime.GetRandom
1. Make seed dependant on the GetRandom invocations counter.
2. Adjust syscall price.
2022-05-26 14:20:12 +03:00
Anna Shaleva
a79c80cb8d vm: wrap cross-contract exceptions 2022-05-26 11:44:26 +03:00
Anna Shaleva
a39b7cc3fd core, vm: move all isolation-related logic out of VM
Keep it inside the interop context.
2022-05-26 09:26:31 +03:00
Anna Shaleva
f79f62dab4 vm: use single function instead of committer/discarder 2022-05-26 09:26:31 +03:00
Anna Shaleva
08b68e9b82 vm, core: push Null return value only if no exception occurs
Close https://github.com/nspcc-dev/neo-go/issues/2509.
2022-05-26 09:26:31 +03:00
Anna Shaleva
0cd19f550e core, vm: implement snapshot isolation
Initial implementation without optimisations, but it should work.
2022-05-26 09:26:25 +03:00
Anna Shaleva
deb1f6d3d8 core: emit notification events in a separate method 2022-05-19 08:48:26 +03:00
Anna Shaleva
e70bf7d12e core: allow to create hard-fork 2022-05-11 14:21:38 +03:00
Elizaveta Chichindaeva
28908aa3cf [#2442] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Anna Shaleva
473955c2d6 core: use proper current block height/hash for interop API 2022-04-29 18:00:46 +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
d942940a82 core: support System.Runtime.GetAddressVersion syscall 2022-04-21 19:26:16 +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
9bfb3357f2 storage: add "private" mode to MemCachedStore
Most of the time we don't need locking on the higher-level stores and we drop
them after Persist, so that's what private MemCachedStore is for.

It doesn't improve things in any noticeable way, some ~1% can be observed in
neo-bench under various loads and even less than that in chain processing. But
it seems to be a bit better anyway (less allocations, less locks).
2022-02-17 22:27:39 +03:00
Roman Khimov
aefb26255a dao: drop DAO interface
It's a remnant from the days when we had Simple and Cached DAO
implementations, now it makes zero sense.
2022-02-16 18:24:20 +03:00
Roman Khimov
cda1c75db3 core: drop GetStandBy* methods
They're misleading now that we have variable number of committee
members/validators. The standby list can be seen in the configuration and the
appropriate numbers can be received from it also.
2022-01-31 23:14:38 +03:00
Roman Khimov
ab2e60458d interop: drop blockchainer dependency
Use local interface.
2022-01-14 19:57:16 +03:00