Skip to content

Commit

Permalink
Update for host function success scval (#166)
Browse files Browse the repository at this point in the history
* specify ruby image precisely to allow use of podman-as-docker

* update xdr for SCVal success in INVOKE_HOST_FUNCTION_SUCCESS arm
  • Loading branch information
graydon authored Sep 21, 2022
1 parent fb78a6b commit c026149
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ generate: src/curr.rs src/next.rs

src/curr.rs: $(XDR_FILES_LOCAL_CURR)
> $@
docker run -i --rm -v $$PWD:/wd -w /wd ruby /bin/bash -c '\
docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
gem install specific_install -v 0.3.7 && \
gem specific_install https://github.com/stellar/xdrgen.git -b master && \
xdrgen --language rust --namespace curr --output src/ $^ \
Expand All @@ -52,7 +52,7 @@ src/curr.rs: $(XDR_FILES_LOCAL_CURR)

src/next.rs: $(XDR_FILES_LOCAL_NEXT)
> $@
docker run -i --rm -v $$PWD:/wd -w /wd ruby /bin/bash -c '\
docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
gem install specific_install -v 0.3.7 && \
gem specific_install https://github.com/stellar/xdrgen.git -b master && \
xdrgen --language rust --namespace next --output src/ $^ \
Expand Down
14 changes: 7 additions & 7 deletions src/next.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub const XDR_FILES_SHA256: [(&str, &str); 9] = [
),
(
"xdr/next/Stellar-transaction.x",
"a7dbe0ad9e3f2625c876bb5b2c2bd5e5c358ace0023dce066321afbfb031e6f4",
"2adffbed3768e594ef91ddf1c79788c7f532cd73f3c8fa06b4db54097fe0fb72",
),
(
"xdr/next/Stellar-types.x",
Expand Down Expand Up @@ -26068,7 +26068,7 @@ impl WriteXdr for InvokeHostFunctionResultCode {
// union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
// {
// case INVOKE_HOST_FUNCTION_SUCCESS:
// void;
// SCVal success;
// case INVOKE_HOST_FUNCTION_MALFORMED:
// case INVOKE_HOST_FUNCTION_TRAPPED:
// void;
Expand All @@ -26084,7 +26084,7 @@ impl WriteXdr for InvokeHostFunctionResultCode {
)]
#[allow(clippy::large_enum_variant)]
pub enum InvokeHostFunctionResult {
Success,
Success(ScVal),
Malformed,
Trapped,
}
Expand All @@ -26093,7 +26093,7 @@ impl InvokeHostFunctionResult {
#[must_use]
pub const fn name(&self) -> &'static str {
match self {
Self::Success => "Success",
Self::Success(_) => "Success",
Self::Malformed => "Malformed",
Self::Trapped => "Trapped",
}
Expand All @@ -26103,7 +26103,7 @@ impl InvokeHostFunctionResult {
pub const fn discriminant(&self) -> InvokeHostFunctionResultCode {
#[allow(clippy::match_same_arms)]
match self {
Self::Success => InvokeHostFunctionResultCode::Success,
Self::Success(_) => InvokeHostFunctionResultCode::Success,
Self::Malformed => InvokeHostFunctionResultCode::Malformed,
Self::Trapped => InvokeHostFunctionResultCode::Trapped,
}
Expand Down Expand Up @@ -26150,7 +26150,7 @@ impl ReadXdr for InvokeHostFunctionResult {
<InvokeHostFunctionResultCode as ReadXdr>::read_xdr(r)?;
#[allow(clippy::match_same_arms, clippy::match_wildcard_for_single_variants)]
let v = match dv {
InvokeHostFunctionResultCode::Success => Self::Success,
InvokeHostFunctionResultCode::Success => Self::Success(ScVal::read_xdr(r)?),
InvokeHostFunctionResultCode::Malformed => Self::Malformed,
InvokeHostFunctionResultCode::Trapped => Self::Trapped,
#[allow(unreachable_patterns)]
Expand All @@ -26166,7 +26166,7 @@ impl WriteXdr for InvokeHostFunctionResult {
self.discriminant().write_xdr(w)?;
#[allow(clippy::match_same_arms)]
match self {
Self::Success => ().write_xdr(w)?,
Self::Success(v) => v.write_xdr(w)?,
Self::Malformed => ().write_xdr(w)?,
Self::Trapped => ().write_xdr(w)?,
};
Expand Down
2 changes: 1 addition & 1 deletion xdr/next/Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ enum InvokeHostFunctionResultCode
union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
{
case INVOKE_HOST_FUNCTION_SUCCESS:
void;
SCVal success;
case INVOKE_HOST_FUNCTION_MALFORMED:
case INVOKE_HOST_FUNCTION_TRAPPED:
void;
Expand Down

0 comments on commit c026149

Please sign in to comment.