Commit graph

147 commits

Author SHA1 Message Date
Roman Khimov
112fa5b92d smartcontract: drop unused ContractDetails
That's a remnant from 2.0.
2020-11-13 21:00:54 +03:00
Roman Khimov
0f827ee6ba
Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
core, rpc: store multiple execution results for single hash
2020-11-12 19:05:22 +03:00
Anna Shaleva
251a660b85 smartcontract: ignore case in trigger.FromString 2020-11-12 17:49:28 +03:00
Anna Shaleva
9c3d8cd398 smartcontract: fix nef.GetVersion
It should be able to parse versions like `1.1.1-rc.1`.

Close #1540.
2020-11-12 17:08:54 +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
Evgenii Stratonikov
44abaa8ef3 smartcontract: implement GetDefaultHonestNodeCount
We may use this in other parts of code.
2020-10-08 13:48:14 +03:00
Roman Khimov
f45c032eff nef: limit the number of bytes to be read during decode 2020-10-07 18:30:44 +03:00
Roman Khimov
63c7469dfd manifest: limit its size when decoding 2020-10-07 18:29:19 +03:00
Evgenii Stratonikov
2d9ef9219a core: call _deploy method during create/update 2020-10-06 18:03:25 +03:00
Evgenii Stratonikov
b2a3a0851e emit: accept multiple opcodes in Opcode() 2020-10-06 18:03:25 +03:00
Anna Shaleva
acacac1b24 rpc: use state.AppExecResult for ApplicationLog marshalling
Closes #1371
2020-09-07 13:38:32 +03:00
Anna Shaleva
34df5d5949 smartcontract: update trigger.Type stringer
We have to explicitly specify the type of `All` trigger type for proper
automatic generation of string representation.
2020-09-07 11:13:58 +03:00
Anna Shaleva
e1a266ab86 smartcontract: increase MaxManifestSize 2020-08-27 11:50:09 +03:00
Evgenii Stratonikov
51cebe9e47 smartcontract: support creation of majority multisig scripts 2020-08-23 09:39:46 +03:00
Roman Khimov
8e619cc671
Merge pull request #1318 from nspcc-dev/fix/verifytests
Add tests for `verifyTx` and `verifyHeader`
2020-08-14 17:24:03 +03:00
Roman Khimov
92f37a5d36
Merge pull request #1324 from nspcc-dev/fix-goreportcard-issues
Fix goreportcard issues
2020-08-14 14:50:35 +03:00
Evgenii Stratonikov
7854dcfd8f core: replace interop names with named constants 2020-08-14 14:21:54 +03:00
Evgenii Stratonikov
f3650e20b0 vm: move InteropNameToID to a separate package 2020-08-14 13:54:11 +03:00
Roman Khimov
e7d13e6db2 *: fix misspellings found in Go Report Card 2020-08-14 12:16:24 +03:00
Evgenii Stratonikov
1eb9a4c6c6 core: allow to use verification contracts
In NEO3 we can't just appcall hash, as verification script has no access
to state. Instead we use `verify` method of an arbitrary contract.
2020-08-14 09:40:34 +03:00
Anna Shaleva
bcb7b9ba63 smartcontract: rename parameter ByteString to ByteArray
Debugger expects it to be ByteArray. C# compiler also compiles it
as `ByteArray` (in both manifest and debug.json).

The previous commit 6a2161207a changed
this line as C# implementation serializes Blockchain.ApplicationExecuted.Stack
as array of stackitem.Item and deserializes it as array of
smartcontract.Parameter.
2020-08-12 17:48:03 +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
Evgenii Stratonikov
bbae7318a5 smartcontract: adjust param types according to NEO3 2020-08-10 11:14:48 +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
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
Roman Khimov
ef53a45e7a
Merge pull request #1264 from nspcc-dev/smartcontract/manifest/supported_standards
smartcontract: add list of supported standards to manifest
2020-08-04 22:17:00 +03:00
Anna Shaleva
90825efa16 core: move transaction's sender to cosigners
Closes #1184

