Commit graph

201 commits

Author SHA1 Message Date
Roman Khimov
cb5ecaefe7 native: drop OnPersistEnd
Now that PostPersist is being run for every native contract we can do our
dirty caching tricks right there instead of OnPersistEnd.
2020-12-14 15:24:15 +03:00
Roman Khimov
cf8cf93e7a native: change contract names, move them to separate package
Follow neo-project/neo#2138 and make RPC client's GetNativeContractHash
case-sensitive.
2020-12-14 15:24:15 +03:00
Roman Khimov
aff1469482 native: uppercase token symbols
Follow neo-project/neo#2136.
2020-12-14 15:24:15 +03:00
Roman Khimov
1e9253f1f0 interop: rename Neo.Native.Call to System.Contract.CallNative 2020-12-14 15:24:13 +03:00
Roman Khimov
ab12eee346 native: move contract deployment to management contract
See neo-project/neo#2119.
2020-12-14 15:23:46 +03:00
Roman Khimov
ad3547783d native: drop Neo.Native.Deploy, move contract init to management contract
The contract is almost a stub at the moment, though it does deploy other
contracts.
2020-12-14 13:33:41 +03:00
Roman Khimov
090bee8624 native: change OnPersist/PostPersist handling
Every contract now has these and they're always invoked. See
neo-project/neo#1913 and neo-project/neo#2119.
2020-12-13 21:36:06 +03:00
Anna Shaleva
2290b91b83 core: fix verification call flag
Previous commit sets AllowCall flag as required for Neo.Native.Call, but
invocation script was loaded with ReadStates flag => native contracts
verification failed.

Other contracts can also make use of AllowCall call flag.
2020-12-11 17:45:12 +03:00
Anna Shaleva
53e45d793b core: adjust call flags 2020-12-11 11:38:14 +03:00
Anna Shaleva
fadbae8997 core: rename call flags
Also new States flag is added and ReadOnly flag is adjusted.
2020-12-11 10:34:01 +03:00
Anna Shaleva
0b5cf78468 network: add notary request payload 2020-12-10 18:17:31 +03:00
Evgenii Stratonikov
e903e40085 core: call from native contracts synchronously
Follow neo-project/neo#2130.
2020-12-10 16:43:46 +03:00
Roman Khimov
02457d9f77
Merge pull request #1597 from nspcc-dev/fix/safemethods
manifest: add `Safe` flag to method descriptor
2020-12-09 16:32:19 +03:00
Evgenii Stratonikov
b7e86fa6a3 manifest: add Safe flag to method descriptor
`interop.Contex.AddMethod` sets `Safe` flag for native
contracts. This allows not to forget to change manifest
when changing call flags.
Also fixed invalid `Safe` flags for `Notary` and `Designate` contracts.
2020-12-08 13:27:43 +03:00
Anna Shaleva
74a143cee3 core: allow to change deposit's till for owner only 2020-12-08 10:39:20 +03:00
Roman Khimov
9211cb636c
Merge pull request #1555 from nspcc-dev/constant-contract-hashes
Constant contract hashes
2020-12-01 14:12:26 +03:00
Evgenii Stratonikov
1db27c004e native: do not fail on missing request in Oracle.PostPersist() 2020-12-01 12:29:18 +03:00
Evgenii Stratonikov
3085710e9b native: call onPayment only during transfer
OnPayment method should be called during GAS distribution
and NEO transfer.
2020-11-30 13:05:44 +03:00
Roman Khimov
1cf1fe5d74 *: introduce stable contract hashes
Follow neo-project/neo#2044.
2020-11-27 21:47:08 +03:00
Roman Khimov
7044e9be40
Merge pull request #1549 from nspcc-dev/core/fix_committee_update
core: update committee every [committee length] blocks
2020-11-27 11:04:40 +03:00
Anna Shaleva
17842dabd6 core: implement native Notary contract 2020-11-25 18:37:29 +03:00
Anna Shaleva
c013522296 core: remove native contracts' name method
We have `name` in contract manifest.
2020-11-25 18:37:29 +03:00
Anna Shaleva
0f68528095 core: add callback to VM context 2020-11-25 18:37:29 +03:00
Anna Shaleva
eca27055b8 core: fix NEP17 Transfer event
`Transfer` event declaration was placed at the wrong part of
`newNEP17Native`, that's why it had incorrect parameters.

