krusty-kms-client 0.2.1

Starknet RPC client for interacting with TONGO contracts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
//! Ethereum-key wallet for secp256k1-signed Starknet accounts.
//!
//! Uses raw V3 transaction building because `starknet-rust`'s `Signer` trait
//! returns `Signature { r, s }` (2 Stark Felts) while Ethereum accounts need
//! a 5-Felt signature: `[r_low, r_high, s_low, s_high, v]`.

use super::utils::{check_deployed, core_felt_to_rs, rs_felt_to_core, StarknetRsFelt};
use super::WalletExecutor;
use crate::tx::encode::encode_execute_calldata;
use crate::tx::hash::{
    compute_deploy_account_v3_hash, compute_invoke_v3_hash, DaMode, ResourceBounds,
};
use crate::tx::Tx;
use krusty_kms::account_class::OpenZeppelinEthAccount;
use krusty_kms::AccountClass;
use krusty_kms::EthSigner;
use krusty_kms_common::address::Address;
use krusty_kms_common::chain::ChainId;
use krusty_kms_common::network::NetworkPreset;
use krusty_kms_common::{KmsError, Result};
use std::sync::Arc;
use std::time::Instant;
use starknet_rust::core::types::{
    BlockId, BlockTag, BroadcastedDeployAccountTransactionV3,
    BroadcastedInvokeTransactionV3, BroadcastedTransaction, Call, DataAvailabilityMode,
    FeeEstimate, ResourceBoundsMapping, SimulationFlagForEstimateFee,
};
use starknet_rust::providers::jsonrpc::{HttpTransport, JsonRpcClient};
use starknet_rust::providers::Provider;
use starknet_types_core::felt::Felt as CoreFelt;
use tokio::sync::RwLock;

/// Cache TTL for the "not deployed" state (3 seconds).
const DEPLOYED_CACHE_TTL_SECS: u64 = 3;

/// Fee estimation safety multiplier (numerator / denominator).
const FEE_MARGIN_NUM: u64 = 3;
const FEE_MARGIN_DEN: u64 = 2;

/// A Starknet wallet using secp256k1 (Ethereum) signing.
///
/// Builds V3 transactions manually since `SingleOwnerAccount` cannot produce
/// the 5-Felt secp256k1 signature format required by OZ Ethereum accounts.
pub struct EthWallet {
    signer: EthSigner,
    provider: Arc<JsonRpcClient<HttpTransport>>,
    address: Address,
    chain_id: ChainId,
    network: NetworkPreset,
    // Precomputed deployment data (CoreFelt for hash computation).
    class_hash: CoreFelt,
    constructor_calldata: Vec<CoreFelt>,
    salt: CoreFelt,
    deployed_cache: RwLock<Option<(bool, Instant)>>,
}

impl EthWallet {
    /// Create from a raw 32-byte Ethereum private key.
    ///
    /// Uses the default OZ Ethereum Account class hash.
    pub fn new(
        provider: Arc<JsonRpcClient<HttpTransport>>,
        private_key: &[u8; 32],
        chain_id: ChainId,
        network: NetworkPreset,
    ) -> Result<Self> {
        let account_class = OpenZeppelinEthAccount::new();
        Self::with_class(provider, private_key, &account_class, chain_id, network)
    }

    /// Create from a hex-encoded private key (with or without `0x` prefix).
    pub fn from_hex(
        provider: Arc<JsonRpcClient<HttpTransport>>,
        hex_key: &str,
        chain_id: ChainId,
        network: NetworkPreset,
    ) -> Result<Self> {
        let signer = EthSigner::from_hex(hex_key)?;
        let account_class = OpenZeppelinEthAccount::new();
        Self::from_signer(provider, signer, &account_class, chain_id, network)
    }

    /// Create with a custom account class.
    pub fn with_class(
        provider: Arc<JsonRpcClient<HttpTransport>>,
        private_key: &[u8; 32],
        account_class: &OpenZeppelinEthAccount,
        chain_id: ChainId,
        network: NetworkPreset,
    ) -> Result<Self> {
        let signer = EthSigner::from_private_key(private_key)?;
        Self::from_signer(provider, signer, account_class, chain_id, network)
    }

