Commit graph

495 commits

Author SHA1 Message Date
Roman Khimov
0b884b92b3 crypto: use PrivateKey to generate a key pair
It makes no sense to provide an API for throw-away public keys, so obtain it
via a new real keypair generation where appropriate (and that's only needed
for testing).
2019-09-05 09:38:13 +03:00
Roman Khimov
1ffda460bd
Merge pull request #351 from nspcc-dev/drop-redundant-dev-code-part-7
Drop redundant dev code part 7, the next one in series of #315, #318, #322, #328, #330, #338.
2019-09-04 19:53:56 +03:00
fabwa
1af97a7a87
Update README.md 2019-09-04 18:19:22 +02:00
Roman Khimov
cea983acc6 _pkg.dev: drop peer/peermgr/syncmgr
It was a nice attempt, but there is not a lot that we can reuse for the
master branch. Refs. #307.
2019-09-04 15:30:04 +03:00
Roman Khimov
441f1d3bf5 _pkg.dev: drop chain package
Duplicated by blockchain code in core. Refs. #307.
2019-09-04 12:12:02 +03:00
Roman Khimov
e636537844
Merge pull request #340 from nspcc-dev/fix-golint-213
Make our build green again! Fixes #213.
2019-09-03 19:54:29 +03:00
Roman Khimov
2c2f91564f rpc: comment out getBlock and getRawTransaction
After the 8388f4a55e Golint quickly pointed that
these are unused, so comment 'em out for now.
2019-09-03 18:25:19 +03:00
Roman Khimov
6bfcc615b2 *: fix some misspellings
Found by goreport.
2019-09-03 18:20:05 +03:00
Roman Khimov
22bea5eccf core: remove ineffective assignment from test code
Spotted by goreport:
  Line 89: warning: ineffectual assignment to hash (ineffassign)
2019-09-03 18:17:44 +03:00
Roman Khimov
8388f4a55e rpc: unexport methods returning internal structures
Golint:
pkg/rpc/rpc.go:15:67: exported method GetBlock returns unexported type *rpc.response, which can be annoying to use
pkg/rpc/rpc.go:82:64: exported method GetRawTransaction returns unexported type *rpc.response, which can be annoying to use
pkg/rpc/rpc.go:97:52: exported method SendRawTransaction returns unexported type *rpc.response, which can be annoying to use

Refs. #213.
2019-09-03 18:16:48 +03:00
Roman Khimov
1fd5e5928c rpc: fix bad name spellings noted by golint
pkg/rpc/neoScanBalanceGetter.go:54:56: method parameter assetIdUint should be assetIDUint
pkg/rpc/neoScanBalanceGetter.go:62:3: var assetId should be assetID
pkg/rpc/server_test.go:27:5: var testRpcCases should be testRPCCases
pkg/rpc/txTypes.go:19:3: struct field assetId should be assetID
pkg/rpc/txTypes.go:39:35: interface method parameter assetId should be assetID
pkg/rpc/types.go:115:2: struct field TxId should be TxID

Refs. #213.
2019-09-03 18:16:48 +03:00
Roman Khimov
db9e37b3bb *: fix golint's omit type suggestions
pkg/core/transaction/attribute.go:67:14: should omit type uint8 from declaration of var urllen; it will be inferred from the right-hand side
pkg/crypto/keys/publickey.go:184:8: should omit type []byte from declaration of var b; it will be inferred from the right-hand side
pkg/network/payload/version_test.go:15:12: should omit type bool from declaration of var relay; it will be inferred from the right-hand side

Refs. #213.
2019-09-03 18:16:48 +03:00
Roman Khimov
a74518691c crypto: improve error messages for base58
Golint:
  error strings should not be capitalized or end with punctuation or a newline

Refs. #213.
2019-09-03 18:16:48 +03:00
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
30eb137200 examples: remove underscores from package names
Fixes golint warnings: "don't use an underscore in package name" and makes our
examples better. Refs. #213.
2019-09-03 18:00:10 +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
Vsevolod
de84e074a2
Merge pull request #337 from nspcc-dev/cli_documentation
Add neo-go cli documentation
2019-09-02 18:38:15 +03:00
Roman Khimov
9de8413d06
Merge pull request #338 from nspcc-dev/drop-redundant-dev-code-part-6
The big delete (#307) series episode six airs today for every subscriber of the neo-go repo (previous episodes: #315, #318, #322, #328, #330).

This one is easy, nothing moved, just the red things.
2019-09-02 18:38:00 +03:00
Vsevolod Brekelov
51b93a9a55 Add neo-go cli documentation
Comments fix
2019-09-02 18:32:11 +03:00
Roman Khimov
46c02de2f3 _pkg.dev: drop server
Nothing useful here for master, it has it all implemented already. Refs. #307.
2019-09-02 17:40:53 +03:00
Roman Khimov
eb95758ddc _pkg.dev: drop connmgr
I don't think it's of any use for us now. Refs. #307.
2019-09-02 17:37:48 +03:00
Roman Khimov
5bdf3682ed _pkg.dev: drop chaincfg package
It's just a wrapper around hardcoded genesis block, we don't need it.
2019-09-02 10:10:31 +03:00
Roman Khimov
f9a5ce89da
Merge pull request #331 from nspcc-dev/vm-fix-things-for-96
This fixes two minor things observed in #96:

    running VM twice, which leads to instruction execution attempt for VM in FAULT state
    panicing with nil dereference (it's better to show some error message)

Before this patchset:

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

After this patchset:

NEO-GO-VM > run
NEO-GO-VM > error encountered at instruction 6 (ROLL)
NEO-GO-VM > bad index
FAULT
2019-08-31 12:34:49 +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
c96be81229
Merge pull request #330 from nspcc-dev/drop-redundant-dev-code-part-5
Drop redundant dev code part 5. The next one in series of #315, #318, #322 and #328. Continuing with #307. Fixes #319 along the way.
2019-08-30 20:08:09 +03:00
Roman Khimov
973d39eceb _pkg.dev: drop wire
Nothing interesting left here, thanks. Refs. #307.
2019-08-30 19:45:39 +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
fb65dd8848
Merge pull request #329 from nspcc-dev/circleci-enable-codecov
circleci: fix codecov integration
2019-08-30 17:27:28 +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
383bececb8 circleci: add codecov integration 2019-08-30 16:44:51 +03:00
Roman Khimov
d0c39a561c
Merge pull request #328 from nspcc-dev/drop-redundant-dev-code-part-4
Drop redundant dev code part 4.

The next one in series of #315, #318 and #322. Continuing with #307. Fixes #173 along the way.
2019-08-30 15:43:18 +03:00
Roman Khimov
055616a18d _pkg.dev: drop zero-payload mmempool and mverack from payload, useless 2019-08-30 13:34:55 +03:00
Roman Khimov
a5566841fe _pkg.dev: drop useless mgetdata from payload 2019-08-30 13:15:20 +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
db39149b3d _pkg.dev: drop mgetaddr "implementation"
It has no real payload, so all of this is just useless.
2019-08-30 11:46:39 +03:00
Roman Khimov
45d94ee8c6 _pkg.dev: drop mblock wrapper
No use for us.
2019-08-30 11:42:25 +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