Commit graph

1256 commits

Author SHA1 Message Date
Evgenii Stratonikov
45a4524054 rpc: remove EnableCORSWorkaround from Request 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
289cb1c1d9 rpc: use zap.Logger 2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
aecdf470e7 cli,pkg: use zap.Logger 2020-01-10 11:14:27 +03:00
Roman Khimov
c0523546c6
Merge pull request #589 from nspcc-dev/wallet-dump
I don't think open is actually of any use for our wallet, so I've renamed it to dump
and implemented it fixing some things along the way.
2020-01-09 19:20:51 +03:00
Roman Khimov
aad0d3792d wallet: implement dump command
Mostly a testing tool for the moment.
2020-01-09 18:40:30 +03:00
Roman Khimov
e96b4bc82e wallet: fix TestNewAccount
It duplicated TestNewFromWif.
2020-01-09 18:40:30 +03:00
Roman Khimov
9bb68d7025 wallet: make DecryptAccount a method of Account
Otherwise it almost duplicates keys.NEP2Decrypt().
2020-01-09 18:40:30 +03:00
Roman Khimov
951ee383e9 keys: improve NEP2 testing 2020-01-09 18:06:03 +03:00
Roman Khimov
b5b05a969c keys: make NEP2Decrypt return a PrivateKey rather than WIF
There is no point in encoding the output of this function in a WIF format,
most of the users actually want the real key and those who need a WIF can
easily get if from the key (and it's simpler than getting the key from the
WIF).

It also fixes a severe bug in NEP2Decrypt, base58 decoding errors were not
processed correctly.
2020-01-09 18:05:14 +03:00
Evgenii Stratonikov
9c79684516 storage: panic on error in boltdb.Seek
Error in Seek means something is terribly wrong (e.g. db was not opened) and
error drop is not the right thing to do, because caller
will continue working with the wrong view.
2020-01-09 15:17:35 +03:00
Roman Khimov
9a8f5c2a5d CHANGELOG: add a note about config changes for v0.71.0 2019-12-30 19:22:12 +03:00
Roman Khimov
3985de1a9c update CHANGELOG and ROADMAP, release 0.71.0 2019-12-30 18:19:03 +03:00
Evgeniy Kulikov
d0ffa2d79d
Merge pull request #583 from nspcc-dev/fix/gettx
consensus: return nil interface from getTx
2019-12-27 14:51:27 +03:00
Evgenii Stratonikov
8d1f564411 consensus: add tests for getTx 2019-12-27 14:12:58 +03:00
Evgenii Stratonikov
d803dffca8 consensus: return nil interface from getTx 2019-12-27 13:54:11 +03:00
Evgeniy Kulikov
68c78d818a
Merge pull request #582 from nspcc-dev/db-dump-fixes
DB dump and restore fixes
2019-12-27 12:53:05 +03:00
Roman Khimov
f15a2401b1 cli/server: close the chain gracefully on restore even on error
Not an issue for dumper, but when restoring we should correctly save
everything already imported even if the subsequent block fails.
2019-12-27 12:38:07 +03:00
Roman Khimov
1f4b7b366e cli/server: skip genesis block on restore if it matches ours
Enables more convenient imports without skipping over the block 0.
2019-12-27 12:25:39 +03:00
Roman Khimov
ae003a1578 cli/server: fix db restorer math wrt skip
Given `-s 1` with a dump of 6001 blocks it skipped the first one and then
tried to import the next 6001 which failed with EOF because there are only
6000 blocks left.
2019-12-27 12:15:47 +03:00
Roman Khimov
b706130175 cli/server: redo dumper to dump blocks from 0
NGD dumps are all zero-based and even though I don't like it (genesys block
should not be imported, it's the root of chain trust), we have to conform to
this convention for interoperability with C# nodes (otherwise they're not able
to import our dumps).

