Commit graph

1719 commits

Author SHA1 Message Date
Evgenii Stratonikov
c9df5d3aed rpc: fix typo in getnep5transfers rpc
Omit empty address for transfers in both directions.
2020-06-18 16:31:33 +03:00
Evgenii Stratonikov
3e76b9a9bf native: fix Transfer event in burn
Tokens should subtract, but transfer amount is positive.
2020-06-18 16:19:09 +03:00
Evgenii Stratonikov
295d8fc70e core: save application logs for native persist 2020-06-18 15:32:27 +03:00
Evgenii Stratonikov
3894b6db9f native: take into account native contract method prices
Burn gas right before function invoke.
2020-06-18 15:32:27 +03:00
Evgenii Stratonikov
031fd93172 native: fix native contract prices 2020-06-18 15:32:27 +03:00
Evgenii Stratonikov
0fa4c49735 core,native: persist native contract via VM
After native contracts are deployed, single persist script is created
and executed at the start of every block persisting.
2020-06-18 15:32:27 +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
Roman Khimov
8fda6a3407 block: fix ConsensusData hashing
It's DoubleSha256 as with the rest of the structures.
2020-06-18 12:22:49 +03:00
Roman Khimov
5fe8287fbb rpc: use non-pointer Block and Transaction in results
Pointers can be nil and in some cases it's important to always have access to
Block or Transaction fields.
2020-06-18 12:13:35 +03:00
Roman Khimov
a7cce3f894 smartcontract: use new VerifiableDecodable for ParameterContext
And implement it for Transaction, the only user of ParameterContext for
now. Which make correct signing/verifying possible for cases when
serialization for general transmission and signing differ.
2020-06-18 12:12:56 +03:00
Roman Khimov
dde0763840 network: fix compression handling functions
Turns out, Neo uses block compression and not a streaming lz4 format. And it
doesn't contain uncompressed payload size which makes guessing it somewhat
suboptimal.
2020-06-18 12:12:43 +03:00
Roman Khimov
8388e509df network: don't allocate memory for messages larger than PayloadMaxSize 2020-06-18 12:12:31 +03:00
Roman Khimov
39fd799992 network: fix Compress flag, it's the first bit (index 0) 2020-06-18 12:12:17 +03:00
Roman Khimov
0002b65238 block: it's not a padding, but a witness count in the base
At least that's the interpretation C# codebase has, so be a bit more correct
in error message.
2020-06-18 12:12:00 +03:00
Roman Khimov
b9a66c64e1 block: drop paddings from structures
It makes no sense at all storing them in a structure, they're just a part of
encoding/decoding process.
2020-06-18 12:11:41 +03:00
Roman Khimov
b6eef9d275 consensus: don't duplicate RebuildMerkleRoot in newBlockFromContext 2020-06-18 12:11:26 +03:00
Roman Khimov
d22286cbbc client/cli: add network option to the RPC client
It doesn't affect anything yet, but it's going to be used in the future for
network-specific behavior. It also renames short '--timeout' form to '-s'
avoiding conlict with '-t' used for '--testnet'.
2020-06-18 12:11:13 +03:00
Roman Khimov
1c2318eed4 netmode: use non-zero unittest network
Using zero is a bit dangerous as it's the default type's value, so we can miss
some uninitialized variables when testing.
2020-06-18 12:10:12 +03:00
Roman Khimov
78ff11fe53 netmode: make default Magic String() more useful 2020-06-18 12:09:57 +03:00
Roman Khimov
26f11a52d9 config: move NetMode into its own micropackage
It's going to be used a bit more and pulling whole config just for one type is
a bit wrong.
2020-06-18 12:09:57 +03:00
Roman Khimov
6eb600de5a config: sync network magic numbers
unit_testnet YAML was out of sync with Go code and Go code was out of sync
with YAML for mainnet and testnet after 308243f36e.
2020-06-18 12:09:55 +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
Evgenii Stratonikov
651976b2ca config: remove AddressVersion from the configuration
It is never used and is the same constant for both mainnet, testnet and
privnet.
2020-06-17 15:55:22 +03:00
Evgenii Stratonikov
b3b1137030 cli: allow to convert wallet from NEO2 to NEO3 format
This command may be helpful to have during transition.
2020-06-17 15:49:34 +03:00
Evgenii Stratonikov
61cae8d8b1 compiler: implement missing System.Contract.* interops
Support System.Contract.IsStandard/CreateStandardAccount syscall.
2020-06-17 11:38:34 +03:00
Evgenii Stratonikov
3762ebdd08 core: implement System.Runtime.GetInvocationCounter syscall 2020-06-17 11:24:11 +03:00
Evgenii Stratonikov
75e597f880 core: implement System.Runtime.GetNotifications syscall 2020-06-17 11:24:11 +03:00
Evgenii Stratonikov
afd8f3b87a compiler: push Null item for nil values 2020-06-17 11:24:11 +03:00
Evgenii Stratonikov
a4e4439967 core,vm: implement System.Runtime.GasLeft syscall 2020-06-17 11:24:11 +03:00
Evgenii Stratonikov
a7d4fff897 vm: make (*VM).GasLimit public
VM is inherently single-threaded and replacing setter/getter methods
with public field simplifies code a bit.
2020-06-16 15:13:20 +03:00
Evgenii Stratonikov
1f97f3abd8 core: adjust prices and flags for System.Runtime.* interops
Related #1055.
2020-06-16 12:30:55 +03:00
Evgenii Stratonikov
ad2a75a500 core: move System.ExecutionEngine.* interops to System.Runtime.* 2020-06-16 12:30:55 +03:00
Evgenii Stratonikov
52a27e9be4 core: implement System.Contract.CreateStandardAccount syscall 2020-06-16 12:12:29 +03:00
Evgenii Stratonikov
5b4f38d717 core: implement System.Contract.IsStandard syscall 2020-06-16 12:12:27 +03:00
Evgenii Stratonikov
b1d2d70c02 core: adjust prices for blockchain/contract syscalls 2020-06-16 12:04:57 +03:00
Evgenii Stratonikov
becb8a0f72 compiler: support System.Json.* syscalls 2020-06-16 11:35:08 +03:00
Evgenii Stratonikov
6339efac11 core: implement System.Json.* interops 2020-06-16 11:35:06 +03:00
Evgenii Stratonikov
d836233352 stackitem: allow to (de-)serialize items to JSON
This commit implements behavior identical to that of C# `System.Json.*` interops.
2020-06-16 11:34:01 +03:00
Evgenii Stratonikov
f2f01a08c9 vm: move MaxArraySize and MaxItemSize to stackitem package 2020-06-16 11:32:16 +03:00
Evgenii Stratonikov
aae312d408 core,vm: adjust prices for iterator/enumerator syscalls
Closes #1027.
2020-06-16 11:05:26 +03:00
Evgenii Stratonikov
18066143bd core,vm: adjust binary (de-)serialization syscalls
Related #1027.

