Commit graph

54 commits

Author SHA1 Message Date
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
fb70c82157 transaction: there are no valid attributes defined for preview3 2020-08-11 21:10:12 +03:00
Roman Khimov
b1034d8ed6 state: drop Neo 2 Account and everything related
It's substituted with NEP5Balances now.
2020-08-11 20:42:02 +03:00
Anna Shaleva
995053f2eb core: add VM into interop context 2020-08-07 16:15:24 +03:00
Anna Shaleva
90825efa16 core: move transaction's sender to cosigners
Closes #1184

Ported changes from https://github.com/neo-project/neo/pull/1752
2020-08-04 17:33:50 +03:00
Evgenii Stratonikov
e52c39ae7e manifest: remove EntryPoint from manifest 2020-07-27 11:08:01 +03:00
Evgenii Stratonikov
8931c9a794 core/interop: increase coverate for crypto interops 2020-07-25 12:16:56 +03:00
Evgenii Stratonikov
83e53fab24 core/test: ensure public key is invalid in test
When providing public key as a subslice, it still can be
decoded as a valid key, thus interop will not return an error
but rather push `false` on stack. This test is about providing
invalid key, so ensure this via setting invalid prefix.
2020-07-25 12:01:16 +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
17233e1d8e core: rename Neo.Crypto.Verify to Neo.Crypto.VerifyWithECDsaSecp256r1
Part of #918
2020-07-14 16:19:12 +03:00
Roman Khimov
fedcc6b6fc transaction: drop old attributes
They're not supported in Neo 3. Also change data encoding to base64 following
Neo 3 changes.
2020-07-10 20:40:27 +03:00
Anna Shaleva
f1cdcbc99c core: store smartcontract items by id
closes #1037
2020-06-19 20:48:45 +03:00
Roman Khimov
b483c38593 block/transaction: add network magic into the hash
We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.
2020-06-18 12:39:50 +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
df958caf93 core: add Manifest to state.Contract 2020-06-11 10:45:24 +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
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
d692de5ea4 core: add System.Blockchain.GetTransactionFromBlock interop 2020-06-09 22:54:16 +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
783f5ecb01 vm: move StackItem to a separate package
closes #912
2020-06-08 13:27:08 +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
Anna Shaleva
8fb67615f8 core: sort results of Storage.Find and NEO.getRegisterValidators
Closes #909
We need to match elements order with C# implementation.
2020-05-29 17:33:01 +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
2fa3bdf6a9 core/native: move Votes from account to native NEO state 2020-04-27 12:30:39 +03:00
Evgenii Stratonikov
a92872931c interop/crypto: allow ECDsaVerify to verify ScriptContainer
When verifying transaction or block, verification script can be
a simple PUSHNULL + SYSCALL, which means that script-encontaining
entity should be verified.
2020-04-17 11:12:40 +03:00
Evgenii Stratonikov
8f08065a8e interop/crypto: allow ECDsaVerify to accept interop items
When invokes with interop item on stack, it should check
for the signature of Verifiable item it contains.
2020-04-17 11:12:40 +03:00
Evgenii Stratonikov
a99e0d7ba6 core: fix typo in TestECDSAVerify 2020-04-14 16:15:50 +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
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
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
a9abd3d841 core: fix wrong endian used in interop functions
C# uses ToArray() or UintXXX(bytes) here which interprets hashes as they
should be interpreted (BE, although they always convert to LE when converting
to String just for the fun of it). It leads to state difference for us at
block 2025204 where even though we have the same value for the key, the key
itself differs, ours:

dd2b538e2a0c1db1ae5061c15be14f916bd1e678e512ffcda6d9499d8e7fe97ee71fd6b8004583d9afe09cc4dadbd5deb63d01e061009b7cffdaa674beae0f930ebe6085af900093e5fe56b34a5c220ccdcf6efc336fc5000000000000000000000000000000000010

theirs:

dd2b538e2a0c1db1ae5061c15be14f916bd1e67861e0013db6ded5dbdac49ce0afd9834500b8d61fe77ee97f8e9d49d9a6cdff12e5009b7cffdaa674beae0f930ebe6085af900093e5fe56b34a5c220ccdcf6efc336fc5000000000000000000000000000000000010

In this key there is a tx hash encoded
(e512ffcda6d9499d8e7fe97ee71fd6b84583d9afe09cc4dadbd5deb63d01e061 in LE used
by all the tools like neoscan).

I love Neo.
2020-03-05 19:44:09 +03:00
Roman Khimov
e41d434a49 *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
Evgenii Stratonikov
fe3bbbd78a core: convert trigger.Type to byte when pushing on stack 2020-03-03 16:13:19 +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
9dc5571327 core,rpc: close Blockchain in tests
If blockchain is not closed, logging in defer can occur
after test has finished, which will lead to a panic with
"Log in goroutine after Test* has completed".
2020-01-10 11:47:56 +03:00
Evgenii Stratonikov
637c99eda7 core: simplify newInteropContext 2020-01-10 11:14:29 +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
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
Vsevolod Brekelov
c1f39d5c7b internal: moved testutil method to internal package 2019-12-11 13:14:43 +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
Roman Khimov
f1856bfa8b core/tx: remove publickey indirection from assets and txes
It makes very little sense having pointers here, these structures MUST have
some kind of key and this key is not gonna be wandering somewhere on its
own. Fixes a part of #519.
2019-12-09 18:33:04 +03:00
Roman Khimov
7e371588a7 core/tx: remove one layer of indirection for scripts and inouts
It reduces heap pressure a little for these elements as we don't have to
allocate/free them individually. And they're directly tied to transactions or
block, not being shared or anything like that, so it makes little sense for
them to be pointer-based. It only makes building transactions a little easier,
but that's obviously a minor usecase.
2019-12-09 17:14:10 +03:00