Roman Khimov
89ed00ddfb
core: simplify GetTransationResults() based on golint suggestion
...
Golint:
pkg/core/blockchain.go:796:9: if block ends with a return statement, so drop
this else and outdent its block (move short variable declaration to its own
line if necessary)
Refs. #213 .
2019-09-03 18:16:48 +03:00
Roman Khimov
0c160a81fe
transaction: use increments instead of '+1's
...
Fixes golint warning:
should replace sz += 1 with sz++
Refs. #213 .
2019-09-03 18:01:37 +03:00
Roman Khimov
a9b9c9226d
*: add/fix godoc comments to satisfy golint
...
Fixes things like:
* exported type/method/function X should have comment or be unexported
* comment on exported type/method/function X should be of the form "X ..."
(with optional leading article)
Refs. #213 .
2019-09-03 17:57:51 +03:00
Roman Khimov
42dfca47cf
vm: fix double VM run from CLI
...
Fixes one more instruction being ran when VM FAULTs:
NEO-GO-VM > run
NEO-GO-VM > error encountered at instruction 6 (ROLL)
NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference
FAULT
NEO-GO-VM > error encountered at instruction 7 (SETITEM)
NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8
Refs. #96 .
2019-08-31 09:06:56 +03:00
Roman Khimov
428e789ddc
vm: produce better error for ROLL with wrong index
...
Current VM implementation doesn't return errors for many operations, so the
only way to handle it here is to check for NULL. Refs. #96 .
2019-08-31 09:04:59 +03:00
Roman Khimov
6767bb5446
transaction: move state test from dev
2019-08-30 19:35:57 +03:00
Roman Khimov
b8adc36e6a
transaction: add missing alloc in state decoder
...
Fixes panic two lines below:
panic: runtime error: index out of range [recovered]
panic: runtime error: index out of range
2019-08-30 19:34:26 +03:00
Roman Khimov
203aab6a7e
transaction: add binary encoding for publish
...
And expand the test to check for it. Fixes #319 .
2019-08-30 19:19:43 +03:00
Roman Khimov
af212f496e
transaction: implement encoding for state
2019-08-30 19:13:19 +03:00
Roman Khimov
868c9d6e8c
transaction: add miner tx test from dev
2019-08-30 18:53:26 +03:00
Roman Khimov
88a47aeeb4
transaction: move enrollment test from dev into the master
2019-08-30 18:28:12 +03:00
Roman Khimov
aa94ae70b6
transaction: move and adapt test from dev
...
Slightly increases coverage for transaction package.
2019-08-30 18:23:53 +03:00
Roman Khimov
d6686350ee
transaction: auto-generate stringer interface for AttrUsage
2019-08-30 17:44:36 +03:00
Roman Khimov
3495fecc65
transaction: fix DescriptionURL attribute handling
...
Both dev and master actually did it wrong.
2019-08-30 16:51:18 +03:00
Roman Khimov
e72a8bbecd
network: decode CMDGetData the same way as CMDInv
...
As they're the same wrt the payload.
2019-08-30 13:14:12 +03:00
Roman Khimov
17679c3b94
core: add block test from dev branch
...
And drop it from _pkg.dev. Adapted for master.
2019-08-30 11:41:10 +03:00
Roman Khimov
683424cce8
transaction: implement proper Size() everywhere
...
Will be needed for the block test from `dev`.
2019-08-30 11:41:10 +03:00
Roman Khimov
200cce9f02
transaction: fix Size() calculation for attribute
...
It wasn't accounting for attr.Data length properly.
2019-08-30 11:41:10 +03:00
Roman Khimov
8ececdc9a7
transaction: fix invocation decoding for different versions
...
Quick fix similar to abc5833853
+ uncomment the
test case for it.
Closes #173 .
2019-08-30 11:41:10 +03:00
Roman Khimov
2ef2c0b84c
transaction: properly print number in attribute log msg
2019-08-30 11:41:10 +03:00
Roman Khimov
c093f070d3
core: add EncodeBinary() support for the block
2019-08-30 11:41:10 +03:00
Roman Khimov
e03eac9dcc
payload: move one test from dev for inventory
...
And drop it from the _pkg.dev.
2019-08-30 11:41:10 +03:00
Roman Khimov
6cf74e2d83
payload: fix wrong stringer impl for InventoryType
2019-08-30 11:41:10 +03:00
Roman Khimov
f636bb9b6e
payload: extend headers test, add limit
...
... from _pkg.dev and drop headers parsing there.
2019-08-30 11:41:10 +03:00
Roman Khimov
2d94a1e337
network: add getblocks
message parsing
...
It has identical structure to the `getheaders`.
2019-08-29 21:23:57 +03:00
Roman Khimov
01c96fbc50
payload: improve address test
...
Check that the structure has proper values stored.
2019-08-29 21:23:57 +03:00
Roman Khimov
650a1d4bcc
payload: expand version test with explicit data checks
2019-08-29 21:23:57 +03:00
Roman Khimov
2e3172f8a5
payload: fix tests to use asserts
...
Like in 483b875f4a
.
2019-08-29 21:23:57 +03:00
Roman Khimov
c949d2ec53
payload: fix Size() calculation for version
...
UserAgent is variable-length-encoded. Fix associated test.
2019-08-29 21:23:57 +03:00
Vsevolod Brekelov
abc5833853
transaction: add version check for publish
...
-Version check done before reading NeedStorage flag
-Add testify according to review
2019-08-29 19:14:22 +03:00
Roman Khimov
4f23117d32
payload: fix wrong useragent parsing in version
...
C# code reads is as a proper variable-length string, so it's not limited to
252 bytes.
2019-08-29 13:42:16 +03:00
Roman Khimov
7b46f9bb86
util: add error check to Read/WriteVarUint
...
Fixes possibility of bogus reads/writes. Suggested by @im-kulikov.
2019-08-29 13:26:03 +03:00
Roman Khimov
15311f202b
util: drop io, reuse its tests for binaryRW
2019-08-28 19:45:17 +03:00
Roman Khimov
eba83a0e31
smartcontract: use new binaryReader/Writer API from util
2019-08-28 19:45:17 +03:00
Roman Khimov
361724a33e
pkg/core: use util.binaryReader/Writer
...
Simplify error handling.
2019-08-28 19:45:17 +03:00
Roman Khimov
459542a978
pkg/network: convert to using binaryReader/Writer
2019-08-28 19:45:17 +03:00
Roman Khimov
07096a551b
util: move strange Read2000Uint256Hashes() into storage
...
It's the only user of it.
2019-08-28 14:38:57 +03:00
Roman Khimov
672668b9fb
util: use more consistent and explicit naming for BR/BW
2019-08-28 13:24:06 +03:00
Roman Khimov
6409cc753c
util: move binaryReader/Writer from _pkg.dev
...
These are useful and nice.
2019-08-28 12:44:23 +03:00
Roman Khimov
a436e22ec1
pkg/network: sort messages
...
Just for convenience.
2019-08-27 20:12:01 +03:00
Roman Khimov
0f265a6a04
_pkg.dev: drop wire/command
...
Transferring some missing commands to pkg/network.
2019-08-27 20:08:48 +03:00
Roman Khimov
e89e78159b
_pkg.dev: drop wire/protocol package
...
Move service definitions from it into version (just to save them), but other
than that it's useless for master that has configs ruling the networks.
2019-08-27 19:56:12 +03:00
Roman Khimov
2a8e420608
nep2: fix comment, NEP-2 is about keys, not wallets
2019-08-27 17:47:07 +03:00
Roman Khimov
5836ae6873
keys: change Signature() and Address() to not return errors
...
As they never can return any real one.
2019-08-27 17:46:01 +03:00
Roman Khimov
483b875f4a
keys: simplify tests with assert package
2019-08-27 17:46:01 +03:00
Roman Khimov
b77e533d13
crypto/wallet: move public/private key into the new keys package
...
And drop associated _pkg.dev remnants (refs. #307 ).
Original `dev` branch had two separate packages for public and private keys,
but those are so intertwined (`TestHelper` subpackage is a proof) that it's
better unite them and all associated code (like WIF and NEP-2) in one
package. This patch also:
* creates internal `keytestcases` package to share things with wallet (maybe
it'll be changed in some future)
* ports some tests from `dev`
* ports Verify() method for public key from `dev`
* expands TestPrivateKey() with public key check
2019-08-27 17:45:51 +03:00
Roman Khimov
2275b9e4ad
_pkg.dev: drop address pkg, move test into crypto
...
address wrappers don't seem to fit well into master's code, so just drop 'em,
but pick the testing function with good known input/output pair.
2019-08-27 17:09:24 +03:00
Evgeniy Kulikov
96169ef266
Merge pull request #317 from nspcc-dev/fix/data-race-in-memeory-store
...
Fix DataRace in MemoryStore
- Add RWMutex to MemoryStore struct
- Use Lock/Unlock for writing
- Use RLock/RUnlock for reading
- Fix #313 issue
2019-08-27 16:51:54 +03:00
Evgeniy Kulikov
33f59debf2
store: Fix DataRace in MemoryStore
...
- Add RWMutex to MemoryStore struct
- Use Lock/Unlock for writing
- Use RLock/RUnlock for reading
- Fix #313 issue
2019-08-27 16:48:30 +03:00
Evgeniy Kulikov
78cf3e9c5f
Use our RFC6979 fork
...
- prepare fork
- update go-modules
- update dependencies
2019-08-27 13:07:02 +03:00