Commit graph

3006 commits

Author SHA1 Message Date
Roman Khimov
c3f7a419a0
Merge pull request #1296 from nspcc-dev/smartcontract/examples
examples: update examples
2020-08-11 19:09:13 +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
Roman Khimov
a17e7b7269
Merge pull request #1295 from nspcc-dev/fix/seqpoints
Add non-main package files in DebugInfo.Documents
2020-08-11 18:12:47 +03:00
Anna Shaleva
b5494320f9 compiler, cli: support events from .yml config file
We currently can't process events in codegen, so we have to provide
them via .yml config file. Do not delete the rest of the code connected
with conversion of MethodDebugInfo.Event into manifest.Event as we have
issue #1038.
2020-08-11 13:42:06 +03:00
Anna Shaleva
de8db692f4 examples: add .yml configuration files 2020-08-11 13:42:06 +03:00
Anna Shaleva
52275bcd9c cli: update default smart-contract template 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
6d169a356e docs: update compiler.md
Make a note about compiling directories.
2020-08-11 11:21:32 +03:00
Evgenii Stratonikov
a34ba92d46 compiler: allow to split main package across multiple files 2020-08-11 11:12:55 +03:00
Evgenii Stratonikov
553e57c2c4 compiler: make sequence points on global var/const declarations 2020-08-11 11:12:30 +03:00
Evgenii Stratonikov
128626de5c compiler: save sequence points for init function 2020-08-11 11:12:30 +03:00
Evgenii Stratonikov
40fa7c0f6e compiler: emit all used files in DebugInfo.Documents 2020-08-11 11:12:29 +03:00
Evgenii Stratonikov
057e1c6e3c compiler: provide filename to Compile() 2020-08-11 11:10:45 +03:00
Roman Khimov
d8db85ef55
Merge pull request #1301 from nspcc-dev/consensus/verify_payload_test
consensus: add test for payload.Verify
2020-08-10 22:26:31 +03:00
Anna Shaleva
5ef6d4d857 consensus: add test for payload.Verify
Closes #1178
2020-08-10 22:03:33 +03:00
Roman Khimov
25ce154cf8
Merge pull request #1300 from nspcc-dev/various-preview3-fixes
Various preview3 testnet fixes
2020-08-10 21:49:30 +03:00
Roman Khimov
c16040aecc native: sort GetValidators result
As it's returned sorted now. Fixes state change mismatch for
NextValidators. It also partially reverts
2f8e7e4d33 and significantly changes the test
chain as the fees are no longer being sent to the same account.
2020-08-10 19:49:09 +03:00
Roman Khimov
dba248236c smartcontract: add CreateDefaultMultiSigRedeemScript
And use it where appropriate. Some of our code was just plain wrong (like the
one in GAS contract) and unification is always useful here.
2020-08-10 18:58:11 +03:00
Roman Khimov
80302c5c07 consensus: use dbft.M() for new block witness
We're collecting dbft.M() number of signatures in getBlockWitness(), so we
should use the same value for M here.
2020-08-10 18:49:48 +03:00
Roman Khimov
547c58c00c
Merge pull request #1299 from nspcc-dev/fix/1298
compiler: use constants in interops
2020-08-10 18:15:44 +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
Roman Khimov
fb97ea9458 native: don't register standby validators on initialization
C# doesn't do that since neo-project/neo#1762.
2020-08-10 17:51:46 +03:00
Roman Khimov
6e252fbaae rpc: answer with zero-length when there are no registered validators
There is a huge difference between
   "result" : [],
and
   "result" : null,
2020-08-10 17:50:19 +03:00
Roman Khimov
f287681fa7 core/native: fix VotersCount zero value encoding
Empty byte array is enough to be bigint value of zero. Fixes state differences
with C# node.
2020-08-10 17:07:14 +03:00
Roman Khimov
98888def16 cli/server: drop key mangler from dumper
It's no longer needed (yay!)
2020-08-10 16:58:38 +03:00
Roman Khimov
5a42b5c7ae network: correct block addition check
Fixes missing an error on block addition when the header actually went it, but
the block didn't.
2020-08-10 16:51:56 +03:00
Roman Khimov
0b96e6a048
Merge pull request #1293 from nspcc-dev/fix/return
Check return values count for external contract calls
2020-08-10 16:22:23 +03:00
Roman Khimov
f54d345f68
Merge pull request #1297 from nspcc-dev/config/fix
config: add ValidatorsCount to default privnet configuraton
2020-08-10 16:06:19 +03:00
Anna Shaleva
b92e90636e config: add ValidatorsCount to default privnet configuraton
This commit prevents the following error while starting default privnet
node:

