Skip to content

Commit fa5b6d2

Browse files
author
MarcoFalke
committed
fuzz: Drop unused params from serialize helpers
With the ser-type and ser-version going away, it seems unlikely that there is need for them in the future, so just remove them.
1 parent adc0921 commit fa5b6d2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/test/fuzz/deserialize.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj, const P& params
9191
}
9292

9393
template <typename T>
94-
CDataStream Serialize(const T& obj, const int version = INIT_PROTO_VERSION, const int ser_type = SER_NETWORK)
94+
CDataStream Serialize(const T& obj)
9595
{
96-
CDataStream ds(ser_type, version);
96+
CDataStream ds{SER_NETWORK, INIT_PROTO_VERSION};
9797
ds << obj;
9898
return ds;
9999
}
@@ -107,12 +107,10 @@ T Deserialize(CDataStream ds)
107107
}
108108

109109
template <typename T>
110-
void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj, const std::optional<int> protocol_version = std::nullopt, const int ser_type = SER_NETWORK)
110+
void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj)
111111
{
112-
CDataStream ds(buffer, ser_type, INIT_PROTO_VERSION);
113-
if (protocol_version) {
114-
ds.SetVersion(*protocol_version);
115-
} else {
112+
CDataStream ds{buffer, SER_NETWORK, INIT_PROTO_VERSION};
113+
{
116114
try {
117115
int version;
118116
ds >> version;
@@ -135,9 +133,9 @@ void AssertEqualAfterSerializeDeserialize(const T& obj, const P& params)
135133
assert(Deserialize<T>(Serialize(obj, params), params) == obj);
136134
}
137135
template <typename T>
138-
void AssertEqualAfterSerializeDeserialize(const T& obj, const int version = INIT_PROTO_VERSION, const int ser_type = SER_NETWORK)
136+
void AssertEqualAfterSerializeDeserialize(const T& obj)
139137
{
140-
assert(Deserialize<T>(Serialize(obj, version, ser_type)) == obj);
138+
assert(Deserialize<T>(Serialize(obj)) == obj);
141139
}
142140

143141
} // namespace

0 commit comments

Comments
 (0)