    fn from_signer(
        provider: Arc<JsonRpcClient<HttpTransport>>,
        signer: EthSigner,
        account_class: &OpenZeppelinEthAccount,
        chain_id: ChainId,
        network: NetworkPreset,
    ) -> Result<Self> {
        let (x, y) = signer.public_key_xy();
        let class_hash = account_class.class_hash();
        let constructor_calldata = account_class.build_constructor_calldata_eth(&x, &y);
        let salt = account_class.get_salt_eth(&x, &y);
        let address_felt = account_class.calculate_address_eth(&x, &y)?;
        let address = Address::from(address_felt);

        Ok(Self {
            signer,
            provider,
            address,
            chain_id,
            network,
            class_hash,
            constructor_calldata,
            salt,
            deployed_cache: RwLock::new(None),
        })
    }

    /// Deploy this account on-chain (user pays gas).
    ///
    /// Sends a `DeployAccountTransactionV3` with the secp256k1 signature.
    pub async fn deploy(&self) -> Result<Tx> {
        let deployed = self.is_deployed().await?;
        if deployed {
            return Err(KmsError::TransactionError(
                "Account is already deployed".into(),
            ));
        }

        let nonce = CoreFelt::ZERO; // deploy nonce is always 0
        let chain_id_core = self.chain_id.as_felt();

        // Convert deployment data to StarknetRsFelt for the broadcasted tx.
        let class_hash_rs = core_felt_to_rs(self.class_hash);
        let salt_rs = core_felt_to_rs(self.salt);
        let constructor_calldata_rs: Vec<StarknetRsFelt> = self
            .constructor_calldata
            .iter()
            .map(|f| core_felt_to_rs(*f))
            .collect();

        // Estimate fees with a dummy deploy tx.
        let dummy_sig = vec![StarknetRsFelt::ZERO; 5];
        let dummy_deploy = BroadcastedDeployAccountTransactionV3 {
            signature: dummy_sig,
            nonce: StarknetRsFelt::ZERO,
            contract_address_salt: salt_rs,
            constructor_calldata: constructor_calldata_rs.clone(),
            class_hash: class_hash_rs,
            resource_bounds: zero_resource_bounds(),
            tip: 0,
            paymaster_data: vec![],
            nonce_data_availability_mode: DataAvailabilityMode::L1,
            fee_data_availability_mode: DataAvailabilityMode::L1,
            is_query: true,
        };

        let estimates = self
            .provider
            .estimate_fee(
                &[BroadcastedTransaction::DeployAccount(dummy_deploy)],
                vec![SimulationFlagForEstimateFee::SkipValidate],
                BlockId::Tag(BlockTag::Latest),
            )
            .await
            .map_err(|e| KmsError::FeeEstimationFailed(e.to_string()))?;

        let estimate = estimates
            .first()
            .ok_or_else(|| KmsError::FeeEstimationFailed("empty estimate".into()))?;

        let resource_bounds = estimate_to_resource_bounds(estimate);

        // Compute the deploy-account transaction hash.
        let (l1_gas, l2_gas) = mapping_to_hash_bounds(&resource_bounds);
        let address_core = self.address.as_felt();

        let tx_hash = compute_deploy_account_v3_hash(
            &address_core,
            &self.class_hash,
            &self.constructor_calldata,
            &self.salt,
            &chain_id_core,
            &nonce,
            0,
            &l1_gas,
            &l2_gas,
            &[], // paymaster_data
            DaMode::L1,
            DaMode::L1,
        );

        // Sign with secp256k1.
        let sig_felts = self.signer.sign_hash(&tx_hash)?;
        let signature: Vec<StarknetRsFelt> =
            sig_felts.iter().map(|f| core_felt_to_rs(*f)).collect();

        // Build and submit the deploy-account transaction.
        let deploy_tx = BroadcastedDeployAccountTransactionV3 {
            signature,
            nonce: StarknetRsFelt::ZERO,
            contract_address_salt: salt_rs,
            constructor_calldata: constructor_calldata_rs,
            class_hash: class_hash_rs,
            resource_bounds,
            tip: 0,
            paymaster_data: vec![],
            nonce_data_availability_mode: DataAvailabilityMode::L1,
            fee_data_availability_mode: DataAvailabilityMode::L1,
            is_query: false,
        };

        let result = self
            .provider
            .add_deploy_account_transaction(&deploy_tx)
            .await
            .map_err(|e| KmsError::TransactionError(e.to_string()))?;

        // Invalidate deployment cache.
        {
            let mut cache = self.deployed_cache.write().await;
            *cache = None;
        }

        Ok(Tx::new(
            result.transaction_hash,
            self.provider.clone(),
            self.network.clone(),
        ))
    }

