Commit graph

1587 commits

Author SHA1 Message Date
Roman Khimov
0a35ee00c6 core: print txes in LE in TestCreateBasicChain
LE is human and RPC compatible representation, BE hex is almost unusable.
2020-06-05 19:20:16 +03:00
Roman Khimov
bf6525e54d core: fix GetUtilityTokenBalance
The value stored in NEP5 tracker for GAS is Fixed8 already, so we need to
type-cast it, but not multiply by 10⁸ again.
2020-06-05 19:20:16 +03:00
Roman Khimov
7e586cc6ab native: deduce transferred assets from sender on transfer
When money is being sent usually they go away from someone's pocket, so that
there is a little less money left there. Not in our case as it turns out, we
actually were adding money both to sender and receiver which is nice, but a
bit different from usual economic's expectations.
2020-06-05 19:20:16 +03:00
Roman Khimov
46cd14a892
Merge pull request #1002 from nspcc-dev/neo3/interop/sort_find
core: sort results of Storage.Find interop and NEO.getRegisterValidators
2020-05-30 15:34:41 +03:00
Anna Shaleva
8fb67615f8 core: sort results of Storage.Find and NEO.getRegisterValidators
Closes #909
We need to match elements order with C# implementation.
2020-05-29 17:33:01 +03:00
Roman Khimov
eec462b00c network: fix Inv types for Neo 3
They actually use the same types as for messages. Fixes
2020-05-29T00:06:17.593+0300    WARN    peer disconnected       {"addr": "168.62.167.190:20333", "reason": "handling CMDInv message: invalid inventory type", "peerCount": 3}
2020-05-29 15:02:20 +03:00
Roman Khimov
56b24bf83e capability: prevent panic on wrong capabilities receival
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xad7b95]

goroutine 134 [running]:
github.com/nspcc-dev/neo-go/pkg/network/capability.(*Capability).DecodeBinary(0xc00024a300, 0xc00015c900)
        /home/rik/dev/neo-go/pkg/network/capability/capability.go:69 +0x85
github.com/nspcc-dev/neo-go/pkg/io.(*BinReader).ReadArray(0xc00015c900, 0xd54880, 0xc00018ecd8, 0xc00071fbe0, 0x1, 0x1)
        /home/rik/dev/neo-go/pkg/io/binaryReader.go:141 +0x22f
github.com/nspcc-dev/neo-go/pkg/network/capability.(*Capabilities).DecodeBinary(0xc00018ecd8, 0xc00015c900)
        /home/rik/dev/neo-go/pkg/network/capability/capability.go:17 +0x6d
github.com/nspcc-dev/neo-go/pkg/network/payload.(*AddressAndTime).DecodeBinary(0xc00018ecc0, 0xc00015c900)
        /home/rik/dev/neo-go/pkg/network/payload/address.go:34 +0x59
github.com/nspcc-dev/neo-go/pkg/io.(*BinReader).ReadArray(0xc00015c900, 0xcb9e00, 0xc00024a2a0, 0x0, 0x0, 0x0)
        /home/rik/dev/neo-go/pkg/io/binaryReader.go:141 +0x22f
github.com/nspcc-dev/neo-go/pkg/network/payload.(*AddressList).DecodeBinary(0xc00024a2a0, 0xc00015c900)
        /home/rik/dev/neo-go/pkg/network/payload/address.go:78 +0x54
github.com/nspcc-dev/neo-go/pkg/network.(*Message).decodePayload(0xc000277890, 0xc000292020, 0xc0003da000)
        /home/rik/dev/neo-go/pkg/network/message.go:158 +0x31a
github.com/nspcc-dev/neo-go/pkg/network.(*Message).Decode(0xc000277890, 0xc00071ff48, 0xc00036e090, 0xc000276e40)
        /home/rik/dev/neo-go/pkg/network/message.go:114 +0x19b
github.com/nspcc-dev/neo-go/pkg/network.(*TCPPeer).handleConn(0xc00036e090)
        /home/rik/dev/neo-go/pkg/network/tcp_peer.go:154 +0x244
created by github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Dial
        /home/rik/dev/neo-go/pkg/network/tcp_transport.go:40 +0x1ad
