Commit graph

67 commits

Author SHA1 Message Date
Anna Shaleva
9862b40f2c rpc: support InitialGasDistribution response from old Neo-Go nodes
https://github.com/nspcc-dev/neo-go/pull/2435 breaks compatibility
between newer RPC clients and older RPC servers with the following
error:
```
failed to get network magic: json: cannot unmarshal string into Go struct field Protocol.protocol.initialgasdistribution of type int64
```

This behaviour is expected, but we can't allow this radical change.
Thus, the following solution is implemented:
1. RPC server responds with proper non-stringified
   InitialGasDistribution value. The value represents an integral
   of fixed8 multiplied by the decimals.
2. RPC client is able to distinguish older and newer responses. For
   older one the stringified value without decimals part is
   expected. For newer responses the int64 value with decimal part
   is expected.

The cludge will be present in the code for a while until nodes of
version <=0.98.3 become completely absolete.
2022-04-27 19:00:46 +03:00
Anna Shaleva
2096ad6e81 *: remove io/ioutil uses
Close #1764.
2022-03-17 19:39:18 +03:00
Roman Khimov
373fce54e6 config: conflict P2PStateExchangeExtensions/KeepOnlyLatestState
They don't make sense together, for P2P state exchange to be possible we need
a set of MPTs.
2022-02-11 14:19:54 +03:00
Roman Khimov
423c7883b8 core: implement basic GC for value-based storage scheme
The key idea here is that even though we can't ensure MPT code won't make the
node active again we can order the changes made to the persistent store in
such a way that it practically doesn't matter. What happens is:
 * after persist if it's time to collect our garbage we do it synchronously
   right in the same thread working the underlying persistent store directly
 * all the other node code doesn't see much of it, it works with bc.dao or
   layers above it
 * if MPT doesn't find some stale deactivated node in the storage it's OK,
   it'll recreate it in bc.dao
 * if MPT finds it and activates it, it's OK too, bc.dao will store it
 * while GC is being performed nothing else changes the persistent store
 * all subsequent bc.dao persists only happen after the GC is completed which
   means that any changes to the (potentially) deleted nodes have a priority,
   it's OK for GC to delete something that'll be recreated with the next
   persist cycle

Otherwise it's a simple scheme with node status/last active height stored in
the value. Preliminary tests show that it works ~18% worse than the simple
KeepOnlyLatest scheme, but this seems to be the best result so far.

