Repository: stellar/rs-soroban-env
Pull request #389 (2022-08-29 23:01:22)

Rename "Binary"("binary", "bin", "binaries" etc) to "Bytes"
### What

Resolves https://github.com/stellar/rs-soroban-env/issues/370. 

### Why

[TODO: Why this change is being made. Include any context required to understand the why.]

### Known limitations

SDK callers of these `binary_` and `_binary` functions need to be updated too. 


Patch:
diff --git a/soroban-env-common/src/array.rs b/soroban-env-common/src/array.rs
index 621dd948..237b7e5d 100644
--- a/soroban-env-common/src/array.rs
+++ b/soroban-env-common/src/array.rs
@@ -13,13 +13,13 @@ impl<E: Env, const N: usize> TryFromVal<E, RawVal> for [u8; N] {
             return Err(ConversionError);
         }
         let env = env.clone();
-        let bin = unsafe { Object::unchecked_from_val(val) };
-        let len = unsafe { u32::unchecked_from_val(env.binary_len(bin)) };
+        let bytes = unsafe { Object::unchecked_from_val(val) };
+        let len = unsafe { u32::unchecked_from_val(env.bytes_len(bytes)) };
         if len as usize != N {
             return Err(ConversionError);
         }
         let mut arr = [0u8; N];
-        env.binary_copy_to_slice(bin, RawVal::U32_ZERO, &mut arr);
+        env.bytes_copy_to_slice(bytes, RawVal::U32_ZERO, &mut arr);
         Ok(arr)
     }
 }
@@ -35,9 +35,9 @@ impl<E: Env, const N: usize> TryIntoVal<E, [u8; N]> for RawVal {
 impl<E: Env> IntoVal<E, RawVal> for &[u8] {
     fn into_val(self, env: &E) -> RawVal {
         let env = env.clone();
-        let mut bin = env.binary_new();
-        bin = env.binary_copy_from_slice(bin, RawVal::U32_ZERO, self);
-        bin.to_raw()
+        let mut bytes = env.bytes_new();
+        bytes = env.bytes_copy_from_slice(bytes, RawVal::U32_ZERO, self);
+        bytes.to_raw()
     }
 }
 
diff --git a/soroban-env-common/src/env.rs b/soroban-env-common/src/env.rs
index d2c46dc5..1794644e 100644
--- a/soroban-env-common/src/env.rs
+++ b/soroban-env-common/src/env.rs
@@ -28,17 +28,19 @@ pub trait EnvBase: Sized + Clone {
     // _only_ interface to passing contract pointers to the host is going to be
     // in EnvBase, not Env, and as a bonus we get lifetime checking for free.
 
-    /// Copy a slice of bytes from the caller's memory into an existing `Binary`
-    /// object the host, returning a new `Binary`.
-    fn binary_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object;
+    /// Copy a slice of bytes from the caller's memory into an existing `Bytes`
+    /// object the host, returning a new `Bytes`.
+    fn bytes_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object;
 
-    /// Copy a slice of bytes from a `Binary` in the host into the caller's memory.
-    fn binary_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]);
+    /// Copy a slice of bytes from a `Bytes` object in the host into the
+    /// caller's memory.
+    fn bytes_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]);
 
-    /// For a new `Binary` in the host from a slice of memory in the caller.
-    fn binary_new_from_slice(&self, mem: &[u8]) -> Object;
+    /// Form a new `Bytes` object in the host from a slice of memory in the
+    /// caller.
+    fn bytes_new_from_slice(&self, mem: &[u8]) -> Object;
 
-    // As with the binary functions above, these take _slices_ with definite
+    // As with the bytes functions above, these take _slices_ with definite
     // lifetimes. The first slice is interpreted as a (very restricted)
     // format-string -- containing literal text interspersed with some number of
     // `{}` markers which must match the number of other args passed -- with