1. Move System.Runtime.(De)serialize to System.Binary.*
2. Rename compiler stubs.
3. Adjust opcode prices.
2020-06-16 11:00:38 +03:00
Roman Khimov
b3507d490d
Merge pull request #1051 from nspcc-dev/neo3/rpc/scopes
core: add json marshaller for Cosigner's scopes
2020-06-15 16:13:48 +03:00
Anna Shaleva
3568ab3d6d core: add json marshaller for Cosigner's scopes
Following C# implementation, we should marshal Scopes as a set of
strings instead of single byte.
2020-06-15 13:48:15 +03:00
Evgenii Stratonikov
2e996ea57d core: adjust System.Storage.* interop prices 2020-06-15 12:02:28 +03:00
Evgenii Stratonikov
61bba1a39c core: store precise gas price in interop descriptions
In NEO3 sycalls can have prices less than 10^5, we need to store them
precisely. Adjusting actual prices is to be done in the following tasks.
2020-06-15 12:02:28 +03:00
Evgenii Stratonikov
fd2cd291e7 core: calculate opcode prices correctly 2020-06-15 12:02:22 +03:00
Evgenii Stratonikov
8f20a70969 core: calculate a price of System.Storage.Put correctly
It also depends on the item already stored by key.
2020-06-15 12:02:21 +03:00
Roman Khimov
fe31c7ed2d
Merge pull request #1047 from nspcc-dev/neo3/rpc/invoke
rpc: update invoke* RPC-calls
2020-06-11 21:39:20 +03:00
Anna Shaleva
9e7fca013e rpc: update CLI and RPC client invoke* calls
part of #1036
2020-06-11 20:32:05 +03:00