Commit graph

204 commits

Author SHA1 Message Date
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
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
Roman Khimov
c942402957 blockchainer: drop Policer interface
We never use it as a proper interface, so it makes no sense keeping it this
way.
2022-01-12 00:58:03 +03:00
Roman Khimov
83d0b2f465 interop: move invocation counter from VM to Context
It's created for interop and used by interop, VM doesn't care.
2021-11-20 21:57:41 +03:00
Roman Khimov
29cda5112a vm: simplify NEF loading by providing a special method
Offsets are still handled outside of VM to avoid introducing manifest
dependency (that's likely to be circular).
2021-11-20 21:57:41 +03:00
Roman Khimov
c53d978edd vm: drop ParamCount from Context
It's unused and it's useless.
2021-11-20 21:57:41 +03:00
Roman Khimov
765235eca3 vm: omit context parameter from Call()
It's not used and should not be used to switch from contract to contract.
2021-11-20 21:57:41 +03:00
Roman Khimov
a577d40de9 vm: move Jump method to the Context
Because it's only relevant for execution context itself.
2021-11-20 21:57:35 +03:00
Roman Khimov
8c704a49b5 interop/contract: micro-optimize argument pushes
Calling Estack() again and again is not very productive.
2021-11-19 16:26:01 +03:00
Roman Khimov
d1f4928e29 contract: drop useless code from call processing
It's done already by LoadScriptWithCallingHash()
2021-11-19 16:22:30 +03:00
Roman Khimov
f96d9d168e native/interop: use oracle request signers for oracle response witness
Oracle responses must use the same set of signers as oracle requests even
though the transaction itself is signed by oracle nodes/contract.

We can probably improve interop.Context by removing Tx field completely and
adding more functionality to Container, but it's not very convenient for
VerifyWitness and will require adding more stub-like methods for Block, so Tx
is used for now (and we do have it in every relevant case).
2021-11-16 11:51:15 +03:00
Roman Khimov
9cdd360606
Merge pull request #2251 from nspcc-dev/rules-witness-scope
transaction: add new Rules witness scope
2021-11-12 18:25:39 +03:00
Roman Khimov
9875799893 transaction: add new Rules witness scope
See neo-project/neo#2622. The implementation is somewhat asymmetric (and not
very efficient) for binary/JSON encoding/decoding, but it should be
sufficient.
2021-11-12 15:29:28 +03:00
Anna Shaleva
1a32fcb2dc core: specify method not found call error
It's useful for debugging and external users.
2021-11-08 17:19:00 +03:00
Anna Shaleva
07cbe4d253 core: add finalizer functions to interop context
These functions are aimed to free the resources occupied by storage
iterator by the end of script execution or whenever Finilize is called.
2021-10-21 10:05:12 +03:00
Anna Shaleva
0a4f45c9b0 core: add ability to free storage.Iterator resources 2021-10-21 10:05:12 +03:00
Anna Shaleva
89ee2e7720 core: refactor storage.Find and storage.Iterator to work with channel
Add SeekAsync methods in order to fetch matching storage items
on demand. Refactor storage.Find and storage.Iterator wrt these changes.
2021-10-21 10:05:12 +03:00
Anna Shaleva
06d3c21e3f core: remove unused interopnames 2021-09-21 16:43:09 +03:00
Anna Shaleva
61fd7bd6ba core: avoid nil values during natives manifest marshalling 2021-09-10 11:38:59 +03:00
Roman Khimov
b07347e602 core: reuse PushItem for interops
Probably less critical here, but still let's push things faster.
2021-08-30 23:43:58 +03:00
Roman Khimov
de4ed7d020 runtime: fix CustomGroups witness
See neo-project/neo#2586.
2021-08-24 15:50:24 +03:00
Roman Khimov
2808f6857d interop: don't allocate for Functions and Notifications in New
Functions are usually immediately replaced (and it's OK for them to be nil,
searching through an array with length of zero is fine), Notifications are
usually appended to (and are absolutely useless in verification contexts).
2021-08-20 11:56:28 +03:00
Anna Shaleva
4b35a1cf92 core: remove conflicting transactions wrt MaxTraceableBlocks 2021-08-18 13:31:47 +03:00
Roman Khimov
f477a48758 contract: block calls to contracts via Policy contract
See neo-project/neo#2567.
2021-08-17 15:24:06 +03:00
Roman Khimov
adc660c3e0
Merge pull request #2123 from nspcc-dev/store-better
Store better
2021-08-13 12:50:24 +03:00
Roman Khimov
50ee1a1f91 *: don't use dao.Cached in tests
There is no need to use it.
2021-08-11 21:02:50 +03:00
Roman Khimov
13da1b62fb interop: fetch baseExecFee once and keep it in the Context
It never changes during single execution, so we can cache it and avoid going
to Policer via Chain for every instruction.
2021-08-11 15:42:23 +03:00
Roman Khimov
3cebd2b129 interop: use non-Cached wrapped DAO
Cached only caches NEP-17 tracking data now, it makes no sense here.
2021-07-30 15:45:17 +03:00
Roman Khimov
1d8ad5b84a *: simplify some error messages
Log:
2021-07-23T09:59:18.948+0300    WARN    contract invocation failed      {"tx": "de3e3c1f1d37e4528990f894dea5583fd320485ad3862a95eb0e8823eecf4a5f", "block": 9643, "error": "error encountered at instruction 1 (SYSCALL): error during call from native: error encountered at instruction 745 (CAT): invalid conversion: Map/ByteString"}

The word "error" appears 4 times here.
2021-07-23 10:08:09 +03:00