Commit graph

615 commits

Author SHA1 Message Date
Jeroen Peeters
b3037cd598 Token Example (CityOfZion/neo-storm#12)
* feat: add token example

* feat: code splitted package

* feat: use updated apis

Imported from CityOfZion/neo-storm (e2bab450d7355b559ae2d70a87f557e8a6dbfff6).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
8bfaed0e4b added in the crypto helper api for smart contracts. (CityOfZion/neo-storm#15)
Imported from CityOfZion/neo-storm (ad6e9dae46846f97a7da6dd48bf55ad554d612b3).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
9e15ab04ce Added missing execution interop api (CityOfZion/neo-storm#14)
Imported from CityOfZion/neo-storm (ab12273da74e0d35df8863f08f1a914723d2bdba).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
0b33cf3193 new mapping for interop api (CityOfZion/neo-storm#10)
* new mapping for interop api

* Fixed interop API mapping + added missing apis

* added engine apis

Imported from CityOfZion/neo-storm (ec5e6c8e2b587704a1e071e83b633d2d3a235300).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
2fbb269c0d added compiler to test all example files. (CityOfZion/neo-storm#9)
Imported from CityOfZion/neo-storm (e756a91b292f525f2cd7e6d6c05b46df582c8ece).
2019-08-14 19:14:05 +03:00
Roman Khimov
d804b517fc examples/token-sale: drop binary avm from the repo
It's easily reproduced from the token_sale.go and it's confusing the compiler
test.
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
05cd2775e2 renamed path to match the new project name (CityOfZion/neo-storm#8)
Imported from CityOfZion/neo-storm (d022d46cd851de78ee041851a80dc34e3b3b68d1).
2019-08-14 19:14:04 +03:00
Anthony De Meulemeester
523789ee1c Compiler interop APIs (CityOfZion/neo-storm#5)
* added draft of block and transaction interop api.

* added header interop API

* added attribute, transaction, input, output interop API

* Added asset, attribute and account interop api.

* added Runtime interop apis

* added asset renew and create + contract and asset interop apis

Imported from CityOfZion/neo-storm (b6810d58b98312a959980f344db24689839574c4).
2019-08-14 19:13:56 +03:00
Jeroen Peeters
e4c80a001c feat: add Log, Notify and Triggers
Imported from CityOfZion/neo-storm (5065465e39fd2b308c487f49f75f517620139660).
2019-08-14 18:59:34 +03:00
Jeroen Peeters
e6c16a6a24 chore: use shorthand in example
Imported from CityOfZion/neo-storm (a2f2da87fcfb1a4f8ccdb48a043f98ff47bb3e89).
2019-08-14 18:59:06 +03:00
Jeroen Peeters
29f05c0edb chore: move examples out of separate folder
Imported from CityOfZion/neo-storm (7eb644415d4083572c4e74590da056319c3a54fb).
2019-08-14 18:58:41 +03:00
Jeroen Peeters
90809ee73e chore: use Context interface
Imported from CityOfZion/neo-storm (16c6f9fab7de374196a4fb352d781abeebb384c1).
2019-08-14 18:58:04 +03:00
Jeroen Peeters
9d983ec77b feat: add storage APi's and example
Imported from CityOfZion/neo-storm (86ac5c215a2c6ec710f2fd913e0ace63d6ea993e).
2019-08-14 18:57:31 +03:00
Anthony De Meulemeester
86715511d0 Added examples folder
Imported from CityOfZion/neo-storm (77d0e5949470b2648acd37c71116f4469197772b).
2019-08-14 18:56:58 +03:00
Anthony De Meulemeester
1927bc54d5 added partial syscall mapping
Imported from CityOfZion/neo-storm (26d10c72f6e3d298135ec3995eb2d821640c3b7c).
2019-08-14 18:55:29 +03:00
Roman Khimov
33c512032f vm: switch from Opcode to Instruction
Which matches the changes done in neo-storm and also make this codebase closer
to the `dev` branch (that also uses Instruction).
2019-08-14 15:40:31 +03:00
Roman Khimov
5f3256d0e0 .gitignore: add *.(orig|rej) 2019-08-14 15:05:54 +03:00
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