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
a71cd0961e
core/dao: remove unnecessary slice type
...
It is used only once, so a simple `sort.Slice`
invocation will suffice.
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
Anna Shaleva
495c1b0565
vm: add tests for missing bit and numeric operations
...
Added tests for:
- bit operatoins: AND, OR, XOR
- numeric operations: BOOLOR, MIN, MAX, WITHIN, NEGATE
2020-04-07 18:10:31 +03:00
Roman Khimov
4e0c3fab0f
Merge pull request #811 from nspcc-dev/feature/debug
...
compiler: support neo-debugger
2020-04-06 19:18:13 +03:00
Evgenii Stratonikov
da826522f8
compiler: set variable index on first declaration
...
This way variables will have indices corresponding to their
order of appearance in a source file.
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
457e7e006a
compiler: support exporting method variables in debug info
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
5bdee683e6
cli,compiler: support emitting debug info in a file
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
5d3da26e1e
compiler: support sequence points in debug info
...
Sequence points is a way to map a specific instruction offset
from a compiled contract to a text span in a source file.
This commit implements mapping only for `return` statements.
Further improvements are straight-forward.
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
24fef35ead
compiler: split Compile info sub-functions
...
Also add tests for basic debug info.
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
00c40b58aa
compiler: record basic debug info
...
Save info about method's byte-code sections.
2020-04-06 15:30:06 +03:00
Roman Khimov
9997661998
Merge pull request #821 from nspcc-dev/fix-cache-propagation-to-invocations
...
core: wrap cached dao properly, don't miss cached data
2020-04-06 11:52:41 +03:00
Roman Khimov
b2c767e356
Merge pull request #827 from nspcc-dev/fix/shl
...
vm: handle negative arguments in SHL/SHR
2020-04-06 10:50:47 +03:00
Evgenii Stratonikov
96806262bf
vm: handle negative arguments in SHL/SHR
...
Do it as in reference implementation: a >> -b == a << b.
2020-04-06 10:46:35 +03:00
Roman Khimov
83a02f42f7
Merge pull request #825 from nspcc-dev/fix/compiler
...
compiler: accept varargs in `runtime.Notify`
2020-04-06 10:08:02 +03:00
Roman Khimov
48e619e26d
Merge pull request #826 from nspcc-dev/fix/mod
...
vm: use truncated division in MOD
2020-04-06 10:03:40 +03:00
Evgenii Stratonikov
1fcc019bf3
rpc: update test chain
...
Also provide info for getblockheader RPC while
generating test chain.
2020-04-06 09:31:09 +03:00
Evgenii Stratonikov
004023920e
rpc: use Notify with varargs in the test contract
2020-04-06 09:31:09 +03:00
Evgenii Stratonikov
efad66aee1
compiler: make Notify accept varargs
2020-04-06 09:31:09 +03:00
Evgenii Stratonikov
0023c4f1f6
vm: use truncated division in MOD
...
Mimic C#'s `%` behavior.
Related 4b44190
(#773 ).
2020-04-06 09:30:48 +03:00
Roman Khimov
c0b5271386
Merge pull request #823 from nspcc-dev/examples/nep5
...
examples: add nep5 mint function
2020-04-03 13:23:22 +03:00
Anna Shaleva
c84c33d398
examples: add nep5 mint function
...
Add Mint(...) to NEP5 for initial tokens supply.
2020-04-03 12:26:13 +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
f64aa201c7
Merge pull request #819 from nspcc-dev/fix/util160_marshalling
...
smartcontract: fix uint160 marshalling in smartcontract.Parameter
2020-04-01 22:04:30 +03:00
Roman Khimov
20fcbda91c
Merge pull request #818 from nspcc-dev/rework-maps
...
Rework maps
2020-04-01 22:04:07 +03:00
Anna Shaleva
5a62eb923e
smartcontract: fix uint160 marshalling in smartcontract.Parameter
...
There's a bug after #785 : smartcontract.Parameter of type hash160 should
be marshalled in LE (as default marshaller for uint160 does) instead of
BE, so fixed.
2020-04-01 20:48:46 +03:00
Roman Khimov
2d0ad30fcf
vm: rework Map with internal slice representation
...
Which makes iterating over map stable which is important for serialization and
and even fixes occasional test failures. We use the same ordering here as
NEO 3.0 uses, but it should also be fine for NEO 2.0 because it has no
defined order.
2020-04-01 19:33:53 +03:00
Roman Khimov
25201d480d
smartcontract: simplify Array JSON marshalling
2020-04-01 19:21:00 +03:00
Roman Khimov
3dbe549a61
smartcontract: store MapType Parameter as a slice of KV pairs
...
Fixes #809 .
Basically, there are three alternative approaches to fixing it:
* allowing both []byte and string for ByteArrayType value
minimal invasion into existing code, but ugly as hell and will probably
backfire at some point
* storing string values in ByteArrayType
incurs quite a number of type conversions (and associated data copying),
though note that these values are not changed usually, so dynamic
properties of []byte are almost irrelevant here
* storing only []byte values in ByteArrayType
makes it impossible to use them as map keys which can be solved in several
ways:
- via an interface (Marshalable)
which is good, but makes testing and comparing values in general harder,
because of keys mismatch
- using serialized Parameter as a key (in a string)
which will need some additional marshaling/unmarshaling
- converting MapType from map to a slice of key-value pairs
not a bad idea as we don't use this map as a map really, the type
itself is all about input/output for real VM types and this approach is
also a bit closer to JSON representation of the Map
2020-04-01 19:21:00 +03:00
Roman Khimov
b502210ade
Merge pull request #814 from nspcc-dev/docs/cli-wallet
...
docs: update wallet operations examples in cli documentation
2020-04-01 19:03:46 +03:00
Roman Khimov
6b4c66a807
Merge pull request #815 from nspcc-dev/fix/stacksize
...
compiler: calculate stack size more precisely
2020-04-01 19:03:15 +03:00
Roman Khimov
1e0a320e24
Merge pull request #816 from nspcc-dev/fix/config
...
Makefile: set config.Version properly
2020-04-01 18:36:57 +03:00
Evgenii Stratonikov
111d7eecdd
Makefile: quote config.Version
...
Accept strings with spaces.
2020-04-01 18:33:34 +03:00
Evgenii Stratonikov
98012fde16
Makefile: set config.Version properly
...
After refactoring in 5a984fd
(#423 ) Version has moved
to pkg/. Makefile should be changed accordingly.
2020-04-01 18:26:05 +03:00
Evgenii Stratonikov
a43c9b9246
compiler: calculate stack size more precisely
...
When calculating number of local variables, only
defining assignments (i.e. via `:=`) must be taken into account.
2020-04-01 17:36:19 +03:00
alexvanin
e93f227598
docs: update wallet operations examples in cli documentation
...
In #589 `wallet open` command was renamed to `wallet dump`.
In #757 `wallet create` command was renamed to `wallet init`.
2020-04-01 15:12:05 +03:00
Roman Khimov
9b5dab57e8
Merge pull request #810 from nspcc-dev/refactor/config
...
config: move config.go out of config
2020-04-01 10:29:57 +03:00
Roman Khimov
12a9a6b9ae
Merge pull request #812 from nspcc-dev/tests/stack_item
...
vm: add tests to stack_item.go
2020-04-01 00:12:43 +03:00
Anna Shaleva
5a984fdf88
config: move config.go out of config/
...
closes #423
2020-03-31 17:55:59 +03:00
Anna Shaleva
a8fa9c9244
vm: add tests to stack_item.go
...
closes #199
2020-03-31 17:18:13 +03:00
Roman Khimov
e41853d0a4
Merge pull request #789 from nspcc-dev/fix/tx_specific_data_marshalling
...
rpc: fix marshalling of type-specific tx data
2020-03-30 16:10:25 +03:00
Anna Shaleva
9c09ad9c89
rpc: fix marshalling of type-specific tx data
...
closes #585
2020-03-30 15:48:50 +03:00
Roman Khimov
6f13455cc9
Merge pull request #800 from nspcc-dev/fix/slice
...
compiler: declare compoud types with var keyword
2020-03-30 00:14:59 +03:00
Roman Khimov
92bafffcd8
Merge pull request #805 from nspcc-dev/fix-rpc-invocation-json
...
rpc: fix stack field name for invocation results
2020-03-29 13:41:46 +03:00
Roman Khimov
237de73dec
Merge pull request #807 from nspcc-dev/optimize-memcached-persist
...
storage: optimize (*MemCachedStore).Persist for memory-backed ps
2020-03-29 13:41:21 +03:00
Roman Khimov
0d482ceb7f
Merge pull request #808 from nspcc-dev/fix-map-serialization
...
vm: make map serialization more compatible with C#
2020-03-29 13:40:52 +03:00
Roman Khimov
665bf78d11
vm: make map serialization more compatible with C#
...
C# pushes value and key to the stack of non-serialized items, so key gets
serialized first followed by value. Fixes #806 .
Notice though that neither IDictionary in C#, nor map in Go have elements
ordered, so we can easily get a difference in KV pairs order and it would be
impossible to fix.
2020-03-28 17:25:42 +03:00
Roman Khimov
4758de71ec
storage: optimize (*MemCachedStore).Persist for memory-backed ps
...
Most of the time it's persisted into the MemoryStore or MemCachedStore, when
that's the case there is no real need to go through the Batch mechanism as it
incurs multiple copies of the data.
Importing 1.5M mainnet blocks with verification turned off, before:
real 12m39,484s
user 20m48,300s
sys 2m25,022s
After:
real 11m15,053s
user 18m2,755s
sys 2m4,162s
So it's around 10% improvement which looks good enough.
2020-03-28 17:21:50 +03:00
Roman Khimov
2316e2c4a7
rpc: fix stack field name for invocation results
...
Follow C# implementation:
https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api/invokefunction.html
2020-03-28 13:59:42 +03:00
Anna Shaleva
0be237beb6
rpc: fix double-pointer bugs in RPC Client
...
Fixed double-pointer bug in following methods:
- GetRawTransactionVerbose
- GetBlockVerbose
- GetBlockHeader
- GetTxOut
- ValidateAddress
2020-03-27 16:04:11 +03:00