Commit graph

1968 commits

Author SHA1 Message Date
Roman Khimov
94d6b5466f docs: update compiler.md, bring it up to date
And add one more reference to it into the main README.
2020-05-19 13:13:15 +03:00
Roman Khimov
0079dfb695 interop: add some top-level doc.go 2020-05-19 13:13:15 +03:00
Roman Khimov
2c921f5277 docs: drop runtime.md
We have now way better godoc for interop functions, so this document makes
little sense and it's not referenced anywhere, so it's safe to drop it.
2020-05-19 13:13:15 +03:00
Roman Khimov
8c19b8f2a1 compiler/interop: add support for working with witnesses 2020-05-19 13:13:15 +03:00
Roman Khimov
085d50b430 interop/util: extend documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
ec2bf7d52e interop/transaction: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
a587274351 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-19 13:13:15 +03:00
Roman Khimov
514f862b81 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-19 13:13:15 +03:00
Roman Khimov
d0a3ce25ff compiler/storage: add read-only related interops 2020-05-19 13:13:15 +03:00
Roman Khimov
07742bdf46 interop/storage: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
dff0f724cd interop/runtime: update documentation, fix Notify
Notify doesn't return anything!
2020-05-19 13:13:15 +03:00
Roman Khimov
eb82661f6b compiler/iterator: add missing iterator.Concat function
We have a syscall for it, so it should be exposed.
2020-05-19 13:13:15 +03:00
Roman Khimov
a17bd6176f interop/iterator: documentation update 2020-05-19 13:13:15 +03:00
Roman Khimov
31d7b07eb5 interop/input|output: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
6c0553da47 interop/header: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
d5d497ccd7 compiler: add support for enumerator interop package 2020-05-19 13:13:15 +03:00
Roman Khimov
8fb4bbca4e interop/enumerator: update doc, fix Next return value 2020-05-19 13:13:15 +03:00
Roman Khimov
5cebd4a7a2 compiler/engine: add dynamic APPCALL generation, fix #914
Previously we could generate dynamic appcall with a kludge of
    AppCall([]byte{/* 20 zeroes */, realScriptHash, args...)

Now there is a separate function for this.
2020-05-19 13:13:15 +03:00
Roman Khimov
78b2387640 interop/engine: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
10abac4362 interop/crypto: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
f0047b4055 interop/contract: update documentation, fix some interfaces
Some functions were just not correct in their interfaces.
2020-05-19 13:13:15 +03:00
Roman Khimov
a43f2234dd 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-19 13:13:15 +03:00
Roman Khimov
541d56a874 gitignore: don't ignore blockchain(s) directories
It interferes with interop/blockchain and it's not a default directory for
chain DBs.
2020-05-19 13:13:15 +03:00
Roman Khimov
5d941364bd compiler/interop: expose GetTransactionHeight
And sort syscall names as they change the indentation anyway.
2020-05-19 13:13:15 +03:00
Roman Khimov
80b8b50f02 core: fix Neo.Blockchain.GetValidators implementation
It should return keys, attempting to push []*state.Validator to the stack
would probably lead to failure.
2020-05-19 13:13:15 +03:00
Roman Khimov
9e94895bb0 interop/blockchain: update documentation 2020-05-19 13:13:15 +03:00
Roman Khimov
d09c3b1e27 interop/block: update documentation, fix GetTransaction
GetTransaction never worked with hash, it works with indexes.
2020-05-19 13:13:15 +03:00
Roman Khimov
7abd35b358 compiler: add support for attribute syscalls 2020-05-19 13:13:15 +03:00
Roman Khimov
77c5f28b09 interop/attribute: update documentation 2020-05-19 13:13:14 +03:00
Roman Khimov
f69e654260 compiler: add missing asset syscalls, sort them 2020-05-19 13:13:14 +03:00
Roman Khimov
cbcc8e160f asset: update documentation and fix Create/Renew
Both Create and Renew have things returned from them.
2020-05-19 13:13:14 +03:00
Roman Khimov
9c46e79745 compiler: add support for account syscalls
Turns out, they never functioned correctly.
2020-05-18 19:08:28 +03:00
Roman Khimov
83df376d17 account: add missing IsStandard interop function
There is a Neo.Account.IsStandard syscall, but we didn't have a wrapper for
it.
2020-05-18 19:08:28 +03:00
Roman Khimov
6dff01672c interop/account: update and extend documentation 2020-05-18 19:08:28 +03:00
Roman Khimov
f0abbfd399
Merge pull request #951 from nspcc-dev/notification-filters-2.x
Notification filters 2.x
2020-05-14 20:57:43 +03:00
Roman Khimov
8cd7bc7e07 rpc/client: deduplicate block/header tests a bit
The same data is copied at least three times here.
2020-05-14 17:28:14 +03:00
Roman Khimov
9546e021a9 rpc/block: rework the way Block is JSONized
Our block.Block was JSONized in a bit different fashion than result.Block in
its Nonce and NextConsensus 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 in result 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.Base which is
to be serialized in proper way.
2020-05-14 17:28:14 +03:00
Roman Khimov
83febead59 transaction: add json.Unmarshaler to Attribute
It actually was missing and it might affect Transaction conversion to/from
JSON.
2020-05-14 17:28:14 +03:00
Roman Khimov
8f55f0ac76 rpc/server: add notification filters
And check state string correctness on unmarshaling.
2020-05-14 17:28:14 +03:00
Roman Khimov
78716c5335 rpc/client: add support for notification filters
Differing a bit from #895 draft specification, we won't add `verifier` (or
signer) for Neo 2, it's not worth doing so at the moment.
2020-05-14 00:56:26 +03:00
Roman Khimov
da32cff313 rpc/server: don't panic on test failure 2020-05-14 00:56:26 +03:00
Roman Khimov
966ff28091 rpc: add subscriber queue overflow check
It's not practical adding server-side tests for 2.0 (as it requires generating
more blocks), so we'll leave it for 3.0.
2020-05-14 00:56:26 +03:00
Roman Khimov
1d5734c882
Merge pull request #944 from nspcc-dev/notifications-2.x
Notifications 2.x
2020-05-13 17:22:55 +03:00
Roman Khimov
9454ef5c28 core: improve locking in storeBlock
Getting batch, updating Prometheus metrics and pushing events doesn't require
any locking: batch is a local cache batch that no one outside cares about,
Prometheus metrics are not critical to be in perfect sync and events are
asynchronous anyway.
2020-05-13 17:17:41 +03:00
Roman Khimov
5464f9c3ae rpc/client: add notifications support for WSClient
It differs from #895 design in that we have Notifications channel always
exposed as WSClient field, probably it simplifies things a little.
2020-05-13 17:17:41 +03:00
Roman Khimov
e1408b6525 rpc/server: add notification subscription
Note that the protocol differs a bit from #895 in its notifications format,
to avoid additional server-side processing we're omitting some metadata like:
 * block size and confirmations
 * transaction fees, confirmations, block hash and timestamp
 * application execution doesn't have ScriptHash populated

