MarcoFalke
fae9054793
test: Use SER_PARAMS_OPFUNC in serialize_tests.cpp
2023-10-13 10:30:42 +02:00
MarcoFalke
fa72f09d6f
Remove CHashWriter type
...
The type is only ever set, but never read via GetType(), so remove it.
Also, remove SerializeHash to avoid silent merge conflicts and use the
already existing GetHash() boilerplate consistently.
2023-09-19 16:38:08 +02:00
MarcoFalke
fafa3fc5a6
test: add tests that exercise WithParams()
...
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2023-09-05 10:13:41 +02:00
MarcoFalke
fac6af16f4
Allow std::byte serialization
2023-06-30 12:09:45 +02:00
MarcoFalke
fa38d86235
Use only Span{} constructor for byte-like types where possible
...
This removes bloat that is not needed.
2023-06-27 10:13:37 +02:00
MarcoFalke
fa257bc831
util: Allow std::byte and char Span serialization
2023-06-27 10:13:29 +02:00
MarcoFalke
fa47b28dfc
refactor: Remove unused CDataStream SerializeMany constructor
2023-01-30 13:04:50 +01:00
MarcoFalke
fa29e73cda
Use DataStream where possible
2023-01-26 10:44:05 +01:00
Pasta
f2fc03ec85
refactor: use braced init for integer constants instead of c style casts
2023-01-03 19:31:29 -06:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
...
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
MarcoFalke
fafc4eb363
test: Fix Wambiguous-reversed-operator compiler warnings
2022-02-21 16:36:59 +01:00
MarcoFalke
fa1b227a72
Remove broken and unused CDataStream methods
2022-02-03 20:16:50 +01:00
MarcoFalke
fa5d2e678c
Remove unused char serialize
2022-01-02 11:52:11 +01:00
MarcoFalke
fa24493d63
Use spans of std::byte in serialize
...
This switches .read() and .write() to take spans of bytes.
2022-01-02 11:40:31 +01:00
Hennadii Stepanov
f47dda2c58
scripted-diff: Bump copyright headers
...
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
Commits of previous years:
* 2020: fa0074e2d8
* 2019: aaaaad6ac9
2021-12-30 19:36:57 +02:00
MarcoFalke
ffff0d0442
refactor: Switch serialize to uint8_t (1/n)
2021-05-31 14:56:17 +02:00
Pieter Wuille
66545da200
Remove support for double serialization
2021-05-24 16:15:05 -07:00
Pieter Wuille
afd964d70b
Convert existing float encoding tests
2021-05-24 16:15:02 -07:00
MarcoFalke
e40224d0c7
Remove unused float serialization
2021-05-24 16:04:44 -07:00
MarcoFalke
fada14b948
Treat CDataStream bytes as uint8_t
...
Also, rename CSerializeData to SerializeData
2020-11-23 21:19:50 +01:00
MarcoFalke
faa96f841f
Remove unused CDataStream methods
2020-11-23 19:24:54 +01:00
Pieter Wuille
77c507358b
Make Hash[160] consume range-like objects
2020-07-30 13:57:54 -07:00
MarcoFalke
448bdff263
Merge #18317 : Serialization improvements step 6 (all except wallet/gui)
...
f9ee0f37c2
Add comments to CustomUintFormatter (Pieter Wuille)
4eb5643e35
Convert everything except wallet/qt to new serialization (Pieter Wuille)
2b1f85e8c5
Convert blockencodings_tests to new serialization (Pieter Wuille)
73747afbbe
Convert merkleblock to new serialization (Pieter Wuille)
d06fedd1bc
Add SER_READ and SER_WRITE for read/write-dependent statements (Russell Yanofsky)
6f9a1e5ad0
Extend CustomUintFormatter to support enums (Russell Yanofsky)
769ee5fa00
Merge BigEndian functionality into CustomUintFormatter (Pieter Wuille)
Pull request description:
The next step of changes from #10785 .
This:
* Adds support for enum serialization to `CustomUintFormatter`, used in `CAddress` for service flags.
* Merges `BigEndian` into `CustomUintFormatter`, used in `CNetAddr` for port numbers.
* Converts everything (except wallet and gui) to use the new serialization framework.
ACKs for top commit:
MarcoFalke:
re-ACK f9ee0f37c2
, only change is new documentation commit for CustomUintFormatter 📂
ryanofsky:
Code review ACK f9ee0f37c2
. Just new commit adding comment since last review
jonatack:
Code review re-ACK f9ee0f37c2
only change since last review is an additional commit adding Doxygen documentation for `CustomUintFormatter`.
Tree-SHA512: e7a0a36afae592d5a4ff8c81ae04d858ac409388e361f2bc197d9a78abca45134218497ab2dfd6d031e0cce0ca586cf857077b7c6ce17fccf67e2d367c1b6cd4
2020-05-20 07:30:29 -04:00
MarcoFalke
fa488f131f
scripted-diff: Bump copyright headers
...
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
MarcoFalke
fac5c37300
scripted-diff: Sort test includes
...
-BEGIN VERIFY SCRIPT-
# Mark all lines with #includes
sed -i --regexp-extended -e 's/(#include <.*>)/\1 /g' $(git grep -l '#include' ./src/bench/ ./src/test ./src/wallet/test/)
# Sort all marked lines
git diff -U0 | ./contrib/devtools/clang-format-diff.py -p1 -i -v
-END VERIFY SCRIPT-
2020-04-16 13:32:36 -04:00
Pieter Wuille
4eb5643e35
Convert everything except wallet/qt to new serialization
2020-03-30 16:10:30 -07:00
Pieter Wuille
0e0fa27acb
Get rid of VARINT default argument
...
This removes the need for the GNU C++ extension of variadic macros.
2020-02-10 12:00:10 -08:00
MarcoFalke
faec28252c
scripted-diff: test: Move setup_common to test library
...
-BEGIN VERIFY SCRIPT-
# Move files
for f in $(git ls-files src/test/lib/); do git mv $f src/test/util/; done
git mv src/test/setup_common.cpp src/test/util/
git mv src/test/setup_common.h src/test/util/
# Replace Windows paths
sed -i -e 's|\\setup_common|\\util\\setup_common|g' $(git grep -l '\\setup_common')
sed -i -e 's|src\\test\\lib\\|src\\test\\util\\|g' build_msvc/test_bitcoin/test_bitcoin.vcxproj
# Everything else
sed -i -e 's|/setup_common|/util/setup_common|g' $(git grep -l 'setup_common')
sed -i -e 's|test/lib/|test/util/|g' $(git grep -l 'test/lib/')
# Fix include guard
sed -i -e 's|BITCOIN_TEST_SETUP_COMMON_H|BITCOIN_TEST_UTIL_SETUP_COMMON_H|g' ./src/test/util/setup_common.h
sed -i -e 's|BITCOIN_TEST_LIB_|BITCOIN_TEST_UTIL_|g' $(git grep -l 'BITCOIN_TEST_LIB_')
-END VERIFY SCRIPT-
2019-11-06 11:56:41 -05:00
Pieter Wuille
92528c260e
Support serialization of std::vector<bool>
2019-08-26 11:36:33 -07:00
practicalswift
9a841696c1
tests: Reduce compilation time and unneccessary recompiles by removing unused includes in tests
2019-06-26 20:37:48 +02:00
MarcoFalke
faf400077d
scripted-diff: Bump copyright headers in test, bench
...
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./src/bench/
./contrib/devtools/copyright_header.py update ./src/test/
-END VERIFY SCRIPT-
2019-04-11 13:34:43 -04:00
MarcoFalke
fa821904bf
scripted-diff: Rename test_bitcoin to test/setup_common
...
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/test_bitcoin\.(h|cpp)/setup_common.\1/g' $(git grep -l test_bitcoin)
git mv ./src/test/test_bitcoin.h ./src/test/setup_common.h
git mv ./src/test/test_bitcoin.cpp ./src/test/setup_common.cpp
sed -i -e 's/BITCOIN_TEST_TEST_BITCOIN_H/BITCOIN_TEST_SETUP_COMMON_H/g' ./src/test/setup_common.h
-END VERIFY SCRIPT-
2019-04-11 10:12:36 -04:00
practicalswift
cf4b0327ed
Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1
2018-12-04 19:55:04 +02:00
Ben Woosley
da74db0940
Drop unused GetType() from CSizeComputer
2018-09-11 00:58:05 -04:00
DrahtBot
eb7daf4d60
Update copyright headers to 2018
2018-07-27 07:15:02 -04:00
João Barbosa
12dd101345
scripted-diff: Remove trailing whitespaces
...
-BEGIN VERIFY SCRIPT-
sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue')
-END VERIFY SCRIPT-
2018-07-24 20:46:23 +01:00
MarcoFalke
fae58eca93
tests: Avoid copies of CTransaction
2018-04-11 14:59:53 -04:00
Karl-Johan Alm
c55aa4f27d
test: Fix sign for expected values
...
A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.
2018-04-11 13:39:41 +09:00
Pieter Wuille
a7c45bce92
Add native support for serializing char arrays without FLATDATA
...
Support is added to serialize arrays of type char or unsigned char directly,
without any wrappers. All invocations of the FLATDATA wrappers that are
obsoleted by this are removed.
This includes a patch by Russell Yanofsky to make char casting type safe.
The serialization of CSubNet is changed to serialize a bool directly rather
than though FLATDATA. This makes the serialization independent of the size
of the bool type (and will use 1 byte everywhere).
2018-03-21 14:14:04 -07:00
Russell Yanofsky
499d95e278
Add static_assert to prevent VARINT(<signed value>)
...
Using VARINT with signed types is dangerous because negative values will appear
to serialize correctly, but then deserialize as positive values mod 128.
This commit changes the VARINT macro to trigger an error by default if called
with an signed value, and updates broken uses of VARINT to pass a special flag
that lets them keep working with no change in behavior.
2018-03-15 18:57:55 -05:00
Pieter Wuille
2761bca997
Merge READWRITEMANY into READWRITE
2018-03-13 17:04:28 -07:00
Akira Takizawa
595a7bab23
Increment MIT Licence copyright header year on files modified in 2017
2018-01-03 02:26:56 +09:00
MeshCollider
1a445343f6
scripted-diff: Replace #include "" with #include <> (ryanofsky)
...
-BEGIN VERIFY SCRIPT-
for f in \
src/*.cpp \
src/*.h \
src/bench/*.cpp \
src/bench/*.h \
src/compat/*.cpp \
src/compat/*.h \
src/consensus/*.cpp \
src/consensus/*.h \
src/crypto/*.cpp \
src/crypto/*.h \
src/crypto/ctaes/*.h \
src/policy/*.cpp \
src/policy/*.h \
src/primitives/*.cpp \
src/primitives/*.h \
src/qt/*.cpp \
src/qt/*.h \
src/qt/test/*.cpp \
src/qt/test/*.h \
src/rpc/*.cpp \
src/rpc/*.h \
src/script/*.cpp \
src/script/*.h \
src/support/*.cpp \
src/support/*.h \
src/support/allocators/*.h \
src/test/*.cpp \
src/test/*.h \
src/wallet/*.cpp \
src/wallet/*.h \
src/wallet/test/*.cpp \
src/wallet/test/*.h \
src/zmq/*.cpp \
src/zmq/*.h
do
base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-
2017-11-16 08:23:01 +13:00
practicalswift
cc16d99f1d
[trivial] Fix typos in comments
2017-01-27 21:22:35 +01:00
MarcoFalke
4cfd57d2e3
Merge #9281 : Refactor: Remove using namespace <xxx> from bench/ & test/ sources
...
73f4119
Refactoring: Removed using namespace <xxx> from bench/ and test/ source files. (Karl-Johan Alm)
2017-01-05 11:32:05 +01:00
Karl-Johan Alm
73f41190b9
Refactoring: Removed using namespace <xxx> from bench/ and test/ source files.
2017-01-02 20:35:23 +09:00
isle2983
27765b6403
Increment MIT Licence copyright header year on files modified in 2016
...
Edited via:
$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Pieter Wuille
81e3228fcb
Make CTransaction actually immutable
2016-12-02 18:37:43 -08:00
Pieter Wuille
528472111b
Get rid of nType and nVersion
...
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.
Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2016-11-07 13:56:27 -08:00
Cory Fields
b98c14c4e3
serialization: teach serializers variadics
...
Also add a variadic CDataStream ctor for ease-of-use.
2016-11-03 13:32:09 -07:00