Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update xdrgen #317

Merged
merged 6 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CARGO_HACK_ARGS=--feature-powerset --exclude-features default --group-features b

CARGO_DOC_ARGS?=--open

XDRGEN_VERSION=64612a24
XDRGEN_VERSION=cbff4b31
XDRGEN_TYPES_CUSTOM_STR_IMPL=PublicKey,AccountId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId,ScAddress

all: build test
Expand Down
5 changes: 1 addition & 4 deletions src/bin/stellar-xdr/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ macro_rules! run_x {
)
})?;
for f in &mut files {
let mut f = stellar_xdr::$m::DepthLimitedRead::new(
f,
stellar_xdr::$m::DEFAULT_XDR_RW_DEPTH_LIMIT,
);
let mut f = stellar_xdr::$m::Limited::new(f, stellar_xdr::$m::Limits::none());
match self.input {
InputFormat::Single => {
let t = stellar_xdr::$m::Type::read_xdr_to_end(r#type, &mut f)?;
Expand Down
11 changes: 7 additions & 4 deletions src/bin/stellar-xdr/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl From<stellar_xdr::curr::Error> for Error {
| stellar_xdr::curr::Error::Utf8Error(_)
| stellar_xdr::curr::Error::InvalidHex
| stellar_xdr::curr::Error::Io(_)
| stellar_xdr::curr::Error::DepthLimitExceeded => Error::WriteXdrCurr(e),
| stellar_xdr::curr::Error::DepthLimitExceeded
| stellar_xdr::curr::Error::LengthLimitExceeded => Error::WriteXdrCurr(e),
stellar_xdr::curr::Error::Json(_) => Error::ReadJsonCurr(e),
}
}
Expand All @@ -53,7 +54,8 @@ impl From<stellar_xdr::next::Error> for Error {
| stellar_xdr::next::Error::Utf8Error(_)
| stellar_xdr::next::Error::InvalidHex
| stellar_xdr::next::Error::Io(_)
| stellar_xdr::next::Error::DepthLimitExceeded => Error::WriteXdrNext(e),
| stellar_xdr::next::Error::DepthLimitExceeded
| stellar_xdr::next::Error::LengthLimitExceeded => Error::WriteXdrNext(e),
stellar_xdr::next::Error::Json(_) => Error::ReadJsonNext(e),
}
}
Expand Down Expand Up @@ -117,10 +119,11 @@ macro_rules! run_x {
match self.input {
InputFormat::Json => {
let t = stellar_xdr::$m::Type::read_json(r#type, f)?;
let l = stellar_xdr::$m::Limits::none();

match self.output {
OutputFormat::Single => stdout().write_all(&t.to_xdr()?)?,
OutputFormat::SingleBase64 => println!("{}", t.to_xdr_base64()?),
OutputFormat::Single => stdout().write_all(&t.to_xdr(l)?)?,
OutputFormat::SingleBase64 => println!("{}", t.to_xdr_base64(l)?),
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/bin/stellar-xdr/guess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ impl Default for OutputFormat {
macro_rules! run_x {
($f:ident, $m:ident) => {
fn $f(&self) -> Result<(), Error> {
let mut f = stellar_xdr::$m::DepthLimitedRead::new(
let mut f = stellar_xdr::$m::Limited::new(
ResetRead::new(self.file()?),
stellar_xdr::$m::DEFAULT_XDR_RW_DEPTH_LIMIT,
stellar_xdr::$m::Limits::none(),
);
'variants: for v in stellar_xdr::$m::TypeVariant::VARIANTS {
f.inner.reset();
Expand Down
Loading