Commit graph

76 commits

Author SHA1 Message Date
Alex Vanin
90400d951a examples: add missing permission methods in manifests 2021-06-24 16:00:45 +03:00
Alex Vanin
5fa000cbae examples: rename onNEP11Transfer to onNEP11Payment in manifests
There is no such thing as `onNEP11Transfer` in NEP-11.
2021-06-23 20:48:04 +03:00
Anna Shaleva
39e096da64 examples: use base64 to encode HASHY token ID
Base58 does not preserve one-to-one byte correspondence with the
original data, so different combinations of the same number of bytes
might have different encoded string length. We use GAS transfer to mint
HASHY token, where the token hash is Base58Encode(Ripemd160(data + txHash)).

The problem is that `invokescript` RPC call is used to define transfer tx
sysfee, thus, txHash during testinvoke differs from the actual one, that's
why resulting token ID may have different length during testinvoke and
real invoke. As far as we use token ID as a key to store contract
values, the storage price may also differ. The result is failing
TestNEP11_OwnerOf_BalanceOf_Transfer test due to `gas limit exceeded`
error:

```
    logger.go:130: 2021-06-10T21:09:08.984+0300	WARN	contract invocation failed	{"tx": "45a0220b19725eaa0a4d01fa7a6cdaac8498592e8f3b43bdde27aae7d9ecf635", "block": 5, "error": "error encountered at instruction 36 (SYSCALL): error during call from native: error encountered at instruction 22 (SYSCALL): failed to invoke syscall 1736177434: gas limit exceeded"}
    executor_test.go:219:
        	Error Trace:	executor_test.go:219
        	            				nep11_test.go:132
        	            				nep11_test.go:235
        	Error:      	Not equal:
        	            	expected: 0x2
        	            	actual  : 0x4
        	Test:       	TestNEP11_OwnerOf_BalanceOf_Transfer
```

Fixed by using base64 instead of base58 (base64 preserves the resulting
encoded string length for the same input length).
2021-06-11 13:57:59 +03:00
Evgeniy Stratonikov
4467e2cbfd cli,compiler: allow to specify manifest permissions 2021-06-04 11:16:22 +03:00
Anna Shaleva
2a9ce03376 examples: fix IPv6 bounds check 2021-05-28 11:31:09 +03:00
Anna Shaleva
fb6a81e5d5 docs: add NNS to examples documentation 2021-05-17 22:24:58 +03:00
Anna Shaleva
7f43c48182 examples: add non-native NeoNameService contract 2021-05-17 22:08:10 +03:00
Evgeniy Stratonikov
ea49c6b637 wallet: rename isdefault to isDefault
Follow neo-project/neo#2451 .
2021-05-14 10:31:31 +03:00
Anna Shaleva
366e79b9b8 core: rename Neo.Crypto.CheckSig interop 2021-05-11 18:37:55 +03:00
Evgeniy Stratonikov
721748acfd examples: change NFT contract to use storage iterators 2021-05-11 12:13:30 +03:00
Anna Shaleva
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +03:00
Anna Shaleva
f61ab6bd11 cli: add nep11 properties command 2021-04-30 16:23:06 +03:00
Anna Shaleva
e27c894338 rpc: add NEP11 commands which return iterator
These are Tokens (optional), TokensOf and OwnerOf (divisible).
2021-04-30 16:23:06 +03:00
Roman Khimov
f21f506493 examples: add NFT example, fix #1845 2021-04-08 12:36:02 +03:00
Roman Khimov
9cc034af9b examples: add a perfect oracle example 2021-04-06 22:50:42 +03:00
Anna Shaleva
0948d53244 examples: add documentation
And provide the wallet for examples `my_wallet.json` with the owner
address inside.
2021-03-23 16:46:15 +03:00
Anna Shaleva
2f07d1aa9e examples: update owner address 2021-03-22 18:12:56 +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
Evgeniy Stratonikov
c57972d0a7 examples: add onNEP17Payment invocation 2021-02-11 17:51:44 +03:00
Evgeniy Stratonikov
c1cc7e6f9d native: add additional parameters to deploy
1. Management contract has 2 overloads of `deploy` method.
2. Normal contracts should have `_deploy` with 2 parameters.
2021-01-29 12:19:08 +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
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
Evgenii Stratonikov
ec1ff42872 manifest: add Safe flag for NEP-17 methods 2020-12-10 18:04:49 +03:00
Evgenii Stratonikov
b807fd9e7f compiler: rename engine.AppCall() to contract.Call() 2020-12-10 13:45:10 +03:00
Evgenii Stratonikov
cbf26f315c compiler: save both VM and smartcontract types
VM types are used in debugger, while smartcontract ones are used in
manifest. We can't save only one of them, because conversion in either
side is lossy:
1. VM has `Array` and `Struct` but smartcontract only has `Array`.
2. Smartcontract has `Hash160` etc, which are all `ByteString` or
`Buffer` in VM.

