Anna Shaleva
2a8ffd9318
core: refactor (*NEO).GetCandidates and add (*NEO).GetAllCandidates
2022-05-06 13:43:12 +03:00
Roman Khimov
75d06d18c9
Merge pull request #2466 from nspcc-dev/rules-fixes
...
Rules scope fixes
2022-05-06 11:09:39 +03:00
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
Roman Khimov
740488f7f3
Merge pull request #2442 from EliChin/feature/eng_review
...
English Check
2022-05-05 17:12:37 +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
ffdcdf4a95
core: restrict the maximum number of contract updates
2022-05-04 13:56:52 +03:00
Anna Shaleva
42e4021898
core: block destroyed contracts
2022-05-04 13:56:45 +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
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
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
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
906d99571b
Merge pull request #2369 from nspcc-dev/goshechka
...
*: go 1.18 support 🎉 😍 🎊 🍰 🥂
2022-03-18 15:07:20 +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
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +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
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
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
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
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
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
7d6f087337
storage: drop (KeyPrefix).Bytes() API
...
It allocates and most of the time we can avoid that.
2022-02-18 15:19:57 +03:00
Roman Khimov
7223caf369
dao: improve PutCurrentHeader logic
...
Move serialization out of the core.
2022-02-18 15:05:25 +03:00
Roman Khimov
522229d731
storage: drop AppendPrefix/AppendPrefixInt APIs
...
We're not using them anymore and they allocate.
2022-02-18 14:59:59 +03:00
Roman Khimov
d2db58d748
dao: move header hash store logic out of the core
...
Which allows for more efficient buffer use along the way.
2022-02-18 14:54:05 +03:00
Roman Khimov
de2579ec07
dao: put contract IDs into keys using big endianness
...
We don't have a need to iterate over them at the moment, but since we're
changing the DB format in the next release anyway let's add this ability also,
just in case.
2022-02-18 14:38:51 +03:00
Roman Khimov
600da6909c
storage: put uint32 into keys using in big endianness
...
Which allows to iterate over the contents easily.
2022-02-18 14:35:17 +03:00
Roman Khimov
1ca918e631
dao: delay buffer creation until it's needed
...
Verification contexts don't ever touch the storage, so these allocations can
be avoided for them.
2022-02-18 14:24:45 +03:00
Roman Khimov
e864768c88
dao: simplify NewPrivate
2022-02-18 14:18:56 +03:00
Roman Khimov
5402e654d1
core: don't create useless DAO layer in GetTestVM
...
We're already wrapping in interop.NewContext.
2022-02-18 14:12:44 +03:00
Roman Khimov
b60d4ff191
dao: deduplicate header->KV conversion
2022-02-18 14:12:44 +03:00
Roman Khimov
d8cf879499
dao: deduplicate DeleteBlock, no functional changes
2022-02-18 14:12:44 +03:00
Roman Khimov
f80680187e
storage: expose private storage map for more efficient MPT batch
...
It couldn't be done previously with two maps and mixed storage, but now all of
the storage changes are located in a single map, so it's trivial to do exact
slice allocations and avoid string->[]byte conversions.
2022-02-17 23:41:10 +03:00
Roman Khimov
7dc8fc443f
dao: simplify buffer management for private DAO
...
Private DAO is only used in a single thread which means we can safely reuse
key/data buffers most of the time and handle it all in DAO.
Doesn't affect any benchmarks.
2022-02-17 22:27:39 +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