Commit graph

9418 commits

Author SHA1 Message Date
Jason Rhinelander
6e0a02d85f Increase simplewallet sweep min tx version to v4
I don't see any reason why we would ever want a v3 tx now.
2019-06-19 17:48:28 -03:00
Jason Rhinelander
4f721c0098 Make tx type and version scoped enums
This converts the transaction type and version to scoped enum, giving
type safety and making the tx type assignment less error prone because
there is no implicit conversion or comparison with raw integers that has
to be worried about.

This ends up converting any use of `cryptonote::transaction::type_xyz`
to `cryptonote::transaction::txtype::xyz`.  For version, names like
`transaction::version_v4` become `cryptonote::txversion::v4_tx_types`.

This also allows/includes various other simplifications related to or
enabled by this change:
- handle `is_deregister` dynamically in serialization code (setting
  `type::standard` or `type::deregister` rather than using a
  version-determined union)
- `get_type()` is no longer needed with the above change: it is now
  much simpler to directly access `type` which will always have the
  correct value (even for v2 or v3 transaction types).  And though there
  was an assertion on the enum value, `get_type()` was being used only
  sporadically: many places accessed `.type` directly.
- the old unscoped enum didn't have a type but was assumed castable
  to/from `uint16_t`, which technically meant there was potential
  undefined behaviour when deserializing any type values >= 8.
- tx type range checks weren't being done in all serialization paths;
  they are now.  Because `get_type()` was not used everywhere (lots of
  places simply accessed `.type` directory) these might not have been
  caught.
- `set_type()` is not needed; it was only being used in a single place
  (wallet2.cpp) and only for v4 txes, so the version protection code was
  never doing anything.
- added a std::ostream << operator for the enum types so that they can be
  output with `<< tx_type <<` rather than needing to wrap it in
  `type_to_string(tx_type)` everywhere.  For the versions, you get the
  annotated version string (e.g. 4_tx_types) rather than just the number
  4.