Some block fields may also differ in encoding compared to `getblock` results
(like nonce field).

I think these differences are unnoticieable for most use cases, so we can
leave them as is, but it can be changed in the future.
2020-05-13 17:17:41 +03:00
Roman Khimov
29ada4ca46 smartcontract: add JSON marshal/unmarshal for InteropType
We actually have to do that in order to answer getapplicationlog requests for
transactions that leave some interop items on the stack. It follows the same
logic our binary serializer/deserializes does leaving the type and stripping
the value (whatever that is).
2020-05-13 17:17:41 +03:00
Roman Khimov
d5df1212c2 rpc/server: start and shutdown Server in tests
It will be important for proper subscription testing and it doesn't hurt even
though technically we've got two http servers listening after this change (one
is a regular Server's http.Server and one is httptest's Server). Reusing
rpc.Server would be nice, but it requires some changes to Start sequence to
start Listener with net.Listen and then communicate back its resulting
Addr. It's not very convenient especially given that no other code needs it,
so doing these changes just for a bit cleaner testing seems like and
overkill.

Update config appropriately. Update Start comment along the way.
2020-05-12 17:42:34 +03:00
Roman Khimov
d686fe4e5d network: get blocks directly from the chain for rebroadcasting
Simplify network<->consensus relations, also broadcast blocks received by
other means like RPC.
2020-05-12 17:42:34 +03:00
Roman Khimov
dd8bcfae47 consensus: remove OnNewBlock(), use Blockchain subscription
Get new blocks directly from the Blockchain. It may lead to some duplications
(as we'll also receive our own blocks), but at the same time it's more
correct, because technically we can also get blocks via other means besides
network server like RPC (submitblock call). And it simplifies network server
at the same time.
2020-05-12 17:41:23 +03:00