Commit graph

26 commits

Author SHA1 Message Date
Doyle
639d7456f7 Merge commit '1d5e8f4' into LokiMergeUpstream 2019-06-26 13:04:37 +10: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
moneromooo-monero
1387549e90
serialization: check stream good flag at the end
just in case
2019-06-14 08:47:23 +00: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
892469ded1 Update monero copyright to 2019 pre-emptively to make merge simpler 2019-04-12 14:36:43 +10:00
binaryFate
1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
moneromooo-monero
6844ae1b8d
tx_pool: avoid parsing a whole tx if only the prefix is needed 2018-10-08 10:18:01 +00:00
xmr-eric
18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
moneromooo-monero
2d17feb060
factor STL container serialization 2017-12-22 19:47:12 +00:00
moneromooo-monero
83fa9047d8
serialization: add std::set and std::unordered_set serialization 2017-11-24 13:45:48 +00:00
moneromooo-monero
493fad8053
serialization: add deque serialization 2017-09-25 21:16:32 +01:00
Riccardo Spagni
c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
moneromooo-monero
98f19d40aa
serialization: add support for serializing std::pair and std::list 2016-09-26 23:12:28 +01:00
moneromooo-monero
1e8d37e7d8
serialization: add override for serializing bool 2016-08-28 21:29:19 +01:00
Henning Kopp
e514f0a369 even more typos 2016-01-25 15:05:29 +01:00
Henning Kopp
9abc4b831b more typos fixed 2016-01-25 13:42:44 +01:00
Henning Kopp
0693f3c7e6 fixed typo 2016-01-25 13:36:14 +01:00
Riccardo Spagni
de03926850
updated copyright year 2015-12-31 08:39:56 +02:00
Riccardo Spagni
f4b69d553a
year updated in license 2015-01-02 18:52:46 +02:00
Riccardo Spagni
acb29cdb0f
fixed errant > 2014-10-15 12:21:09 +02:00
jebes
b032619a9c Commented most of src/serialization/ going to read up more on variant's and finish off the job/add last touchs next 2014-10-13 16:00:09 -04:00
fluffypony
6fc995fe5d License updated to BSD 3-clause 2014-07-23 15:03:52 +02:00
mydesktop
3a3a817678 0.8.8update 2014-05-25 13:06:40 -04:00
NoodleDoodleNoodleDoodleNoodleDoodleNoo
c0cf78a1d1 Update serialization.h
1. Added VARINT_FIELD_N(t,f) macro required for tx_extra_merge_mining_tag serialization.
2014-05-13 16:10:58 -07:00
mydesktop
333f975760 initial [broken] update 2014-05-03 12:19:43 -04:00
Antonio Juarez
296ae46ed8 moved all stuff to github 2014-03-03 22:07:58 +00:00