    /// Deploy if not already deployed. Returns `None` if already deployed.
    pub async fn ensure_deployed(&self) -> Result<Option<Tx>> {
        if self.is_deployed().await? {
            Ok(None)
        } else {
            Ok(Some(self.deploy().await?))
        }
    }

    /// The underlying `EthSigner`.
    pub fn signer(&self) -> &EthSigner {
        &self.signer
    }

    /// The account class hash.
    pub fn class_hash(&self) -> CoreFelt {
        self.class_hash
    }

    /// The underlying JSON-RPC provider.
    pub fn provider(&self) -> &Arc<JsonRpcClient<HttpTransport>> {
        &self.provider
    }

    /// Start building a batched transaction.
    pub fn tx(&self) -> crate::tx::TxBuilder<'_> {
        crate::tx::TxBuilder::new(self)
    }

    /// Check whether the account contract is deployed on-chain.
    async fn check_deployed(&self) -> Result<bool> {
        {
            let cache = self.deployed_cache.read().await;
            if let Some((deployed, ts)) = *cache {
                if deployed || ts.elapsed().as_secs() < DEPLOYED_CACHE_TTL_SECS {
                    return Ok(deployed);
                }
            }
        }

        let address_rs = core_felt_to_rs(self.address.as_felt());
        let deployed = check_deployed(&self.provider, address_rs).await?;

        {
            let mut cache = self.deployed_cache.write().await;
            *cache = Some((deployed, Instant::now()));
        }

        Ok(deployed)
    }

    /// Execute a list of calls as a single V3 invoke transaction.
    async fn execute_inner(&self, calls: Vec<Call>) -> Result<Tx> {
        let calldata = encode_execute_calldata(&calls);
        let address_rs = core_felt_to_rs(self.address.as_felt());
        let chain_id_core = self.chain_id.as_felt();

        // Get nonce.
        let nonce_rs = self
            .provider
            .get_nonce(BlockId::Tag(BlockTag::Latest), address_rs)
            .await
            .map_err(|e| KmsError::RpcError(e.to_string()))?;

        let nonce_core = rs_felt_to_core(nonce_rs);

        // Estimate fees with dummy signature.
        let dummy_sig = vec![StarknetRsFelt::ZERO; 5];
        let dummy_tx = BroadcastedInvokeTransactionV3 {
            sender_address: address_rs,
            calldata: calldata.clone(),
            signature: dummy_sig,
            nonce: nonce_rs,
            resource_bounds: zero_resource_bounds(),
            tip: 0,
            paymaster_data: vec![],
            account_deployment_data: vec![],
            nonce_data_availability_mode: DataAvailabilityMode::L1,
            fee_data_availability_mode: DataAvailabilityMode::L1,
            is_query: true,
        };

        let estimates = self
            .provider
            .estimate_fee(
                &[BroadcastedTransaction::Invoke(dummy_tx)],
                vec![SimulationFlagForEstimateFee::SkipValidate],
                BlockId::Tag(BlockTag::Latest),
            )
            .await
            .map_err(|e| KmsError::FeeEstimationFailed(e.to_string()))?;

        let estimate = estimates
            .first()
            .ok_or_else(|| KmsError::FeeEstimationFailed("empty estimate".into()))?;

        let resource_bounds = estimate_to_resource_bounds(estimate);

        // Convert calldata to CoreFelt for hash computation.
        let calldata_core: Vec<CoreFelt> =
            calldata.iter().map(|f| rs_felt_to_core(*f)).collect();

        let (l1_gas, l2_gas) = mapping_to_hash_bounds(&resource_bounds);
        let address_core = self.address.as_felt();

        let tx_hash = compute_invoke_v3_hash(
            &address_core,
            &calldata_core,
            &chain_id_core,
            &nonce_core,
            0,
            &l1_gas,
            &l2_gas,
            &[], // paymaster_data
            &[], // account_deployment_data
            DaMode::L1,
            DaMode::L1,
        );

        // Sign with secp256k1.
        let sig_felts = self.signer.sign_hash(&tx_hash)?;
        let signature: Vec<StarknetRsFelt> =
            sig_felts.iter().map(|f| core_felt_to_rs(*f)).collect();

        // Build and submit the invoke transaction.
        let invoke_tx = BroadcastedInvokeTransactionV3 {
            sender_address: address_rs,
            calldata,
            signature,
            nonce: nonce_rs,
            resource_bounds,
            tip: 0,
            paymaster_data: vec![],
            account_deployment_data: vec![],
            nonce_data_availability_mode: DataAvailabilityMode::L1,
            fee_data_availability_mode: DataAvailabilityMode::L1,
            is_query: false,
        };

        let result = self
            .provider
            .add_invoke_transaction(&invoke_tx)
            .await
            .map_err(|e| KmsError::TransactionError(e.to_string()))?;

        Ok(Tx::new(
            result.transaction_hash,
            self.provider.clone(),
            self.network.clone(),
        ))
    }

    /// Estimate fees for a list of calls.
    async fn estimate_fee_inner(&self, calls: Vec<Call>) -> Result<FeeEstimate> {
        let calldata = encode_execute_calldata(&calls);
        let address_rs = core_felt_to_rs(self.address.as_felt());

        let nonce_rs = self
            .provider
            .get_nonce(BlockId::Tag(BlockTag::Latest), address_rs)
            .await
            .map_err(|e| KmsError::RpcError(e.to_string()))?;

        let dummy_sig = vec![StarknetRsFelt::ZERO; 5];
        let dummy_tx = BroadcastedInvokeTransactionV3 {
            sender_address: address_rs,
            calldata,
            signature: dummy_sig,
            nonce: nonce_rs,
            resource_bounds: zero_resource_bounds(),
            tip: 0,
            paymaster_data: vec![],
            account_deployment_data: vec![],
            nonce_data_availability_mode: DataAvailabilityMode::L1,
            fee_data_availability_mode: DataAvailabilityMode::L1,
            is_query: true,
        };

        let estimates = self
            .provider
            .estimate_fee(
                &[BroadcastedTransaction::Invoke(dummy_tx)],
                vec![SimulationFlagForEstimateFee::SkipValidate],
                BlockId::Tag(BlockTag::Latest),
            )
            .await
            .map_err(|e| KmsError::FeeEstimationFailed(e.to_string()))?;

        estimates
            .into_iter()
            .next()
            .ok_or_else(|| KmsError::FeeEstimationFailed("empty estimate".into()))
    }
}

