Commit graph

2286 commits

Author SHA1 Message Date
Roman Khimov
c3175112fe network: fix Ping messages
* NewPing() accepts block index first and nonce then.
 * Block height should be used, it'll be important for state exchanging nodes
2021-08-06 11:31:31 +03:00
Roman Khimov
38d14d4e3a network: drop requests to discovery pool when it can't be handled
It happens from time to time in a four-node private network where there are
seeds (aka CNs) and not a lot of other nodes to connect to.

I don't know how to test for an infinite loop that has no side-effects, so no
test added here.
2021-06-18 10:55:29 +03:00
Roman Khimov
9d6439bbe6 network: don't attempt to connect to the same node twice
We can have multiple copies of the same address in the pool and we should only
proceed to connect once per attempt.
2021-06-18 10:50:01 +03:00
Roman Khimov
46a59e904a network: don't register addresses before version handshake
1) It duplicates registration in `version` message handler and no valid
   connection can work without version exchange.
2) On public networks we have seed nodes defined by names, so we register
   connections to them using these names, but then if connection is dropped we
   delist them by IP:PORT combinations which can lead to zero PeerCount() with
   all seeds still being registered as connected in the discovery subsystem
   and thus no reconnection attempts being made.
2021-06-18 10:49:42 +03:00
Roman Khimov
33db3f76c0
Merge pull request #1910 from nspcc-dev/fix-zero-mpt-init-2.x
[2.x] Fix zero MPT init
2021-04-19 14:46:08 +03:00
Roman Khimov
36938462f1 go.sum: tidy 2021-04-19 12:43:06 +03:00
Roman Khimov
bcc2d1bb8f dao: don't treat zero stateroot as valid during MPT init
Because it's not really valid and MPT state should be the same as if it was
initialized at height 0. Fixes #1870
2021-04-19 12:39:43 +03:00
Roman Khimov
d8c8593410
Merge pull request #1901 from nspcc-dev/nep5-tracking-fixes
NEP5 tracking fixes
2021-04-12 17:04:55 +03:00
Roman Khimov
1202494479 state: reject too big transfers, fix #1900 2021-04-12 12:14:33 +03:00
Roman Khimov
663f10192f core: record transfers even if 'from' balance is 0
Transfer events should still be saved even if balance tracking goes wild.
2021-03-16 12:57:20 +03:00
Roman Khimov
4a2bdf5ddc
Merge pull request #1783 from nspcc-dev/allow-specifying-sysgas-for-invocations-2.x
[2.x] cli: allow specifying system fee via -s for invocations
2021-02-27 10:01:51 +03:00
Roman Khimov
483fefbb62 cli: allow specifying system fee via -s for invocations
Makes it possible to migrate a contract on Neo 2.
2021-02-26 14:52:45 +03:00
Roman Khimov
259522abde CHANGELOG: fix typo 2021-02-26 14:46:37 +03:00
Roman Khimov
39a2360448 CHANGELOG: release 0.78.3 2021-02-22 11:51:26 +03:00
Roman Khimov
3f50f90dc5
Merge pull request #1760 from nspcc-dev/rpc-compatibility-fixes-and-docs
[2.x] RPC compatibility (and other) fixes and docs
2021-02-19 12:30:59 +03:00
Roman Khimov
1179fdb44d
Merge pull request #1761 from nspcc-dev/backport-from-3.0
[2.x] Backport from 3.0
2021-02-19 09:11:27 +03:00
Roman Khimov
98580ae9b4 transaction: always JSONize all contract fields for Publish tx 2021-02-18 17:28:19 +03:00
Roman Khimov
7fc4f3c4ea transaction: always marshal all token's data for register tx
Fix missing precision and token type.
2021-02-18 17:28:19 +03:00
Roman Khimov
9d6a5dc26f result: fix confirmations count for blocks
It's +1, current block actually had `-1` value calcuated that transformed into
4294967295.
2021-02-18 17:28:19 +03:00
Roman Khimov
8571107741 core: bump DB version for NEP5 tracking data change
It's incompatible.
2021-02-18 17:28:19 +03:00
Roman Khimov
eb1986d2fc state: use big.Int for NEP5 balances and transfer amounts
In general, NEP5 contracts are not limited to int64. And we have an example
of pnWETH Flamingo token now (with 18 decimals) that easily overflows int64,
so for correctness we need to store big.Int.

