Commit graph

2741 commits

Author SHA1 Message Date
Anna Shaleva
43b28ffa06 core: get rid of NEP5TransferSize
Part of #1133

It will help us to use big.Int to store amount of NEP5 tokens. As far as
big.Int doesn't have constant size, we shouldn't use `NEP5TransferSize`
constant anymore.
2020-07-09 13:25:03 +03:00
Roman Khimov
76925fe3e0 compiler: slices must default to nil 2020-07-09 13:07:21 +03:00
Roman Khimov
eee8ac1655 compiler: fix initialization of struct fields, fix #1164
Make `s{}` initializers work. Deduplicate code a bit along the way. The test
added follows bf6aa02dcf test.
2020-07-09 12:27:21 +03:00
Roman Khimov
f32920bf39
Merge pull request #1162 from nspcc-dev/neo3/compiler/dynamic_appcall
compiler: compile appcall with dynamic argument
2020-07-08 19:55:53 +03:00
Anna Shaleva
56a5c9db11 compiler: compile appcall with dynamic argument
Closes #1160
2020-07-08 19:49:14 +03:00
Roman Khimov
cf1e5243b9
Merge pull request #1157 from nspcc-dev/neo3/env_image/fix
dockerfile: fix useragent version
2020-07-08 09:40:50 +03:00
Roman Khimov
8532d76401
Merge pull request #1155 from nspcc-dev/interop-compiler-fixes-for-3.0
Interop and compiler fixes for 3.0
2020-07-08 09:40:06 +03:00
Roman Khimov
bca890a888
Merge pull request #1156 from nspcc-dev/hex-base64-fix
rpc/request: decode bytearray as base64, fix #1151
2020-07-08 09:39:44 +03:00
Anna Shaleva
a8d9e27513 dockerfile: fix useragent version
Useragent version wasn't set when building from Dockerfile. Fixed.
2020-07-08 08:40:27 +03:00
Roman Khimov
540a20c1c9 rpc/request: decode bytearray as base64, fix #1151
It's encoded in base64 now.
2020-07-07 22:35:03 +03:00
Roman Khimov
694963d607 compiler: fix binary.* syscalls compilation, fix #1152
They were attributed to a wrong package.
2020-07-07 21:57:51 +03:00
Roman Khimov
ebe37d1a46 compiler: check for NULL when calculating len(), fix #1153 2020-07-07 21:49:21 +03:00
Roman Khimov
b3e450477d interop/runtime: synchronize trigger values with smartcontract/trigger
Neo 3.0 has new updated and improved constants. A better (non-function-based)
fix requires #1154 to be solved.
2020-07-07 20:25:52 +03:00
Roman Khimov
b823a516f1
Merge pull request #1142 from nspcc-dev/neo3/compiler/unexported_methods
compiler, cli: update manifest.json format
2020-07-07 16:41:36 +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
Anna Shaleva
2200f7ff71 compiler: lowercase the first letter of methods in manifest
In order to be compatable with NEP5 standards and C# node we have to
keep the first letter of each manifest method lowercased.
2020-07-07 13:44:47 +03:00
Anna Shaleva
f37831d173 compiler: convert to manifest only methods from main pkg
manifest.json should contain only methods from the package where `Main`
function located.
2020-07-07 13:42:15 +03:00
Anna Shaleva
c2dccb6314 compiler: add ability to emit package to debug info
Emit package information into MethodDebugInfo
2020-07-07 13:39:58 +03:00
Anna Shaleva
c3a0998cae compiler: fix bug in codegen
Main function (as far as the others uncknown to codegen at the moment of
`convertFuncDecl`) didn't have package set. Fixed.
2020-07-07 13:28:38 +03:00
Anna Shaleva
c3431f4fff cli: add extra validUntilBlockIncrement to transferNEP5
When we export tx to a file, we might need validUntilBlock to be larger
a bit in order to use it in future.
2020-07-07 13:23:01 +03:00
Anna Shaleva
7d8a3a7065 compiler: exclude unexported methods from manifest
We should be able to invoke exported methods only.
2020-07-07 13:23:01 +03:00
Roman Khimov
cb18cd0893
Merge pull request #1148 from nspcc-dev/neo3/stackitem/serialisation
vm: fix stackitem deserialisation
2020-07-06 15:31:23 +03:00
Anna Shaleva
1755ce10ac rpc: make getapplicationlog error more deterministic 2020-07-06 15:04:28 +03:00
Anna Shaleva
29f1e646ed vm: fix stackitem serialisation
We're able to serialise Buffer stackitem, but can not deserealise it
which leads to errors. Fixed.
2020-07-06 15:04:19 +03:00
Roman Khimov
e2c8fd1d5d
Merge pull request #1147 from nspcc-dev/neo3/cli/invoke_fix
cli: fixes for contract deployment and invocation
2020-07-06 11:14:04 +03:00
Anna Shaleva
7b90ad9337 rpc: fix cosigner scope in CreateNEP5TransferTx
It should be the same as transaction's cosigner scope.
2020-07-06 11:03:21 +03:00
Anna Shaleva
966ad8a0b1 rpc: fix adding extra network fee to tx 2020-07-06 11:02:57 +03:00
Anna Shaleva
3c551788c9 cli: fix parseCosigner method 2020-07-06 10:06:18 +03:00
Anna Shaleva
1880e96844 cli: fix contract deploy&invoke
We should add cosigners to deplyment and invocation transactions.
2020-07-06 10:01:14 +03:00
Roman Khimov
02bc0bdc1e
Merge pull request #1145 from nspcc-dev/fix/feeperbyte
Cache `transaction.FeePerByte()`
2020-07-03 18:45:44 +03:00
Evgenii Stratonikov
5787d7775f transaction: fail creating tx if there is additional data present 2020-07-03 18:03:57 +03:00
Evgenii Stratonikov
27b3054df4 transaction: set feePerByte on tx construction 2020-07-03 17:52:13 +03:00
Evgenii Stratonikov
3097dc60e5 transaction: cache feePerByte 2020-07-03 17:37:01 +03:00
Roman Khimov
2f09ec38fc
Merge pull request #1140 from nspcc-dev/feature/config
config: allow to specify config path directly
2020-07-03 12:28:30 +03:00
Evgenii Stratonikov
681e0e0a4d config: allow to specify config path directly
It costs us nothing and makes API much more flexible.
2020-07-03 11:47:56 +03:00
Roman Khimov
08d304c838
Merge pull request #1138 from nspcc-dev/fix/nep6
wallet: marshal script in base64
2020-07-03 10:11:49 +03:00
Roman Khimov
6cd166fb7a
Merge pull request #1139 from nspcc-dev/fix-deployment-sysfee-and-invokes
Fix deployment sysfee and invokes
2020-07-03 10:11:23 +03:00
Roman Khimov
4f8e4628dc cli/rpc: hide parameter encoding details for Invoke* calls
The script is passed as a hex string, but no one should care. The hash is a
hex-encoded LE value, but no one should care either. Hex might change to
base64, LE to BE, no one outside these functions should care about that.
2020-07-02 16:41:34 +03:00
Roman Khimov
0819583413 cli/rpc: test-invoke deployment script to get the system fee value
Fix #1134.
2020-07-02 16:41:31 +03:00
Roman Khimov
17ea6411a2 rpc/client: ensure compatibility with preview2 C# node for invoke*
It won't work with proper cosigners and the client must be compatible both
with neo-go and C# node. See neo/neo-modules#260 also.
2020-07-02 16:40:32 +03:00
Roman Khimov
cc95d559cc rpc/client: unify invoke* functions 2020-07-02 16:40:32 +03:00
Evgenii Stratonikov
0b67d80bb1 wallet: marshal script in base64
Related #1015.
2020-07-02 11:43:53 +03:00
Roman Khimov
d8677844fd
Merge pull request #1137 from nspcc-dev/neo3/compiler/contract_deploy
compiler, cli: update ContractCompile and ContractDeploy methods
2020-07-02 10:01:56 +03:00
Anna Shaleva
3875c0a923 cli: deploy contract using manifest.json instead of yaml config
1. We have all necessary information in manifest.json, so don't need
   config.yaml for deployment anymore. It also allow us to be consistent
   with C# cli (it uses only .manifest.json and .nef files for contract
   deployment)
