Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alenmestrov committed Dec 18, 2024
1 parent 0c7d998 commit ddbfd50
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions crates/context/config/src/client/env/proxy/types/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ impl Encode for ContextVariableKey {

// Use exactly 16 bytes per chunk
let chunk_size = 16;
#[allow(clippy::integer_division, reason = "Using integer division for ceiling division calculation")]
#[allow(
clippy::integer_division,
reason = "Using integer division for ceiling division calculation"
)]
let num_chunks = (bytes.len() + chunk_size - 1) / chunk_size;

// Write number of chunks first
Expand Down Expand Up @@ -289,22 +292,24 @@ impl From<Vec<ProposalAction>> for StarknetProposalActionWithArgs {
serde_json::Value::Object(map) => {
// For objects, serialize each value to a felt
map.into_iter()
.map(|(_, value)| Felt::from_bytes_be_slice(value.to_string().as_bytes()))
.map(|(_, value)| {
Felt::from_bytes_be_slice(value.to_string().as_bytes())
})
.collect()
},
}
serde_json::Value::Array(arr) => {
// For arrays, convert each element
arr.into_iter()
.map(|value| Felt::from_bytes_be_slice(value.to_string().as_bytes()))
.collect()
},
}
// Explicitly match all other variants
value @ (serde_json::Value::Null
| serde_json::Value::Bool(_)
| serde_json::Value::Number(_)
| serde_json::Value::String(_)) => {
value @ (serde_json::Value::Null
| serde_json::Value::Bool(_)
| serde_json::Value::Number(_)
| serde_json::Value::String(_)) => {
vec![Felt::from_bytes_be_slice(value.to_string().as_bytes())]
},
}
};

StarknetProposalActionWithArgs::ExternalFunctionCall(
Expand Down

0 comments on commit ddbfd50

Please sign in to comment.