add intial focil test

This commit is contained in:
Eitan Seri-Levi
2025-02-04 16:03:53 +02:00
parent 88afbb39be
commit 7414f485a3
4 changed files with 131 additions and 1 deletions

View File

@@ -2,9 +2,12 @@ use super::Context;
use crate::engine_api::{http::*, *};
use crate::json_structures::*;
use crate::test_utils::{DEFAULT_CLIENT_VERSION, DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI};
use crate::EthersTransaction;
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::Value as JsonValue;
use ssz_types::VariableList;
use std::sync::Arc;
use types::InclusionListTransactions;
pub const GENERIC_ERROR_CODE: i64 = -1234;
pub const BAD_PARAMS_ERROR_CODE: i64 = -32602;
@@ -686,6 +689,35 @@ pub async fn handle_rpc<E: EthSpec>(
Ok(serde_json::to_value(response).unwrap())
}
ENGINE_GET_INCLUSION_LIST_V1 => {
// This is a real transaction hex encoded, but we don't care about the contents of the transaction.
let transaction: EthersTransaction = serde_json::from_str(
r#"{
"blockHash":"0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
"blockNumber":"0x5daf3b",
"from":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"gas":"0xc350",
"gasPrice":"0x4a817c800",
"hash":"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
"input":"0x68656c6c6f21",
"nonce":"0x15",
"to":"0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
"transactionIndex":"0x41",
"value":"0xf3dbb76162000",
"v":"0x25",
"r":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
"s":"0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
}"#,
)
.unwrap();
let tx_list: InclusionListTransactions<E> =
vec![VariableList::new(transaction.rlp().to_vec())
.map_err(|e| format!("Failed to convert transaction to SSZ: {:?}", e))
.unwrap()]
.into();
Ok(serde_json::to_value(tx_list).unwrap())
}
other => Err((
format!("The method {} does not exist/is not available", other),
METHOD_NOT_FOUND_CODE,