Roman Khimov
5365da9860
native: remove unregistered candidate with 0 votes on NEO transfer
...
See neo-project/neo#1935 .
2020-09-29 22:38:38 +03:00
Evgenii Stratonikov
26dc807a2d
native: initialize cache in OnPersist
...
If node started from non-zero height, `Initialize` is
not called thus cache is empty. Thus we should initialize
it before any tx is executed.
2020-09-29 10:17:47 +03:00
Evgenii Stratonikov
e0e7fd5367
native: cache GASPerBlock values
...
Close #1421 .
2020-09-28 10:53:48 +03:00
Evgenii Stratonikov
5b205ffa7d
native: cache committee script hash
2020-09-25 16:32:10 +03:00
Evgenii Stratonikov
c5cdaae87a
native: support postPersist
method
...
It should be called for NEO contract to distribute
committee bounties.
2020-09-23 14:47:09 +03:00
Evgenii Stratonikov
af16519413
native: do not update committee every block
...
Update frequency depends on committee size and
amount of validators. For mainnet it is 28.
2020-09-23 14:42:13 +03:00
Evgenii Stratonikov
81a11c629a
native: remove getValidators
method
...
Follow https://github.com/neo-project/neo/pull/1920 .
2020-09-23 14:42:13 +03:00
Evgenii Stratonikov
83e94d3bbc
native: cache committee members
2020-09-23 14:42:13 +03:00
Evgenii Stratonikov
43b3e15330
native: send GAS to a committee member on persist
2020-09-23 14:42:12 +03:00
Evgenii Stratonikov
5a38208361
native: implement NEO.Get/SetMaxGasPerBlock()
2020-09-23 14:12:42 +03:00
Evgenii Stratonikov
7d90d79ae6
core: update claimable GAS calculation
2020-09-23 14:12:42 +03:00
Evgenii Stratonikov
dce456f77f
native: fix a bug in GetCommitteeMembers
...
Return standby committee instead of validators.
2020-08-27 18:40:37 +03:00
Evgenii Stratonikov
4782a94200
native: do not rewrite NextValidators in (*NEO).OnPersist()
...
There is no need in writing the same value again and again.
Closes #1337 .
2020-08-24 16:45:09 +03:00
Evgenii Stratonikov
2661ebd295
transaction: add HighPriority attribute
...
HighPriority attributes specifies that transaction was
signed by a committee.
2020-08-23 09:39:46 +03:00
Roman Khimov
e7d13e6db2
*: fix misspellings found in Go Report Card
2020-08-14 12:16:24 +03:00
Roman Khimov
c16040aecc
native: sort GetValidators result
...
As it's returned sorted now. Fixes state change mismatch for
NextValidators. It also partially reverts
2f8e7e4d33
and significantly changes the test
chain as the fees are no longer being sent to the same account.
2020-08-10 19:49:09 +03:00
Roman Khimov
fb97ea9458
native: don't register standby validators on initialization
...
C# doesn't do that since neo-project/neo#1762 .
2020-08-10 17:51:46 +03:00
Roman Khimov
f287681fa7
core/native: fix VotersCount zero value encoding
...
Empty byte array is enough to be bigint value of zero. Fixes state differences
with C# node.
2020-08-10 17:07:14 +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
bfda60c683
native: add missing witness checks to NEO.(Un)registerCandidate
2020-08-07 09:17:02 +03:00
Evgenii Stratonikov
8af3f05358
native: implement NEO.UnregisterCandidate
method
2020-08-06 20:39:13 +03:00
Evgenii Stratonikov
38a92323c9
native: fill votes when registering unregistered candidate
...
If a candidate was registered, then unregistered and then again
registered, it's votes must not be lost.
2020-08-06 20:39:13 +03:00
Evgenii Stratonikov
b14b047c78
native: add tests for delegated voting
2020-08-06 20:39:13 +03:00
Evgenii Stratonikov
9bc731b3b1
native: implement delegated voting
...
Close #867 .
2020-08-06 20:39:13 +03:00
Evgenii Stratonikov
f0b62cdaa6
native: make *totalSupply accept DAO
...
There is no need to provide full interop context.
2020-08-06 14:26:24 +03:00
Evgenii Stratonikov
3e39f0f211
native: rename Validator to Candidate
2020-08-06 14:26:24 +03:00
Anna Shaleva
b9bdab8ec8
core: store nep5balances using contract id
...
Closes #1194
2020-07-29 15:15:48 +03:00
Anna Shaleva
4bf88ba6b0
core: decouple native contracts from interop service
...
Closes #1191 .
2020-07-29 10:33:18 +03:00
Roman Khimov
acfded7f45
Merge pull request #1180 from nspcc-dev/fix-calling-scripthash-check-in-nep5
...
Add calling scripthash check to native nep5 transfers
2020-07-16 07:29:14 +03:00
Roman Khimov
d4c3a17883
interop/native: always use proper ScriptHashGetter, fix #924
...
All scripts are run in VM, so it's there to tell us about script hashes
involved and it must be used instead of nep5ScriptHash kludge.
2020-07-15 22:43:30 +03:00
Anna Shaleva
a3e306ff78
core: implement Secp256k1 Verify and CheckMultisig interops
...
Closes #918 .
2020-07-14 16:21:34 +03:00
Roman Khimov
579630a3fa
native: don't expose internal slices to the outside world
...
They should be hidden.
2020-07-11 19:54:50 +03:00
Roman Khimov
ae497228f0
core: use native NEO GetValidators for bc.GetValidators
...
NextBlockValidators are updated before the new block persist, so we need to
use GetValidators to get the list corresponding to the current state of the
chain.
2020-07-11 19:54:50 +03:00
Anna Shaleva
abe3c94b95
core: use big.Int to store NEP5 balances
...
closes #1133
2020-07-09 13:26:39 +03:00
Anna Shaleva
0aaaf7f787
*: switch from fixed8 to int64 in (Blockchain).CalculateClaimable
2020-06-29 21:40:54 +03:00
Evgenii Stratonikov
f007cca80b
native: hide native contract methods
...
Copy public keys when returning them to the outside and hide unused
`GetValidators` method.
2020-06-29 10:48:37 +03:00
Evgenii Stratonikov
bbe02ac584
native: store typed nil
in validators cache
...
Fix `error encountered at instruction 0 (SYSCALL): sync/atomic: store of nil value into Value"`.
2020-06-29 10:37:52 +03:00
Evgenii Stratonikov
978b3c96fe
native: cache GetValidators result
2020-06-24 19:42:50 +03:00
Roman Khimov
7987cdadc0
native: update storage item value after gas distribution
...
Even if the value is zero, the GAS distribution updates the balance height, so
storage item must be updated too. Fixes the followin on preview2 testnet:
block 74227: value mismatch for key ffffffff1454a6cb279fbcedc66162ad4ad5d1d910202b92743e000000000000000000000005: 1041032104809fd5002103f3210128010000 vs 1041032104809fd50021033f110128010000
2020-06-24 10:22:21 +03:00
Roman Khimov
fccad11716
native: drop accounts with zero balance
...
They make no sense. Fixes preview2 testnet state problem:
file BlockStorage_100000/dump-block-70000.json: block 69935: state mismatch for key ffffffff1454a6cb279fbcedc66162ad4ad5d1d910202b92743e000000000000000000000005: Deleted vs Added
2020-06-24 10:22:21 +03:00
Roman Khimov
5e56c9db29
native: fix voting accounting in transfers processing
...
We should modify votes count exactly by the amount of NEO balance change, it
might be negative here.
2020-06-24 10:22:21 +03:00
Roman Khimov
d0331bf21b
native: simplify votes saving in NEO contract
...
Follow C# behavior and fix state mismatch at block 11561 of preview2 testnet.
2020-06-24 10:22:21 +03:00
Roman Khimov
e5f05790d5
core: cache standby validators in the Blockchain
...
They never change, so it makes no sense parsing the keys over and over
again. It also simplifies the interface a little.
2020-06-24 10:22:17 +03:00
Roman Khimov
2f8e7e4d33
native: fix getvalidators to match C# implementation
...
ValidatorsCount is not initialized at block 0 with C# node (the first voter
initializes it) and until that initialization happens the standby validators
list is being returned as is without sorting.
Fixes state mismatch for the key ffffffff0e00000000000000000000000000000001 in
the first blocks.
It also affects tests as now the first validator is different and it receives
the network fees.
2020-06-24 10:21:24 +03:00
Anna Shaleva
f1cdcbc99c
core: store smartcontract items by id
...
closes #1037
2020-06-19 20:48:45 +03:00
Anna Shaleva
c767ac2973
core: fix NEO native contract id
...
It should be set to -1 as in c# implementation.
2020-06-19 20:44:52 +03:00
Evgenii Stratonikov
031fd93172
native: fix native contract prices
2020-06-18 15:32:27 +03:00
Evgenii Stratonikov
0fa4c49735
core,native: persist native contract via VM
...
After native contracts are deployed, single persist script is created
and executed at the start of every block persisting.
2020-06-18 15:32:27 +03:00
Evgenii Stratonikov
a3b876d55c
native: specify call flags for native contract methods
2020-06-11 13:16:07 +03:00