Evgeniy Stratonikov
ad65d1fa1f
compiler: implement custom logic for go1.15
...
For some reason `foo.go` is interpreted as an http URL, and even if we
replace it with `./foo.go` there is an errors with file missing on disk.
Because `CompileWithOptions` should be able to compile file under any
circumstances, we allocate temporary directory base on version used to
compile a binary.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-21 17:43:28 +03:00
Evgeniy Stratonikov
25583f9aeb
compiler: make pkg/interop a separate module
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Anna Shaleva
cc60bca491
core: adjust native Notary withdraw
call flags
...
It changes states and calls `transfer` method of GAS which emits `transfer`
notification, so it requires States | AllowCall | AllowNotify, i.e. the
widest permission.
See
https://github.com/nspcc-dev/neo-go/issues/1990#issuecomment-1014911528 .
2022-01-19 11:33:33 +03:00
Roman Khimov
299a7ea614
compiler: use CALLT for native contract calls, fix #2257
2021-12-10 11:58:50 +03:00
Roman Khimov
f8d5c5ff79
interop/storage: fix outdated RemovePrefix comment
...
ffaae0f773
changed the behavior long time ago,
we're actually stripping whole requested prefix.
2021-12-06 18:09:53 +03:00
Evgeniy Stratonikov
a92bf281c1
compiler: remove custom logic for util
builtins
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-23 16:12:47 +03:00
Roman Khimov
36295357d8
interop: add Abort() function to ABORT things
...
Related to #2227 .
2021-10-22 14:50:51 +03:00
Roman Khimov
e230040c2e
interop: add canonical type lengths as constants
...
Contracts need them anyway.
2021-10-22 10:56:58 +03:00
Anna Shaleva
2f23d83a49
interop: adjust documentation
2021-09-08 17:53:09 +03:00
Roman Khimov
d6bd6b6888
native: drop Refuel method from GAS
...
It can be used to attack the network (amplifying DOS), so it's broken
beyond repair. This reverts ac601601c1
.
See also neo-project/neo#2560 and neo-project/neo#2561 .
2021-08-05 10:27:13 +03:00
Evgeniy Stratonikov
8077f9232d
interop: implement System.Runtime.GetRandom
...
Our murmur3 implementation is architecture independent and optimized in
assembly.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 16:00:01 +03:00
Evgeniy Stratonikov
3a4e0caeb8
core/block: add Nonce
field to header
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Evgeniy Stratonikov
96a42cd011
interop: add System.Runtime.GetNetwork
, fix #2038
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-08 17:02:37 +03:00
Evgeniy Stratonikov
233996eec0
native/neo: add getAccountState
method, close #1975
2021-05-27 10:59:38 +03:00
Evgeniy Stratonikov
e314e55a1b
compiler: add Base58Check*
interop wrappers
...
Missing piece from #1977 .
2021-05-25 18:06:40 +03:00
Anna Shaleva
6eee868b4a
interop: remove native NNS API wrappers
2021-05-17 22:08:15 +03:00
Roman Khimov
9d2712573f
*: enable godot linter and fix all its warnings
...
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Anna Shaleva
6d59689d9c
core: rename Neo.Crypto.CheckMultisig interop
2021-05-11 18:38:14 +03:00
Anna Shaleva
366e79b9b8
core: rename Neo.Crypto.CheckSig interop
2021-05-11 18:37:55 +03:00
Roman Khimov
3a21d8f44f
Merge pull request #1947 from nspcc-dev/iterator-remove
...
interop: remove `System.Iterator.Create`
2021-05-11 18:29:17 +03:00
Evgeniy Stratonikov
23a4e25436
interop: remove System.Iterator.Create
, fix #1935
...
There are now only storage iterators. Related #1933 .
2021-05-11 12:13:30 +03:00
Evgeniy Stratonikov
40d1dd0e0d
native/std: add stringSplit
method
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
dadfe2b9ab
native/std: add memorySearch
method
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
978f4dfbc5
native/std: add memoryCompare
method
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
e4b34833da
native/std: add overloads for itoa
and atoi
2021-05-11 12:11:38 +03:00
Anna Shaleva
d0c64347ab
*: add data
to NEP11 Transfer
2021-05-05 19:44:29 +03:00
Evgeniy Stratonikov
bb039ef035
manifest: add features
field
2021-05-04 13:10:46 +03:00
Evgeniy Stratonikov
ac601601c1
native: add refuel
method to GAS contract
2021-04-29 18:26:34 +03:00
Evgeniy Stratonikov
0114f9a912
interop: add System.Runtime.BurnGas
2021-04-29 18:23:33 +03:00
Evgeniy Stratonikov
8c3998593e
native: emit Designation
event on role update
2021-04-29 14:12:48 +03:00
Roman Khimov
555693d8b8
oracle: add MinimumResponseGas to interop
...
It's important for users of oracle contract.
2021-04-06 22:50:42 +03:00
Roman Khimov
090d68f8fa
oracle: add response codes to interop defintions
...
Client should be aware of them.
2021-04-06 22:50:42 +03:00
Roman Khimov
607cdcf13d
oracle: improve oracle interop documentation
2021-04-06 22:50:42 +03:00
Roman Khimov
83cb5ff07b
roles: add missing NeoFSAlphabet role
2021-03-19 16:18:45 +03:00
Roman Khimov
b56e028733
*: add more package-specific documentation
...
For the most important packages at least.
2021-03-19 16:18:45 +03:00
Anna Shaleva
0d9266d407
core: remove System.Contract.IsStandard
2021-03-16 16:59:23 +03:00
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
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
fd4174ad31
core/state: remove IsConst
from StorageItem
2021-03-09 11:59:08 +03:00
Evgeniy Stratonikov
dcbfe856cd
compiler/interop: fix contract.GetCallFlags
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
Evgeniy Stratonikov
d66ce43239
compiler/interop: replace int64
with int
2021-03-04 13:20:43 +03:00
Evgeniy Stratonikov
1138143a50
compiler/interop: add flag type for PutEx
2021-03-04 13:13:12 +03:00
Evgeniy Stratonikov
1e2944f492
compiler/interop: return proper type from contract.GetCallFlags
2021-03-04 13:09:03 +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
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
Roman Khimov
58ea4607d0
Merge pull request #1805 from nspcc-dev/interop/convertcontext-fix
...
interop: fix ConvertContextToReadOnly interop
2021-03-04 12:31:36 +03:00
Anna Shaleva
0c464083ed
interop: fix ConvertContextToReadOnly interop
...
The same bug as in #1804 .
2021-03-04 11:51:32 +03:00
Anna Shaleva
52e4d69c82
interop: fix CreateMultisigAccount interop
...
Introduced in #1720 .
2021-03-04 11:39:49 +03:00
Evgeniy Stratonikov
f9f1fe03b2
core: refactor native call
...
1. `System.Contract.CallNative` expects version on stack.
2. Actual method is determined based on current
instruction pointer.
3. Native hashes don't longer depend on NEF checksum.
2021-02-26 10:59:09 +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
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
ac91de80e7
interop: fix Base58Decode interop
2021-02-25 15:11:52 +03:00
Evgeniy Stratonikov
df5314f286
compiler: refactor syscall handling
...
Close #941 .
2021-02-24 12:51:15 +03:00
Anna Shaleva
c82b11eebe
compiler: add CreateMultisigAccount interop
2021-02-19 17:34:23 +03:00
Roman Khimov
ca08a559fa
interop: allow transfer calls to read states
...
Follow-up to #1734 .
2021-02-12 12:56:15 +03:00
Evgeniy Stratonikov
18b7584cb4
compiler/interop: add Manifest to Contract struct
2021-02-08 13:13:11 +03:00
Evgeniy Stratonikov
69c011b3e7
compiler: implement Ledger contract wrapper
2021-02-08 13:09:41 +03:00
Evgeniy Stratonikov
7bee28b81e
compiler: implement Management contract wrapper
2021-02-08 13:09:41 +03:00
Evgeniy Stratonikov
9988f4ed1c
compiler: implement Notary contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
2f26490e59
compiler: implement RoleManagement contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
77fcfeccff
compiler: implement Policy contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
3c237e2a29
compiler: implement NameService contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
779fba3001
compiler: implement Oracle contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
34a6eef8ce
compiler: implement GAS contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
6e866b622a
compiler: implement NEO contract wrapper
2021-02-08 11:44:39 +03:00
Roman Khimov
ac527650eb
native: add Ledger contract, fix #1696
...
But don't change the way we process/store transactions and blocks. Effectively
it's just an interface for smart contracts that replaces old syscalls.
Transaction definition is moved temporarily to runtime package and Block
definition is removed (till we solve #1691 properly).
2021-02-04 13:12:11 +03:00
Evgeniy Stratonikov
9b1a7021ba
core: add PickN flags to Storage.Find
...
Allow to pick items by index from serialized struct or array.
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
44af99fd07
core: add Deserialize flag to Storage.Find
...
Allow to deserialize values being iterated over.
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
7fc0c04dba
core: add flags to Storage.Find
...
It can be iterated over keys, values or both.
Prefix can be stripped.
2021-01-15 21:12:08 +03:00
Evgeniy Stratonikov
2130e17f0c
core,vm: remove System.Enumerator.*
interops
...
Map iterator now returns key-value pair, while array/byte-array
iterators work like old enumerators.
Follow neo-project/neo#2190 .
2021-01-15 21:11:32 +03:00
Evgeniy Stratonikov
d04b000748
vm: remove iterator/enumerator Concat API
...
Follow neo-project/neo#2170 .
2021-01-15 21:08:59 +03:00
Evgenii Stratonikov
1c0c331e25
core: update System.Contract.Call
syscall
...
1. Remove `System.Contract.CallEx`.
2. Extend number of parameters.
3. Add return value count to `VM.Context`.
2021-01-14 18:23:36 +03:00
Roman Khimov
ab12eee346
native: move contract deployment to management contract
...
See neo-project/neo#2119 .
2020-12-14 15:23:46 +03:00
Anna Shaleva
fadbae8997
core: rename call flags
...
Also new States flag is added and ReadOnly flag is adjusted.
2020-12-11 10:34:01 +03:00
Evgenii Stratonikov
37a8550215
compiler: add contract.CallEx
interop
2020-12-10 13:45:10 +03:00
Evgenii Stratonikov
b807fd9e7f
compiler: rename engine.AppCall()
to contract.Call()
2020-12-10 13:45:10 +03:00
Roman Khimov
286d9185f4
smartcontract: remove contract features
...
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060 .
2020-11-13 21:26:23 +03:00
Evgenii Stratonikov
d193e16662
compiler: support System.Binary.Atoi/Itoa
syscalls
2020-11-10 16:15:10 +03:00
Roman Khimov
eaa260474f
trigger/core: split System trigger into OnPerist and PostPersist
...
Follow neo-project/neo#2022 .
2020-10-29 19:17:07 +03:00
Roman Khimov
5f22bdfecf
Merge pull request #1375 from nspcc-dev/compiler/types
...
Smartcontract types definition in interops
2020-09-16 14:43:50 +03:00
Evgenii Stratonikov
bcc11cbd74
compiler: support removing slice elements
...
Go-way of removing elements from slice is via `append` builtin.
There is a separate opcode for removing elements from
Arrays, which is cheaper and supported in this commit.
2020-09-15 16:33:43 +03:00
Evgenii Stratonikov
b319f127e7
interop: make Base*Encode
return string
2020-09-09 13:10:38 +03:00
Evgenii Stratonikov
37f7363386
interop: return struct pointers where needed
...
`Transaction`, `Block` and `Contract` are represented as
`Array`s in VM, so we must return pointers.
Revert a1f98f92
.
2020-09-09 13:10:04 +03:00
Evgenii Stratonikov
cee1836183
interop: provide missing smartcontract parameter type defs
...
Contract can have Hash160, Hash256, Signature etc. types which
all map to a `[]byte` in Go. Having synonyms helps us to generate
proper manifest file.
2020-09-09 13:06:44 +03:00
Roman Khimov
9c72ea1d64
core/interop: add base58 encoding/decoding syscalls
...
Follow neo-project/neo#1833 .
2020-08-23 17:19:56 +03:00