Commit graph

419 commits

Author SHA1 Message Date
Evgeniy Stratonikov
256cd09228 native: allow to set oracle request price 2021-03-11 10:12:30 +03:00
Evgeniy Stratonikov
27fc28bd69 native: allow to set candidate register price 2021-03-11 10:12:30 +03:00
Anna Shaleva
9015e50847 core: refactor Neo.Crypto.CheckMultisigWithECDsaSecpr1
Rename it to Neo.Crypto.CheckMultisig and remove `message` parameter.
2021-03-10 21:46:05 +03:00
Anna Shaleva
7126637f73 core: remove Neo.Crypto.CheckMultisigWithECDsaSecp256k1
Koblitz RIP.
2021-03-10 21:46:05 +03:00
Anna Shaleva
cdaca7be3e core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +03:00
Anna Shaleva
4e6c1092b8 core: add Neo.Crypto.CheckSig interop 2021-03-10 19:24:19 +03:00
Anna Shaleva
14ade42101 core: remove System.Binary.[Serialize, Deserialize] syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
5c9c168ee5 core: remove System.Binary.[Base64*, Base58*] syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
4d2ad4b9e2 core: remove System.Json.[Serialize, Deserialize] interops
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
f65485b735 core: remove System.Binary.Itoa and System.Binary.Atoi syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
2b90d4455f native: implement StdLib contract 2021-03-10 19:24:19 +03:00
Anna Shaleva
078870fceb compiler: fix contract.IsStandard syscall test 2021-03-10 19:24:19 +03:00
Evgeniy Stratonikov
100f2db3fb native: implement CryptoLib contract 2021-03-10 19:24:19 +03:00
Evgeniy Stratonikov
7160675ac1 compiler/interop: improve conversion to bytes interops
Allow to convert to both `Buffer` and `ByteString`
and explicitly mention VM types. Rename `ToByteArray` to `ToBytes`
to avoid ambiguity.
2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
55009153a9 vm/emit: emit Boolean values correctly
We should convert both `true` and `false` values.
2021-03-09 13:34:22 +03:00
Evgeniy Stratonikov
fd4174ad31 core/state: remove IsConst from StorageItem 2021-03-09 11:59:08 +03:00
Evgeniy Stratonikov
7c62df1253 compiler: add tests for syscall handling 2021-03-05 10:17:35 +03:00
Evgeniy Stratonikov
ffd85dd51d native/policy: remove MaxBlockSize and MaxBlockSystemFee 2021-03-04 16:59:19 +03:00
Evgeniy Stratonikov
7b8533b67c native/policy: move MaxTransactionsPerBlock to config 2021-03-04 16:59:19 +03:00
Roman Khimov
924de3e090
Merge pull request #1796 from nspcc-dev/compiler/pow
Add syscalls for POW and SQRT opcodes
2021-03-04 16:56:15 +03:00
Evgeniy Stratonikov
8f8c7d2839 compiler: fix import alias handling 2021-03-04 14:41:20 +03:00
Evgeniy Stratonikov
d66ce43239 compiler/interop: replace int64 with int 2021-03-04 13:20:43 +03:00
Evgeniy Stratonikov
0b54870bfe compiler: add missing math routines
Add interops for ABS, SIGN, MIN, MAX, WITHIN opcodes
2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
56fe6574c9 compiler: simplify convert.To* processing
With inlining there is no need for special logic in compiler.
2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
e754ca62db compiler: do not emit CONVERT for syscall results
When we encounter type assertion CONVERT is emitted.
This isn't needed for SYSCALL (or opcode) results
because value already has needed type.
Problems can arise when result is converted to invalid type
but `neogointernal` package shouldn't be used directly anyway.
2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
5f4385d3fa compiler: implement syscalls for POW and SQRT opcodes 2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
578bbabd1d compiler: allow to emit opcodes directly 2021-03-04 13:03:05 +03:00
Anna Shaleva
2c81fc8b8e *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
Evgeniy Stratonikov
7577bbef22 compiler: copy locals slice during inline
Consider function call `f(1, g(2, 3))` when
both `f` and `g` are inlined. If `f` contains some locals,
inlining `g` will replace them with it's another locals map,
because slices in Go reuse storage on `append`.
Thus scope needs to be copied.
2021-03-01 11:48:42 +03:00
Evgeniy Stratonikov
b66b853285 compiler: drop stack after inline
Some control-flow statements drop stack items, for example
`return` when it is used inside of `range` loop.
For inlined calls this `return` should drop only portion of stack
which belongs to inlined call.
2021-03-01 11:48:42 +03:00
Roman Khimov
f264996f74
Merge pull request #1777 from nspcc-dev/fix/vote
core: fix native method call flags
2021-02-25 18:55:10 +03:00
Evgeniy Stratonikov
4db5ef05f8 core: fix call flags for System.Contract.Call
Follow neo-project/neo#2292.
2021-02-25 18:12:38 +03:00
Evgeniy Stratonikov
cbda20aca3 core: fix native method call flags
Replace `WriteStates` with `States`.

Follow neo-project/neo#2339.
Close #1775.
Related #1725.
2021-02-25 18:07:33 +03:00
Evgeniy Stratonikov
0a4ff9d3e4 compiler: allow to use inlined functions to init globals 2021-02-25 15:12:16 +03:00
Evgeniy Stratonikov
df5314f286 compiler: refactor syscall handling
Close #941.
2021-02-24 12:51:15 +03:00
Evgeniy Stratonikov
f7b9861c11 compiler: count locals for vararg inline functions 2021-02-24 12:45:47 +03:00
Roman Khimov
abee3b5b05
Merge pull request #1722 from nspcc-dev/fix/nep11
smartcontract: add NEP-11 standard check
2021-02-22 22:27:09 +03:00
Anna Shaleva
c82b11eebe compiler: add CreateMultisigAccount interop 2021-02-19 17:34:23 +03:00
Evgeniy Stratonikov
b38443fe20 smartcontract: add checks for onNEP*Payable methods
When they are present in contract, we want them
to have correct signature.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
d89f055697 smartcontract: add checks for parameter names
It can be annoying to use parameter names as specified by standard,
so a separate `CheckABI` is supported.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
d16ef53653 compiler: support ellipsis for append of non-byte slices
NeoVM lacks opcode for array append, thus some
kind of loop is needed for this.
2021-02-17 17:14:32 +03:00
Evgeniy Stratonikov
fc3b840335 compiler: append bytes >0x80 properly
NeoVM encoding for int(0x80) is []byte{0x80, 0x00} and
byte constant can be used both as integer and as an element
of byte-slice. Thus special case needs to be taken in
`append`.
2021-02-17 16:34:34 +03:00
Evgeniy Stratonikov
cf459002f7 compiler: allow to inline global variables 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
6e560c6c9f compiler: allow to inline var arg functions 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
339187a56d compiler: count locals number properly 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
57a0377c81 compiler: load nil directly on inline 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
3484025065 compiler: load constants directly on inline 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
27e60455c7 compiler: do not introduce excessive locals on inline
When function call-site parameter is an identifier,
we may load it directly. Currently it can be also modified,
this will be fixed in a separate commit.
2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
1ae0d022dd compiler: support basic inlining 2021-02-15 18:48:33 +03:00
Evgeniy Stratonikov
1f238ce6fd compiler: do not emit RET twice for nested BlockStmt
When function finishes with `*ast.BlockStmt`, last return
in that block should be looked for.
2021-02-15 18:48:33 +03:00