Ported changes from https://github.com/neo-project/neo/pull/1752
2020-08-04 17:33:50 +03:00
Anna Shaleva
66ceaa6b75 smartcontract: add list of supported standards to manifest
Closes #1204
2020-08-04 17:29:44 +03:00
Roman Khimov
fa5ff8dd95
Merge pull request #1242 from nspcc-dev/fix/json
Implement lossless stackitem to json conversion
2020-08-04 12:59:47 +03:00
Anna Shaleva
b2aef6acbf smartcontract: calculate double-SHA256 for .nef files
Closes #1203
2020-08-03 14:25:27 +03:00
Evgenii Stratonikov
b53f0257f5 stackitem: change ByteArray type to ByteString
Adjust only string representation.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +03:00
Evgenii Stratonikov
51ae12e4fd *: move syscall handling out of VM
Remove interop-related structures from the `vm` package.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-29 13:41:08 +03:00
Evgenii Stratonikov
685d44dbc1 *: support _initialize method in contracts
Invoke `_initialize` method on every call if present.
In NEO3 there is no entrypoint and methods are invoked by offset,
thus `Main` function is no longer required.
We still have special `Main` method in tests to simplify them.
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
d2ddf7b7cb *: support invoking methods by offset
Allow to invoke methods by offset:
1. Every invoked contract must have manifest.
2. Check arguments count on invocation.
3. Change AppCall to a regular syscall.
4. Add test suite for `System.Contract.Call`.
2020-07-27 13:00:35 +03:00
Evgenii Stratonikov
a892e3ffa8 manifest: add Offset in method descriptor 2020-07-27 11:08:01 +03:00
Evgenii Stratonikov
e52c39ae7e manifest: remove EntryPoint from manifest 2020-07-27 11:08:01 +03:00
Roman Khimov
3f2f0be2c2
Merge pull request #1187 from nspcc-dev/neo3/interop/post-preview2_adjustment
interop: post-preview2 adjustment
2020-07-17 13:33:29 +03:00
Anna Shaleva
fddad0b475 core: adjust System.Contract.Create interop
Part of #1055.

It should check given scripthash against manifest groups and return the
contract state as a struct (not interop interface).
2020-07-17 09:28:52 +03:00
Roman Khimov
f46ed798f0
Merge pull request #1169 from nspcc-dev/neo3/rpc/fields_names_adjustment
rpc: adjust RPC calls JSON fields
2020-07-15 18:24:54 +03:00
Anna Shaleva
5326fc587a core: rename Neo.Crypto.CheckMultisig to Neo.Crypto.CheckMultisigWithECDsaSecp256r1
Part of #918
2020-07-14 16:19:12 +03:00
Roman Khimov
db027ad9c5 vm: zero GAS means no GAS, use fee data to properly limit execution
We were accepting transactions with zero system fee, but we shouldn't do
that. Also, transaction's verification execution has to be limited by network
fee.
2020-07-14 08:37:29 +03:00
Anna Shaleva
72a6740717 rpc: adjust getcontractstate RPC-call JSON fields names
Part of #1130
2020-07-09 17:34:53 +03:00
Roman Khimov
372dd71708
Merge pull request #1108 from nspcc-dev/neo3/compiler/nef
compiler: support *.nef and *.manifest.json generation
2020-06-29 20:55:47 +03:00
Evgenii Stratonikov
8c18142e8a keys: implement PublicKeys.Copy()
Implement convenient wrapper over explicit allocation and copying.
2020-06-29 10:44:35 +03:00
Anna Shaleva
927127e5fb smartcontract: add nef file
It should match C# NEF3 specification in order to debug and deploy smart
contracts via NEO3 Blockchain Toolkit.
2020-06-29 09:15:25 +03:00
Roman Khimov
6f5a42facf smartcontract: correctly encode/decode AnyType
It might get emitted with notifications.
2020-06-24 10:22:21 +03:00
Anna Shaleva
9097a1a23d smartcontract: update (Parameter).MarshalJSON method
MarshalJSON should be defined on structure (not pointer), as we use
structures to marshal parameters (e.g. in NotificationEvent and
Invoke of RPC result package) and never use pointers for that purpose.

Also added marshalling of nil array into `[]` instead of `null` to
follow C# implementation.
2020-06-24 07:58:09 +03:00
Evgenii Stratonikov
6a2161207a smartcontract: rename ByteArray to ByteString in JSON for smartcontract parameters 2020-06-19 11:38:56 +03:00
Evgenii Stratonikov
b9e260a704 smartcontract: omit empty value in JSON for Interop/Any parameters 2020-06-19 11:38:56 +03:00
Roman Khimov
b483c38593 block/transaction: add network magic into the hash
We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.
2020-06-18 12:39:50 +03:00