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

fix(rpc/v06): simulation_flags is optional for starknet_estimateFee #1589

Closed
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
32 changes: 31 additions & 1 deletion crates/rpc/src/v06/method/estimate_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ use pathfinder_common::BlockId;
#[serde(deny_unknown_fields)]
pub struct EstimateFeeInput {
pub request: Vec<BroadcastedTransaction>,
#[serde(default)]
pub simulation_flags: SimulationFlags,
pub block_id: BlockId,
}

#[derive(Debug, serde::Deserialize, Eq, PartialEq)]
#[derive(Debug, Default, serde::Deserialize, Eq, PartialEq)]
pub struct SimulationFlags(pub Vec<SimulationFlag>);

#[derive(Debug, serde::Deserialize, Eq, PartialEq)]
Expand Down Expand Up @@ -250,6 +251,35 @@ pub(crate) mod tests {
};
assert_eq!(input, expected);
}

#[test]
fn named_args_with_no_simulation_flags() {
let named_args = json!({
"request": [
{
"type": "INVOKE",
"version": "0x100000000000000000000000000000001",
"max_fee": "0x6",
"signature": [
"0x7"
],
"nonce": "0x8",
"sender_address": "0xaaa",
"calldata": [
"0xff"
]
}
],
"block_id": { "block_hash": "0xabcde" }
});
let input = serde_json::from_value::<EstimateFeeInput>(named_args).unwrap();
let expected = EstimateFeeInput {
request: vec![test_invoke_txn()],
simulation_flags: SimulationFlags(vec![]),
block_id: BlockId::Hash(BlockHash(felt!("0xabcde"))),
};
assert_eq!(input, expected);
}
}

mod in_memory {
Expand Down
Loading