Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 6d57cfd

Browse files
authored
more refactoring around Felt (#730)
* more refactoring around Felt * Update crates/ef-testing/src/evm_sequencer/evm_state/v0.rs * Update crates/ef-testing/src/evm_sequencer/evm_state/v1.rs * Update crates/ef-testing/src/evm_sequencer/evm_state/v1.rs * Update crates/ef-testing/src/evm_sequencer/sequencer/v0.rs * Update crates/ef-testing/src/evm_sequencer/sequencer/v1.rs * Update crates/ef-testing/src/evm_sequencer/utils.rs * Update crates/sequencer/src/state.rs * fix
1 parent 69a4d95 commit 6d57cfd

File tree

1 file changed

+5
-10
lines changed
  • crates/ef-testing/src/evm_sequencer

1 file changed

+5
-10
lines changed

crates/ef-testing/src/evm_sequencer/utils.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ pub fn to_broadcasted_starknet_transaction(
4242
transaction: &TransactionSigned,
4343
signer_starknet_address: Felt,
4444
) -> Result<BroadcastedInvokeTransaction, eyre::Error> {
45-
let nonce = Felt::from(transaction.nonce());
46-
4745
let mut bytes = BytesMut::new();
4846
transaction.transaction.encode_without_signature(&mut bytes);
4947

@@ -52,13 +50,10 @@ pub fn to_broadcasted_starknet_transaction(
5250
#[cfg(feature = "v0")]
5351
{
5452
use crate::evm_sequencer::account::pack_byte_array_to_starkfelt_array;
55-
let bytes_u8: Vec<u8> = bytes.into_iter().collect();
56-
let bytes_len = bytes_u8.len();
57-
let packed_data: Vec<_> = pack_byte_array_to_starkfelt_array(bytes_u8.as_slice())
58-
.map(Felt::from)
59-
.collect();
60-
std::iter::once(Felt::from(bytes_len))
61-
.chain(packed_data)
53+
std::iter::once((bytes.len()).into())
54+
.chain(pack_byte_array_to_starkfelt_array(
55+
&bytes.into_iter().collect::<Vec<u8>>(),
56+
))
6257
.collect()
6358
}
6459
#[cfg(not(feature = "v0"))]
@@ -115,7 +110,7 @@ pub fn to_broadcasted_starknet_transaction(
115110
let request = BroadcastedInvokeTransaction::V1(BroadcastedInvokeTransactionV1 {
116111
max_fee: Felt::ZERO,
117112
signature,
118-
nonce,
113+
nonce: transaction.nonce().into(),
119114
sender_address: signer_starknet_address,
120115
calldata: execute_calldata,
121116
is_query: false,

0 commit comments

Comments
 (0)