This also renames `skip` dumper parameter to `start` which is more logical
now, the default is to start the dump from block number zero.
2019-12-27 12:11:57 +03:00
Roman Khimov
7aa7490fb2 cli: fix wrong db dump format
It was broken by 03ff2976ed that changed fixed
32-bit length encoding to VarBytes.
2019-12-26 20:03:06 +03:00
Roman Khimov
c306d2f07c
Merge pull request #581 from nspcc-dev/feat/storage_find
core: implement Neo.Storage.Find interop, closes #422.
2019-12-26 15:46:46 +03:00
Evgenii Stratonikov
48cf4f4a84 core: implement Neo.Storage.Find interop 2019-12-26 15:21:41 +03:00
Evgenii Stratonikov
7b5c47e7f5 vm: add NewMapIterator() 2019-12-26 14:34:15 +03:00
Roman Khimov
f8887b63ba
Merge pull request #578 from nspcc-dev/fix/sign
consensus: verify payloads correctly, closes #555.
2019-12-26 13:07:40 +03:00
Evgenii Stratonikov
64d24d8ddd consensus: verify payloads correctly 2019-12-26 10:49:56 +03:00
Evgenii Stratonikov
714c466c2c core: add ScriptFromWitness function
Extracting verification script from witness became a common task.
This commit adds such a possibility.
2019-12-26 10:49:56 +03:00
Roman Khimov
13f8d6729d
Merge pull request #580 from nspcc-dev/server-getblocks
network: implement getblocks command
2019-12-25 23:11:49 +03:00
Roman Khimov
234d94d27e network: implement getblocks command
Fixes #577, tested with C# nodes connecting to neo-go privnet.
2019-12-25 19:46:57 +03:00
Roman Khimov
9145855d2c
Merge pull request #579 from nspcc-dev/refactor-crypto
This moves some functionality into micro-packages, improves testing,
unexports some code and fixes bugs along the way.
2019-12-25 18:12:50 +03:00
Roman Khimov
604b2c8240 keys: add a successful test for 04-encoded public key 2019-12-25 18:06:25 +03:00
Roman Khimov
fa0537758f keys: add a test for X/Y > P decoding case 2019-12-25 18:01:54 +03:00
Roman Khimov
6c471ecd98 keys: move IsOnCurve decoding check, add a test for it
This check only makes sense for 04-encoded points, because 02 and 03 derive Y
from X and they're on the curve by definition.
2019-12-25 18:00:25 +03:00
Roman Khimov
5ac8cae221 keys: fix bad compressed public key decoding, add a test
The error was not propagated properly here.
2019-12-25 17:44:30 +03:00
Roman Khimov
b246653f62 address: rename functions as per #579 comments
Make them more clear to understand.
2019-12-25 17:34:18 +03:00
Roman Khimov
53e6fbbbf9 base58: add a test for a025b9c42d
As noted by @fyrchik in #579 comments.
2019-12-25 17:33:48 +03:00
Roman Khimov
e25133a385 keys: reuse address package for address generation
Deduplicates code and makes prefix overridable.
2019-12-25 16:03:39 +03:00
Roman Khimov
b7702f3a2e address: improve testing, make it 100% covered 2019-12-25 15:55:39 +03:00
Roman Khimov
c5ceb9128a address: check for prefix when decoding 2019-12-25 15:50:52 +03:00
Roman Khimov
89b6cbf795 address: make Prefix overridable
As it should be, it's specified in the configuration file (and it should be
treated as byte in the config)
2019-12-25 15:42:18 +03:00
Roman Khimov
e685e9bf9a address: move into its own package
Doesn't really belong to the crypto.
2019-12-25 15:22:02 +03:00
Roman Khimov
a025b9c42d base58: remove bogus code from CheckDecode
No other implementation does that and it looks weird, I see nothing meaninful
here.
2019-12-25 15:07:11 +03:00
Roman Khimov
369ac01a27 base58: move into its own package
It doesn't belong to crypto in any way other than it uses hash function
internally.
2019-12-25 15:05:54 +03:00
Roman Khimov
5dd8d29534 hash: improve merkle tree testing
Make it 100% covered.
2019-12-25 14:43:50 +03:00
Roman Khimov
ddad9ac9a3 hash: simplify merkle tree error handling
buildMerkleTree() is internal to the hash package and if anyone calls it with
`len(leaves) == 0` he deserves a panic. As it's the only error case in it, we
can remove error value return from this function and simplify NewMerkleTree().
2019-12-25 14:38:48 +03:00
Roman Khimov
ee28fb08f6 crypto: move merkle tree into the hash package
It's all about hashes, so it makes sense putting it there.
2019-12-25 11:28:59 +03:00
Roman Khimov
db5555bb15 crypto: internalize aes functions into the keys package
This is the only user of it and no one outside should care about these
details.
2019-12-25 11:25:05 +03:00
Roman Khimov
9cc0fca9d2
Merge pull request #574 from nspcc-dev/feature/multireturn
compiler: implement multiple return support, closes #562.
2019-12-25 08:46:38 +03:00
Roman Khimov
ef3510072a
Merge pull request #575 from nspcc-dev/feature/rpc_and_serialize_fixes
Fixes missing unmarshal function for TXType and missing parametrization for "getblock" so
it can return pure bytes.
2019-12-25 08:46:01 +03:00
Vsevolod Brekelov
606616618f rpc: add ability to answer as C# with block as []byte 2019-12-25 01:44:37 +03:00