@@ -56,7 +58,7 @@ pub trait EnvBase: Sized + Clone {
     //
     // When Env = Guest, these currently compile as no-ops. We may change this
     // to record a VM-relative guest static string pointer (similar to how the
-    // binary functions above work) into the debug buffer in the future, but it
+    // bytes functions above work) into the debug buffer in the future, but it
     // is a little involved to do so and we assume that VM code probably does
     // not want to be carrying static strings at all.
 
@@ -140,16 +142,16 @@ macro_rules! call_macro_with_all_host_functions {
                 // This one variant of logging does not take a format string and
                 // is live in both Env=Guest and Env=Host configurations.
                 {"_", fn log_value(v:RawVal) -> RawVal }
-                /// Get the binary contractID of the contract which invoked the
+                /// Get the contractID `Bytes` of the contract which invoked the
                 /// running contract. Traps if the running contract was not
                 /// invoked by a contract.
                 {"0", fn get_invoking_contract() -> Object }
                 {"1", fn obj_cmp(a:RawVal, b:RawVal) -> i64 }
                 /// Records a contract event. `topics` is expected to be a `SCVec` with
-                /// length <= 4 that cannot contain Vecs, Maps, or Binaries > 32 bytes
-                /// On succes, returns an `SCStatus::Ok`.
+                /// length <= 4 that cannot contain `Vec`, `Map`, or `Bytes` with length > 32
+                /// On success, returns an `SCStatus::Ok`.
                 {"2", fn contract_event(topics:Object, data:RawVal) -> RawVal }
-                /// Get the binary contractID of the contract which invoked the
+                /// Get the contractID `Bytes` of the contract which invoked the
                 /// running contract. Traps if the running contract was not
                 /// invoked by a contract.
                 {"3", fn get_current_contract() -> Object }
@@ -159,7 +161,7 @@ macro_rules! call_macro_with_all_host_functions {
                 {"5", fn get_ledger_sequence() -> RawVal }
                 /// Return the timestamp number of the current ledger as a u64.
                 {"6", fn get_ledger_timestamp() -> Object }
-                /// Return the network identity of the current ledger as bytes.
+                /// Return the network identity of the current ledger as `Bytes`.
                 {"7", fn get_ledger_network_id() -> Object }
             }
 
@@ -352,60 +354,63 @@ macro_rules! call_macro_with_all_host_functions {
 
             }
 
-            mod binary "b" {
-                /// Serializes an (SC)Val into XDR opaque binary array.
-                {"_", fn serialize_to_binary(v:RawVal) -> Object}
-                /// Deserialize a binary array to get back the (SC)Val.
-                {"0", fn deserialize_from_binary(b:Object) -> RawVal}
-                /// Copies a slice of bytes from a binary array specified at offset `b_pos` with length `len` into the linear memory at position `lm_pos`.
-                /// Traps if either the binary array or the linear memory doesn't have enough bytes.
-                {"1", fn binary_copy_to_linear_memory(b:Object, b_pos:RawVal, lm_pos:RawVal, len:RawVal) -> RawVal}
-                /// Copies a segment of the linear memory specified at position `lm_pos` with length `len`, into a binary array at offset `b_pos`. The binary array may grow in size to accommodate the new bytes.
+            mod bytes "b" {
+                /// Serializes an (SC)Val into XDR opaque `Bytes` object.
+                {"_", fn serialize_to_bytes(v:RawVal) -> Object}
+                /// Deserialize a `Bytes` object to get back the (SC)Val.
+                {"0", fn deserialize_from_bytes(b:Object) -> RawVal}
+                /// Copies a slice of bytes from a `Bytes` object specified at offset `b_pos` with
+                /// length `len` into the linear memory at position `lm_pos`.
+                /// Traps if either the `Bytes` object or the linear memory doesn't have enough bytes.
+                {"1", fn bytes_copy_to_linear_memory(b:Object, b_pos:RawVal, lm_pos:RawVal, len:RawVal) -> RawVal}
+                /// Copies a segment of the linear memory specified at position `lm_pos` with
+                /// length `len`, into a `Bytes` object at offset `b_pos`. The `Bytes` object may
+                /// grow in size to accommodate the new bytes.
                 /// Traps if the linear memory doesn't have enough bytes.
-                {"2", fn binary_copy_from_linear_memory(b:Object, b_pos:RawVal, lm_pos:RawVal, len:RawVal) -> Object}
-                /// Constructs a new binary array initialized with bytes copied from a linear memory slice specified at position `lm_pos` with length `len`.
-                {"3", fn binary_new_from_linear_memory(lm_pos:RawVal, len:RawVal) -> Object}
+                {"2", fn bytes_copy_from_linear_memory(b:Object, b_pos:RawVal, lm_pos:RawVal, len:RawVal) -> Object}
+                /// Constructs a new `Bytes` object initialized with bytes copied from a linear memory slice specified at position `lm_pos` with length `len`.
+                {"3", fn bytes_new_from_linear_memory(lm_pos:RawVal, len:RawVal) -> Object}
                 // These functions below ($3-$F) mirror vector operations
-                /// Create an empty new binary.
-                {"4", fn binary_new() -> Object}
-                /// Update the value at index `i` in the binary. Return the new binary.
+                /// Create an empty new `Bytes` object.
+                {"4", fn bytes_new() -> Object}
+                /// Update the value at index `i` in the `Bytes` object. Return the new `Bytes`.
                 /// Trap if the index is out of bounds.
-                {"5", fn binary_put(b:Object, i:RawVal, u:RawVal) -> Object}
-                /// Returns the element at index `i` of the binary. Traps if the index is out of bound.
-                {"6", fn binary_get(b:Object, i:RawVal) -> RawVal}
-                /// Delete an element in a binary at index `i`, shifting all elements after it to the left.
-                /// Return the new binary. Traps if the index is out of bound.
-                {"7", fn binary_del(b:Object, i:RawVal) -> Object}
-                /// Returns length of the binary.
-                {"8", fn binary_len(b:Object) -> RawVal}
-                /// Appends an element to the back of the binary.
-                {"9", fn binary_push(b:Object, u:RawVal) -> Object}
-                /// Removes the last element from the binary and returns the new binary.
-                /// Traps if original binary is empty.
-                {"A", fn binary_pop(b:Object) -> Object}
-                /// Return the first element in the binary. Traps if the binary is empty
-                {"B", fn binary_front(b:Object) -> RawVal}
-                /// Return the last element in the binary. Traps if the binary is empty
-                {"C", fn binary_back(b:Object) -> RawVal}
-                /// Inserts an element at index `i` within the binary, shifting all elements after it to the right.
+                {"5", fn bytes_put(b:Object, i:RawVal, u:RawVal) -> Object}
+                /// Returns the element at index `i` of the `Bytes` object. Traps if the index is out of bound.
+                {"6", fn bytes_get(b:Object, i:RawVal) -> RawVal}
+                /// Delete an element in a `Bytes` object at index `i`, shifting all elements after it to the left.
+                /// Return the new `Bytes`. Traps if the index is out of bound.
+                {"7", fn bytes_del(b:Object, i:RawVal) -> Object}
+                /// Returns length of the `Bytes` object.
+                {"8", fn bytes_len(b:Object) -> RawVal}
+                /// Appends an element to the back of the `Bytes` object.
+                {"9", fn bytes_push(b:Object, u:RawVal) -> Object}
+                /// Removes the last element from the `Bytes` object and returns the new `Bytes`.
+                /// Traps if original `Bytes` is empty.
+                {"A", fn bytes_pop(b:Object) -> Object}
+                /// Return the first element in the `Bytes` object. Traps if the `Bytes` is empty
+                {"B", fn bytes_front(b:Object) -> RawVal}
+                /// Return the last element in the `Bytes` object. Traps if the `Bytes` is empty
+                {"C", fn bytes_back(b:Object) -> RawVal}
+                /// Inserts an element at index `i` within the `Bytes` object, shifting all elements after it to the right.
                 /// Traps if the index is out of bound
-                {"D", fn binary_insert(b:Object, i:RawVal, u:RawVal) -> Object}
-                /// Clone the binary `b1`, then moves all the elements of binary `b2` into it.
-                /// Return the new binary. Traps if number of elements in the binary overflows a u32.
-                {"E", fn binary_append(b1:Object, b2:Object) -> Object}
-                /// Copies the elements from `start` index until `end` index, exclusive, in the binary and creates a new binary from it.
-                /// Returns the new binary. Traps if the index is out of bound.
-                {"F", fn binary_slice(b:Object, start:RawVal, end:RawVal) -> Object}
+                {"D", fn bytes_insert(b:Object, i:RawVal, u:RawVal) -> Object}
+                /// Clone the `Bytes` object `b1`, then moves all the elements of `Bytes` object `b2` into it.
+                /// Return the new `Bytes`. Traps if its length overflows a u32.
+                {"E", fn bytes_append(b1:Object, b2:Object) -> Object}
+                /// Copies the elements from `start` index until `end` index, exclusive, in the `Bytes` object and creates a new `Bytes` from it.
+                /// Returns the new `Bytes`. Traps if the index is out of bound.
+                {"F", fn bytes_slice(b:Object, start:RawVal, end:RawVal) -> Object}
             }
 
             mod hash "h" {
-                {"_", fn hash_from_binary(x:Object) -> Object}
-                {"0", fn hash_to_binary(x:Object) -> Object}
+                {"_", fn hash_from_bytes(x:Object) -> Object}
+                {"0", fn hash_to_bytes(x:Object) -> Object}
             }
 
             mod key "k" {
-                {"_", fn public_key_from_binary(x:Object) -> Object}
-                {"0", fn public_key_to_binary(x:Object) -> Object}
+                {"_", fn public_key_from_bytes(x:Object) -> Object}
+                {"0", fn public_key_to_bytes(x:Object) -> Object}
             }
 
             mod crypto "c" {
@@ -415,21 +420,21 @@ macro_rules! call_macro_with_all_host_functions {
 
             mod account "a" {
                 /// Get the low threshold for the account with ed25519 public
-                /// key a (a is binary). Traps if no such account exists.
+                /// key `a` (`a` is `Bytes`). Traps if no such account exists.
                 {"_", fn account_get_low_threshold(a:Object) -> RawVal}
                 /// Get the medium threshold for the account with ed25519 public
-                /// key a (a is binary). Traps if no such account exists.
+                /// key `a` (`a` is `Bytes`). Traps if no such account exists.
                 {"0", fn account_get_medium_threshold(a:Object) -> RawVal}
                 /// Get the high threshold for the account with ed25519 public
-                /// key a (a is binary). Traps if no such account exists.
+                /// key `a` (`a` is `Bytes`). Traps if no such account exists.
                 {"1", fn account_get_high_threshold(a:Object) -> RawVal}
                 /// Get the signer weight for the signer with ed25519 public key
-                /// s (s is binary) on the account with ed25519 public key a (a
-                /// is binary). Returns the master weight if the signer is the
+                /// `s` (`s` is `Bytes`) on the account with ed25519 public key `a` (`a`
+                /// is `Bytes`). Returns the master weight if the signer is the
                 /// master, and returns 0 if no such signer exists. Traps if no
                 /// such account exists.
                 {"2", fn account_get_signer_weight(a:Object, s:Object) -> RawVal}
-                /// Given an ed25519 public key `a` (`a` is binary) of an account,
+                /// Given an ed25519 public key `a` (`a` is `Bytes`) of an account,
                 /// check if it exists. Returns (SCStatic) TRUE/FALSE.
                 {"3", fn account_exists(a:Object) -> RawVal}
             }
diff --git a/soroban-env-common/src/meta.rs b/soroban-env-common/src/meta.rs
index 15138bc3..becab8ca 100644
--- a/soroban-env-common/src/meta.rs
+++ b/soroban-env-common/src/meta.rs
@@ -56,5 +56,5 @@
 // implementations over a long period of time.
 
 soroban_env_macros::generate_env_meta_consts!(
-    interface_version: 9,
+    interface_version: 10,
 );
diff --git a/soroban-env-common/src/unimplemented_env.rs b/soroban-env-common/src/unimplemented_env.rs
index 5676e1ee..65c54901 100644
--- a/soroban-env-common/src/unimplemented_env.rs
+++ b/soroban-env-common/src/unimplemented_env.rs
@@ -17,15 +17,15 @@ impl EnvBase for UnimplementedEnv {
         Self
     }
 
-    fn binary_copy_from_slice(&self, _b: Object, _b_pos: RawVal, _mem: &[u8]) -> Object {
+    fn bytes_copy_from_slice(&self, _b: Object, _b_pos: RawVal, _mem: &[u8]) -> Object {
         unimplemented!()
     }
 
-    fn binary_copy_to_slice(&self, _b: Object, _b_pos: RawVal, _mem: &mut [u8]) {
+    fn bytes_copy_to_slice(&self, _b: Object, _b_pos: RawVal, _mem: &mut [u8]) {
         unimplemented!()
     }
 
-    fn binary_new_from_slice(&self, _mem: &[u8]) -> Object {
+    fn bytes_new_from_slice(&self, _mem: &[u8]) -> Object {
         unimplemented!()
     }
 
diff --git a/soroban-env-guest/src/guest.rs b/soroban-env-guest/src/guest.rs
index 538be984..a589f35f 100644
--- a/soroban-env-guest/src/guest.rs
+++ b/soroban-env-guest/src/guest.rs
@@ -32,15 +32,15 @@ impl EnvBase for Guest {
         unimplemented!()
     }
 
-    fn binary_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
+    fn bytes_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
         unimplemented!()
     }
 
-    fn binary_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
+    fn bytes_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
         unimplemented!()
     }
 
-    fn binary_new_from_slice(&self, mem: &[u8]) -> Object {
+    fn bytes_new_from_slice(&self, mem: &[u8]) -> Object {
         unimplemented!()
     }
 
@@ -75,38 +75,38 @@ impl EnvBase for Guest {
         Self
     }
 
-    fn binary_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
+    fn bytes_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
         sa::assert_eq_size!(u32, *const u8);
         sa::assert_eq_size!(u32, usize);
         let lm_pos: RawVal = RawVal::from_u32(mem.as_ptr() as u32);
         let len: RawVal = RawVal::from_u32(mem.len() as u32);
-        self.binary_copy_from_linear_memory(b, b_pos, lm_pos, len)
+        self.bytes_copy_from_linear_memory(b, b_pos, lm_pos, len)
     }
 
-    fn binary_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
+    fn bytes_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
         sa::assert_eq_size!(u32, *const u8);
         sa::assert_eq_size!(u32, usize);
         let lm_pos: RawVal = RawVal::from_u32(mem.as_ptr() as u32);
         let len: RawVal = RawVal::from_u32(mem.len() as u32);
-        self.binary_copy_to_linear_memory(b, b_pos, lm_pos, len);
+        self.bytes_copy_to_linear_memory(b, b_pos, lm_pos, len);
     }
 
-    fn binary_new_from_slice(&self, mem: &[u8]) -> Object {
+    fn bytes_new_from_slice(&self, mem: &[u8]) -> Object {
         sa::assert_eq_size!(u32, *const u8);
         sa::assert_eq_size!(u32, usize);
         let lm_pos: RawVal = RawVal::from_u32(mem.as_ptr() as u32);
         let len: RawVal = RawVal::from_u32(mem.len() as u32);
-        self.binary_new_from_linear_memory(lm_pos, len)
+        self.bytes_new_from_linear_memory(lm_pos, len)
     }
 
     fn log_static_fmt_val(&self, fmt: &'static str, v: RawVal) {
         // TODO: It's possible we might want to do something in the wasm
-        // case with static strings similar to the binary functions above,
+        // case with static strings similar to the bytes functions above,
         // eg. decay the strings to u32 values and pass them to the host as linear
         // memory locations for capture into the debug-events buffer,
         // but for the time being we're going to _not_ do that because
         // we assume users building for wasm want their static strings
-        // _removed_ from the binary statically (it's also somewhat annoying
+        // _removed_ from the bytes statically (it's also somewhat annoying
         // to implement the capture of static strings into the debug buffer,
         // it makes the debug buffer into non-Send+Sync and then we need
         // to remove it from the HostError, report separately from HostError's
diff --git a/soroban-env-host/src/events.rs b/soroban-env-host/src/events.rs
index 4a4af3e2..63e02f04 100644
--- a/soroban-env-host/src/events.rs
+++ b/soroban-env-host/src/events.rs
@@ -22,7 +22,7 @@ pub struct Events(pub Vec<HostEvent>);
 // Maximum number of topics in a `ContractEvent`. This applies to both
 // `Contract` and `System` types of contract events.
 pub(crate) const CONTRACT_EVENT_TOPICS_LIMIT: usize = 4;
-// Maximum number of bytes in a topic binary.
+// Maximum number of bytes in a topic `Bytes`.
 pub(crate) const TOPIC_BYTES_LENGTH_LIMIT: usize = 32;
 
 impl Events {
diff --git a/soroban-env-host/src/host.rs b/soroban-env-host/src/host.rs
index e88d8d6e..4631d3d6 100644
--- a/soroban-env-host/src/host.rs
+++ b/soroban-env-host/src/host.rs
@@ -86,7 +86,7 @@ pub(crate) enum Frame {
 }
 
 /// Temporary helper for denoting a slice of guest memory, as formed by
-/// various binary operations.
+/// various bytes operations.
 #[cfg(feature = "vm")]
 struct VmSlice {
     vm: Rc<Vm>,
@@ -447,7 +447,7 @@ impl Host {
                 let vm = vm.clone();
                 Ok(VmSlice { vm, pos, len })
             }
-            _ => Err(self.err_general("attempt to access guest binary in non-VM frame")),
+            _ => Err(self.err_general("attempt to access guest bytes in non-VM frame")),
         })
     }
 
@@ -507,7 +507,7 @@ impl Host {
                         }
                         HostObject::U64(u) => Ok(ScObject::U64(*u)),
                         HostObject::I64(i) => Ok(ScObject::I64(*i)),
-                        HostObject::Bin(b) => Ok(ScObject::Bytes(
+                        HostObject::Bytes(b) => Ok(ScObject::Bytes(
                             self.map_err(b.metered_clone(&self.0.budget)?.try_into())?,
                         )),
                         HostObject::BigInt(bi) => self.scobj_from_bigint(bi),
@@ -586,7 +586,7 @@ impl Host {
             HostObject::I64(_) => {
                 self.charge_budget(CostType::HostI64AllocCell, 1)?;
             }
-            HostObject::Bin(b) => {
+            HostObject::Bytes(b) => {
                 self.charge_budget(CostType::HostBinAllocCell, b.len() as u64)?;
             }
             HostObject::BigInt(bi) => {
@@ -782,8 +782,8 @@ impl Host {
     }
 
     /// Records a `System` contract event. `topics` is expected to be a `SCVec`
-    /// with length <= 4 that cannot contain Vecs, Maps, or Binaries > 32 bytes
-    /// On succes, returns an `SCStatus::Ok`.
+    /// length <= 4 that cannot contain `Vec`, `Map`, or `Bytes` with length > 32
+    /// On success, returns an `SCStatus::Ok`.
     pub fn system_event(&self, topics: Object, data: RawVal) -> Result<RawVal, HostError> {
         let topics = self.event_topics_from_host_obj(topics)?;
         let data = self.from_host_val(data)?;
@@ -837,7 +837,7 @@ impl EnvBase for Host {
         new_host
     }
 
-    fn binary_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
+    fn bytes_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
         // This is only called from native contracts, either when testing or
         // when the contract is otherwise linked into the same address space as
         // us. We therefore access the memory we were passed directly.
@@ -852,7 +852,7 @@ impl EnvBase for Host {
         let len = u32::try_from(mem.len()).expect("slice len exceeds u32");
         let mut vnew = self
             .visit_obj(b, |hv: &Vec<u8>| Ok(hv.clone()))
-            .expect("access to unknown host binary object");
+            .expect("access to unknown host bytes object");
         let end_idx = b_pos.checked_add(len).expect("u32 overflow") as usize;
         // TODO: we currently grow the destination vec if it's not big enough,
         // make sure this is desirable behaviour.
@@ -866,7 +866,7 @@ impl EnvBase for Host {
             .into()
     }
 
-    fn binary_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
+    fn bytes_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
         let b_pos = u32::try_from(b_pos).expect("pos input is not u32");
         let len = u32::try_from(mem.len()).expect("slice len exceeds u32");
         self.visit_obj(b, move |hv: &Vec<u8>| {
@@ -880,9 +880,9 @@ impl EnvBase for Host {
         .expect("access to unknown host object");
     }
 
-    fn binary_new_from_slice(&self, mem: &[u8]) -> Object {
+    fn bytes_new_from_slice(&self, mem: &[u8]) -> Object {
         self.add_host_object::<Vec<u8>>(mem.into())
-            .expect("unable to add host binary object")
+            .expect("unable to add host bytes object")
             .into()
     }
 
@@ -1341,9 +1341,9 @@ impl CheckedEnv for Host {
         let key_val = self.uint256_from_obj_input("key", key)?;
 
         // Verify parameters
-        let params = self.visit_obj(v, |bin: &Vec<u8>| {
+        let params = self.visit_obj(v, |bytes: &Vec<u8>| {
             let separator = "create_contract_from_ed25519(contract: Vec<u8>, salt: u256, key: u256, sig: Vec<u8>)";
-            let params = [separator.as_bytes(), salt_val.as_ref(), bin].concat();
+            let params = [separator.as_bytes(), salt_val.as_ref(), bytes].concat();
             // Another charge-after-work. Easier to get the num bytes this way.
             // TODO: 1. pre calcualte the bytes and charge before concat. 
             // 2. Might be overkill to have a separate type for this. Maybe can consolidate
@@ -1664,7 +1664,7 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: covered by components
-    fn serialize_to_binary(&self, v: RawVal) -> Result<Object, HostError> {
+    fn serialize_to_bytes(&self, v: RawVal) -> Result<Object, HostError> {
         let scv = self.from_host_val(v)?;
         let mut buf = Vec::<u8>::new();
         scv.write_xdr(&mut buf)
@@ -1680,7 +1680,7 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: covered by components
-    fn deserialize_from_binary(&self, b: Object) -> Result<RawVal, HostError> {
+    fn deserialize_from_bytes(&self, b: Object) -> Result<RawVal, HostError> {
         let scv = self.visit_obj(b, |hv: &Vec<u8>| {
             self.charge_budget(CostType::ValDeser, hv.len() as u64)?;
             ScVal::read_xdr(&mut hv.as_slice())
@@ -1689,7 +1689,7 @@ impl CheckedEnv for Host {
         Ok(self.to_host_val(&scv)?.into())
     }
 
-    fn binary_copy_to_linear_memory(
+    fn bytes_copy_to_linear_memory(
         &self,
         b: Object,
         b_pos: RawVal,
@@ -1713,7 +1713,7 @@ impl CheckedEnv for Host {
         }
     }
 
-    fn binary_copy_from_linear_memory(
+    fn bytes_copy_from_linear_memory(
         &self,
         b: Object,
         b_pos: RawVal,
@@ -1746,7 +1746,7 @@ impl CheckedEnv for Host {
         }
     }
 
-    fn binary_new_from_linear_memory(
+    fn bytes_new_from_linear_memory(
         &self,
         lm_pos: RawVal,
         len: RawVal,
@@ -1766,12 +1766,12 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: covered by `add_host_object`
-    fn binary_new(&self) -> Result<Object, HostError> {
+    fn bytes_new(&self) -> Result<Object, HostError> {
         Ok(self.add_host_object(Vec::<u8>::new())?.into())
     }
 
     // Notes on metering: `get_mut` is free
-    fn binary_put(&self, b: Object, i: RawVal, u: RawVal) -> Result<Object, HostError> {
+    fn bytes_put(&self, b: Object, i: RawVal, u: RawVal) -> Result<Object, HostError> {
         let i = self.usize_from_rawval_u32_input("i", i)?;
         let u = self.u8_from_rawval_input("u", u)?;
         let vnew = self.visit_obj(b, move |hv: &Vec<u8>| {
@@ -1788,7 +1788,7 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: `get` is free
-    fn binary_get(&self, b: Object, i: RawVal) -> Result<RawVal, HostError> {
+    fn bytes_get(&self, b: Object, i: RawVal) -> Result<RawVal, HostError> {
         let i = self.usize_from_rawval_u32_input("i", i)?;
         self.visit_obj(b, |hv: &Vec<u8>| {
             hv.get(i)
@@ -1797,7 +1797,7 @@ impl CheckedEnv for Host {
         })
     }
 
-    fn binary_del(&self, b: Object, i: RawVal) -> Result<Object, HostError> {
+    fn bytes_del(&self, b: Object, i: RawVal) -> Result<Object, HostError> {
         let i = self.u32_from_rawval_input("i", i)?;
         let vnew = self.visit_obj(b, move |hv: &Vec<u8>| {
             self.validate_index_lt_bound(i, hv.len())?;
@@ -1810,13 +1810,13 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: `len` is free
-    fn binary_len(&self, b: Object) -> Result<RawVal, HostError> {
+    fn bytes_len(&self, b: Object) -> Result<RawVal, HostError> {
         let len = self.visit_obj(b, |hv: &Vec<u8>| Ok(hv.len()))?;
         self.usize_to_rawval_u32(len)
     }
 
     // Notes on metering: `push` is free
-    fn binary_push(&self, b: Object, u: RawVal) -> Result<Object, HostError> {
+    fn bytes_push(&self, b: Object, u: RawVal) -> Result<Object, HostError> {
         let u = self.u8_from_rawval_input("u", u)?;
         let vnew = self.visit_obj(b, move |hv: &Vec<u8>| {
             let mut vnew = hv.metered_clone(&self.0.budget)?;
@@ -1829,7 +1829,7 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: `pop` is free
-    fn binary_pop(&self, b: Object) -> Result<Object, HostError> {
+    fn bytes_pop(&self, b: Object) -> Result<Object, HostError> {
         let vnew = self.visit_obj(b, move |hv: &Vec<u8>| {
             let mut vnew = hv.metered_clone(&self.0.budget)?;
             // Passing `len()` since worse case can cause reallocation.
@@ -1842,7 +1842,7 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: `first` is free
-    fn binary_front(&self, b: Object) -> Result<RawVal, HostError> {
+    fn bytes_front(&self, b: Object) -> Result<RawVal, HostError> {
         self.visit_obj(b, |hv: &Vec<u8>| {
             hv.first()
                 .map(|u| Into::<RawVal>::into(Into::<u32>::into(*u)))
@@ -1851,7 +1851,7 @@ impl CheckedEnv for Host {
     }
 
     // Notes on metering: `last` is free
-    fn binary_back(&self, b: Object) -> Result<RawVal, HostError> {
+    fn bytes_back(&self, b: Object) -> Result<RawVal, HostError> {
         self.visit_obj(b, |hv: &Vec<u8>| {
             hv.last()
                 .map(|u| Into::<RawVal>::into(Into::<u32>::into(*u)))
@@ -1859,7 +1859,7 @@ impl CheckedEnv for Host {
         })
     }
 
-    fn binary_insert(&self, b: Object, i: RawVal, u: RawVal) -> Result<Object, HostError> {
+    fn bytes_insert(&self, b: Object, i: RawVal, u: RawVal) -> Result<Object, HostError> {
         let i = self.u32_from_rawval_input("i", i)?;
         let u = self.u8_from_rawval_input("u", u)?;
         let vnew = self.visit_obj(b, move |hv: &Vec<u8>| {
@@ -1872,7 +1872,7 @@ impl CheckedEnv for Host {
         Ok(self.add_host_object(vnew)?.into())
     }
 
-    fn binary_append(&self, b1: Object, b2: Object) -> Result<Object, HostError> {
+    fn bytes_append(&self, b1: Object, b2: Object) -> Result<Object, HostError> {
         let mut vnew = self.visit_obj(b1, |hv: &Vec<u8>| Ok(hv.metered_clone(&self.0.budget)?))?;
         let mut b2 = self.visit_obj(b2, |hv: &Vec<u8>| Ok(hv.metered_clone(&self.0.budget)?))?;
         if b2.len() > u32::MAX as usize - vnew.len() {
@@ -1883,7 +1883,7 @@ impl CheckedEnv for Host {
         Ok(self.add_host_object(vnew)?.into())
     }
 
-    fn binary_slice(&self, b: Object, start: RawVal, end: RawVal) -> Result<Object, HostError> {
+    fn bytes_slice(&self, b: Object, start: RawVal, end: RawVal) -> Result<Object, HostError> {
         let start = self.u32_from_rawval_input("start", start)?;
         let end = self.u32_from_rawval_input("end", end)?;
         let vnew = self.visit_obj(b, move |hv: &Vec<u8>| {
@@ -1894,25 +1894,25 @@ impl CheckedEnv for Host {
         Ok(self.add_host_object(vnew)?.into())
     }
 
-    fn hash_from_binary(&self, x: Object) -> Result<Object, HostError> {
+    fn hash_from_bytes(&self, x: Object) -> Result<Object, HostError> {
         todo!()
     }
 
-    fn hash_to_binary(&self, x: Object) -> Result<Object, HostError> {
+    fn hash_to_bytes(&self, x: Object) -> Result<Object, HostError> {
         todo!()
     }
 
-    fn public_key_from_binary(&self, x: Object) -> Result<Object, HostError> {
+    fn public_key_from_bytes(&self, x: Object) -> Result<Object, HostError> {
         todo!()
     }
 
-    fn public_key_to_binary(&self, x: Object) -> Result<Object, HostError> {
+    fn public_key_to_bytes(&self, x: Object) -> Result<Object, HostError> {
         todo!()
     }
 
     // Notes on metering: covered by components.
     fn compute_hash_sha256(&self, x: Object) -> Result<Object, HostError> {
-        let hash = self.sha256_hash_from_binary_input(x)?;
+        let hash = self.sha256_hash_from_bytes_input(x)?;
         Ok(self.add_host_object(hash)?.into())
     }
 
@@ -1921,10 +1921,10 @@ impl CheckedEnv for Host {
         use ed25519_dalek::Verifier;
         let public_key = self.ed25519_pub_key_from_obj_input(k)?;
         let sig = self.signature_from_obj_input("sig", s)?;
-        let res = self.visit_obj(x, |bin: &Vec<u8>| {
-            self.charge_budget(CostType::VerifyEd25519Sig, bin.len() as u64)?;
+        let res = self.visit_obj(x, |bytes: &Vec<u8>| {
+            self.charge_budget(CostType::VerifyEd25519Sig, bytes.len() as u64)?;
             public_key
-                .verify(bin, &sig)
+                .verify(bytes, &sig)
                 .map_err(|_| self.err_general("Failed ED25519 verification"))
         });
         Ok(res?.into())
diff --git a/soroban-env-host/src/host/conversion.rs b/soroban-env-host/src/host/conversion.rs
index 4eacf140..8c368115 100644
--- a/soroban-env-host/src/host/conversion.rs
+++ b/soroban-env-host/src/host/conversion.rs
@@ -57,9 +57,10 @@ impl Host {
     }
 
     pub(crate) fn to_u256(&self, a: Object) -> Result<Uint256, HostError> {
-        self.visit_obj(a, |bin: &Vec<u8>| {
+        self.visit_obj(a, |bytes: &Vec<u8>| {
             self.charge_budget(CostType::BytesClone, 32)?;
-            bin.try_into()
+            bytes
+                .try_into()
                 .map_err(|_| self.err_general("bad u256 length"))
         })
     }
@@ -87,7 +88,7 @@ impl Host {
         name: &'static str,
         hash: Object,
     ) -> Result<Hash, HostError> {
-        self.fixed_length_binary_from_obj_input::<Hash, 32>(name, hash)
+        self.fixed_length_bytes_from_obj_input::<Hash, 32>(name, hash)
     }
 
     pub(crate) fn uint256_from_obj_input(
@@ -95,7 +96,7 @@ impl Host {
         name: &'static str,
         u256: Object,
     ) -> Result<Uint256, HostError> {
-        self.fixed_length_binary_from_obj_input::<Uint256, 32>(name, u256)
+        self.fixed_length_bytes_from_obj_input::<Uint256, 32>(name, u256)
     }
 
     pub(crate) fn signature_from_obj_input(
@@ -103,10 +104,10 @@ impl Host {
         name: &'static str,
         sig: Object,
     ) -> Result<Signature, HostError> {
-        self.fixed_length_binary_from_obj_input::<Signature, SIGNATURE_LENGTH>(name, sig)
+        self.fixed_length_bytes_from_obj_input::<Signature, SIGNATURE_LENGTH>(name, sig)
     }
 
-    fn fixed_length_binary_from_obj_input<T, const N: usize>(
+    fn fixed_length_bytes_from_obj_input<T, const N: usize>(
         &self,
         name: &'static str,
         obj: Object,
@@ -114,8 +115,8 @@ impl Host {
     where
         T: From<[u8; N]>,
     {
-        self.visit_obj(obj, |bin: &Vec<u8>| {
-            match <[u8; N]>::try_from(bin.as_slice()) {
+        self.visit_obj(obj, |bytes: &Vec<u8>| {
+            match <[u8; N]>::try_from(bytes.as_slice()) {
                 Ok(arr) => {
                     self.charge_budget(CostType::BytesClone, N as u64)?;
                     Ok(arr.into())
@@ -132,18 +133,18 @@ impl Host {
     }
 
     pub fn ed25519_pub_key_from_obj_input(&self, k: Object) -> Result<PublicKey, HostError> {
-        self.visit_obj(k, |bin: &Vec<u8>| {
-            self.charge_budget(CostType::ComputeEd25519PubKey, bin.len() as u64)?;
-            PublicKey::from_bytes(bin).map_err(|_| {
+        self.visit_obj(k, |bytes: &Vec<u8>| {
+            self.charge_budget(CostType::ComputeEd25519PubKey, bytes.len() as u64)?;
+            PublicKey::from_bytes(bytes).map_err(|_| {
                 self.err_status_msg(ScHostObjErrorCode::UnexpectedType, "invalid public key")
             })
         })
     }
 
-    pub fn sha256_hash_from_binary_input(&self, x: Object) -> Result<Vec<u8>, HostError> {
-        self.visit_obj(x, |bin: &Vec<u8>| {
-            self.charge_budget(CostType::ComputeSha256Hash, bin.len() as u64)?;
-            let hash = Sha256::digest(bin).as_slice().to_vec();
+    pub fn sha256_hash_from_bytes_input(&self, x: Object) -> Result<Vec<u8>, HostError> {
+        self.visit_obj(x, |bytes: &Vec<u8>| {
+            self.charge_budget(CostType::ComputeSha256Hash, bytes.len() as u64)?;
+            let hash = Sha256::digest(bytes).as_slice().to_vec();
             if hash.len() != 32 {
                 return Err(self.err_general("incorrect hash size"));
             }
@@ -204,10 +205,10 @@ impl Host {
                                     | HostObject::ContractCode(_) => {
                                         Err(self.err_status(ScHostObjErrorCode::UnexpectedType))
                                     }
-                                    HostObject::Bin(b) => {
+                                    HostObject::Bytes(b) => {
                                         if b.len() > TOPIC_BYTES_LENGTH_LIMIT {
                                             // TODO: use more event-specific error codes than `UnexpectedType`.
-                                            // Something like "topic binary exceeds length limit"
+                                            // Something like "topic bytes exceeds length limit"
                                             return Err(
                                                 self.err_status(ScHostObjErrorCode::UnexpectedType)
                                             );
diff --git a/soroban-env-host/src/host_object.rs b/soroban-env-host/src/host_object.rs
index 02391fbd..9d46e434 100644
--- a/soroban-env-host/src/host_object.rs
+++ b/soroban-env-host/src/host_object.rs
@@ -18,7 +18,7 @@ pub(crate) enum HostObject {
     Map(HostMap),
     U64(u64),
     I64(i64),
-    Bin(Vec<u8>),
+    Bytes(Vec<u8>),
     BigInt(MeteredBigInt),
     Hash(xdr::ScHash),
     PublicKey(xdr::PublicKey),
@@ -57,7 +57,7 @@ declare_host_object_type!(HostMap, Map, Map);
 declare_host_object_type!(HostVec, Vec, Vec);
 declare_host_object_type!(u64, U64, U64);
 declare_host_object_type!(i64, I64, I64);
-declare_host_object_type!(Vec<u8>, Bytes, Bin);
+declare_host_object_type!(Vec<u8>, Bytes, Bytes);
 declare_host_object_type!(MeteredBigInt, BigInt, BigInt);
 declare_host_object_type!(xdr::ScHash, Hash, Hash);
 declare_host_object_type!(xdr::PublicKey, PublicKey, PublicKey);
diff --git a/soroban-env-host/src/native_contract/base_types.rs b/soroban-env-host/src/native_contract/base_types.rs
index 760b7709..79c2c421 100644
--- a/soroban-env-host/src/native_contract/base_types.rs
+++ b/soroban-env-host/src/native_contract/base_types.rs
@@ -133,7 +133,7 @@ impl<const N: u32> TryFromVal<Host, Object> for BytesN<N> {
     type Error = HostError;
 
     fn try_from_val(env: &Host, val: Object) -> Result<Self, Self::Error> {
-        let len: u32 = env.binary_len(val)?.try_into()?;
+        let len: u32 = env.bytes_len(val)?.try_into()?;
         if len == N {
             Ok(Self(val.in_env(env)))
         } else {
diff --git a/soroban-env-host/src/native_contract/token/cryptography.rs b/soroban-env-host/src/native_contract/token/cryptography.rs
index 214c8734..6769af66 100644
--- a/soroban-env-host/src/native_contract/token/cryptography.rs
+++ b/soroban-env-host/src/native_contract/token/cryptography.rs
@@ -32,7 +32,7 @@ fn check_ed25519_auth(
         domain: domain as u32,
         parameters,
     };
-    let msg_bin = e.serialize_to_binary(Message::V0(msg).try_into_val(e)?)?;
+    let msg_bin = e.serialize_to_bytes(Message::V0(msg).try_into_val(e)?)?;
 
     e.verify_sig_ed25519(msg_bin, auth.public_key.into(), auth.signature.into())?;
     Ok(())
@@ -49,7 +49,7 @@ fn check_account_auth(
         domain: domain as u32,
         parameters,
     };
-    let msg_bin = e.serialize_to_binary(Message::V0(msg).try_into_val(e)?)?;
+    let msg_bin = e.serialize_to_bytes(Message::V0(msg).try_into_val(e)?)?;
 
     let mut weight = 0u32;
     let sigs = &auth.signatures;
diff --git a/soroban-env-host/src/vm.rs b/soroban-env-host/src/vm.rs
index 8392782d..239d4394 100644
--- a/soroban-env-host/src/vm.rs
+++ b/soroban-env-host/src/vm.rs
@@ -384,7 +384,7 @@ impl Vm {
         })
     }
 
-    /// Returns the raw binary content of a named custom section from the WASM
+    /// Returns the raw bytes content of a named custom section from the WASM
     /// module loaded into the [Vm], or `None` if no such custom section exists.
     pub fn custom_section(&self, name: impl AsRef<str>) -> Option<&[u8]> {
         Self::module_custom_section(&self.elements_module, name)
diff --git a/soroban-env-host/src/weak_host.rs b/soroban-env-host/src/weak_host.rs
index fb6773ce..a89888da 100644
--- a/soroban-env-host/src/weak_host.rs
+++ b/soroban-env-host/src/weak_host.rs
@@ -50,16 +50,16 @@ impl EnvBase for WeakHost {
         self.get_host().deep_clone().get_weak()
     }
 
-    fn binary_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
-        self.get_host().binary_copy_from_slice(b, b_pos, mem)
+    fn bytes_copy_from_slice(&self, b: Object, b_pos: RawVal, mem: &[u8]) -> Object {
+        self.get_host().bytes_copy_from_slice(b, b_pos, mem)
     }
 
-    fn binary_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
-        self.get_host().binary_copy_to_slice(b, b_pos, mem)
+    fn bytes_copy_to_slice(&self, b: Object, b_pos: RawVal, mem: &mut [u8]) {
+        self.get_host().bytes_copy_to_slice(b, b_pos, mem)
     }
 
-    fn binary_new_from_slice(&self, mem: &[u8]) -> Object {
-        self.get_host().binary_new_from_slice(mem)
+    fn bytes_new_from_slice(&self, mem: &[u8]) -> Object {
+        self.get_host().bytes_new_from_slice(mem)
     }
 
     fn log_static_fmt_val(&self, fmt: &'static str, v: RawVal) {


Test patch:
diff --git a/soroban-env-host/src/test.rs b/soroban-env-host/src/test.rs
index 8486c8c8..2d25ea17 100644
--- a/soroban-env-host/src/test.rs
+++ b/soroban-env-host/src/test.rs
@@ -3,7 +3,7 @@ mod util;
 mod account;
 mod basic;
 mod bigint;
-mod binary;
+mod bytes;
 mod crypto;
 mod map;
 mod vec;
diff --git a/soroban-env-host/src/test/account.rs b/soroban-env-host/src/test/account.rs
index 494eb5fd..196ea25e 100644
--- a/soroban-env-host/src/test/account.rs
+++ b/soroban-env-host/src/test/account.rs
@@ -35,9 +35,9 @@ fn check_account_exists() -> Result<(), HostError> {
     );
 
     let host = Host::with_storage_and_budget(storage, budget.clone());
-    let obj0 = host.binary_new_from_slice(&id0);
-    let obj1 = host.binary_new_from_slice(&id1);
-    let obj2 = host.binary_new_from_slice(&id2);
+    let obj0 = host.bytes_new_from_slice(&id0);
+    let obj1 = host.bytes_new_from_slice(&id1);
+    let obj2 = host.bytes_new_from_slice(&id2);
     // declared and exists
     assert_eq!(
         host.account_exists(obj0)?.get_payload(),
diff --git a/soroban-env-host/src/test/bigint.rs b/soroban-env-host/src/test/bigint.rs
index 8cb552a2..2657773c 100644
--- a/soroban-env-host/src/test/bigint.rs
+++ b/soroban-env-host/src/test/bigint.rs
@@ -203,9 +203,9 @@ fn bigint_tests() -> Result<(), HostError> {
     }
     // convert to digits
     {
-        let bin = host.bigint_to_radix_be(obj_a, 10_u32.into())?;
+        let bytes = host.bigint_to_radix_be(obj_a, 10_u32.into())?;
         let digits = host.test_bin_obj(&[2, 3, 7, 4, 3, 4, 0])?;
-        assert_eq!(host.obj_cmp(bin.into(), digits.into())?, 0);
+        assert_eq!(host.obj_cmp(bytes.into(), digits.into())?, 0);
 
         let bin2 = host.bigint_to_radix_be(obj_b, 10_u32.into())?;
         let digits2 = host.test_bin_obj(&[4, 3, 8, 7, 3, 0])?;
diff --git a/soroban-env-host/src/test/binary.rs b/soroban-env-host/src/test/bytes.rs
similarity index 75%
rename from soroban-env-host/src/test/binary.rs
rename to soroban-env-host/src/test/bytes.rs
index b48e9a69..190805e5 100644
--- a/soroban-env-host/src/test/binary.rs
+++ b/soroban-env-host/src/test/bytes.rs
@@ -19,12 +19,12 @@ use crate::{
 use soroban_test_wasms::LINEAR_MEMORY;
 
 #[test]
-fn binary_suite_of_tests() -> Result<(), HostError> {
+fn bytes_suite_of_tests() -> Result<(), HostError> {
     let host = Host::default();
     // new and push
-    let mut obj = host.binary_new()?;
+    let mut obj = host.bytes_new()?;
     for i in 0..32 {
-        obj = host.binary_push(obj, (i as u32).into())?;
+        obj = host.bytes_push(obj, (i as u32).into())?;
     }
     if let ScObject::Bytes(b) = host.from_host_obj(obj)? {
         assert_eq!((0..32).collect::<Vec<u8>>().as_slice(), b.as_slice());
@@ -33,105 +33,105 @@ fn binary_suite_of_tests() -> Result<(), HostError> {
     }
     // pop and len
     for _ in 0..24 {
-        obj = host.binary_pop(obj)?;
+        obj = host.bytes_pop(obj)?;
     }
     assert_eq!(
-        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.binary_len(obj)?) },
+        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.bytes_len(obj)?) },
         8
     );
     assert_eq!(
         unsafe {
-            <u32 as RawValConvertible>::unchecked_from_val(host.binary_get(obj, 5_u32.into())?)
+            <u32 as RawValConvertible>::unchecked_from_val(host.bytes_get(obj, 5_u32.into())?)
         },
         5
     );
     // put, del, get, front, back
-    obj = host.binary_put(obj, 5_u32.into(), 99_u32.into())?;
+    obj = host.bytes_put(obj, 5_u32.into(), 99_u32.into())?;
     assert_eq!(
         unsafe {
-            <u32 as RawValConvertible>::unchecked_from_val(host.binary_get(obj, 5_u32.into())?)
+            <u32 as RawValConvertible>::unchecked_from_val(host.bytes_get(obj, 5_u32.into())?)
         },
         99
     );
-    obj = host.binary_del(obj, 5_u32.into())?; // [0,1,2,3,4,6,7]
+    obj = host.bytes_del(obj, 5_u32.into())?; // [0,1,2,3,4,6,7]
     assert_eq!(
-        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.binary_len(obj)?) },
+        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.bytes_len(obj)?) },
         7
     );
     assert_eq!(
-        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.binary_front(obj)?) },
+        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.bytes_front(obj)?) },
         0
     );
     assert_eq!(
-        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.binary_back(obj)?) },
+        unsafe { <u32 as RawValConvertible>::unchecked_from_val(host.bytes_back(obj)?) },
         7
     );
     // insert, slice and append
-    obj = host.binary_insert(obj, 5_u32.into(), 5_u32.into())?; // [0,1,2,3,4,5,6,7]
-    let obj0 = host.binary_slice(obj, 0_u32.into(), 3_u32.into())?; // [0,1,2]
+    obj = host.bytes_insert(obj, 5_u32.into(), 5_u32.into())?; // [0,1,2,3,4,5,6,7]
+    let obj0 = host.bytes_slice(obj, 0_u32.into(), 3_u32.into())?; // [0,1,2]
     if let ScObject::Bytes(b) = host.from_host_obj(obj0)? {
         assert_eq!((0..3).collect::<Vec<u8>>().as_slice(), b.as_slice());
     } else {
         return Err(host.err_general("Type error"));
     }
-    let obj1 = host.binary_slice(obj, 3_u32.into(), 8_u32.into())?; // [3,4,5,6,7]
+    let obj1 = host.bytes_slice(obj, 3_u32.into(), 8_u32.into())?; // [3,4,5,6,7]
     if let ScObject::Bytes(b) = host.from_host_obj(obj1)? {
         assert_eq!((3..8).collect::<Vec<u8>>().as_slice(), b.as_slice());
     } else {
         return Err(host.err_general("Type error"));
     }
-    let obj_back = host.binary_append(obj0, obj1)?;
+    let obj_back = host.bytes_append(obj0, obj1)?;
     assert_eq!(host.obj_cmp(obj.into(), obj_back.into())?, 0);
 
     Ok(())
 }
 
 #[test]
-fn binary_put_out_of_bound() -> Result<(), HostError> {
+fn bytes_put_out_of_bound() -> Result<(), HostError> {
     let host = Host::default();
-    let obj = host.binary_new()?;
-    let res = host.binary_put(obj, 0u32.into(), 1u32.into());
+    let obj = host.bytes_new()?;
+    let res = host.bytes_put(obj, 0u32.into(), 1u32.into());
     let code = ScHostObjErrorCode::VecIndexOutOfBound;
     assert!(HostError::result_matches_err_status(res, code));
     Ok(())
 }
 
 #[test]
-fn binary_slice_start_greater_than_end() -> Result<(), HostError> {
+fn bytes_slice_start_greater_than_end() -> Result<(), HostError> {
     let host = Host::default();
-    let obj = host.binary_new_from_slice(&[1, 2, 3, 4]);
-    let res = host.binary_slice(obj, 2_u32.into(), 1_u32.into());
+    let obj = host.bytes_new_from_slice(&[1, 2, 3, 4]);
+    let res = host.bytes_slice(obj, 2_u32.into(), 1_u32.into());
     let code = ScHostFnErrorCode::InputArgsInvalid;
     assert!(HostError::result_matches_err_status(res, code));
     Ok(())
 }
 
 #[test]
-fn binary_slice_start_equal_len() -> Result<(), HostError> {
+fn bytes_slice_start_equal_len() -> Result<(), HostError> {
     let host = Host::default();
-    let obj = host.binary_new_from_slice(&[1, 2, 3, 4]);
-    let res = host.binary_slice(obj, 4_u32.into(), 4_u32.into())?;
-    assert_eq!(host.obj_cmp(res.into(), host.binary_new()?.into())?, 0);
+    let obj = host.bytes_new_from_slice(&[1, 2, 3, 4]);
+    let res = host.bytes_slice(obj, 4_u32.into(), 4_u32.into())?;
+    assert_eq!(host.obj_cmp(res.into(), host.bytes_new()?.into())?, 0);
     Ok(())
 }
 
 #[test]
-fn binary_slice_start_greater_than_len() -> Result<(), HostError> {
+fn bytes_slice_start_greater_than_len() -> Result<(), HostError> {
     let host = Host::default();
-    let obj = host.binary_new_from_slice(&[1, 2, 3, 4]);
-    let res = host.binary_slice(obj, 5_u32.into(), 10_u32.into());
+    let obj = host.bytes_new_from_slice(&[1, 2, 3, 4]);
+    let res = host.bytes_slice(obj, 5_u32.into(), 10_u32.into());
     let code = ScHostObjErrorCode::VecIndexOutOfBound;
     assert!(HostError::result_matches_err_status(res, code));
     Ok(())
 }
 
 #[test]
-fn binary_xdr_roundtrip() -> Result<(), HostError> {
+fn bytes_xdr_roundtrip() -> Result<(), HostError> {
     let host = Host::default();
     let roundtrip = |v: ScVal| -> Result<(), HostError> {
         let rv: RawVal = host.to_host_val(&v)?.into();
-        let bo = host.serialize_to_binary(rv.clone())?;
-        let rv_back = host.deserialize_from_binary(bo)?;
+        let bo = host.serialize_to_bytes(rv.clone())?;
+        let rv_back = host.deserialize_from_bytes(bo)?;
         assert_eq!(host.obj_cmp(rv, rv_back)?, 0);
         Ok(())
     };
@@ -203,7 +203,7 @@ fn invoke_memcpy() -> Result<(), HostError> {
     let host = Host::with_storage_and_budget(storage, Budget::default());
     // create a dummy contract obj as the caller
     let id_obj = host.test_bin_obj(&[0; 32])?;
-    // tests binary_new_from_linear_memory
+    // tests bytes_new_from_linear_memory
     {
         let args = host.test_vec_obj::<u32>(&[0xaabbccdd])?;
         let obj = host.call(
@@ -214,7 +214,7 @@ fn invoke_memcpy() -> Result<(), HostError> {
         let obj_ref = host.test_bin_obj(&[0xaa, 0xbb, 0xcc, 0xdd])?;
         assert_eq!(host.obj_cmp(obj.into(), obj_ref.into())?, 0);
     }
-    // tests binary_copy_{to,from}_linear_memory
+    // tests bytes_copy_{to,from}_linear_memory
     {
         let obj0 = host.test_bin_obj(&[1, 2, 3, 4])?;
         let mut args = host.vec_new(RawVal::from_void())?;
diff --git a/soroban-env-host/src/test/contract_event.rs b/soroban-env-host/src/test/contract_event.rs
index b8d4a0d9..0e81ead0 100644
--- a/soroban-env-host/src/test/contract_event.rs
+++ b/soroban-env-host/src/test/contract_event.rs
@@ -26,8 +26,8 @@ impl ContractFunctionSet for EmptyContractWithEvents {
 fn contract_event() -> Result<(), HostError> {
     let host = Host::default();
     let dummy_id = [0; 32];
-    let mut id = host.binary_new();
-    id = host.binary_copy_from_slice(id, 0u32.into(), &dummy_id);
+    let mut id = host.bytes_new();
+    id = host.bytes_copy_from_slice(id, 0u32.into(), &dummy_id);
     let test_contract = Rc::new(EmptyContractWithEvents {});
     let sym = Symbol::from_str("add");
     let args = host.test_vec_obj::<i32>(&[1, 2])?;
diff --git a/soroban-env-host/src/test/crypto.rs b/soroban-env-host/src/test/crypto.rs
index 7c9d3318..e78d0e84 100644
--- a/soroban-env-host/src/test/crypto.rs
+++ b/soroban-env-host/src/test/crypto.rs
@@ -12,9 +12,9 @@ fn sha256_test() -> Result<(), HostError> {
     let hash_obj = host.compute_hash_sha256(obj0.to_object())?;
 
     let v = host.from_host_val(hash_obj.to_raw())?;
-    let bin = match v {
+    let bytes = match v {
         ScVal::Object(Some(scobj)) => match scobj {
-            ScObject::Bytes(bin) => bin,
+            ScObject::Bytes(bytes) => bytes,
             _ => panic!("Wrong type"),
         },
         _ => panic!("Wrong type"),
@@ -28,7 +28,7 @@ fn sha256_test() -> Result<(), HostError> {
         75, 245, 18, 47, 52, 69, 84, 197, 59, 222, 46, 187, 140, 210, 183, 227, 209, 96, 10, 214,
         49, 195, 133, 165, 215, 204, 226, 60, 119, 133, 69, 154,
     ];
-    assert_eq!(bin.as_vec().clone(), exp);
+    assert_eq!(bytes.as_vec().clone(), exp);
     Ok(())
 }
 
diff --git a/soroban-env-host/src/test/lifecycle.rs b/soroban-env-host/src/test/lifecycle.rs
index ab745821..e7f0f5e0 100644
--- a/soroban-env-host/src/test/lifecycle.rs
+++ b/soroban-env-host/src/test/lifecycle.rs
@@ -97,15 +97,15 @@ fn create_contract_test_helper(
     )?;
 
     let v = host.from_host_val(contract_id.to_raw())?;
-    let bin = match v {
+    let bytes = match v {
         ScVal::Object(Some(scobj)) => match scobj {
-            ScObject::Bytes(bin) => bin,
+            ScObject::Bytes(bytes) => bytes,
             _ => panic!("Wrong type"),
         },
         _ => panic!("Wrong type"),
     };
 
-    if bin.as_slice() != hash_copy.0.as_slice() {
+    if bytes.as_slice() != hash_copy.0.as_slice() {
         panic!("return value doesn't match")
     }
 
diff --git a/soroban-env-host/tests/array.rs b/soroban-env-host/tests/array.rs
index dda15c0c..8d51b661 100644
--- a/soroban-env-host/tests/array.rs
+++ b/soroban-env-host/tests/array.rs
@@ -10,10 +10,10 @@ fn u8_array() {
     let val: RawVal = arr.into_val(&host);
     let obj: Object = val.try_into().unwrap();
     assert!(obj.is_obj_type(ScObjectType::Bytes));
-    assert_eq!(3u32, host.binary_len(obj).try_into().unwrap());
-    assert_eq!(1u32, host.binary_get(obj, 0u32.into()).try_into().unwrap());
-    assert_eq!(2u32, host.binary_get(obj, 1u32.into()).try_into().unwrap());
-    assert_eq!(3u32, host.binary_get(obj, 2u32.into()).try_into().unwrap());
+    assert_eq!(3u32, host.bytes_len(obj).try_into().unwrap());
+    assert_eq!(1u32, host.bytes_get(obj, 0u32.into()).try_into().unwrap());
+    assert_eq!(2u32, host.bytes_get(obj, 1u32.into()).try_into().unwrap());
+    assert_eq!(3u32, host.bytes_get(obj, 2u32.into()).try_into().unwrap());
 
     let arr: [u8; 3] = val.try_into_val(&host).unwrap();
     assert_eq!(arr, [1, 2, 3]);
@@ -27,10 +27,10 @@ fn u8_slice() {
     let val: RawVal = slice.into_val(&host);
     let obj: Object = val.try_into().unwrap();
     assert!(obj.is_obj_type(ScObjectType::Bytes));
-    assert_eq!(3u32, host.binary_len(obj).try_into().unwrap());
-    assert_eq!(1u32, host.binary_get(obj, 0u32.into()).try_into().unwrap());
-    assert_eq!(2u32, host.binary_get(obj, 1u32.into()).try_into().unwrap());
-    assert_eq!(3u32, host.binary_get(obj, 2u32.into()).try_into().unwrap());
+    assert_eq!(3u32, host.bytes_len(obj).try_into().unwrap());
+    assert_eq!(1u32, host.bytes_get(obj, 0u32.into()).try_into().unwrap());
+    assert_eq!(2u32, host.bytes_get(obj, 1u32.into()).try_into().unwrap());
+    assert_eq!(3u32, host.bytes_get(obj, 2u32.into()).try_into().unwrap());
 
     let arr: [u8; 3] = val.try_into_val(&host).unwrap();
     assert_eq!(arr, [1, 2, 3]);
diff --git a/soroban-test-wasms/wasm-workspace/Cargo.toml b/soroban-test-wasms/wasm-workspace/Cargo.toml
index 6f6496b1..c60916f0 100644
--- a/soroban-test-wasms/wasm-workspace/Cargo.toml
+++ b/soroban-test-wasms/wasm-workspace/Cargo.toml
@@ -1,5 +1,5 @@
 # This file defines a workspace that is _periodically_ recompiled as part of
-# updating the WASM files that are then embedded as as binary constants in the
+# updating the WASM files that are then embedded as as bytes constants in the
 # surrounding crate `soroban-test-wasms`.
 #
 # Neither the rust crates in this workspace, nor the workspace itself, are (in
@@ -16,7 +16,14 @@
 [workspace]
 resolver = "2"
 
-members = ["add_i32", "contract_data", "create_contract", "invoke_contract", "linear_memory", "vec"]
+members = [
+    "add_i32",
+    "contract_data",
+    "create_contract",
+    "invoke_contract",
+    "linear_memory",
+    "vec",
+]
 
 [patch.crates-io]
 soroban-env-common = { path = "../../soroban-env-common" }
@@ -86,8 +93,8 @@ wasmi = { package = "soroban-wasmi", git = "https://github.com/stellar/wasmi", r
 # when you change the Env trait itself, and whatever change you make to Env may
 # well cause recompilation to fail. Again, you will know if it doesn't compile!
 
-soroban-sdk = {git = "https://github.com/stellar/rs-soroban-sdk", rev = "44f6711a"}
-soroban-sdk-macros = {git = "https://github.com/stellar/rs-soroban-sdk", rev = "44f6711a"}
+soroban-sdk = { git = "https://github.com/stellar/rs-soroban-sdk", rev = "44f6711a" }
+soroban-sdk-macros = { git = "https://github.com/stellar/rs-soroban-sdk", rev = "44f6711a" }
 
 [profile.release]
 opt-level = "z"
diff --git a/soroban-test-wasms/wasm-workspace/linear_memory/src/lib.rs b/soroban-test-wasms/wasm-workspace/linear_memory/src/lib.rs
index a3590851..2782b60e 100644
--- a/soroban-test-wasms/wasm-workspace/linear_memory/src/lib.rs
+++ b/soroban-test-wasms/wasm-workspace/linear_memory/src/lib.rs
@@ -5,7 +5,7 @@ pub struct Contract;
 
 #[contractimpl]
 impl Contract {
-    // Produce a bin with 1 byte from each 8 bits of a 32-bit word.
+    // Produce a bytes with 1 byte from each 8 bits of a 32-bit word.
     pub fn bin_word(e: Env, word: u32) -> Bytes {
         let buf: [u8; 4] = [
             (word >> 24) as u8,
@@ -16,11 +16,11 @@ impl Contract {
         Bytes::from_slice(&e, &buf)
     }
 
-    // Transform a 4-byte bin into a new one with each byte incremented,
+    // Transform a 4-byte bytes into a new one with each byte incremented,
     // via a temporary guest memory buffer.
-    pub fn bin_inc(e: Env, bin: Bytes) -> Bytes {
+    pub fn bin_inc(e: Env, bytes: Bytes) -> Bytes {
         let mut buf: [u8; 4] = [0; 4];
-        bin.copy_into_slice(&mut buf);
+        bytes.copy_into_slice(&mut buf);
         for i in buf.iter_mut() {
             *i += 1;
         }