Commit graph

1863 commits

Author SHA1 Message Date
Roman Khimov
acb1151d71 transaction: fix maxSubitems handling in JSON scope unmarshaller
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can
be checked with neo-project/neo#2720 case.
2022-05-06 10:20:55 +03:00
Roman Khimov
bd352daab4 transaction: fix Rules stringer, it's WitnessRules in C#
See neo-project/neo#2720.
2022-05-06 10:08:09 +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
9cc41528ef core: avoid unnecessary NEO cached values copying 2022-04-29 16:10:04 +03:00
Anna Shaleva
335c1ee369 core: optimize access to NEO cache
Do not copy RW cache each block. Instead we should get RO cache and
change it only if there's a necessity.
2022-04-29 16:10:04 +03:00
Anna Shaleva
a6a0c1eb12 core: avoid lock copy in private DAO constructor
Fix the following linter warning:
```
pkg/core/dao/dao.go:101:7  govet  copylocks: assignment copies lock value to *d: github.com/nspcc-dev/neo-go/pkg/core/dao.Simple contains sync.RWMutex
```
2022-04-29 16:10:04 +03:00
Anna Shaleva
8d2d48f360 core: move native cache from MemCachedStore to DAO 2022-04-29 16:10:04 +03:00
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
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
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
Anna Shaleva
35d930951c core: consider Rules witness scope as valid 2022-04-27 12:48:33 +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
Anna Shaleva
d942940a82 core: support System.Runtime.GetAddressVersion syscall 2022-04-21 19:26:16 +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
Anna Shaleva
16f952270c core: add murmur32 to CryptoLib native contract
Close #2415.
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
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
Anna Shaleva
9a41356a3b core: add getUint256FromItem helper to native ledger 2022-04-04 12:33:29 +03:00
Roman Khimov
4e375fd8f4
Merge pull request #2414 from nspcc-dev/eliminate-getstorageitems
Eliminate GetStorageItems
2022-04-01 09:16:42 +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