Fixes #2095.
2022-02-11 14:19:54 +03:00
Roman Khimov
e621f746a7 config/core: allow to change the number of validators
Fixes #2320.
2022-01-31 23:14:38 +03:00
Roman Khimov
6e9d725a29 config: consolidate ProtocolConfiguration consistency checks 2022-01-24 18:42:57 +03:00
Roman Khimov
7f48653e66 rpc: add server-side NEP-11 tracking API 2021-11-19 12:58:46 +03:00
Anna Shaleva
43ac4e1517 rpc: implement findstates RPC handler 2021-10-13 11:41:05 +03:00
Evgeniy Stratonikov
7fa6c8dcf6 config: fix duration parameter types
These parameters denote seconds and are thus unitless integers, not
durations.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-25 13:13:51 +03:00
Anna Shaleva
76c687aaa1 config: add P2PStateExchangeExtensions and StateSyncInterval settings 2021-08-10 11:00:32 +03:00
Roman Khimov
df07ba505a config: update mainnet magic
It's NEO3, see neo-project/neo-node#795.
2021-07-21 14:42:26 +03:00
Roman Khimov
35c2c3ae8e
Merge pull request #2078 from nspcc-dev/configurable-initial-gas
config: add InitialGASSupply, fix #2073
2021-07-20 17:10:25 +03:00
Roman Khimov
36d486a664 config: add InitialGASSupply, fix #2073
We now have 52M by default.
2021-07-20 16:59:54 +03:00
Roman Khimov
f9a9d15490 config: update testnet magic for RC4
See neo-project/neo-node#798 and https://github.com/neo-project/neo-node/releases/tag/v3.0.0-rc4
2021-07-20 13:16:38 +03:00
Evgeniy Stratonikov
8e9302f40b oracle: check response Content-Type
If not specified everything is allowed.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 13:13:48 +03:00
Evgeniy Stratonikov
33e1e61343 config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +03:00
Evgeniy Stratonikov
275a5c9daa network: limit message number from the same sender 2021-05-12 10:52:11 +03:00
Roman Khimov
02eb40376e netmode: fix testnet magic
Somehow missed this in 134c7acff1.
2021-05-07 16:40:08 +03:00
Roman Khimov
3acdbbd603
Merge pull request #1918 from nspcc-dev/cli/nep11
cli: support NEP11-related commands
2021-04-30 17:10:29 +03:00
Anna Shaleva
9eeebf481c rpc: allow to marshal Iterators for invoke* results 2021-04-30 16:23:06 +03:00
Anna Shaleva
09bb162de0 network: add ability to specify port for P2P version exchange 2021-04-30 11:27:55 +03:00
Roman Khimov
7a1c1638e4 oracle: specify neofs timeout as timeout, set default if 0
There has to be some sane default and we'd like configuration to be consistent
with other timeout values.
2021-04-06 17:08:04 +03:00
Roman Khimov
b2944bcf8a config: adjust default testnet magic for RC1 testnet
It's 827601742, N3T1, see https://github.com/neo-project/neo-node/releases/tag/v3.0.0-rc1
2021-03-24 10:57:05 +03:00
Roman Khimov
b56e028733 *: add more package-specific documentation
For the most important packages at least.
2021-03-19 16:18:45 +03:00
Roman Khimov
c1b2a79cfe netmode: use proper testnet magic number
Preview5 network used 'N3P5' as its magic, but the official testnet magic is
still 'NEOt', that's the way it's defined in neo-node, so use that.
2021-03-19 16:18:45 +03:00
Roman Khimov
025330f132
Merge pull request #1832 from nspcc-dev/consensus/microfixes
consensus: add MaxBlockSize and MaxBlockSysFee settings
2021-03-16 18:11:33 +03:00
Anna Shaleva
20b70ee9fe config: add MaxBlockSystemFee setting 2021-03-16 12:09:11 +03:00
Anna Shaleva
8f06bf21d7 config: add MaxBlockSize setting 2021-03-16 12:08:47 +03:00
Anna Shaleva
9377751e65 config: add NativeUpdateHistory 2021-03-15 12:35:14 +03:00
Roman Khimov
731adf8448
Merge pull request #1484 from nspcc-dev/oracle/neofs
Integrate NeoFS into oracle module
2021-03-09 17:30:15 +03:00
Evgenii Stratonikov
22b4edd58e oracle: support NeoFS 2021-03-09 14:24:57 +03:00
Evgeniy Stratonikov
3c65ed1507 stateroot: allow to sign new roots 2021-03-09 13:51:11 +03:00
Evgeniy Stratonikov
7b8533b67c native/policy: move MaxTransactionsPerBlock to config 2021-03-04 16:59:19 +03:00
Anna Shaleva
bcb82b457d config: move notary module config to ApplicationConfiguration 2021-02-16 13:58:25 +03:00
Anna Shaleva
840104461b config: update testnet netmode to preview5 magic 2021-02-05 18:57:54 +03:00
Anna Shaleva
19fa0daaa6 core, network: add Notary module 2021-02-02 22:01:20 +03:00
Evgenii Stratonikov
e4528e59dc oracle: reprocess request on fail 2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
25d734cbad oracle: process requests concurrently 2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
43e4d3af88 oracle: integrate module in core and RPC
1. Initialization is performed via `Blockchain` methods.
2. Native Oracle contract updates list of oracle nodes
  and in-fly requests in `PostPersist`.
3. RPC uses Oracle module directly.
2021-01-28 13:00:58 +03:00
Anna Shaleva
0b5cf78468 network: add notary request payload 2020-12-10 18:17:31 +03:00
Evgenii Stratonikov
28b4d4e2f8 core: remove old blocks and transactions
Remove blocks with `height <= current height - MaxTraceableBlocks`
together with transactions.
2020-11-25 16:38:20 +03:00
Evgenii Stratonikov
1869d6d460 core: allow to use state root in header 2020-11-20 17:16:32 +03:00
Evgenii Stratonikov
85f927d892 mpt: implement reference counting
Also postpone MPT initialization until `storeBlock`
because we need to read-and-check or save info about refcounting
depending on starting height.
2020-11-20 16:50:30 +03:00
Roman Khimov
b327308df8 core/config: move MaxTraceableBlocks to configuration file
Follow neo-project/neo#2042, use 2102400 setting for mainnet/testnet and
200000 for private networks.
2020-11-06 13:41:46 +03:00
Anna Shaleva
09b8b8de73 core: reserve attributes range for experimantal purposes 2020-10-23 11:04:59 +03:00
Anna Shaleva
368ff820b3 core: add NotValidBefore transaction attribute
Close #1490
2020-10-23 11:02:46 +03:00
Roman Khimov
292c186665 *: use proper YAML library import path, fix #1306 2020-08-12 16:31:06 +03:00
Roman Khimov
c3c88a57cd
Merge pull request #1281 from nspcc-dev/drop-go-1.12-and-fix-some-things
Drop go 1.12 and fix some things
2020-08-07 13:34:54 +03:00
Roman Khimov
5ef08f60ae remove github.com/pkg/errors from dependencies
It's not needed any more with Go 1.13 as we have wrapping/unwrapping in base
packages. All errors.Wrap calls are replaced with fmt.Errorf, some strings are
improved along the way.
2020-08-07 12:21:52 +03:00
Evgenii Stratonikov
e5d973d3a4 config: rename StandbyValidators to StandbyCommittee 2020-08-06 20:39:13 +03:00