Skip to content
Open
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
9 changes: 9 additions & 0 deletions sdk/stdlib-sys/src/intrinsics/word.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,12 @@ impl AsRef<Word> for Word {
self
}
}

impl Default for Word {
/// Creates a new `Word` with all four field elements set to zero.
fn default() -> Self {
Self {
inner: (felt!(0), felt!(0), felt!(0), felt!(0)),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fn rust_sdk_account_has_procedure_binding() {
run_account_binding_test(
"rust_sdk_account_has_procedure_binding",
"pub fn binding(&self) -> Felt {
let proc_root = Word::from([Felt::from_u32(0); 4]);
let proc_root = Word::default();
if self.has_procedure(proc_root) {
Felt::from_u32(1)
} else {
Expand All @@ -207,7 +207,7 @@ fn rust_sdk_account_was_procedure_called_binding() {
run_account_binding_test(
"rust_sdk_account_was_procedure_called_binding",
"pub fn binding(&self) -> Felt {
let proc_root = Word::from([Felt::from_u32(0); 4]);
let proc_root = Word::default();
if self.was_procedure_called(proc_root) {
Felt::from_u32(1)
} else {
Expand All @@ -232,7 +232,7 @@ fn rust_sdk_account_storage_get_initial_map_item_binding() {
run_account_binding_test(
"rust_sdk_account_storage_get_initial_map_item_binding",
"pub fn binding(&self) -> Word {
let key = Word::from([Felt::from_u32(0); 4]);
let key = Word::default();
storage::get_initial_map_item(0, &key)
}",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn rust_sdk_account_asset_build_non_fungible_asset_binding() {
"rust_sdk_account_asset_build_non_fungible_asset_binding",
"pub fn binding(&self) -> Asset {
let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) };
let hash = Word::from([Felt::from_u32(0); 4]);
let hash = Word::default();
asset::build_non_fungible_asset(faucet, hash)
}",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn rust_sdk_account_faucet_create_non_fungible_asset_binding() {
run_faucet_binding_test(
"rust_sdk_account_faucet_create_non_fungible_asset_binding",
"pub fn binding(&self) -> Asset {
let hash = Word::from([Felt::from_u32(0); 4]);
let hash = Word::default();
faucet::create_non_fungible_asset(hash)
}",
);
Expand Down