Commit graph

2685 commits

Author SHA1 Message Date
Roman Khimov
18dcc16553
Merge pull request #1222 from nspcc-dev/fix/rvcount
Remove return value count
2020-07-23 10:34:34 +03:00
Evgenii Stratonikov
58a594e3d4 vm: remove rvcount
It isn't used anymore.
2020-07-23 10:29:05 +03:00
Roman Khimov
06f70e6a0b
Merge pull request #1218 from nspcc-dev/neo3/interop/post-preview2_adjustment2
interop: post-preview2 adjustment, part 2
2020-07-23 09:35:34 +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
120eff92f7 core: adjust System.Runtime.Notify interop
Part of #1198.

Notification name should be UTF8-encoded.
2020-07-23 07:55:12 +03:00
Anna Shaleva
2c41b7b254 core: adjust System.Runtime.Log interop
Part of #1055 and #1198.

It should check the message length and encoding.
2020-07-23 07:54:51 +03:00
Anna Shaleva
76acef18ad core: adjust System.Runtime.Platform interop
Part of #1055.

Added `Platform` method to compiler.
2020-07-23 07:51:24 +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
990ef5525c core: adjust System.Runtime.GasLeft interop
Part of #1055.

In test mode it should return -1.
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
c9ef7425ac core: adjust System.Iterator.Create interop
Closes #1201.

It should be able to iterate over primitive byte-array-like types also.
2020-07-23 07:51:55 +03:00
Anna Shaleva
459ac34839 core: adjust System.Enumerator.Create interop
Part of #1201.

It should be able to create enumerator from primitive byte-array-like
stack items too.
2020-07-23 07:51:24 +03:00
Roman Khimov
c4cde44543
Merge pull request #1216 from nspcc-dev/neo3/rpc/sendrawtransaction
rpc: adjust `sendrawtransaction` and `submitblock` RPC calls
2020-07-22 22:13:21 +03:00
Evgenii Stratonikov
261ff3c655 vm: remove alt.stack
It is no longer present in NEO3.
2020-07-22 13:20:31 +03:00
Anna Shaleva
889a5d7eb6 rpc: adjust submitblock RPC-call
It should return block hash instead of boolean.
2020-07-22 08:37:53 +03:00
Anna Shaleva
c2534b1a0b rpc: adjust sendrawtransaction RPC-call
It should return tx has instead of boolean.
2020-07-22 08:37:46 +03:00
Roman Khimov
d6342ab68c
Merge pull request #1127 from nspcc-dev/fix/notify
Provide event name in `runtime.Notify`
2020-07-21 10:13:35 +03:00
Evgenii Stratonikov
3d7fa9de93 *: make Notify interop accept event name 2020-07-20 13:33:32 +03:00
Roman Khimov
1154e180fa
Merge pull request #1188 from nspcc-dev/forward-port-from-2.x
Forward port from 2.x
2020-07-17 19:07:25 +03:00
Roman Khimov
432cef59f4 network: copy peers for Shutdown iteration
We can't lock them (or there will be a deadlock), but we need to fix this:

fatal error: concurrent map iteration and map write

goroutine 1 [running]:
runtime.throw(0xdec086, 0x26)
        /usr/lib64/go/1.12/src/runtime/panic.go:617 +0x72 fp=0xc02fec2bf8 sp=0xc02fec2bc8 pc=0x42d932
runtime.mapiternext(0xc02fec2d40)
        /usr/lib64/go/1.12/src/runtime/map.go:860 +0x597 fp=0xc02fec2c80 sp=0xc02fec2bf8 pc=0x40efe7
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Shutdown(0xc0000fc160)
        /home/rik/dev/neo-go2/pkg/network/server.go:194 +0x238 fp=0xc02fec2db0 sp=0xc02fec2c80 pc=0xa89da8
github.com/nspcc-dev/neo-go/cli/server.startServer(0xc0000fcc60, 0x0, 0x0)
        /home/rik/dev/neo-go2/cli/server/server.go:399 +0x7a9 fp=0xc02fec3820 sp=0xc02fec2db0 pc=0xae2079
...
2020-07-17 19:03:12 +03:00
Roman Khimov
ae9658a108 dao: migrate nep5 balances with the contract
Fixes #1144. It's quite simple approach, we just update balance info right
upon contract migration. It will slow down migration transactions, but it
takes about 1-2 seconds to Seek through balances at mainnet's 3.8M, so the
approach should still work good enough. The other idea was to make lazy
updates (maintaining contract migration map), but it's more complicated to
implement (and implies that a balance get might also do a write).

