Evgenii Stratonikov
d136569ac8
core: move System.Binary.*
interops to binary/
package
...
Also extend test suite.
2020-12-02 15:54:03 +03:00
Evgenii Stratonikov
2eb256014e
core: move System.Runtime.*
interops to runtime/
package
...
Also extend test suite.
2020-12-02 15:54:03 +03:00
Evgenii Stratonikov
e4bf531e3e
core: implement System.Binary.Atoi/Itoa
syscalls
...
They follow C# conversion rules, but differ from our `bigint` module
conversions:
1. String must be big-endian.
2. Sign extension is 4-bit in size (single hex character)
and not 8-byte.
2020-11-10 16:15:10 +03:00
Evgenii Stratonikov
877b8ece63
core: move contractCall* to a separate package
2020-09-25 16:32:10 +03:00
Evgenii Stratonikov
f6319f80e8
interop: allow to call CheckWitness without AllowStates
...
State access is needed only in specific circumstances.
2020-08-27 10:29:29 +03:00
Roman Khimov
9c72ea1d64
core/interop: add base58 encoding/decoding syscalls
...
Follow neo-project/neo#1833 .
2020-08-23 17:19:56 +03:00
Roman Khimov
7cba3a0342
core: require AllowStates flag for IsStandard
...
Follow neo-project/neo#1830 .
2020-08-23 15:41:55 +03:00
Evgenii Stratonikov
7854dcfd8f
core: replace interop names with named constants
2020-08-14 14:21:54 +03:00
Evgenii Stratonikov
f3650e20b0
vm: move InteropNameToID to a separate package
2020-08-14 13:54:11 +03:00
Evgenii Stratonikov
23a1430395
core: allow to restrict creating callbacks from syscalls
...
Specify DisallowCallback flag if syscall is not allowed to be used in a
callback.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
Evgenii Stratonikov
99b0397a61
core: implement System.Callback.CreateFromSyscall
interop
...
Allow to create callbacks from syscalls.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
Evgenii Stratonikov
c54b45e76d
core: implement System.Callback.CreateFromMethod
interop
...
Support creating callbacks from contract methods.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
Evgenii Stratonikov
382a7f5b3e
core: implement System.Callback.*
interops
...
Support creating callbacks from pointers.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
Evgenii Stratonikov
51ae12e4fd
*: move syscall handling out of VM
...
Remove interop-related structures from the `vm` package.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
Anna Shaleva
4bf88ba6b0
core: decouple native contracts from interop service
...
Closes #1191 .
2020-07-29 10:33:18 +03:00
Anna Shaleva
8fde41001e
core, vm: remove allowed triggers from syscalls
...
Closes #1205 .
2020-07-23 20:44:39 +03:00
Roman Khimov
d8a1c3de46
Merge pull request #1221 from nspcc-dev/neo3/interop/post-preview2_adjustment3
...
interop: post-preview2 adjustment, part 3
2020-07-23 20:35:53 +03:00
Anna Shaleva
ef8de3b2dc
core: adjust System.Runtime.GetNotifications interop
...
Part of #1055 .
Forgot to add this pretty interop to the list of system interops.
2020-07-23 07:54:51 +03:00
Anna Shaleva
88e003d219
core: adjust System.Runtime.GetTime interop
...
Part of #1055 .
It should have AllowStates flag.
2020-07-23 07:51:24 +03:00
Anna Shaleva
8fed383523
core: adjust System.Runtime.CheckWitness interop
...
Part of #1055 .
It should have `AllowStates` flag.
Also removed unreachable code: we can't have such situation when
script container is not a transaction in the scope of `CheckWitness`
method because:
1. Blocks have their own implementation of CheckWitness for
internal usage (it's (bc *Blockchain) verifyHeaderWitnesses method).
2. For the outside calls of System.Runtime.CheckWitness interop (e.g.
calls from smart-contract) script container is always a transaction.
2020-07-23 07:51:24 +03:00
Anna Shaleva
b8d82b49ec
core: add Neo.Crypto.RIPEMD160 interop
...
Closes #1193 .
2020-07-22 16:58:32 +03:00
Roman Khimov
3f2f0be2c2
Merge pull request #1187 from nspcc-dev/neo3/interop/post-preview2_adjustment
...
interop: post-preview2 adjustment
2020-07-17 13:33:29 +03:00
Anna Shaleva
74d2f437f4
core: add System.Binary.Base64Encode(Decode) interops
...
Part of #1055
2020-07-17 12:36:18 +03:00
Anna Shaleva
f31ce9289d
core: add System.Contract.GetCallFlags interop
...
Part of #1055 .
It returns calling flags of the current context.
2020-07-17 12:35:02 +03:00
Roman Khimov
acfded7f45
Merge pull request #1180 from nspcc-dev/fix-calling-scripthash-check-in-nep5
...
Add calling scripthash check to native nep5 transfers
2020-07-16 07:29:14 +03:00
Roman Khimov
d4c3a17883
interop/native: always use proper ScriptHashGetter, fix #924
...
All scripts are run in VM, so it's there to tell us about script hashes
involved and it must be used instead of nep5ScriptHash kludge.
2020-07-15 22:43:30 +03:00
Anna Shaleva
a3e306ff78
core: implement Secp256k1 Verify and CheckMultisig interops
...
Closes #918 .
2020-07-14 16:21:34 +03:00
Anna Shaleva
5326fc587a
core: rename Neo.Crypto.CheckMultisig to Neo.Crypto.CheckMultisigWithECDsaSecp256r1
...
Part of #918
2020-07-14 16:19:12 +03:00
Anna Shaleva
17233e1d8e
core: rename Neo.Crypto.Verify to Neo.Crypto.VerifyWithECDsaSecp256r1
...
Part of #918
2020-07-14 16:19:12 +03:00
Evgenii Stratonikov
4b31c18316
core: fix Neo.Native.Deploy
price
2020-06-19 12:58:33 +03:00
Evgenii Stratonikov
540ac23ca8
core: calculate prices of Neo.Crypt.*
opcodes correctly
2020-06-19 12:58:33 +03:00
Evgenii Stratonikov
3762ebdd08
core: implement System.Runtime.GetInvocationCounter syscall
2020-06-17 11:24:11 +03:00
Evgenii Stratonikov
a4e4439967
core,vm: implement System.Runtime.GasLeft syscall
2020-06-17 11:24:11 +03:00
Evgenii Stratonikov
1f97f3abd8
core: adjust prices and flags for System.Runtime.* interops
...
Related #1055 .
2020-06-16 12:30:55 +03:00
Evgenii Stratonikov
ad2a75a500
core: move System.ExecutionEngine.* interops to System.Runtime.*
2020-06-16 12:30:55 +03:00
Evgenii Stratonikov
52a27e9be4
core: implement System.Contract.CreateStandardAccount syscall
2020-06-16 12:12:29 +03:00
Evgenii Stratonikov
5b4f38d717
core: implement System.Contract.IsStandard syscall
2020-06-16 12:12:27 +03:00
Evgenii Stratonikov
b1d2d70c02
core: adjust prices for blockchain/contract syscalls
2020-06-16 12:04:57 +03:00
Evgenii Stratonikov
6339efac11
core: implement System.Json.* interops
2020-06-16 11:35:06 +03:00
Evgenii Stratonikov
aae312d408
core,vm: adjust prices for iterator/enumerator syscalls
...
Closes #1027 .
2020-06-16 11:05:26 +03:00
Evgenii Stratonikov
18066143bd
core,vm: adjust binary (de-)serialization syscalls
...
Related #1027 .
1. Move System.Runtime.(De)serialize to System.Binary.*
2. Rename compiler stubs.
3. Adjust opcode prices.
2020-06-16 11:00:38 +03:00
Evgenii Stratonikov
2e996ea57d
core: adjust System.Storage.*
interop prices
2020-06-15 12:02:28 +03:00
Evgenii Stratonikov
971ab0646f
core: specify allowed triggers for interops
...
Related #1026 , #1027 , #1028 , #1031 .
2020-06-11 13:16:07 +03:00
Evgenii Stratonikov
0dd00a49f5
core: specify require call flags in interop description
...
Related #1026 , #1027 , #1028 , #1031 .
2020-06-11 13:16:07 +03:00
Evgenii Stratonikov
f8a11f61b6
core: update *.Contract.* interops
...
1. Remove GetScript, IsPayable, GetStorageContext.
2. Revert 82319538
related to GetStorageContext.
3. Rename Migrate to Update.
4. Move remaining to System.Contract.*.
Related #1031 .
2020-06-11 10:50:35 +03:00
Evgenii Stratonikov
38d020d1a2
core: move Neo.Storage.* interops to System.*
2020-06-10 12:13:35 +03:00
Evgenii Stratonikov
0472a0b0b1
core: move Neo.Runtime/Enumerator/Iterator.* interops to System.*
2020-06-10 12:13:35 +03:00
Evgenii Stratonikov
97c6ac7a73
core: move Neo.Blockchain.* syscalls to System.*
2020-06-10 12:13:18 +03:00
Evgenii Stratonikov
3d3fe9398e
core: remove Neo.Header/Witness/Account.* interops
...
They are not present in NEO3.
2020-06-10 12:13:18 +03:00
Anna Shaleva
8b7abd36c9
core: remove Block.GetTransactions, Block.GetTransactionsCount interops
...
Updated System.Blockchain.GetBlock interop replaced the functionality of
the following interops:
System.Block.GetTransactions
System.Block.GetTransactionCount
Neo.Block.GetTransactions
Neo.Block.GetTransactionsCount
2020-06-09 23:24:11 +03:00
Anna Shaleva
7a2d37cf7e
core: update System.Blockchain.GetBlock interop
...
closes #1025
Now we put on stack stackitem.Array instead of Interop, so we're able to
use all available block properties without extra interop getters.
Removed Neo.Blockchain.GetBlock interop as we don't need it anymore.
2020-06-09 23:24:04 +03:00
Anna Shaleva
e2187c0a96
core: remove Block.GetTransaction interops
...
Removed Neo.Block.GetTransaction and System.Block.GetTransaction
interops. These interops were replaced by new
System.Blockchain.GetTransactionFromBlock interop.
2020-06-09 22:54:21 +03:00
Anna Shaleva
d692de5ea4
core: add System.Blockchain.GetTransactionFromBlock interop
2020-06-09 22:54:16 +03:00
Anna Shaleva
1e63ae4b3f
core: update System.Blockchain.GetTransactionHeight interop
...
Update System.Blockchain.GetTransactionHeight and removed
Neo.Blockchain.GetTransactionHeight interop as we don't need it.
2020-06-09 22:04:18 +03:00
Anna Shaleva
53655c5ac2
core: implement new System.Blockchain.GetTransaction interop
...
closes #1023
Now we put on stack stackitem.Array instead of Interop, so we don't
need old transaction-related interops anymore. Removed the following
interops:
System.Transaction.GetHash
Neo.Transaction.GetAttributes
Neo.Transaction.GetHash
Neo.Transaction.GetWitnesses
Neo.Attribute.GetData
Neo.Attribute.GetUsage
Also removed the following duplicated NEO interop:
Neo.Blockchain.GetTransaction
2020-06-09 22:04:13 +03:00
Anna Shaleva
f2e3be6fef
core: remove old AntShares interops
...
We don't need them anymore.
2020-06-09 20:54:00 +03:00
Roman Khimov
a986e2a064
*: drop support for old on-chain assets
...
You no longer can transfer them, so creating/renewing/storing doesn't make
much sense.
2020-06-05 19:21:37 +03:00
Roman Khimov
709146f295
transaction: drop Inputs and Outputs, forget UTXO
2020-06-05 19:20:16 +03:00
Roman Khimov
21efccd300
transaction: remove type field, set Version to 0
...
Two changes being done here, because they require a lot of updates to
tests. Now we're back into version 0 and we only have one type of
transaction.
It also removes GetType and GetScript interops, both are obsolete in Neo 3.
2020-06-05 19:20:16 +03:00
Evgenii Stratonikov
73c82584a3
vm,compiler: replace APPCALL with System.Contract.Call
...
Contract calls are performed via syscall System.Contract.Call
in NEO3. This implements this in compiler and removes APPCALL from the
VM.
2020-05-07 14:52:03 +03:00
Evgenii Stratonikov
ec900c7ff7
core: implement System.Contract.Call interop
2020-05-07 14:39:06 +03:00
Evgenii Stratonikov
519b31a704
vm: remove crypto-related opcodes
...
All cryptography has moved to interops in NEO3.
There is no SHA256 interop RN, but it is to appear later.
Closes #777 .
2020-04-29 19:16:38 +03:00
Anna Shaleva
55fd9f8d24
core: change block.ConsensusData to neo3 format
...
1. Dropped `Base.ConsensusData` block field
2. Added `Block.ConsensusData` field with `Nonce` and `PrimaryIndex`
3. Removed "Neo.Header.GetConsensusData" and
"AntShares.Header.GetConsensusData" interops
2020-04-27 17:57:37 +03:00
Roman Khimov
b83e84ca08
core: switch to the new voting system (via native NEO contract)
...
It has all the methods required now, so you can register, vote and get
voting results. Fixes #865 .
2020-04-27 16:06:50 +03:00
Roman Khimov
2fa3bdf6a9
core/native: move Votes from account to native NEO state
2020-04-27 12:30:39 +03:00
Evgenii Stratonikov
bfbbef952a
vm: move InteropNameToID to emit package
2020-04-17 11:46:31 +03:00
Evgenii Stratonikov
25354c44f9
core: implement NativeContract support
2020-04-16 15:55:34 +03:00
Evgenii Stratonikov
9586af32f2
core: move runtime.CheckWitness interop to a separate package
2020-04-16 15:54:58 +03:00
Evgenii Stratonikov
c23af595c9
core: implement Neo.Crypto.ECDsaCheckMultisig interop
2020-04-13 13:47:39 +03:00
Evgenii Stratonikov
5a30af2c75
core: implement Neo.Crypto.ECDsaVerify interop
2020-04-13 13:46:31 +03:00
Evgenii Stratonikov
30cc2c5783
core: move enumerator/iterator interops to a separate packages
2020-04-11 10:56:36 +03:00
Evgenii Stratonikov
7ffc6c0936
core: move interopContext to a separate package
2020-04-11 10:56:36 +03:00
Evgenii Stratonikov
a7c19d445b
core: move Blockchainer interface to a separate package
2020-04-11 10:56:36 +03:00
Evgenii Stratonikov
efddcf3bfe
core: remove interop methods from interopContext
...
If interops are defined as a separate functions
they can be implemented in a separate packages
which can help us to structure core.
2020-04-11 10:56:35 +03:00
Evgenii Stratonikov
ee0ba9b1b4
core: make SpawnVM a method of context
...
spawnVMWithInterops is rather long too type and
it doesn't use Blockchain in any way.
2020-04-08 08:38:45 +03:00
Evgenii Stratonikov
030b7754ad
core: move DAO to a separate package
2020-04-08 08:38:44 +03:00
Roman Khimov
5f09381cf4
core: wrap cached dao properly, don't miss cached data
...
Fixes #817 where invoked contract missed updated account information because
it got it one layer below cachedDao used to process the block.
2020-04-03 10:15:11 +03:00
Roman Khimov
e41d434a49
*: move all packages from CityOfZion to nspcc-dev
2020-03-03 17:21:42 +03:00
Anna Shaleva
7d46404e2d
smartcontract: turn trigger types into Type
...
1) Turn trigger types from byte constants into Type
2) Add auto-generated stringer for future purposes
2020-03-02 17:25:27 +03:00
Evgenii Stratonikov
63c56cca5c
core: refactor out Block, BlockBase and Header structs
...
See #597 .
2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
aecdf470e7
cli,pkg: use zap.Logger
2020-01-10 11:14:27 +03:00
Evgenii Stratonikov
48cf4f4a84
core: implement Neo.Storage.Find interop
2019-12-26 15:21:41 +03:00
Evgenii Stratonikov
5bc32b523a
vm: implement Neo.Iterator.* interops
2019-12-24 10:21:47 +03:00
Evgenii Stratonikov
3ff7fd5262
vm: implement Neo.Enumerator.* interops
2019-12-24 10:21:46 +03:00
Roman Khimov
76d69ee5ee
core: restore proper interops ordering
2019-12-23 16:14:43 +03:00
Roman Khimov
c287a9e93c
core: implement Neo.Witness.GetVerificationScript interop
2019-12-23 16:14:43 +03:00
Roman Khimov
9d638d0fee
core: implement Neo.InvocationTransaction.GetScript
2019-12-23 16:14:43 +03:00
Roman Khimov
a7457d08a1
vm/core: add ID support for SYSCALL, redo interop registration
...
This solves two problems:
* adds support for shortened SYSCALL form that uses IDs (similar to #434 , but
for NEO 2.0, supporting both forms), which is important for compatibility
with C# node and mainnet chain that uses it from some height
* reworks interop plugging to use callbacks rather than appending to the map,
these map mangling functions are clearly visible in the VM profiling
statistics and we want spawning a VM to be fast, so it makes sense
optimizing it. This change moves most of the work to the init() phase
making VM setup cheaper.
Caveats:
* InteropNameToID accepts `[]byte` because that's the thing we have in
SYSCALL processing and that's the most often usecase for it, it leads to
some conversions in other places but that's acceptable because those are
either tests or init()
* three getInterop functions are: `getDefaultVMInterop`, `getSystemInterop`
and `getNeoInterop`
Our 100K (1.4M->1.5M) block import time improves by ~4% with this change.
2019-12-19 13:35:42 +03:00
Roman Khimov
0d0a27d271
core: add cachedDao to cache accounts and contracts
...
Importing 100K blocks starting at 1.4M, before this patch:
real 6m0,356s
user 8m52,293s
sys 0m47,372s
After this patch:
real 4m17,748s
user 6m23,316s
sys 0m37,866s
Almost 30% better.
2019-12-13 19:57:17 +03:00
Roman Khimov
c5ed3b788b
core: simplify dao creation with newDao()
2019-12-12 21:04:55 +03:00
Vsevolod Brekelov
2d42b14a1d
core: renames entities-> state and removed State prefix
2019-12-11 13:14:18 +03:00
Vsevolod Brekelov
ec17654986
core: refactoring blockchain state and storage
...
add dao which takes care about all CRUD operations on storage
remove blockchain state since everything is stored on change
remove storage operations from structs(entities)
move structs to entities package
2019-12-11 13:05:31 +03:00
Vsevolod Brekelov
c80ee952a1
core/crypto: add validators and interop for validators
...
add processing of validators while block persist;
add validator structure with decoding/encoding;
add validator get from store;
add EnrollmentTX and StateTX processing;
add pubkey decode bytes, unique and contains functions;
2019-11-21 15:23:35 +03:00
Roman Khimov
5ce269c035
core: change notify implementation to save notifications
...
Fixes #453 and makes it possible to refer to these notifications later.
2019-11-15 18:04:59 +03:00
ed758458d5
vm: implement serialization interops in core package
2019-11-05 17:10:52 +03:00
Roman Khimov
fc0031e5aa
core: move write caching layer into MemCacheStore
...
Simplify Blockchain and associated functions, deduplicate code, fix Get() and
Seek() implementations.
2019-10-16 17:33:45 +03:00
Roman Khimov
74590551c4
core: add some interops
...
This also changes Verify to VerifyTx and VerifyWitnesses, because there is a
need to pass a block for some interop functions.
2019-10-15 12:56:25 +03:00