Skip to content

Commit

Permalink
fix some test failures, hex encode u128,u256 in SATN format
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Aug 20, 2024
1 parent ddd42c1 commit a3a9cac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1353,12 +1353,12 @@ mod tests {
ColRow { table: ST_CONSTRAINT_ID.into(), pos: 4, name: "columns", ty: AlgebraicType::array(ColId::get_type()) },

ColRow { table: ST_MODULE_ID.into(), pos: 0, name: "database_address", ty: AlgebraicType::U128 },
ColRow { table: ST_MODULE_ID.into(), pos: 1, name: "owner_identity", ty: AlgebraicType::bytes() },
ColRow { table: ST_MODULE_ID.into(), pos: 1, name: "owner_identity", ty: AlgebraicType::U256 },
ColRow { table: ST_MODULE_ID.into(), pos: 2, name: "program_kind", ty: AlgebraicType::U8 },
ColRow { table: ST_MODULE_ID.into(), pos: 3, name: "program_hash", ty: AlgebraicType::bytes() },
ColRow { table: ST_MODULE_ID.into(), pos: 3, name: "program_hash", ty: AlgebraicType::U256 },
ColRow { table: ST_MODULE_ID.into(), pos: 4, name: "program_bytes", ty: AlgebraicType::bytes() },

ColRow { table: ST_CLIENT_ID.into(), pos: 0, name: "identity", ty: AlgebraicType::bytes()},
ColRow { table: ST_CLIENT_ID.into(), pos: 0, name: "identity", ty: AlgebraicType::U256},
ColRow { table: ST_CLIENT_ID.into(), pos: 1, name: "address", ty: AlgebraicType::U128},

ColRow { table: ST_VAR_ID.into(), pos: 0, name: "name", ty: AlgebraicType::String },
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/sql/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ mod tests {
// Check tuples
let kind = [
("a", AlgebraicType::String),
("b", AlgebraicType::bytes()),
("b", AlgebraicType::U256),
("o", Identity::get_type()),
("p", Address::get_type()),
]
Expand Down
4 changes: 2 additions & 2 deletions crates/sats/src/satn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ impl<'a, 'b> ser::Serializer for SatnFormatter<'a, 'b> {
write!(self, "{v}")
}
fn serialize_u128(mut self, v: u128) -> Result<Self::Ok, Self::Error> {
write!(self, "{v}")
write!(self, "0x{}", hex::encode(v.to_le_bytes()))
}
fn serialize_u256(mut self, v: u256) -> Result<Self::Ok, Self::Error> {
write!(self, "{v}")
write!(self, "0x{}", hex::encode(v.to_le_bytes()))
}
fn serialize_i8(mut self, v: i8) -> Result<Self::Ok, Self::Error> {
write!(self, "{v}")
Expand Down
2 changes: 1 addition & 1 deletion crates/standalone/src/control_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl ControlDb {
let name = b"clockworklabs:";
let bytes = [name, bytes].concat();
let hash = hash_bytes(bytes);
let address = Address::from_slice(&hash.abbreviate());
let address = Address::from_slice(hash.abbreviate());
Ok(address)
}

Expand Down

0 comments on commit a3a9cac

Please sign in to comment.