2019-06-19 17:47:03 -03:00
Maxim Shishmarev
95eb74704c
Merge pull request #656 from jagerman/ip-display-fix
Format sn-public-ip option in error message
2019-06-19 15:43:24 +10:00
Jason Rhinelander
28525b81e1 Format sn-public-ip option in error message
Prints a human-readable IP instead of a 32-bit integer
2019-06-19 02:26:48 -03:00
Jason Rhinelander
e873130cb0 RED error message for storage server uptime fail (#653)
Because bright red is scarier.
2019-06-19 14:58:21 +10:00
Jason Rhinelander
62bc26e59e epee: fix SSL autodetect on reconnection (#651) 2019-06-19 12:58:17 +10:00
Doyle
3f05468ee1
Check both tx keys stored in tx_extra in get_reserve_proof (#647) 2019-06-18 14:58:50 +10:00
Doyle
9f12ae0c0a
Service Node Checkpointing: More reliable transportation of votes, culling of old checkpoints (#632)
* Initial updates to allow syncing of checkpoints in protocol_handler

* Handle checkpoints in prepare_handle_incoming_blocks

* Debug changes for testing, cancel changes later

* Add checkpoint pruning code

* Reduce DB checkpoint accesses, sync votes for up to 60 blocks

* Remove duplicate lifetime variable

* Move parsing checkpoints to above early return for consistency

* Various integration test fixes

- Don't try participate in quorums at startup if you are not a service node
- Add lock for when potentially writing to the DB
- Pre-existing batch can be open whilst updating checkpoint so can't use
  DB guards
- Temporarily emit the ban message using msgwriter instead of logs

* Integration mode bug fixes

- Always deserialize empty quorums so get_testing_quorum only fails when
an actual critical error has occurred
- Cache the last culled height so we don't needlessly query the DB over
the same heights trying to delete already-deleted checkpoints
- Submit votes when new blocks arrive for more reliable vote
transportation

* Undo debug changes for testing

* Update incorrect DB message and stale comment
2019-06-13 18:01:08 +10:00
Maxim Shishmarev
612438a057 RPC endpoint for requesting random snodes (#638)
* RPC endpoint for requesting random snodes

* optionally get fully funded service nodes only

* static random device

* explicitly initialize fields

* better handle default parameters

* add more comments to aid doc generator
2019-06-13 18:00:38 +10:00
Doyle
6b9e9f24ef
Merge pull request #642 from Doy-lee/BackportMasterToDev3
Backport master to dev: export_key_image key image gen failure fix
2019-06-13 11:12:11 +10:00
Doyle
ad5ea741ae Backport master to dev
Merge branch 'master' into BackportMasterToDev3
2019-06-13 11:08:51 +10:00
Doyle
5b737e8f5f
Use the precalculated public key when trying to gen key images (#640)
* Use the precalculated public key when trying to gen key images

Fixes failure to export key image bug and several other spending proof
mechanisms, where if you receive Loki from multiple outputs in the same
transaction, encrypted using multiple public keys- we don't fail out
prematurely by only trying the first public key.

* Rewrite find_tx_extra_field_by_typte
2019-06-13 10:58:42 +10:00
Doyle
a1745346e5
Drop connection when requesting duplicated tx indexes (#637)
* Drop connection when requesting duplicated tx indexes

* Use insert's returned iterator to dupe check
2019-06-12 17:48:46 +10:00
Doyle
e7b7fcd115
Don't access array OOB when parsing percentage in stakes (#636) 2019-06-11 12:07:50 +10:00
Maxim Shishmarev
e53922faa8 Require storage server running for uptime proofs (v.2) (#631)
* Require storage server running for uptime proofs (v.2)

* use atomic time_t; reset ping on startup
2019-06-07 17:03:11 +10:00
Doyle
ae76293487
Make --service-node give more verbose failure flags (#630) 2019-06-06 17:39:54 +10:00
Doyle
ed0ef399db
Various integration test fixes (#628)
- Don't try participate in quorums at startup if you are not a service node
- Add lock for when potentially writing to the DB
- Pre-existing batch can be open whilst updating checkpoint so can't use
  DB guards
- Temporarily emit the ban message using msgwriter instead of logs
2019-06-06 14:44:57 +10:00
Maxim Shishmarev
d3d8a14df0 Print ip and port with print_sn command (#627) 2019-06-06 13:10:43 +10:00
Doyle
639ab2bf9b
Integration Test: Granular block mining (#625)
* Add debug_mine_singular_block to mine one block at a time for integration tests

* Add workaround for mining thread modifying main thread state causing lock

* Change debug_mine_singular blocks to debug_mine_n_blocks
2019-06-05 12:34:54 +10:00
Maxim Shishmarev
0c23035562 Incorporate service node ip address into uptime proofs (#622)
* Incorporate service node ip address into uptime proofs; expose them using rpc

* Check that storage server port is specified in service-node mode

* Remove problematic const, rename argument name for storage port, update comments

* Validate ip address when receive uptime proof

* Better argument names and descriptions
2019-06-04 14:15:16 +10:00
Doyle
3794dce241
Service Node Checkpointing Basic Syncing (#621)
* Initial updates to allow syncing of checkpoints in protocol_handler

* Handle checkpoints in prepare_handle_incoming_blocks

* Parse checkpoints sent by peer

* Fix rebase to dev referencing no longer valid argument
2019-06-04 13:50:31 +10:00
Doyle
cdde63b6ce
Remove non-fluffy blockchain syncing path (#618)
Obsolete since forever, fluffy blocks is by default- it's more space
efficient when syncing the blockchain.
2019-06-04 12:28:56 +10:00
Doyle
ac796c7767
Enforce miner tx version (#623)
* Enforce tx version for coinbase transactions

* Gate coinbase version enforcement to HF12

* Remove min/max type/version check comment
2019-06-04 09:50:19 +10:00
Doyle
cc72791b9d
Remove unused txs member in NOTIFY_RESPONSE_GET_OBJECT (#619) 2019-06-03 14:04:43 +10:00
Doyle
a23b553a31
Merge pull request #606 from Doy-lee/LokiMergeUpstream
Loki Merge Upstream #e8487fa 2019-05-17
2019-05-31 12:35:25 +10:00
Doyle
8af377d2b8
Unify and move responsibility of voting to quorum_cop (#615)
* Unify checkpointing and uptime quorums

* Begin making checkpoints cull old votes/checkpoints

* Begin rehaul of service node code out of core, to assist checkpoints

* Begin overhaul of votes to move resposibility into quorum_cop

* Update testing suite to work with the new system

* Remove vote culling from checkpoints and into voting_pool

* Fix bugs making integration deregistration fail

* Votes don't always specify an index in the validators

* Update tests for validator index member change

* Rename deregister to voting, fix subtle hashing bug

Update the deregister hash derivation to use uint32_t as originally set
not uint64_t otherwise this affects the result and produces different
results.

* Remove un-needed nettype from vote pool

* PR review, use <algorithms>

* Rename uptime_deregister/uptime quorums to just deregister quorums

* Remove unused add_deregister_vote, move side effect out of macro
2019-05-31 11:06:42 +10:00
Doyle
9366b21430 Update readme ports and versions 2019-05-29 11:37:15 +10:00
Doyle
58e60ec6f6 Merge branch 'dev' into LokiMergeUpstream 2019-05-29 11:34:08 +10:00
Doyle
efc9e44137
Restore old style hashing for non-standard TX's so calculated hashes are consistent (#613) 2019-05-28 14:00:13 +10:00
Doyle
5408caed48
Merge pull request #614 from Doy-lee/CherryPickDevFixesForIOSBuild
Cherry pick dev fixes for ios build to master
2019-05-28 12:42:08 +10:00
Doyle
a58a2793fe Add overrides to calm warnings on GUI, make is_open in header 2019-05-28 12:03:05 +10:00
Doyle
ee18050d4e Update libwallet api for the GUI wallet 2019-05-28 12:03:05 +10:00
Maxim Shishmarev
4837cadc79 Add blockchain testing routine (#608)
* add blockchain testing routine

* endianness-agnostic blockchain testing

* remove signatures, relying on restricted mode instead
2019-05-27 13:37:40 +10:00
Doyle
44ac02ec33
Merge pull request #612 from Doy-lee/UpdateEnumDeclarationForSharedLib
Update stake result enum for shared lib compilation
2019-05-27 13:33:02 +10:00
Doyle
76947b4ca3 Update stake result enum for shared lib compilation 2019-05-27 13:31:47 +10:00
Doyle
f0889f1de1
Merge pull request #611 from Doy-lee/BackportVersion3Patch6ToDev
Backport version 3 patch 6 to dev
2019-05-27 11:25:08 +10:00
Doyle
47e5ab779c Merge branch 'master' into BackportVersion3Patch6ToDev 2019-05-27 10:16:13 +10:00
Doyle
62a5d7abe5 Merge branch 'master' into dev 2019-05-27 10:05:14 +10:00
Doyle
7d52b79eac Merge commit 'e8487fa' into LokiMergeUpstream 2019-05-17 04:39:08 +10:00
Doyle
e6c97579df Merge commit '5e80b3c' into LokiMergeUpstream 2019-05-17 04:14:11 +10:00
Doyle
27dc2f88fa Merge commit 'c0bc6d9' into LokiMergeUpstream 2019-05-17 03:54:20 +10:00
Doyle
676276fb4c Merge commit 'f64f596' into LokiMergeUpstream 2019-05-17 03:53:08 +10:00
Doyle
2649eb79da Merge commit 'ebb1c03' into LokiMergeUpstream 2019-05-17 03:43:06 +10:00
Doyle
170e841a12
Merge pull request #590 from Doy-lee/LokiMergeUpstream
Loki Merge Upstream 2019-05-07 2bf855e
2019-05-16 13:15:49 -04:00
Doyle
18cb47cd7c Switch to modern bytes format and add missing override 2019-05-16 03:14:37 +10:00
Doyle
60110980ea Remove virtual and add override to top_block_hash 2019-05-16 00:58:51 +10:00
Riccardo Spagni
e8487fa46b
Merge pull request #5539
3f612cda Changed odd bullet point to low level header (Rohaq)
af9bc4ec Used subeaders to avoid slightly wonky looking formatting (Rohaq)
1873af35 Made code block usage consistent across all .md files (Rohaq)
68103075 Updated Copyright notice (Rohaq)
39bd157f Added Table of Contents to main README.md (Rohaq)
2019-05-15 16:10:41 +02:00
Riccardo Spagni
5e80b3c3ef
Merge pull request #5535
e1016bce password: do not use line input on windows (moneromooo-monero)
2019-05-15 16:06:58 +02:00
luigi1111
1607419e38
Merge pull request #5538
615f287 wallet: fix certificate fingerprint length check (moneromooo-monero)
2019-05-14 16:02:59 -05:00
luigi1111
eedf5106f5
Merge pull request #5532
46244dd wallet_rpc_server: use original addresses in destinations in get_transfers (moneromooo-monero)
2019-05-14 15:59:34 -05:00