There also is a concern about memory usage, it can give a spike of some tens
of megabytes, but that also is considered to be acceptable.
2020-07-17 19:03:12 +03:00
Evgenii Stratonikov
a6fc5cfdf1 rpc: support raw address in getnep5transfers RPC 2020-07-17 18:51:13 +03:00
Evgenii Stratonikov
c4c2ce1465 rpc: support stringified address in getnep5balances RPC 2020-07-17 18:51:13 +03:00
Evgenii Stratonikov
62bb130ccb rpc/request: add (*Param).GetUint160FromAddressOrHex()
Allow to get address from both representations.
2020-07-17 18:51:13 +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
Anna Shaleva
842feb2533 core: adjust System.Contract.Update interop
Part of #1055.

We should check contract scripthash against the one provided in manifest
and manifest groups. We shouldn't put on stack anything after return.
And ofcourse, we mast not destroy the old contract at the end, as
`contractDestroy` removes all storage items associated with the
old contract ID (which equals to the new contract ID). We just remove
old contract state - it's enough.
2020-07-17 12:33:44 +03:00
Anna Shaleva
fddad0b475 core: adjust System.Contract.Create interop
Part of #1055.

It should check given scripthash against manifest groups and return the
contract state as a struct (not interop interface).
2020-07-17 09:28:52 +03:00
Anna Shaleva
d2ec0fed3d core: adjust System.Blockchain.GetContract interop
Part of #1055.

It should put on stack an array instead of interop interface.
2020-07-17 09:28:52 +03:00
Anna Shaleva
1a5fb01e61 core: adjust System.Contract.IsStandard interop
Part of #1055.

It should check not only stored contracts, but also interop context
script container in case if it's a transaction.
2020-07-17 08:19:43 +03:00
Anna Shaleva
d2f452c240 core: adjust System.Contract.CallEx interop
Part of #1055
2020-07-17 08:19:43 +03:00
Anna Shaleva
74ffde8367 core: adjust System.Blockchain.GetTransactionFromBlock interop
To match C# implementation, we should pick all arguments from stack first.
2020-07-17 08:19:43 +03:00
Anna Shaleva
a1f98f92fe compiler: add ConvertResultToStruct flag
Part of #1055.

There'll be a lot of interops which result with a struct on stack instead
of interop interface, and sometimes their names are the same, so it's
unrelyable to take into account interop name only and don't pay
attention to it's API (package).

Also sort syscalls by package and name.
2020-07-17 08:19:43 +03:00
Roman Khimov
1af2c69644
Merge pull request #1189 from nspcc-dev/remove-stale-storeblock-comment
core: remove stale storeBlock comment, fix #365
2020-07-17 07:39:12 +03:00
Roman Khimov
38f0432f36 core: remove stale storeBlock comment, fix #365
After transaction unification and UTXO removal storeBlock became quite simple
and doesn't require any refactoring any more.
2020-07-16 23:06:17 +03:00
Roman Khimov
58f23422ac
Merge pull request #1161 from nspcc-dev/neo3/protocol/cmd_not_found
network: update CMDUncknown
2020-07-16 09:49:16 +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
Anna Shaleva
db5b42b601 network: update CMDUncknown
Closes #1135
2020-07-16 06:58:55 +03:00
Roman Khimov
59be6bcd24 native: add calling script hash to NEP5 transfer witness check
Fix transfers from contract's address.
2020-07-15 22:52:35 +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
Roman Khimov
f46ed798f0
Merge pull request #1169 from nspcc-dev/neo3/rpc/fields_names_adjustment
rpc: adjust RPC calls JSON fields
2020-07-15 18:24:54 +03:00
Anna Shaleva
e9f4693e18 wallet: adjust isDefault field name
Part of #1130
2020-07-15 14:45:57 +03:00
Anna Shaleva
2ab23dc56a rpc: adjust getunclaimedgas RPC-call
Part of #1130
2020-07-15 14:45:51 +03:00
Anna Shaleva
3a3cd0353d rpc: adjust invokefunction RPC-call JSON fields names
Part of #1130
2020-07-15 14:44:22 +03:00
Anna Shaleva
48ccdb09d4 rpc: adjust getversion RPC-call JSON fields names
Part of #1130
2020-07-15 14:44:22 +03:00
Anna Shaleva
538616e9f8 rpc: adjust getrawtransaction RPC-call JSON fields names
Part of #1130
2020-07-15 14:44:13 +03:00
Roman Khimov
75dc62fa81
Merge pull request #1175 from nspcc-dev/neo3/crypto/ecdsa
crypto: add Secp256k1 support
2020-07-15 13:34:42 +03:00
Roman Khimov
aee200720d README: update release info 2020-07-14 19:45:18 +03:00
Roman Khimov
447554ea4d CHANGELOG: release 0.90.0 2020-07-14 18:47:33 +03:00