2020-05-29 00:11:54 +03:00
Anna Shaleva
1dffe0bea9 network: remove outdated fields
After #980 there were outdated fields present in message test.
2020-05-27 19:32:50 +03:00
Roman Khimov
a446821753
Merge pull request #980 from nspcc-dev/neo3/protocol/version_payload_optimisation
protocol: add node capabilities
2020-05-27 19:13:00 +03:00
Anna Shaleva
7547a3efe1 network: minor code refactoring
We need to handle IPv6 addresses correctly and net.JoinHostPort takes it
into account.
2020-05-27 19:04:09 +03:00
Anna Shaleva
8c5c248e79 protocol: add capabilities to address payload
Part of #871
2020-05-27 19:02:25 +03:00
Anna Shaleva
c590cc02f4 protocol: add capabilities to version payload
closes #871
2020-05-27 19:01:14 +03:00
Roman Khimov
fba4b20cc8
Merge pull request #989 from nspcc-dev/doc-update
Documentation update
2020-05-27 14:29:43 +03:00
Evgenii Stratonikov
f39b51deee compiler: restore support for GetUnspentCoins
Revert a587274.
2020-05-27 12:01:50 +03:00
Evgenii Stratonikov
44709cf6fe core: make GetUnspentCoins interop return array, fix #978. 2020-05-27 12:01:50 +03:00
Roman Khimov
77b92de074 interop: add some top-level doc.go 2020-05-27 12:01:50 +03:00
Roman Khimov
7e96f82a5b compiler/interop: add support for working with witnesses 2020-05-27 12:01:50 +03:00
Roman Khimov
87e7e157ae interop/util: extend documentation 2020-05-27 12:01:50 +03:00
Roman Khimov
85cc0639bb interop/transaction: update documentation 2020-05-27 12:01:50 +03:00
Roman Khimov
e32d0e01af compiler|transaction: remove transaction.GetUnspentCoins support
It's useless. Even though there is Neo.Transaction.GetUnspentCoins syscall
that can be used, its return type is an interop structure that's not accepted
by any other syscall, so you can't really do anything with it. And there is no
such interface for the .net Framework.
2020-05-27 12:01:50 +03:00
Roman Khimov
1cbd75ab9e compiler|transaction: fix transaction.GetScript build, add to interop
There is no such syscall as Neo.Transaction.GetScript and GetScript should be
available for contract's use.
2020-05-27 12:01:50 +03:00
Roman Khimov
559e8a16da compiler/storage: add read-only related interops 2020-05-27 12:01:50 +03:00
Roman Khimov
bfd8fe5960 interop/storage: update documentation 2020-05-27 12:01:50 +03:00
Roman Khimov
ddb9497649 interop/runtime: update documentation, fix Notify
Notify doesn't return anything!
2020-05-27 12:01:50 +03:00
Roman Khimov
6d2b2d7263 compiler/iterator: add missing iterator.Concat function
We have a syscall for it, so it should be exposed.
2020-05-27 12:01:50 +03:00
Roman Khimov
5733573d2e
Merge pull request #987 from nspcc-dev/neo3/protocol/compression
protocol: add payload compression
2020-05-26 23:31:17 +03:00
Anna Shaleva
0cbd7823ab protocol: add payload compression
closes #872
2020-05-26 22:19:10 +03:00
Roman Khimov
01b5299355 interop/iterator: documentation update 2020-05-26 20:07:44 +03:00
Roman Khimov
2bf7329a15 interop/input|output: update documentation 2020-05-26 20:07:37 +03:00
Roman Khimov
80b39649aa interop/header: update documentation 2020-05-26 20:07:31 +03:00
Roman Khimov
4e21e43e72 compiler: add support for enumerator interop package 2020-05-26 20:07:19 +03:00
Roman Khimov
a0e9673c3e interop/enumerator: update doc, fix Next return value 2020-05-26 20:06:33 +03:00
Roman Khimov
a44bdea890 interop/engine: update documentation 2020-05-26 20:05:17 +03:00
Roman Khimov
71f29c1f9f interop/crypto: update documentation 2020-05-26 20:02:46 +03:00
Roman Khimov
1e83a5e318 interop/contract: update documentation, fix some interfaces
Some functions were just not correct in their interfaces.
2020-05-26 19:58:59 +03:00
Roman Khimov
8231953842 core: fix Neo.Contract.GetStorageContext security check
This syscall should only work for contracts created by current transaction and
that is what is supposed to be checked here. Do so by looking at the
differences between ic.dao and original lower DAO.
2020-05-26 19:58:49 +03:00
Roman Khimov
14409addd9 compiler/interop: expose GetTransactionHeight
And sort syscall names as they change the indentation anyway.
2020-05-26 19:55:21 +03:00
Roman Khimov
afe23ce239 interop/blockchain: update documentation 2020-05-26 19:53:51 +03:00
Roman Khimov
aaf65729bf interop/block: update documentation, fix GetTransaction
GetTransaction never worked with hash, it works with indexes.
2020-05-26 19:53:39 +03:00
Roman Khimov
9718891d79 compiler: add support for attribute syscalls 2020-05-26 19:53:28 +03:00
Roman Khimov
60bea7e224 interop/attribute: update documentation 2020-05-26 19:52:57 +03:00
Roman Khimov
6fac273d5d compiler: add missing asset syscalls, sort them 2020-05-26 19:52:46 +03:00
Roman Khimov
ff583a10a5 asset: update documentation and fix Create/Renew
Both Create and Renew have things returned from them.
2020-05-26 19:52:39 +03:00
Roman Khimov
41337732be compiler: add support for account syscalls
Turns out, they never functioned correctly.
2020-05-26 19:52:24 +03:00
Roman Khimov
7c1a54b725 account: add missing IsStandard interop function
There is a Neo.Account.IsStandard syscall, but we didn't have a wrapper for
it.
2020-05-26 19:51:32 +03:00
Roman Khimov
19c21452c9 interop/account: update and extend documentation 2020-05-26 19:51:20 +03:00
alexvanin
aca6f2f3ad rpc/client: handle client creation error in new wsclient
Client returns error if it can't parse endpoint string. WSClient
should check client error or there could be panic at `cl.cli = nil`
expression.
2020-05-26 11:36:47 +03:00
Roman Khimov
29e66925aa rpc/client: deduplicate block/header tests a bit
The same data is copied at least twice here. Also use this block for header
test making it a bit more convenient.
2020-05-26 11:36:47 +03:00
Roman Khimov
5432530df4 result: use witnesses field in result.Header JSON
Follow new Neo 3.0 standard for these outputs.
2020-05-26 11:36:47 +03:00
Roman Khimov
7633439845 rpc/block: rework the way Block is JSONized
Our block.Block was JSONized in a bit different fashion than result.Block in
its NextConsensus and Index fields. It's not good for notifications because
third-party clients would probably expect to see the same format. Also, using
completely different Block representation is probably making our client a bit
weaker as this representation is harder to use with other neo-go components.

So use the same approach we took for Transactions and wrap block.Block which is
to be serialized in proper way.

Fix `Script` JSONization along the way, 3.0 node wraps it within `witnesses`.
2020-05-26 11:36:47 +03:00