Commit graph

2848 commits

Author SHA1 Message Date
Roman Khimov
d6fc045142
Merge pull request #288 from nspcc-dev/tiny-toolchain-fixes
Tiny tooling fixes
2019-08-13 13:11:03 +03:00
Roman Khimov
2949c3bd9d .gitignore: add db directory
Where the node stores its stuff.
2019-08-12 19:42:26 +03:00
Roman Khimov
bb4680a59d go.(mod|sum): make a clenup with go mod tidy 2019-08-12 19:32:17 +03:00
Roman Khimov
b3d6740a77 .gitignore: add some standard ignore files 2019-08-12 19:25:32 +03:00
Roman Khimov
2e7c0daa25
Merge pull request #287 from nspcc-dev/vm
VM improvements for dev branch, merging as outlined in #283.
2019-08-12 19:19:03 +03:00
Roman Khimov
2ddf1d15ab
Merge branch 'dev' into vm 2019-08-12 19:12:19 +03:00
Roman Khimov
f068f4c0ed pkg/vm/stack: drop unused (*RandomAccess).items()
GolangCI complains:
  U1000: func (*RandomAccess).items is unused

And it looks like everyone and their dog just use ras.vals without any
wrappers when there is a need to access it, so drop the wrapper.
2019-08-12 18:19:26 +03:00
Roman Khimov
bc87d3e8e6 pkg/vm: fix GolangCI's SA4009 in RET()
SA4009: argument ctx is overwritten before first use (from staticcheck)

It should be OK here.
2019-08-12 18:15:48 +03:00
Roman Khimov
9be53e5961 pkg/vm/stack: fix SA4006 GolangCI warning in TestStackPushPop()
SA4006: this value of stackElement is never used (from staticcheck)
2019-08-12 18:13:04 +03:00
Roman Khimov
f445103260 pkg/vm/stack: fix S1002 gosimple warnings in map.go
S1002: should omit comparison to bool constant, can be simplified to ok.Value() (from gosimple)
2019-08-12 18:08:39 +03:00
Roman Khimov
4e40467dc3 pkg/vm/stack: fix S1008 gosimple warning from GolangCI
S1008: should use 'return ' instead of 'if { return }; return ' (from gosimple)
2019-08-12 18:05:04 +03:00
Roman Khimov
bab187f4a8 pkg/vm: drop bogus err check in BoolAnd() and BoolOr()
GolangCI:
  nilness: impossible condition: nil != nil (from govet)
2019-08-12 18:00:54 +03:00
Roman Khimov
613bad36e0 pkg/vm/stack: fix unused binary.Read() result in testReadInt64()
GolangCI:
  Error return value of binary.Read is not checked (from errcheck)
2019-08-12 17:56:51 +03:00
Roman Khimov
d6c3f74e3c pkg/vm/stack: make some use of testReadInt64()
GolangCI complains:
  testReadInt64 is unused (from deadcode)

Fix it to always provide correctly-sized buffer for the binary.Read().
2019-08-12 17:53:19 +03:00
Roman Khimov
6be27ad4b0 pkg/vm/stack: s,testPeakInteger,testPeakInteger,
Fix obvious typo.
2019-08-12 17:16:47 +03:00
Roman Khimov
1fb66d6b73 pkg/vm/stack: improve Array testing code slightly
GolangCI complained:
  testArray is unused (from deadcode)

But this function was actually wrong being a copy-paste of testMakeStackMap(),
it also didn't conform to testMake... naming scheme, so this fixes it. To make
thing more uniform NewArray() was also changed to return error, map_test.go
code adjusted to this changes and finally array_test.go was added as a stub
for future Array testing.
2019-08-12 17:12:05 +03:00
Roman Khimov
3bc195659a pkg/vm: fix error handling in XDROP()
Found by GolangCI:
  Error return value of ctx.Estack.Remove is not checked (from errcheck)
  nilness: impossible condition: nil != nil (from govet)
2019-08-12 16:40:19 +03:00
Roman Khimov
06f9e1d123 pkg/(crypto|vm): fix GolangCI errcheck warnings
Like:
  Error return value of alg.Write is not checked (from errcheck)

Actually even though the hash.Hash implements an io.Writer interface (that
return meaningful things on .Write()) it has this comment in its
documentation:

// Write (via the embedded io.Writer interface) adds more data to the running hash.
// It never returns an error.

so it should be OK to ignore return results here.
2019-08-12 16:36:06 +03:00
Roman Khimov
a976c4d04f pkg/vm: go fmt
Some errors were introduced by github merges.
2019-08-12 16:29:42 +03:00
Roman Khimov
0258fa48f8 pkg/vm: fix all GolangCI warnings about v.executeOp errcheck
Fixes lots of warnings like this in the test code:
  Error return value of v.executeOp is not checked (from errcheck)
2019-08-12 16:25:16 +03:00
Roman Khimov
db41a397cd
Merge pull request #120 from hal0x2328/master
Merging as a reminder as discussed in #283.
2019-08-12 15:41:48 +03:00
Roman Khimov
a4b2bb268e
Merge pull request #279 from dauTT/dauTT/vm-ROLL-ROT-SWAP-TUCK-opcode
VM: Implement ROLL, ROT, SWAP, TUCK opcode

Closes #278, merging as per #283 discussion.
2019-08-12 15:40:03 +03:00
Roman Khimov
18d32a33a2
Merge branch 'vm' into dauTT/vm-ROLL-ROT-SWAP-TUCK-opcode 2019-08-12 15:37:58 +03:00
Roman Khimov
f2f9a37d3f
Merge pull request #277 from dauTT/dauTT/vm-DUP-NIP-OVER-PICK-opcode
VM: Implement DUP, NIP, OVER, PICK opcode