2. Remove EntryPoint and Methods from ProjectConfig as compiler is able
   to generate this information by itself.
2020-06-30 18:22:47 +03:00
Anna Shaleva
4dfb0eb438 compiler, cli: generate manifest.json and debug.json independently
We should be able to generate manifest.json without debug.json and vice
versa.
2020-06-30 14:33:19 +03:00
Roman Khimov
59d1013a8f
Merge pull request #1136 from nspcc-dev/neo3/consensus/fix
consensus: prevent `invalid message` panic
2020-06-30 13:10:43 +03:00
Anna Shaleva
995abcf0c3 consensus: prevent invalid message panic
After 5c2f69bd2c there's an `invalid
message` panic when trying to run 4-nodes private network:

```
=> Try to restore blocks before running node
2020-06-30T08:59:39.696Z	INFO	no storage version found! creating genesis block
2020-06-30T08:59:39.696Z	INFO	service is running	{"service": "Prometheus", "endpoint": ":20001"}
2020-06-30T08:59:39.696Z	INFO	service hasn't started since it's disabled	{"service": "Pprof"}

    _   ____________        __________
   / | / / ____/ __ \      / ____/ __ \
  /  |/ / __/ / / / /_____/ / __/ / / /
 / /|  / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/      \____/\____/
2020-06-30T08:59:39.696Z	INFO	starting rpc-server	{"endpoint": ":30333"}
2020-06-30T08:59:39.696Z	INFO	node started	{"blockHeight": 0, "headerHeight": 0}

