Skip to content

Commit

Permalink
add kakarot address in Constant (#1499)
Browse files Browse the repository at this point in the history
* add kakarot address in Constant

* cleanup
  • Loading branch information
tcoratger authored Oct 25, 2024
1 parent 3dcd01e commit 443e148
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/eth_rpc/servers/kakarot_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl KakarotApiServer for KakarotRpc {
starknet_network: String::from(starknet_config.network_url),
max_felts_in_calldata: *MAX_FELTS_IN_CALLDATA,
white_listed_eip_155_transaction_hashes: get_white_listed_eip_155_transaction_hashes(),
kakarot_address: starknet_config.kakarot_address,
})
}
}
3 changes: 3 additions & 0 deletions src/providers/eth_provider/constant.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::{B256, U256};
use serde::{Deserialize, Serialize};
use starknet::core::types::Felt;
use std::{str::FromStr, sync::LazyLock};

/// Maximum priority fee per gas
Expand Down Expand Up @@ -35,6 +36,8 @@ pub struct Constant {
pub max_felts_in_calldata: usize,
/// List of whitelisted hashes allow to submit pre EIP-155 transactions.
pub white_listed_eip_155_transaction_hashes: Vec<B256>,
/// Kakarot address the RPC points to.
pub kakarot_address: Felt,
}

#[cfg(feature = "hive")]
Expand Down
3 changes: 3 additions & 0 deletions tests/tests/kakarot_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use kakarot_rpc::{
};
use rstest::*;
use serde_json::Value;
use starknet::core::types::Felt;
use std::str::FromStr;

#[rstest]
Expand All @@ -28,13 +29,15 @@ async fn test_kakarot_get_config(#[future] katana: Katana, _setup: ()) {
std::env::set_var("WHITE_LISTED_EIP_155_TRANSACTION_HASHES", white_listed_eip_155_transaction_hashes);
std::env::set_var("MAX_LOGS", max_logs.to_string());
std::env::set_var("MAX_FELTS_IN_CALLDATA", max_felts_in_calldata.to_string());
std::env::set_var("KAKAROT_ADDRESS", "0x03d937c035c878245caf64531a5756109c53068da139362728feb561405371cb");

// Hardcoded expected values
let expected_constant = Constant {
max_logs: Some(max_logs),
starknet_network: (starknet_network).to_string(),
max_felts_in_calldata,
white_listed_eip_155_transaction_hashes: vec![B256::from_str(white_listed_eip_155_transaction_hashes).unwrap()],
kakarot_address: Felt::from_hex("0x03d937c035c878245caf64531a5756109c53068da139362728feb561405371cb").unwrap(),
};

// Start the Kakarot RPC server
Expand Down

0 comments on commit 443e148

Please sign in to comment.