And as TransferLog is shared for different purposes I've decided to not make
it variable-length on Neo 2.
2021-02-18 17:28:19 +03:00
Roman Khimov
38842531ca core: drop NEP5 tracker data if balance is zero
Makes no sense storing it and returning to the user (C# plugin doesn't do
that).
2021-02-18 17:28:19 +03:00
Roman Khimov
d4f26fe473 docs: update RPC documentation
Add missing methods and notice a bit more implementation differences.
2021-02-18 17:28:19 +03:00
Roman Khimov
07c91ea22d core: fix getenrollments
Make getvalidators return the same set of keys with C# for mainnet.
2021-02-18 17:28:19 +03:00
Roman Khimov
1ef91fa409 rpc: encode port numbers as proper numbers in getpeers
The way C# node does it.
2021-02-18 17:28:19 +03:00
Roman Khimov
850d29060a result: assets are LE in JSON
LE/BE split is the worst NEO feature ever.
2021-02-18 17:28:19 +03:00
Roman Khimov
70a20ce031 core: fix system fee calculation
It was completely wrong starting from the genesis block.
2021-02-18 17:28:19 +03:00
Roman Khimov
5ff57e890b consensus: flush previous proposal on new block
Reusing proposals from previous blocks doesn't make sense. And reduce some
code duplication along the way.
2021-02-18 15:45:34 +03:00
Roman Khimov
d1e02c393d consensus: only use previous proposal if it has something in it
It might just be uninitialized it doesn't really make sense using zero-length
previous proposal anyway.
2021-02-18 15:42:06 +03:00
Roman Khimov
62a11807a8 fixedn: always correctly unmarshal Fixed8 values
Quoted or not, they should be unmarshalled without going through float64.
2021-02-18 15:38:02 +03:00
Evgeniy Stratonikov
feb6ba2ef7 io: allow to restrict string size 2021-02-18 15:36:22 +03:00
Roman Khimov
a46c93f6bb rpc: fix getblocksystemfee call
It should return cumulative fee and it should be wrapped into a string.
2021-02-15 17:58:39 +03:00
Roman Khimov
fda8b784c8 rpc/server: allow numbers for getblockheader call 2021-02-15 17:27:23 +03:00
Roman Khimov
9c34dea296 rpc/server: return more specific error in getblockhash 2021-02-15 16:18:03 +03:00
Roman Khimov
c3b6405f0f transaction: fix asset type JSONization
It's stringy in C#.
2021-02-12 23:02:51 +03:00
Roman Khimov
90a06ed7a5 rpc: fix IsFrozen JSONization for assets
C# node uses `frozen` as field name here.
2021-02-12 00:04:13 +03:00
Roman Khimov
9571ecffac core: add proper asset issuer for UTXO assets
It just wasn't set which is wrong (AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM was
always the issuer).
2021-02-12 00:01:00 +03:00
Roman Khimov
89fb02a7f8
Merge pull request #1648 from nspcc-dev/backport-fixes-from-master
Backport fixes from master to 2.x
2021-01-11 12:44:05 +03:00
Roman Khimov
17c010e07d
Merge pull request #1649 from nspcc-dev/dont-return-spent-in-gettxout
rpc: fix gettxout result for already spent outputs
2021-01-02 13:20:06 +03:00
Roman Khimov
9e35758653 rpc: fix gettxout result for already spent outputs
As per C# documentation [1]:
  If the transaction output is already spent, the result value will be null .

[1]: https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api/gettxout.html
2020-12-31 13:54:42 +03:00
Evgenii Stratonikov
ee45d7739f network: fix requestTx()
2 bugs were here:
1. If amount of tx is small, no messages were sent.
2. Correctly cut byte slice if last message is small.
2020-12-31 13:00:50 +03:00
Roman Khimov
363c24d128 network: fix tx requests, we can't ask more than 500 txes at once 2020-12-31 13:00:00 +03:00
Evgenii Stratonikov
9756ed2b06 network: set timeout on write
Fix a bug occuring under high load when node
hangs during this write.
2020-12-31 12:58:00 +03:00
Evgenii Stratonikov
edf587bbf1 network: fix a bug in discovery with a peer connected twice
It could be the case that checks are performed simultaneosly and
peers connections goes down from 2 to 0. We must take such case into
account and register address as good in discovery.
2020-12-31 12:57:43 +03:00
Evgenii Stratonikov
0d2bc8f4a6 network: remove extra error check from Message.Encode()
Buffer write error is returned from `Encode()`.
2020-12-31 12:52:40 +03:00
Evgenii Stratonikov
0510d1e6c1 vmcli: return after error in break 2020-12-31 12:51:01 +03:00
Evgenii Stratonikov
5d6065c3ee vmcli: set breakpoint before the instruction
Breakpoint should occur before actual instruction execution.
2020-12-31 12:50:52 +03:00
Anna Shaleva
4a8259caea rpc: adjust getrawtransaction and gettransactionheight RPC call
We should not return transaction metadata from `getrawtransaction` in case
transaction is not in the mempool. Height shouldn't be returned from
`gettransactionheight` in case transaction is in the mempool.
2020-12-31 12:44:07 +03:00
Roman Khimov
124c674b17 *: gofmt -s 2020-12-31 11:52:27 +03:00
Roman Khimov
50f477b2af
Merge pull request #1623 from nspcc-dev/2x/core/mempool_fix
[master-2.x] core: fix bug with mempool.verifiedMap
2020-12-16 16:54:46 +03:00