Roman Khimov
832c56f97d
core: fix DutyFlag check in GetScriptHashesForVerifying()
...
It's a flag (used by Share and Invoice asset types), so it should be checked
like a flag, the same way C# node does.
2019-10-01 13:41:26 +03:00
Roman Khimov
4ae18e8ffc
block: check for Transaction length before messing with txes
...
Fixes panic two lines below. Blocks without transactions are invalid by
definition, so there is a need to adjust tests accordingly.
2019-10-01 13:41:26 +03:00
Roman Khimov
c3591d8897
vm: fix CHECKMULTISIG to comply with NEO VM implementation
...
Testing with testnet quickly revealed that our code has an issue when the key
count doesn't equal signature count, fix it and add some comments.
2019-10-01 13:41:26 +03:00
Roman Khimov
fac778d3dd
Merge pull request #414 from nspcc-dev/persistence-rewamp
...
What started as an attempt to fix #366 ended up being quite substantial refactoring of the Blockchain->Store and Server->Blockchain interactions. As usually, some additional problems were noted and fixed along the way. It also accidentally fixes #410 .
2019-09-27 17:55:43 +03:00
Roman Khimov
7779ad6c28
storage: always return ErrKeyNotFound when key is not found
...
It was true for MemoryStore and BoltDB, but not for LevelDB and Redis.
2019-09-27 15:42:36 +03:00
Roman Khimov
5ff1399d54
storage: unexport MemoryStore mutex
...
It shouldn't be available from outside.
2019-09-27 15:42:36 +03:00
Roman Khimov
9617a6f9e9
network: fix requestBlocks() for (headers == blocks + 1)
...
In the very specific case when the list of headers received is exactly one
block ahead of the chain of full blocks requestBlocks() failed to generate
request to get the next full block.
2019-09-27 15:42:35 +03:00
Roman Khimov
3c40a53c4d
core: no need to Close() Blockchain in tests
...
It's a Store method actually and for every Blockchain that uses Run() the
Close() will be handled automatically on exit because of context magic.
2019-09-27 15:42:35 +03:00
Roman Khimov
0dbdbb9c2a
storage: remove RedisBatch in favor of MemoryBatch
...
They're also almost the same.
2019-09-27 15:42:35 +03:00
Roman Khimov
af557cea19
storage: deduplicate BoltDBBatch/MemoryBatch
...
BoltDB doesn't have internal batching mechanism, thus we have a substitute for
it, but this substitute is absolutely identical to MemoryBatch, so it's better
to unify them and import ac5d2f94d3
fix into the
MemoryBatch.
2019-09-27 15:42:35 +03:00
Roman Khimov
8bf37f45fc
storage: remove impossible error branch from MemoryStore
...
MemoryStore is always successful, so this branch makes no sense.
2019-09-27 15:42:35 +03:00
Roman Khimov
4a732d97ac
storage: add comments about errors from MemoryStore
...
It never returns errors for some operations and this knowledge can be used by
other code.
2019-09-27 15:42:35 +03:00
Roman Khimov
920d7c610c
core: remove blockCache, use MemoryStore, redesign persist()
...
Commit 578ac414d4
was wrong in that it saved
only a part of the block, so depending on how you use blockchain, you may
still see that the block was not really processed properly. To really fix it
this commit introduces intermediate storage layer in form of memStore, which
actually is a MemoryStore that supports full Store API (thus easily fitting
into the existing code) and one extension that allows it to flush its data to
some other Store.
It also changes AddBlock() semantics in that it only accepts now successive
blocks, but when it does it guarantees that they're properly added into the
Blockchain and can be referred to in any way. Pending block queing is now
moved into the server (see 8c0c055ac657813fe3ed10257bce199e9527d5ed).
So the only thing done with persist() now is just a move from memStore to
Store which probably should've always been the case (notice also that
previously headers and some other metadata was written into the Store
bypassing caching/batching mechanism thus leading to some inefficiency).
2019-09-27 15:42:35 +03:00
Roman Khimov
c531dc0bde
network: add block queue
...
This one will replace blockCache in Blockchain itself as it can and should be
external from it. The idea is that we only feed successive blocks into the
Blockchain and it only stores valid proper Blockchain and nothing else.
2019-09-27 13:00:09 +03:00
Roman Khimov
ab8d9c59d6
Merge pull request #412 from nspcc-dev/feature/map
...
VM: implement maps, closes #359 .
2019-09-25 19:00:26 +03:00
Evgenii Stratonikov
c7c4291774
vm: simplify APPEND implementation a bit
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
13d7770c68
vm: support Map in ARRAYSIZE
...
Also make logic the same as in reference implementation
and add tests.
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
c66f493017
vm: compare Map by reference in EQUAL
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
c0be2b2a99
vm: support Map in REMOVE
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
8b6bddca3c
vm: support Map in PICKITEM and SETITEM
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
d7bb50c609
vm: implement VALUES opcode
2019-09-25 17:53:36 +03:00
Evgenii Stratonikov
2da64267b0
vm: implement KEYS opcode
2019-09-25 17:53:34 +03:00
Roman Khimov
903173c991
core: fix deadlock in headers list init
...
This probably is a problem since adc880d323
,
because AddHeaders() uses headersOp channel and its reader is only ran in
Run().
2019-09-25 17:52:46 +03:00
Roman Khimov
578ac414d4
core: make unpersisted blocks/txs available in Blockchain
...
This changes the Blockchain to also return unpersisted (theoretically, verified
in the AddBlock!) blocks and transactions, making Add/Get interfaces
symmetrical. It allows to turn Persist into internal method again and makes it
possible to enable transaction check in GetBlock(), thus fixing #366 .
2019-09-25 17:46:28 +03:00
Evgenii Stratonikov
0fb4bb05cf
vm: implement HASKEY opcode
2019-09-25 12:08:41 +03:00
Roman Khimov
2daff0957a
rpc: check for error responses in tests
...
sendrawtransaction_negative was actually wrong in trying to get
SendTXResponse, it received an error.
2019-09-24 18:47:23 +03:00
Evgenii Stratonikov
df18da0ac9
vm: implement NEWMAP opcode
2019-09-24 17:06:17 +03:00
Roman Khimov
8a457ef540
transaction: add a check for createHash() invocation
...
It should work in general.
2019-09-24 13:01:54 +03:00
Roman Khimov
679e01bd0f
core: implement witness verification logic
...
Fix #368 .
2019-09-24 13:01:54 +03:00
Roman Khimov
ca9c9be71f
vm: add CHECKSIG/VERIFY/CHECKMULTISIG implementations
...
Fix #269 .
2019-09-24 13:01:54 +03:00
Roman Khimov
3bbeb2476e
vm: introduce HasFailed() method and use it where appropriate
...
It's gonna be used by external modules.
2019-09-23 20:19:07 +03:00
Evgenii Stratonikov
3c53beca82
vm: restrict SHL/SHR arguments to -256..256
...
Also unify SHL/SHR implementation.
2019-09-23 15:13:10 +03:00
Evgenii Stratonikov
4a8be486f0
vm: do not pop items in OVER
2019-09-23 14:54:59 +03:00
Evgenii Stratonikov
7cd69ea8e2
vm: truncate length in SUBSTR
...
Also fail on first error, without changing the stack.
2019-09-23 14:54:59 +03:00
Evgenii Stratonikov
a88a8e13fc
vm: compare Array by reference in EQUAL
2019-09-23 13:25:59 +03:00
Evgenii Stratonikov
99f1d761ca
vm: clone Struct on APPEND
2019-09-23 13:25:59 +03:00
Roman Khimov
ac5d2f94d3
storage: fix BoltDB batched Put()
...
It must copy both the value and the key because they can be reused for other
purposes between Put() and PutBatch(). This actually happens with values in
headers processing, leading to wrong data being written into the DB.
Extend the batch test to check for that.
2019-09-23 09:27:18 +03:00
Roman Khimov
5a0f08f2c0
network: fix SIGSEGV on unknown message acceptance
...
For example, at the moment our node can't handle `consensus` message, so when
it received it before the patch it just crashed because of uninitialized `p`.
2019-09-22 20:09:55 +03:00
Roman Khimov
4b4bac675b
core: don't print persisting errors twice
...
As they're already printed in the calling goroutine. And they're alse not
always useful when printed by Persist().
2019-09-22 20:08:15 +03:00
Roman Khimov
102c926ef3
core: don't print useless persist messages with nil errors
...
Errors should be printed only when there are errors.
2019-09-22 20:07:49 +03:00
Roman Khimov
f69adc59ad
io: drop getVarStringSize() completely
...
After unexport this doesn't make much sense at all as it has just one user.
2019-09-20 20:01:56 +03:00
Roman Khimov
d01b7740e2
io: improve GetVarSize() documentation
2019-09-20 20:00:45 +03:00
Roman Khimov
6dd37dd076
io: unexport getVarIntSize and getVarStringSize
...
All external users should just use GetVarSize().
2019-09-20 19:08:58 +03:00
Roman Khimov
5cddfe071b
Merge pull request #403 from nspcc-dev/fix_rpctest
...
Fix rpctest, fix #353 , fix #305 .
2019-09-18 23:14:37 +03:00
Vsevolod Brekelov
100fee164b
unitTest: reworked RPC unit test
...
earlier we had an issue with failing test in #353 and other one #305 .
Reworked these test to have in-memory database. This led to multiple
changes: made some functions like Hash and Persist public(otherwise
it's not possible to control state of the blockchain); removed
unit_tests storage package which was used mainly for leveldb in unit
tests.
I see these tests not really good since they look like e2e tests and
as for me should be run in separate step against dockerized env or
in case we want to check rpc handler we might want to rework it in order
to have interface for proper unit tests.
As for me this patchset at least makes as safe with not removing totally
previous tests and at the same time CircleCI will be happy now.
2019-09-18 18:21:16 +03:00
Vsevolod Brekelov
55dfc0bbbc
storage: add seek implementation
...
during testing found missing Seek() implementation for inmemorydb
2019-09-18 18:20:41 +03:00
Roman Khimov
c68a254eba
Merge pull request #404 from nspcc-dev/move-user-docs
...
Move user docs, fix #339 .
2019-09-18 12:50:06 +03:00
Roman Khimov
42df4c2f39
vm: update and move README, refs. #339
2019-09-18 12:10:12 +03:00
Roman Khimov
9441c5e77b
rpc: split README into developer and user parts
...
Most of the document is written for developers and thus belongs to
godoc. User-related document is now moved to docs as per #339 .
2019-09-18 12:10:12 +03:00
Roman Khimov
778d29f543
compiler: update and move README to the docs folder
...
Refs. #339 .
2019-09-17 19:09:02 +03:00
Roman Khimov
cb4be2ae4a
storage: drop useless README, refs. #339
2019-09-17 17:30:05 +03:00
Vsevolod
8e75674f30
Merge pull request #401 from nspcc-dev/refactor_bc_run
...
blockchain: server runs goroutine instead of blockchain init
2019-09-17 16:26:06 +03:00
Roman Khimov
bd1f70366a
crypto: change files mode to 644 (some *.go had exec flags set)
2019-09-17 15:34:00 +03:00
Vsevolod Brekelov
adc880d323
blockchain: server runs goroutine instead of blockchain init
...
rework initBlockChain in order to have controllable way of running
blockchain;
remove context from initBlockChain func;
2019-09-17 15:27:40 +03:00
Roman Khimov
5bca4d2313
io: expand panic tests to reach 100% coverage
2019-09-17 13:23:24 +03:00
Roman Khimov
96618015cd
network: implement EncodeBinary() for MerkleBlock
2019-09-17 13:21:52 +03:00
Roman Khimov
d1a4e43c48
io: redo Serializable to return errors in BinReader/BinWriter
...
Further simplifies error handling.
2019-09-17 13:21:52 +03:00
Roman Khimov
0bb8950f89
make TXer and Payload implement Serializable
...
Both are duplicating Serializable at the moment, but let's keep them for the
future.
2019-09-17 13:21:52 +03:00
Roman Khimov
e299a44983
io: drop Size() method from Serializable and associated
...
It's no longer needed after the io.GetVarSize() improvement. It's duplicating
a lot of EncodeBinary() logic also.
2019-09-17 13:21:45 +03:00
Roman Khimov
56c72b5c67
io: redo GetVarSize for Serializable things
...
Use writes to a fake io.Writer that counts the bytes. Allows us to kill Size()
methods as useless and duplicating lots of functionality.
2019-09-16 23:39:54 +03:00
Roman Khimov
0da9fe6946
io: move size calculator there
...
It's mostly used for Serializable and in other cases where one needs to
estimate binary-encoded size of the stucture. This also simplifies future
removal of the Size() from Serializable.
2019-09-16 23:39:54 +03:00
Roman Khimov
5bf00db2c9
io: move BinReader/BinWriter there, redo Serializable with it
...
The logic here is that we'll have all binary encoding/decoding done via our io
package, which simplifies error handling. This functionality doesn't belong to
util, so it's moved.
This also expands BufBinWriter with Reset() method to fit the needs of core
package.
2019-09-16 23:39:51 +03:00
Roman Khimov
f01354b5bd
core: make TestHeaderEncodeDecode use assert for field comparisons
2019-09-16 23:38:48 +03:00
Roman Khimov
031a260cb1
util: add tests for BinaryReader/BinaryWriter
...
100% coverage.
2019-09-16 23:38:48 +03:00
Roman Khimov
72fc880182
util: remove bogus check from BinWriter.WriteVarUint()
...
val is uint64, it can't be less than zero by definition.
2019-09-16 23:38:48 +03:00
Roman Khimov
aacf58c9ab
util: add 'constructors' for BinReader/BinWriter
...
And an additional BufBinWriter to ease buffer management.
2019-09-16 23:38:48 +03:00
Roman Khimov
0838948540
Merge pull request #394 from nspcc-dev/fix/json-tests-bugs
...
VM: fix some bugs from neo-vm JSON tests
2019-09-16 19:46:12 +03:00
Roman Khimov
c98a626871
Merge pull request #399 from nspcc-dev/refactor_store
...
storage: refactor store, add Close()
2019-09-16 18:59:34 +03:00
Vsevolod Brekelov
264dfef370
storage: close function
...
add close function to storage interface
add common defer function call which will close db connection
remove context as soon as it's not needed anymore
updated unit tests
2019-09-16 18:52:47 +03:00
Roman Khimov
adba9e11ee
Merge pull request #396 from nspcc-dev/network-reconnections-and-fixes
...
This one fixes #390 and some connected problems. After this patchset the node reconnects to some other nodes if anything goes wrong and it better senses when something goes wrong. It also fixes some block handling problems based on the testnet connection experience.
2019-09-16 16:57:10 +03:00
Roman Khimov
b9ff4d929c
network: add getaddr message handling
...
Respond with known good addresses.
2019-09-16 16:32:04 +03:00
Roman Khimov
b2530a4c93
network: be more specific on port mismatch error
2019-09-16 16:32:04 +03:00
Roman Khimov
773ccc2b92
network: allow discoverer to reuse addresses
...
...and don't try to connect to the nodes we're already connected to.
Before this change we had a problem of discoverer throwing away good valid
addresses just because they are already known which lead to pool draining over
time (as address reuse was basically forbidden and getaddr may not get enough
new nodes).
2019-09-16 16:32:04 +03:00
Roman Khimov
46dc141c6c
network: enlarge address request queue
...
Queuing one message is not reliable enough, the peer that gets it can fail to
actually make a request, so make this queue a bit deeper to have a higher
chance of success.
2019-09-16 16:32:04 +03:00
Roman Khimov
d3bb8ddf8f
network: handle errors and connection close more correctly
...
This makes writer side handle errors properly and fixes communication between
reader and writer goroutine to always correctly unregister the peer. This is
especially important for the case where error occurs before handshake
completes as in this case we don't even have goroutine in startProtocol()
running.
2019-09-16 16:32:04 +03:00
Roman Khimov
76c7cff67f
network: make node strictly follow handshake procedure
...
Don't accept other messages before handshake is completed, check handshake
message sequence.
2019-09-16 16:32:04 +03:00
Roman Khimov
c6487423ae
network: close connection on disconnect
...
If it's already closed, this won't hurt, but in the case of logical error it
saves us from leaking this connection (and potentially, peer).
2019-09-16 16:26:30 +03:00
Roman Khimov
90e13debe4
network: implement getaddr sends and addr receival
...
Request new addresses if we're short on known addresses pool size.
2019-09-16 16:26:30 +03:00
Roman Khimov
2a49e68d77
network: start worker goroutine for every connection attempts
...
Prevents blocking on write to workCh which can be dangerous for the server.
2019-09-16 16:26:30 +03:00
Roman Khimov
b4e284f301
discovery: make pool management more reliable
...
Just drop excessive addresses, otherwise we can block for no good reason.
2019-09-16 16:26:30 +03:00
Roman Khimov
85f19936dd
network: implement connection retries
...
It's worth to try a bit more than once.
2019-09-16 16:26:30 +03:00
Roman Khimov
be6c905e5d
network: use and improve discovery mechanism for reconnections
...
This makes our node reconnect to other nodes if connection drops for some
reason. Fixes #390 .
2019-09-16 16:26:30 +03:00
Roman Khimov
b263c97bbb
core: add some mechanism to drop bad blocks from cache
...
If we can't persist anything from our cache there is something wrong with
it. Try to remediate some possible problems.
2019-09-16 16:26:30 +03:00
Evgenii Stratonikov
d2ccc3b017
vm: make REVERSE consume an item from stack
2019-09-16 15:50:51 +03:00
Evgenii Stratonikov
fd264cb06f
vm: make REVERSE work with structs
...
Also add more tests.
Extend `Array` method of `Element` to work with `StructItem`.
2019-09-16 15:50:51 +03:00
Evgenii Stratonikov
f0426ac2d5
vm: do nothing if SHL/SHR by 0
2019-09-16 15:50:51 +03:00
Evgenii Stratonikov
9eca5ee317
vm: convert SIZE argument to bytearray
2019-09-16 15:50:51 +03:00
Evgenii Stratonikov
9780889239
vm: make NEWARRAY/NEWSTRUCT accept bytearray
2019-09-16 15:50:51 +03:00
Evgenii Stratonikov
09e197eaf3
vm: make PUSH0 create empty bytearray
...
Also make tests expect []byte{} instead of 0.
2019-09-16 15:50:51 +03:00
Evgenii Stratonikov
66501f9ef9
vm: make REMOVE consume array from stack
2019-09-16 15:50:14 +03:00
Evgenii Stratonikov
71cfd14b92
vm: create an array of false
items in NEWARRAY/NEWSTRUCT
2019-09-16 15:24:58 +03:00
Evgenii Stratonikov
bafdb916a0
vm: make PICKITEM accept bytearrays
2019-09-16 15:24:58 +03:00
Evgenii Stratonikov
1881adabb9
vm: fail if NIP has not enough arguments
2019-09-16 15:24:58 +03:00
Evgenii Stratonikov
6e4014547d
vm: fail if DROP has no argument
2019-09-16 15:24:58 +03:00
Evgenii Stratonikov
729b7a0b24
vm: fail if ROT has not enough arguments
2019-09-16 15:24:58 +03:00
Evgenii Stratonikov
cf7fbb80ba
vm: fail if EQUAL has not enough arguments
2019-09-16 15:24:58 +03:00
Evgenii Stratonikov
d257044298
vm: fail if XTUCK argument is 0
2019-09-16 15:24:58 +03:00
Roman Khimov
b21a220712
Merge pull request #381 from nspcc-dev/add_boltd
...
storage: add boltdb support, closes #335 .
2019-09-14 13:00:52 +03:00
Vsevolod Brekelov
2cabd5b274
storage: add boltDB unit tests
2019-09-14 10:29:08 +03:00
Vsevolod Brekelov
bfe5fd538e
storage: add boltDB support
...
closes #335
2019-09-14 10:28:43 +03:00
Evgenii Stratonikov
56ec097d76
vm: fix codegen for APPEND
2019-09-13 11:24:21 +03:00
Roman Khimov
521a707e33
core: don't print contracts in persistBlock()
...
Yeah, this really needs more love, but for now just don't spit 'em out on the
screen, please.
2019-09-12 16:12:12 +03:00
Roman Khimov
d0ffd165fd
Merge pull request #393 from nspcc-dev/assorted-db-handling-fixes-and-optimizations
...
Assorted db handling fixes and optimizations based on the testnet
connection experience.
2019-09-11 22:31:19 +03:00
Roman Khimov
4395cea344
storage: fix reading overlapping hash blocks from the DB
...
In the unlikely event of overlapping hash block written to the DB we might end
up with wrong hash list. That happened to me for some reason when synching
with the testnet leading to the following keys with respective values:
150000 -> 2000 hashes
152000 -> 2000 hashes
153999 -> 2000 hashes
Reading it hashes number 153999 and 154000 got the same values and the chain
couldn't sync correctly.
2019-09-11 20:33:41 +03:00
Roman Khimov
4f60fd3e8e
core: optimize persist() for the case when no next block found
...
If there is no next block in the cache, looping through the whole cache won't
help.
2019-09-11 20:32:30 +03:00
Roman Khimov
7812fb28ea
core: optimize blockchain init with existing DB
...
There is no need to generate genesis block (it's already in the DB) and we can
add all hashes at once without iterating over them.
2019-09-11 20:28:49 +03:00
Evgenii Stratonikov
68c6c93980
vm: do not allow APPEND to operate on bytearray
2019-09-11 17:17:37 +03:00
Evgenii Stratonikov
723dcc6e25
vm: make APPEND push no value on stack
2019-09-11 17:17:34 +03:00
Roman Khimov
8311bda355
vm: harden LEFT and RIGHT implementations against negative indexes
2019-09-11 14:51:04 +03:00
Roman Khimov
17f3a21e27
vm: harden SUBSTR implementation against bad index/offset values
...
The upper index bound for slices is capacity, not length. Check for negative
values also. Fixes #387 .
2019-09-11 14:37:41 +03:00
Roman Khimov
fc1075bf75
vm: protect PUSHDATA from short reads
...
Same thing done in a2a8981979
for PUSHBYTES,
failing to read the amount of bytes specified should lead to FAULT. Also
makes readUint16() and readUint32() panic as this is the behavior we want in
these cases. Add some tests along the way.
2019-09-11 12:35:37 +03:00
Roman Khimov
14c02cb3b1
Merge pull request #385 from nspcc-dev/vm-contract-invoke-parameters-332-part1
...
VM CLI improvements, part 1 of #332 work.
2019-09-10 23:55:23 +03:00
Roman Khimov
392a4c4f39
vm/cli: add some convenience heuristic to ease 'run' use
2019-09-10 23:31:06 +03:00
Roman Khimov
c5911c2f10
vm/cli: add support for bool type as 'run' parameter
2019-09-10 23:31:06 +03:00
Roman Khimov
982bdcd704
vm/cli: make operation mandatory if anything added to run
...
Matches neo-cli behavior.
2019-09-10 23:31:06 +03:00
Roman Khimov
5bd666b786
vm: return NOP as current instruction for just loaded VM
...
Before:
NEO-GO-VM > loadgo h.go
READY: loaded 16 instructions
NEO-GO-VM > ip
instruction pointer at -1 (PUSH0)
After:
NEO-GO-VM > loadgo h.go
READY: loaded 16 instructions
NEO-GO-VM > ip
instruction pointer at -1 (NOP)
I think NOP is a little less scary.
2019-09-10 23:31:06 +03:00
Roman Khimov
e872b6b421
vm/cli: redo the whole thing using abiosoft/ishell
...
Adds history support, better editing and way better help system. Expand on
some helps while at it.
2019-09-10 23:31:06 +03:00
Vsevolod Brekelov
0f31e7bf7f
unitTests: fix for failing test
...
should fix circleCI and now these tests using inmemory db
2019-09-10 23:21:26 +03:00
Roman Khimov
4d7456903b
Merge pull request #377 from nspcc-dev/config_for_db
...
storage: support of Redis and configuration for DB
Closes #336 .
2019-09-10 17:46:31 +03:00
Evgenii Stratonikov
31f4c7486b
vm: add tests for CAT
2019-09-10 17:33:42 +03:00
Evgenii Stratonikov
1289d0f7e9
vm: add tests for NOT
2019-09-10 17:29:10 +03:00
Evgenii Stratonikov
f2393e5efc
vm: implement * -> Boolean conversion
2019-09-10 17:29:10 +03:00
Evgenii Stratonikov
7e14c5a274
vm: implement * -> ByteArray conversion
2019-09-10 17:29:07 +03:00
Vsevolod Brekelov
06ecb1855e
storage: redis db unit test
2019-09-10 17:22:45 +03:00
Vsevolod Brekelov
4f680703a4
storage: multiple DB support and Redis support
...
add config which closes #336
add redis db support
2019-09-10 17:22:21 +03:00
Evgenii Stratonikov
9b10b4c4d8
vm: add tests for SIGN
2019-09-10 15:08:42 +03:00
Evgenii Stratonikov
52b0d661e0
vm: implement BigInt -> Boolean conversion
2019-09-10 14:19:36 +03:00
Roman Khimov
33bb371f9b
Merge pull request #380 from nspcc-dev/drop-endpoint-fix-321
...
util: drop Endpoint structure, fix #321
2019-09-09 19:39:49 +03:00
Roman Khimov
8d9bc83214
util: drop Endpoint structure, fix #321
...
I think it's useless, buggy and hides parsing errors for no good reason.
2019-09-09 17:54:38 +03:00
Evgenii
0b58ed4a22
vm: do not fault on LEFT with big index
...
Fixes #378 .
2019-09-09 17:29:31 +03:00
Roman Khimov
a039ae6cdb
Merge pull request #374 from nspcc-dev/makefile-and-gofmt
...
Makefile convenience targets and gofmt
2019-09-09 15:05:12 +03:00
Roman Khimov
b5d3c37a01
Merge pull request #375 from nspcc-dev/pushbytes-short-read-fix-361
...
vm: fix not failing PUSHBYTES* on short read
2019-09-09 15:02:56 +03:00
Roman Khimov
b8b26d8e79
core: fix 'implementation' misspell in test code
...
Found in the Go report card.
2019-09-09 14:53:50 +03:00
Roman Khimov
8db9d2a976
crypto: use mr-tron/base58 for base58
...
Use more fast and reliable implementation. Add some tests for our wrappers,
deduplicate code in PublicKey.Adress(). Fixes #355 .
2019-09-09 13:12:55 +03:00
Roman Khimov
a2a8981979
vm: fix not failing PUSHBYTES* on short read
...
Add some tests also. Fixes #361 .
2019-09-09 12:09:05 +03:00
Roman Khimov
fabd11699a
*: gofmt -s
...
Appy gofmt for all the source tree.
2019-09-09 12:02:24 +03:00
Roman Khimov
450063de7d
Merge pull request #362 from nspcc-dev/add-missing-opcodes-into-the-list
...
Add missing opcodes into the list
2019-09-09 11:24:39 +03:00
Roman Khimov
7b0c2781d2
vm: expand instruction list with commands from current VM spec
...
Current NEO documentation lists them:
https://docs.neo.org/docs/en-us/tooldev/advanced/neo_vm.html
CALL_* instructions were left out because of conflict with golint (but they're
removed in NEO 3.0 anyway, so wasting time on them makes no sense).
Update autogenerated instruction_string.go accordingly.
2019-09-08 20:46:35 +03:00
Evgenii
bcc8234155
vm: implement Array <-> Struct conversion
...
Reference VM implementation supports convertation from
Struct to Array via NEWARRAY and vice versa.
https://github.com/neo-project/neo-vm/pull/91
2019-09-08 13:40:21 +03:00
Roman Khimov
8c448ab890
util: add some tests to make GetVarSize() fully covered
2019-09-07 10:28:00 +03:00
Roman Khimov
7e8dc9ad66
vm: uncomment TestForLoopBigIter
...
It works just fine.
2019-09-07 10:10:11 +03:00
Roman Khimov
1c7d203993
compiler: drop TODO comment, #294 was fixed a while ago
2019-09-07 10:09:42 +03:00
Roman Khimov
8169edf04c
vm: expand PUSHBYTES instructions
...
Allows to reliably use String() on any of those. Update autogenerated
instruction_string.go accordingly.
2019-09-06 19:14:47 +03:00
Roman Khimov
aefe572df3
vm: implement UNPACK, REVERSE, REMOVE opcodes
...
Also expand makeStackItem() to accept slices of int for testing
convenience. Fixes #195 .
2019-09-06 19:00:34 +03:00
Roman Khimov
5bd50c7bcd
vm: add some tests for PACK instruction
2019-09-06 13:15:30 +03:00
Roman Khimov
b3ed3d24ee
vm: implement CAT, SUBSTR, LEFT and RIGHT
...
String instruction set.
2019-09-06 12:41:27 +03:00
Roman Khimov
3f40334979
vm: add generic stub for all unimplemented instructions
2019-09-05 17:35:30 +03:00
Roman Khimov
59de72f446
vm: implement INVERT instruction
2019-09-05 17:35:30 +03:00
Roman Khimov
b494e094c0
vm: add XDROP implementation
2019-09-05 17:35:30 +03:00
Roman Khimov
974f5db6bc
vm: add a TUCK implementation with tests
...
Also fix stack's InsertAt for the edge case of inserting into a position that
currently is empty (the first good TUCK test illustrates this).
2019-09-05 17:35:30 +03:00