And to spice things a bit more, return type in debugger can be `Void`,
which corresponds to no real stackitem type (as it must exist).
2020-12-09 22:35:22 +03:00
Evgenii Stratonikov
75a9a42403 compiler: check emitted event names
Check that all `Notify` invocations in source correspond to some event
in manifest.
Helpful for typos such as `transfer` instead of `Transfer`.
2020-11-26 13:49:58 +03:00
Evgenii Stratonikov
25f1db6de0 compiler: check supported standards
Check that emitted manifest complies with supported standards.
This can be made a separate flag.
2020-11-26 12:51:39 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
b97dfae8d8 native: replace NEP-5 with NEP-17 2020-11-24 13:08:23 +03:00
Evgenii Stratonikov
c849176be7 manifest: include contract Name 2020-11-24 11:23:44 +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
Anna Shaleva
5e193a34eb examples: add an example of binary.Itoa usage 2020-11-10 15:21:57 +03:00
Anna Shaleva
fde0546e28 examples: add _deploy usage examples
Close #1466
2020-10-13 19:14:44 +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
Anna Shaleva
4fdcefc87c examples: fix AddToCirculation method of TokenSale
Closes #1379

We should check owner witness before adding more tokens to circulation.
Also we shouldn't allow to add to circulation more than TokenSupply
tokens.
2020-09-01 12:01:21 +03:00
Anna Shaleva
e2b22bc511 examples: fix ANT token example
We don't have totalSupply in contract storage because we did't put it
there. Fixed.
2020-08-11 18:25:39 +03:00
Anna Shaleva
de8db692f4 examples: add .yml configuration files 2020-08-11 13:42:06 +03:00
Anna Shaleva
ae3f15523c examples: update examples
Closes #1234
2020-08-11 13:42:06 +03:00
Evgenii Stratonikov
f2cb1d5f02 compiler: use constants in interops
We now support using exported constants, so there is no
need in declaring functions. All functions from `interop/`
are not to be compiled.

Fix #1298.
2020-08-10 17:52:31 +03:00
Evgenii Stratonikov
d1ef9e67be examples: fix method names
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 12:07:07 +03:00
Evgenii Stratonikov
3d7fa9de93 *: make Notify interop accept event name 2020-07-20 13:33:32 +03:00
Anna Shaleva
c4f7b06974 core, compiler: return struct from GetScriptContainer interop
Closes #1173
2020-07-14 06:04:48 +03:00
Anna Shaleva
08ae869028 examples: update ANT owner for workshop 2020-07-07 15:57:17 +03:00
Anna Shaleva
db8cb752e3 examples: update methods signatures
Update methods signatures in order to generate correct manifest files
with full description of available methods.
2020-07-07 15:57:12 +03:00
Anna Shaleva
53ff02f1ad examples: fix typo in method argument 2020-07-07 15:54:45 +03:00
Roman Khimov
d81d826bfc core: fix Storage.Get to return Null when there is no value
Match C# implementation and fix state inconsistency at block 249920 of
preview2 testnet. Make our Go Storage.Get return nil and adapt
examples/tests.
2020-06-24 10:43:58 +03:00
Roman Khimov
5f276de003
Merge pull request #1057 from nspcc-dev/fix/newaddress
Update addresses to NEO3 format
2020-06-17 16:25:32 +03:00
Evgenii Stratonikov
7b4ca57e33 *: change address to the new format
NEO3 uses new prefix for address (53 = 0x35), thus string representations as
well as encrypted WIFs should be changed.
2020-06-17 15:58:21 +03:00