Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Oct 31, 2023
2 parents c1cea1e + 3c0b66c commit 8ceed6c
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 89 deletions.
6 changes: 5 additions & 1 deletion contrib/guix/libexec/codesign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ mkdir -p "$DISTSRC"
signapple apply dist/Groestlcoin-Qt.app codesignatures/osx/dist

# Make a .zip from dist/
zip "${OUTDIR}/${DISTNAME}-${HOST}.zip" dist/*
cd dist/
find . -print0 \
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
find . | sort \
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip"
;;
*)
exit 1
Expand Down
6 changes: 2 additions & 4 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
((gnu packages python) #:select (python-minimal))
((gnu packages python-build) #:select (python-tomli))
((gnu packages python-crypto) #:select (python-asn1crypto))
((gnu packages python-web) #:select (python-requests))
((gnu packages tls) #:select (openssl))
((gnu packages version-control) #:select (git-minimal))
(guix build-system cmake)
Expand Down Expand Up @@ -445,7 +444,7 @@ and endian independent.")
(license license:expat)))

(define-public python-signapple
(let ((commit "8a945a2e7583be2665cf3a6a89d665b70ecd1ab6"))
(let ((commit "7a96b4171a360abf0f0f56e499f8f9ed2116280d"))
(package
(name "python-signapple")
(version (git-version "0.1" "1" commit))
Expand All @@ -458,14 +457,13 @@ and endian independent.")
(file-name (git-file-name name commit))
(sha256
(base32
"0fr1hangvfyiwflca6jg5g8zvg3jc9qr7vd2c12ff89pznf38dlg"))))
"0aa4k180jnpal15yhncnm3g3z9gzmi7qb25q5l0kaj444a1p2pm4"))))
(build-system python-build-system)
(propagated-inputs
`(("python-asn1crypto" ,python-asn1crypto)
("python-oscrypto" ,python-oscrypto)
("python-certvalidator" ,python-certvalidator)
("python-elfesteem" ,python-elfesteem)
("python-requests" ,python-requests)
("python-macholib" ,python-macholib)))
;; There are no tests, but attempting to run python setup.py test leads to
;; problems, just disable the test
Expand Down
1 change: 1 addition & 0 deletions src/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Checks: '
-*,
bitcoin-*,
bugprone-argument-comment,
bugprone-string-constructor,
bugprone-use-after-move,
bugprone-lambda-function-name,
misc-unused-using-decls,
Expand Down
12 changes: 4 additions & 8 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3770,7 +3770,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,

std::vector<CAddress> vAddr;

vRecv >> WithParams(ser_params, vAddr);
vRecv >> ser_params(vAddr);

if (!SetupAddressRelay(pfrom, *peer)) {
LogPrint(BCLog::NET, "ignoring %s message from %s peer=%d\n", msg_type, pfrom.ConnectionTypeAsString(), pfrom.GetId());
Expand Down Expand Up @@ -5375,16 +5375,12 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
// No addr messages to send
if (peer.m_addrs_to_send.empty()) return;

const char* msg_type;
CNetAddr::Encoding ser_enc;
CNetMsgMaker mm(node.GetCommonVersion());
if (peer.m_wants_addrv2) {
msg_type = NetMsgType::ADDRV2;
ser_enc = CNetAddr::Encoding::V2;
m_connman.PushMessage(&node, mm.Make(NetMsgType::ADDRV2, CAddress::V2_NETWORK(peer.m_addrs_to_send)));
} else {
msg_type = NetMsgType::ADDR;
ser_enc = CNetAddr::Encoding::V1;
m_connman.PushMessage(&node, mm.Make(NetMsgType::ADDR, CAddress::V1_NETWORK(peer.m_addrs_to_send)));
}
m_connman.PushMessage(&node, CNetMsgMaker(node.GetCommonVersion()).Make(msg_type, WithParams(CAddress::SerParams{{ser_enc}, CAddress::Format::Network}, peer.m_addrs_to_send)));
peer.m_addrs_to_send.clear();

// we only send the big addr message once
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class CAddress : public CService
}
// Invoke V1/V2 serializer for CService parent object.
const auto ser_params{use_v2 ? CNetAddr::V2 : CNetAddr::V1};
READWRITE(WithParams(ser_params, AsBase<CService>(obj)));
READWRITE(ser_params(AsBase<CService>(obj)));
}

//! Always included in serialization. The behavior is unspecified if the value is not representable as uint32_t.
Expand Down
31 changes: 14 additions & 17 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ const Out& AsBase(const In& x)
* }
* };
* which would then be invoked as
* READWRITE(WithParams(BarParameter{...}, Using<FooFormatter>(obj.foo)))
* READWRITE(BarParameter{...}(Using<FooFormatter>(obj.foo)))
*
* WithParams(parameter, obj) can be invoked anywhere in the call stack; it is
* parameter(obj) can be invoked anywhere in the call stack; it is
* passed down recursively into all serialization code, until another
* WithParams overrides it.
* serialization parameter overrides it.
*
* Parameters will be implicitly converted where appropriate. This means that
* "parent" serialization code can use a parameter that derives from, or is
Expand Down Expand Up @@ -1182,17 +1182,6 @@ class ParamsWrapper
}
};

/**
* Return a wrapper around t that (de)serializes it with specified parameter params.
*
* See FORMATTER_METHODS_PARAMS for more information on serialization parameters.
*/
template <typename Params, typename T>
static auto WithParams(const Params& params, T&& t)
{
return ParamsWrapper<Params, T>{params, t};
}

/**
* Helper macro for SerParams structs
*
Expand All @@ -1202,8 +1191,16 @@ static auto WithParams(const Params& params, T&& t)
* constexpr SerParams FOO{....};
* ss << FOO(obj);
*/
#define SER_PARAMS_OPFUNC \
template <typename T> \
auto operator()(T&& t) const { return WithParams(*this, t); }
#define SER_PARAMS_OPFUNC \
/** \
* Return a wrapper around t that (de)serializes it with specified parameter params. \
* \
* See FORMATTER_METHODS_PARAMS for more information on serialization parameters. \
*/ \
template <typename T> \
auto operator()(T&& t) const \
{ \
return ParamsWrapper{*this, t}; \
}

#endif // BITCOIN_SERIALIZE_H
6 changes: 3 additions & 3 deletions src/test/fuzz/deserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ template <typename T, typename P>
DataStream Serialize(const T& obj, const P& params)
{
DataStream ds{};
ds << WithParams(params, obj);
ds << params(obj);
return ds;
}

template <typename T, typename P>
T Deserialize(DataStream&& ds, const P& params)
{
T obj;
ds >> WithParams(params, obj);
ds >> params(obj);
return obj;
}

Expand All @@ -83,7 +83,7 @@ void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj, const P& params
{
DataStream ds{buffer};
try {
ds >> WithParams(params, obj);
ds >> params(obj);
} catch (const std::ios_base::failure&) {
throw invalid_fuzzing_input_exception();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/fuzz/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ template <typename T, typename P>
DataStream ds{buffer};
T obj;
try {
ds >> WithParams(params, obj);
ds >> params(obj);
} catch (const std::ios_base::failure&) {
return std::nullopt;
}
Expand Down
Loading

0 comments on commit 8ceed6c

Please sign in to comment.