/NEO-GO:/

2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.1:20333", "peerCount": 1}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.2:46692", "peerCount": 2}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.1:54140", "peerCount": 3}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.4:42890", "peerCount": 4}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.4:20336", "peerCount": 5}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.2:20334", "peerCount": 6}
2020-06-30T08:59:39.697Z	INFO	started protocol	{"addr": "172.200.0.4:42890", "userAgent": "/NEO-GO:/", "startHeight": 0, "id": 3797159912}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.4:20336", "reason": "already connected", "peerCount": 5}
2020-06-30T08:59:39.697Z	INFO	started protocol	{"addr": "172.200.0.2:20334", "userAgent": "/NEO-GO:/", "startHeight": 0, "id": 1116452361}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.2:46692", "reason": "already connected", "peerCount": 4}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.1:54140", "reason": "identical node id", "peerCount": 3}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.1:20333", "reason": "identical node id", "peerCount": 2}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:44948", "peerCount": 3}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:20335", "peerCount": 4}
2020-06-30T08:59:40.673Z	WARN	peer disconnected	{"addr": "172.200.0.3:20335", "reason": "already connected", "peerCount": 3}
2020-06-30T08:59:40.673Z	WARN	peer disconnected	{"addr": "172.200.0.3:44948", "reason": "unexpected empty payload", "peerCount": 2}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:44950", "peerCount": 3}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:20335", "peerCount": 4}
2020-06-30T08:59:40.677Z	INFO	node reached synchronized state, starting consensus
2020-06-30T08:59:40.677Z	INFO	started protocol	{"addr": "172.200.0.3:44950", "userAgent": "/NEO-GO:/", "startHeight": 0, "id": 2658713129}
2020-06-30T08:59:40.689Z	WARN	peer disconnected	{"addr": "172.200.0.3:20335", "reason": "already connected", "peerCount": 3}
2020-06-30T08:59:40.697Z	INFO	blockchain persist completed	{"persistedBlocks": 0, "persistedKeys": 23, "headerHeight": 0, "blockHeight": 0, "took": "243.634µs"}
2020-06-30T08:59:41.057Z	INFO	initializing dbft	{"height": 1, "view": 0, "index": 0, "role": "Backup"}
2020-06-30T08:59:41.057Z	DPANIC	invalid message
2020-06-30T08:59:41.058Z	DPANIC	invalid message
```

Reason: payload wasn't decoded as payload.message isn't null anymore.
Fixed.
2020-06-30 12:06:50 +03:00
Roman Khimov
ee0d869815
Merge pull request #1126 from nspcc-dev/fix/variable
compiler: support variable shadowing
2020-06-30 11:27:52 +03:00