Fixed.
2020-11-25 18:37:29 +03:00
Anna Shaleva
2fee69f26f core: add missing onPersist and postPersist methods to natives
Although not every contract is persisted (see
https://github.com/neo-project/neo/blob/master/src/neo/Ledger/Blockchain.cs#L94)
we have to add `onPersist` and `postPersist` methods to every
native contract in order to display them in manifest for users and
follow C# behaviour. In C# there are `onPersist` and `postPersist`
methods in base native contract class, see
https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/NativeContract.cs#L141
and
https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/NativeContract.cs#L148
2020-11-25 18:37:29 +03:00
Anna Shaleva
b00eb51c55 core: add P2PNotary designated role 2020-11-24 18:47:09 +03:00
Evgenii Stratonikov
7d91a3a89e pkg: move internal/ package to the root directory
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
b97dfae8d8 native: replace NEP-5 with NEP-17 2020-11-24 13:08:23 +03:00
Evgenii Stratonikov
42ae226f9e native: use proper stack for result
When native method calls other contract result should be put
on the stack of current context. With oracles this problem wasn't
noticed because of void return type.
2020-11-24 12:17:28 +03:00
Roman Khimov
eef921b8e0 native: allow NULL filter in oracle requests
Follow neo-project/neo#2067
2020-11-18 23:59:13 +03:00
Anna Shaleva
933bb4ca75 core: update committee every [committee length] blocks
Was changed in https://github.com/neo-project/neo/pull/1848. Affects
storage dumps.
2020-11-17 11:22:32 +03:00
Anna Shaleva
054e60c0cf core: remove NodeList from Oracle storage
The reference implementation does not store NodeList. This commit fixes
state difference for genesis block.
2020-11-16 19:09:34 +03:00
Roman Khimov
286d9185f4 smartcontract: remove contract features
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060.
2020-11-13 21:26:23 +03:00
Evgenii Stratonikov
adf403666f native: decode storage item in Seek 2020-11-13 17:33:00 +03:00
Anna Shaleva
01296bda5f core: remove policy default values initialisation 2020-11-10 18:05:40 +03:00
Evgenii Stratonikov
54992ad4f3 core: provide account in calculate claimable
`getunclaimedgas` RPC should return all GAS available to claim.
2020-11-10 16:08:21 +03:00
Evgenii Stratonikov
860c146260 native: increase committee GAS bounty
Follow neo-project/neo#2049 .
2020-11-10 15:30:31 +03:00
Evgenii Stratonikov
af583c14ea native: add GAS rewards for voters
Close #1348.
2020-11-10 15:30:30 +03:00
Evgenii Stratonikov
a3c7130ab2 native: cache committee together with votes 2020-11-10 15:23:06 +03:00
Evgenii Stratonikov
c30d891aa9 consensus: update NextConsensus only when committee is recalculated 2020-11-09 17:35:32 +03:00
Roman Khimov
0ee377792e
Merge pull request #1519 from nspcc-dev/designate-role-history
native: implement designate contract history retention
2020-11-06 15:35:18 +03:00
Roman Khimov
47421f23f4 native: add events to oracle contract
Follow neo-project/neo#2036.
2020-11-06 13:49:07 +03:00
Roman Khimov
9e781bff47 native: implement designate contract history retention
Follow neo-project/neo#2007. Fix getDesignatedByRole price along the way.
2020-11-06 13:46:40 +03:00
Anna Shaleva
15a939b1da rpc: allow to getcontractstate by address, id or name
close #1423
2020-11-03 17:23:49 +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
Roman Khimov
c4a4a84515 native: lower voting fee
Follow neo-project/neo#2010.
2020-10-26 22:12:56 +03:00
Anna Shaleva
0232bbcb0c core: refactor GASRecord handling
We should store each GAS record as
{
    Key: ContractID + RecordsPrefix + RecordID,
    Value: RecordValue,
}
So don't use state.GASRecord for storing anymore. However, it's still
useful to cache GasRecord values by using state.GASRecords, because we
have to keep GASIndexPairs sorted by indexes.
2020-10-23 12:49:12 +03:00
Anna Shaleva
0da01fde7f core: refactor blocked accounts logic 2020-10-23 11:42:30 +03:00
Anna Shaleva
6685f8eba9 core: restrict the maximum number of requests per URL 2020-10-22 11:32:02 +03:00