#[async_trait::async_trait]
impl WalletExecutor for EthWallet {
    async fn execute(&self, calls: Vec<Call>) -> Result<Tx> {
        self.execute_inner(calls).await
    }

    async fn estimate_fee(&self, calls: Vec<Call>) -> Result<FeeEstimate> {
        self.estimate_fee_inner(calls).await
    }

    fn address(&self) -> &Address {
        &self.address
    }

    fn chain_id(&self) -> ChainId {
        self.chain_id
    }

    fn network(&self) -> &NetworkPreset {
        &self.network
    }

    async fn is_deployed(&self) -> Result<bool> {
        self.check_deployed().await
    }
}

// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------

/// Create zero resource bounds (used for fee estimation queries).
fn zero_resource_bounds() -> ResourceBoundsMapping {
    ResourceBoundsMapping {
        l1_gas: starknet_rust::core::types::ResourceBounds {
            max_amount: 0,
            max_price_per_unit: 0,
        },
        l1_data_gas: starknet_rust::core::types::ResourceBounds {
            max_amount: 0,
            max_price_per_unit: 0,
        },
        l2_gas: starknet_rust::core::types::ResourceBounds {
            max_amount: 0,
            max_price_per_unit: 0,
        },
    }
}

/// Convert a `FeeEstimate` into `ResourceBoundsMapping` with safety margins.
fn estimate_to_resource_bounds(estimate: &FeeEstimate) -> ResourceBoundsMapping {
    ResourceBoundsMapping {
        l1_gas: starknet_rust::core::types::ResourceBounds {
            max_amount: estimate
                .l1_gas_consumed
                .saturating_mul(FEE_MARGIN_NUM)
                / FEE_MARGIN_DEN,
            max_price_per_unit: estimate
                .l1_gas_price
                .saturating_mul(FEE_MARGIN_NUM as u128)
                / FEE_MARGIN_DEN as u128,
        },
        l1_data_gas: starknet_rust::core::types::ResourceBounds {
            max_amount: estimate
                .l1_data_gas_consumed
                .saturating_mul(FEE_MARGIN_NUM)
                / FEE_MARGIN_DEN,
            max_price_per_unit: estimate
                .l1_data_gas_price
                .saturating_mul(FEE_MARGIN_NUM as u128)
                / FEE_MARGIN_DEN as u128,
        },
        l2_gas: starknet_rust::core::types::ResourceBounds {
            max_amount: estimate
                .l2_gas_consumed
                .saturating_mul(FEE_MARGIN_NUM)
                / FEE_MARGIN_DEN,
            max_price_per_unit: estimate
                .l2_gas_price
                .saturating_mul(FEE_MARGIN_NUM as u128)
                / FEE_MARGIN_DEN as u128,
        },
    }
}

