Evgeniy Stratonikov
cb76757e6b
core: turn off GAS generation at 8M height
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-04 17:00:13 +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
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
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
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
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
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
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
c3b6405f0f
transaction: fix asset type JSONization
...
It's stringy in C#.
2021-02-12 23:02:51 +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
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
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
Anna Shaleva
66a64dd4c9
core: fix bug with mempool.verifiedMap
...
Changes ported from #1621 .
2020-12-16 14:14:09 +03:00
Roman Khimov
64d0876fc0
Merge pull request #1503 from nspcc-dev/mpt/refcount
...
Implement reference counting in MPT
2020-11-18 14:20:42 +03:00
Evgenii Stratonikov
0ffffb93d7
mpt: implement reference counting
2020-11-18 12:16:05 +03:00
Evgenii Stratonikov
d93ddfda10
network: retransmit stale transactions
2020-11-11 15:51:36 +03:00
Roman Khimov
06f3c34981
mempool: replace timeStamp with blockStamp
...
Time is not really relevant for us here and we don't use this timestamp in any
way. Yet it occupies 24 bytes and we do two clock_gettime calls to get it.
Replace it with blockStamp which is going to be used in the future for
transaction retransmissions.
It allows to improve single-node TPS by another 3%.
2020-11-11 15:48:13 +03:00
Evgenii Stratonikov
f3abbf34e3
mpt: fill cached fields when getting node from store
...
Node which has been got from store shouldn't be flushed again.
2020-11-11 13:22:53 +03:00
Evgenii Stratonikov
df1792c80b
mpt: export func for decoding node with type
...
`NodeObject` can contain auxilliary fields and shouldn't be used from outside.
2020-11-11 13:22:53 +03:00
Roman Khimov
136e4b5886
core: move NotificationEvent->NEP5Transfer conversion to state
...
We'll need it as a separate function and it's cleaner this way.
2020-10-29 22:10:40 +03:00
Roman Khimov
14c39b2b26
storage: fix Get for BoltDB, fix #1482
2020-10-13 19:21:57 +03:00
Anna Shaleva
168366f33e
core: copy storage item key in simple.GetStorageItems
...
Close #1468 .
We should copy the key to avoid bytes substitution. Otherwise there's a
chance that at the end of dao.Store.Seek(...) execution some keys won't
be the same as the original keys found inside saveToMap function.
2020-10-10 12:24:08 +03:00
Roman Khimov
4f7fa732cf
core|config: make max(free)txperblock height-dependent
...
See neo-project/neo-modules#336 .
2020-09-14 22:57:03 +03:00
Roman Khimov
e14ba6c855
core: fix policy-enforcing network fee check
...
0.001 should be added to the 'extra' value as per https://neo.org/blog/details/4148
2020-09-11 16:52:58 +03:00
Roman Khimov
0ef65d1bb9
config: add minimum network fee setting
...
Follow neo-project/neo#1901 .
2020-09-11 15:41:08 +03:00
Roman Khimov
8865d5b2c5
Merge pull request #1395 from nspcc-dev/add-limits-to-gettransfers
...
Add limits to get(nep5|utxo)transfers
2020-09-09 15:45:09 +03:00
Roman Khimov
5b05081525
config: allow configuring free gas depending on height
...
And update default mainnet/testnet settings. Follow neo-project/neo#1888 and
neo-project/neo-node#656 .
2020-09-08 18:52:53 +03:00
Roman Khimov
b310ac051b
core/rpc: add continue
flag to iterating functions
...
Most of the time we don't need to get all transfers from the DB and
deserialize them.
2020-09-08 15:38:33 +03:00
Roman Khimov
d3e415d3bd
core/state: reverse the order of ForEachTransfer
...
When using limits we're usually concerned about the most recent
transfers. Returning 3 transfers from the middle of the chain isn't very
helpful.
2020-09-08 12:57:45 +03:00
Roman Khimov
9aee3e5a34
transaction: set output position when decoding
...
We had a kludge for getrawtransaction to set this useless field, but
7e371588a7
broke it. Add it right into the
decoder now to fix all types of queries (getblock/getrawtransaction/gettxout).
Fixes #1392 .
2020-09-07 15:37:57 +03:00
Roman Khimov
39897e811d
core: fix NEO UTXO tracking, drop Fixed8 multiplier
...
When this vout:
{
"n" : 0,
"address" : "ASkbjwosE3aKyGtDQkEgqhNq3Zpv8Xkt14",
"asset" : "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"value" : "606"
},
Becomes this transfer:
{
"txid" : "0x192ab8e422aed6ac868cb329d6f9af20964134b591908c736d32a2fd8a51d7bf",
"amount" : "60600000000",
"block_index" : 6113653,
"timestamp" : 1599199074
}
Something is wrong here.
2020-09-04 09:09:35 +03:00
Roman Khimov
43eb670d45
mpt: fix comment typo
2020-08-11 21:55:51 +03:00
Roman Khimov
ffbdcb202f
Merge pull request #1288 from nspcc-dev/fix/utxo
...
rpc: adjust `getutxotransfers` RPC
2020-08-07 19:08:46 +03:00
Evgenii Stratonikov
57a325b3d5
rpc: adjust getutxotransfers
RPC
2020-08-07 18:12:40 +03:00
Anna Shaleva
4715efd531
core, rpc: invoke script with hashes for verifying
...
Closes #1275
2020-08-07 13:18:55 +03:00
Evgenii Stratonikov
7bd4488ff9
core: do not store NEP5 transfer log in memory
...
Traversing transfer log instead of accumulating and returning it
is faster and takes less memory.
2020-08-06 14:22:30 +03:00
Evgenii Stratonikov
022fb04077
rpc: implement getutxotransfers
RPC
2020-08-06 14:16:28 +03:00
Evgenii Stratonikov
407e348cd5
core: save UTXO transfer info
2020-08-06 14:03:21 +03:00
Evgenii Stratonikov
e4fcd90b6d
state: make NEP5Transfer log more generic
2020-08-04 16:57:36 +03:00
Evgenii Stratonikov
49f9c4ad7e
dao: rename transfers to nep5transfers
2020-08-04 15:50:09 +03:00
Evgenii Stratonikov
c6d33c5841
core: save NEP5 transfer notify index
...
TransferNotifyIndex is the index of transfer event in the list
of all transfers in a transaction.
2020-08-03 10:58:23 +03:00
Evgenii Stratonikov
f0d75afc48
rpc: provide old transfers in getnep5transfers
...
Return performed transfers even if contract was migrated.
2020-07-24 14:39:16 +03:00
Evgenii Stratonikov
7cd1bca1e1
core,dao: save contract metadata on migration
...
After contract is migrated there is no way to retrieve it's state.
This commit implements some metadata for NEP5 contracts, so that
values important for diplaying transfer log aren't lost.
2020-07-24 14:38:10 +03:00
Roman Khimov
6d32751292
core: fix stateroot height update for testnet
...
When synchronizing with stateroot-enabled network from genesis and if
stateroot is not enabled in block zero we were failing to update state height
because initially it's updated with a jump from 0 to StateRootEnableIndex, so
we should allow that to happen to have correct state height.
2020-07-18 10:17:17 +03:00
Roman Khimov
1ab4f81fc3
dao: migrate nep5 balances with the contract
...
Fixes #1144 . It's quite simple approach, we just update balance info right
upon contract migration. It will slow down migration transactions, but it
takes about 1-2 seconds to Seek through balances at mainnet's 3.8M, so the
approach should still work good enough. The other idea was to make lazy
updates (maintaining contract migration map), but it's more complicated to
implement (and implies that a balance get might also do a write).
There also is a concern about memory usage, it can give a spike of some tens
of megabytes, but that also is considered to be acceptable.
2020-07-07 19:55:55 +03:00