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

20.1.0 cleanup #1314

Merged
merged 12 commits into from
Jan 9, 2024
4 changes: 2 additions & 2 deletions soroban-env-host/src/host/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ mod tests {
}),
ScVal::Bytes(xdr::ScBytes::try_from(vec![]).unwrap()),
ScVal::String(xdr::ScString::try_from(vec![]).unwrap()),
ScVal::Symbol(xdr::ScSymbol::try_from("big-symbol").unwrap()),
ScVal::Symbol(xdr::ScSymbol::try_from("very_big_symbol").unwrap()),
ScVal::Vec(Some(xdr::ScVec::try_from((0,)).unwrap())),
ScVal::Map(Some(xdr::ScMap::try_from(vec![]).unwrap())),
ScVal::Address(xdr::ScAddress::Contract(xdr::Hash([0; 32]))),
Expand Down Expand Up @@ -702,7 +702,7 @@ mod tests {
Tag::StringObject => Val::try_from_val(host, &"foo").unwrap(),
Tag::SymbolObject => Val::try_from_val(
host,
&ScVal::Symbol(xdr::ScSymbol::try_from("a-big-symbol").unwrap()),
&ScVal::Symbol(xdr::ScSymbol::try_from("a_very_big_symbol").unwrap()),
)
.unwrap(),
Tag::VecObject => {
Expand Down
9 changes: 8 additions & 1 deletion soroban-env-host/src/host/conversion.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::rc::Rc;

use crate::host_object::MemHostObjectType;
use crate::{
budget::{AsBudget, DepthLimiter},
err,
Expand Down Expand Up @@ -500,7 +501,13 @@ impl Host {
}
ScVal::Bytes(b) => Ok(self.add_host_object(b.metered_clone(self)?)?.into()),
ScVal::String(s) => Ok(self.add_host_object(s.metered_clone(self)?)?.into()),
ScVal::Symbol(s) => Ok(self.add_host_object(s.metered_clone(self)?)?.into()),
graydon marked this conversation as resolved.
Show resolved Hide resolved
ScVal::Symbol(s) => Ok(self
.add_host_object(ScSymbol::try_from_bytes(
graydon marked this conversation as resolved.
Show resolved Hide resolved
self,
s.0.metered_clone(self.as_budget())?.into(),
)?)?
.into()),

ScVal::Address(addr) => Ok(self.add_host_object(addr.metered_clone(self)?)?.into()),

// None of the following cases should have made it into this function, they
Expand Down
Loading