/// Convert `ResourceBoundsMapping` to the hash module's `ResourceBounds` type.
fn mapping_to_hash_bounds(
    mapping: &ResourceBoundsMapping,
) -> (ResourceBounds, ResourceBounds) {
    (
        ResourceBounds {
            max_amount: mapping.l1_gas.max_amount,
            max_price_per_unit: mapping.l1_gas.max_price_per_unit,
        },
        ResourceBounds {
            max_amount: mapping.l2_gas.max_amount,
            max_price_per_unit: mapping.l2_gas.max_price_per_unit,
        },
    )
}

#[cfg(test)]
mod tests {
    use super::*;

    const TEST_KEY_HEX: &str =
        "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";

    fn make_provider() -> Arc<JsonRpcClient<HttpTransport>> {
        Arc::new(JsonRpcClient::new(
            starknet_rust::providers::jsonrpc::HttpTransport::new(
                url::Url::parse("http://localhost:5050").unwrap(),
            ),
        ))
    }

    #[test]
    fn test_factory_computes_address() {
        let provider = make_provider();
        let wallet = EthWallet::from_hex(
            provider,
            TEST_KEY_HEX,
            ChainId::Sepolia,
            NetworkPreset::sepolia(),
        )
        .unwrap();

        assert_ne!(wallet.address().as_felt(), CoreFelt::ZERO);
    }

    #[test]
    fn test_factory_deterministic() {
        let provider1 = make_provider();
        let wallet1 = EthWallet::from_hex(
            provider1,
            TEST_KEY_HEX,
            ChainId::Sepolia,
            NetworkPreset::sepolia(),
        )
        .unwrap();

        let provider2 = make_provider();
        let wallet2 = EthWallet::from_hex(
            provider2,
            TEST_KEY_HEX,
            ChainId::Sepolia,
            NetworkPreset::sepolia(),
        )
        .unwrap();

        assert_eq!(wallet1.address(), wallet2.address());
    }

    #[test]
    fn test_different_keys_different_addresses() {
        let provider1 = make_provider();
        let wallet1 = EthWallet::from_hex(
            provider1,
            TEST_KEY_HEX,
            ChainId::Sepolia,
            NetworkPreset::sepolia(),
        )
        .unwrap();

        let provider2 = make_provider();
        let wallet2 = EthWallet::from_hex(
            provider2,
            "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
            ChainId::Sepolia,
            NetworkPreset::sepolia(),
        )
        .unwrap();

        assert_ne!(wallet1.address(), wallet2.address());
    }

    #[test]
    fn test_class_hash_matches_oz_eth() {
        let provider = make_provider();
        let wallet = EthWallet::from_hex(
            provider,
            TEST_KEY_HEX,
            ChainId::Sepolia,
            NetworkPreset::sepolia(),
        )
        .unwrap();
        let expected = CoreFelt::from_hex(OpenZeppelinEthAccount::CLASS_HASH).unwrap();
        assert_eq!(wallet.class_hash(), expected);
    }

    #[test]
    fn test_zero_resource_bounds() {
        let bounds = zero_resource_bounds();
        assert_eq!(bounds.l1_gas.max_amount, 0);
        assert_eq!(bounds.l2_gas.max_amount, 0);
    }

    #[test]
    fn test_estimate_to_resource_bounds_applies_margin() {
        let estimate = FeeEstimate {
            l1_gas_consumed: 100,
            l1_gas_price: 1000,
            l2_gas_consumed: 200,
            l2_gas_price: 2000,
            l1_data_gas_consumed: 50,
            l1_data_gas_price: 500,
            overall_fee: 999999,
        };
        let bounds = estimate_to_resource_bounds(&estimate);

        // 100 * 3 / 2 = 150
        assert_eq!(bounds.l1_gas.max_amount, 150);
        assert_eq!(bounds.l1_gas.max_price_per_unit, 1500);
        assert_eq!(bounds.l2_gas.max_amount, 300);
        assert_eq!(bounds.l2_gas.max_price_per_unit, 3000);
        assert_eq!(bounds.l1_data_gas.max_amount, 75);
        assert_eq!(bounds.l1_data_gas.max_price_per_unit, 750);
    }
}