Closes #276, merging as per #283 discussion.
2019-08-12 13:37:23 +03:00
Roman Khimov
e9f4a0739f
Merge branch 'vm' into dauTT/vm-DUP-NIP-OVER-PICK-opcode 2019-08-12 13:35:08 +03:00
Roman Khimov
37d7198877
Merge pull request #275 from dauTT/dauTT/vm-XSWAP-XTUCK-DEPTH-DROP-opcode
VM: Implement XSWAP, XTUCK, DEPTH, DROP opcode

Closes #274, merging as per #283 discussion.
2019-08-12 13:05:30 +03:00
Roman Khimov
5167c37255
Merge branch 'vm' into dauTT/vm-XSWAP-XTUCK-DEPTH-DROP-opcode 2019-08-12 13:02:24 +03:00
Roman Khimov
6c3634cdb8
Merge pull request #273 from dauTT/dauTT/vm-DUPFROMALTSTACK-TOALTSTACK-FROMALTSTACK-XDROP-opcode
VM: Implement DUPFROMALTSTACK, TOALTSTACK, FROMALTSTACK, XDROP opcodes

Closes #272, merging as per #283 discussion.
2019-08-12 12:49:34 +03:00
Roman Khimov
c0a0749d80
Merge branch 'vm' into dauTT/vm-DUPFROMALTSTACK-TOALTSTACK-FROMALTSTACK-XDROP-opcode 2019-08-12 12:47:24 +03:00
Roman Khimov
6ffb4b6a5e
Merge pull request #271 from dauTT/dauTT/vm-NOP-JMP-JMPIF-JMPIFNOT-opcodes
VM: Implement NOP, JMP, JMPIF, JMPIFNOT opcode, closes #270.

Merging as per #283 discussion.
2019-08-12 12:44:02 +03:00
Roman Khimov
3a7cfe26ac
Merge branch 'vm' into dauTT/vm-NOP-JMP-JMPIF-JMPIFNOT-opcodes 2019-08-12 12:42:21 +03:00
Roman Khimov
cdb92ebaa2
Merge pull request #267 from dauTT/dauTT/vm-crypto-opcode-194
VM: Implement SHA1, SHA256, HASH160, HASH256 opcode, closes #268.

Implemented
1) SHA1
2) SHA256
3) HASH160
4) HASH256
2019-08-12 12:40:18 +03:00
Roman Khimov
b46439d8d4
Merge branch 'vm' into dauTT/vm-crypto-opcode-194 2019-08-12 12:36:23 +03:00
Roman Khimov
b50411b057
Merge pull request #266 from dauTT/dauTT/vm-bitwise-opcodes-191
VM: Implement bitwise opcodes, closes #191

Implemented following opcodes:
    AND
    XOR
    OR
    INVERT
2019-08-12 12:28:51 +03:00
Roman Khimov
03939bb8ba
Merge branch 'vm' into dauTT/vm-bitwise-opcodes-191 2019-08-12 12:21:52 +03:00
Roman Khimov
ce0d6d97dc
Merge pull request #265 from dauTT/dauTT/vm-implement-Map-Struct-167
VM: Implement Map, Struct Stack Item:

Closes #167, merging as per discussion in #283.
2019-08-12 12:13:25 +03:00
Roman Khimov
eeecbf96bf
Merge branch 'vm' into dauTT/vm-implement-Map-Struct-167 2019-08-12 12:11:29 +03:00
Roman Khimov
e52f78165e
Merge pull request #261 from dauTT/dauTT/vm-implement-MIN-MAX-WITHIN-opcodes-230
Implemented MIN, MAX WITHIN opcode
2019-08-12 12:06:24 +03:00
Roman Khimov
e99d916b04
Merge pull request #286 from nspcc-dev/interop-test-dummy
neo-vm test reusage sample, merging as per #283 discussion.
2019-08-12 12:05:36 +03:00
Roman Khimov
03629a31c7
Merge pull request #264 from nspcc-dev/blockPool
syncmgr : Add blockpool to syncmgr
2019-08-12 12:02:09 +03:00
dauTT
b9b118d3ea Add ReverseString, ToReverseScriptHash method (#281)
* Added
1) ReverseString method to the Uint160 type
2) ToReverseScriptHash method to convert a base58 address to a reverse script hash

* Simplified ToScriptHash method
2019-08-05 09:34:31 +02:00
DauTT
458e6f922b Clean up comments 2019-04-12 22:34:28 +02:00
DauTT
d36d8b456c Implemented following opcodes:
1) ROLL
2) ROT
3) SWAP
4) TUCK
2019-04-12 22:27:52 +02:00
DauTT
d43dcf03cb Implemented following opcodes:
1) DUP
2) NIP
3) OVER
4) PICK
2019-04-12 20:25:20 +02:00
DauTT
aa67e98726 Implemented following opcodes:
1) XSWAP
2) XTUCK
3) DEPTH
4) DROP
2019-04-12 00:38:57 +02:00
DauTT
7e20b604b4 Implemented following opcodes:
1) DUPFROMALTSTACK
2) TOALTSTACK
3) FROMALTSTACK
4) XDROP
2019-04-11 00:07:17 +02:00
DauTT
4dc11ee48f Implemented following control flow opcodes:
1) NOP
2) JMP
3) JMPIF
4) JMPIFNOT
2019-04-09 01:07:15 +02:00
DauTT
51f8351723 Used consistently assert.Nil for checking absence of error 2019-04-05 21:13:23 +02:00
DauTT
3c8448ed40 Simplied code by using help method PopByteArray 2019-04-05 20:34:02 +02:00
DauTT
2897c3cbc1 Implemented crypto opcodes:
1) SHA1
2) SHA256
3) HASH160
4) HASH256
2019-04-04 22:46:06 +02:00