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

add kakarot address in Constant #1499

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
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
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
Loading