```
2020-08-10T15:23:35.733+0300	INFO	restoring blockchain	{"version": "0.1.0"}
could not initialize blockchain: param m cannot be smaller or equal to 1 got 0

```
2020-08-10 15:36:38 +03:00
Evgenii Stratonikov
bf01599430 vm: check return value on context unload
When calling external contracts we expect exactly 1 value to be on
stack. For methods returning nothing, `Null` value is pushed, otherwise
it is an error.`
2020-08-10 11:52:33 +03:00
Evgenii Stratonikov
bbae7318a5 smartcontract: adjust param types according to NEO3 2020-08-10 11:14:48 +03:00
Evgenii Stratonikov
b65369e111 emit: remove unused functions 2020-08-10 11:14:48 +03:00
Roman Khimov
4aeaf05f90
Merge pull request #1289 from nspcc-dev/fix/nep5
Port `getnep5transfers` changes to master
2020-08-10 11:11:24 +03:00
Roman Khimov
08ca8d3365
Merge pull request #1290 from nspcc-dev/fix/tests
core: fix failing tests after merge
2020-08-10 10:20:53 +03:00
Evgenii Stratonikov
14aba7fc80 core: fix failing tests after merge
Related f5131491b .
2020-08-10 09:20:34 +03:00
Roman Khimov
f5131491b7
Merge pull request #1271 from nspcc-dev/core/call_from_native
core: contractCall from native contracts
2020-08-07 21:24:50 +03:00
Anna Shaleva
c87e2262c3 core: remove ScriptHashGetter from interop context
We have VM inside the context, so don't need ScriptHashGetter anymore.
2020-08-07 20:31:20 +03:00
Anna Shaleva
42736095a1 core: add test to call contract from native
Closes #1200
2020-08-07 20:31:16 +03:00
Evgenii Stratonikov
412fc53cdd rpc: provide timestamps in getnep5transfers
Set default value for the first timestamp to a week ago.
2020-08-07 18:42:34 +03:00
Evgenii Stratonikov
807338f97e core: do not store NEP5 transfer log in memory
Traversing transfer log instead of accumulating and returning it
is faster and takes less memory.
2020-08-07 18:21:06 +03:00
Anna Shaleva
995053f2eb core: add VM into interop context 2020-08-07 16:15:24 +03:00
Roman Khimov
c3c88a57cd
Merge pull request #1281 from nspcc-dev/drop-go-1.12-and-fix-some-things
Drop go 1.12 and fix some things
2020-08-07 13:34:54 +03:00
Roman Khimov
d5a9d80c12 core: refactor out policy check for transaction
We were checking blocked accounts twice which is obviously excessive. We also
have our accounts sorted, so we can rely on that in CheckPolicy(). It also
doesn't make much sense to check MaxBlockSystemFee in Blockchain code, policy
contract can handle that.
2020-08-07 12:21:52 +03:00
Roman Khimov
90180c6fb6 native: pass DAO to CheckPolicy(), it doesn't need interop context
Simplify things a bit.
2020-08-07 12:21:52 +03:00
Roman Khimov
791c983304 core: drop GetScriptHashesForVerifying
It no longer depends on blockchain state and there can't ever be an error, in
fact we can always iterate over signers, so copying these hashes doesn't make
much sense at all as well as sorting arrays in verifyTxWitnesses (witnesses
order must match signers order).
2020-08-07 12:21:52 +03:00
Roman Khimov
c19838ea67 core: use errors.Is in PoolTx
Just in case.
2020-08-07 12:21:52 +03:00
Roman Khimov
4c38fae54c core: fix mempool error check in PoolTx
ErrAlreadyExists should be returned for ErrDup, not ErrConflict.
2020-08-07 12:21:52 +03:00
Roman Khimov
0e2784cd2c always wrap errors when creating new ones with fmt.Errorf()
It doesn't really change anything in most of the cases, but it's a useful
habit anyway.

Fix #350.
2020-08-07 12:21:52 +03:00
Roman Khimov
205f52c563 core: use error wrapping to provide more details 2020-08-07 12:21:52 +03:00
Roman Khimov
5ef08f60ae remove github.com/pkg/errors from dependencies
It's not needed any more with Go 1.13 as we have wrapping/unwrapping in base
packages. All errors.Wrap calls are replaced with fmt.Errorf, some strings are
improved along the way.
2020-08-07 12:21:52 +03:00