From cdfd1304a5d9a6b6b8dc2b84fa9db994d49ff86b Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 15 Nov 2021 15:14:57 +1100 Subject: [PATCH] Skip memory intensive engine test (#2809) * Allocate less memory (3GB) in engine tests * Run cargo format * Remove tx too large test Co-authored-by: Michael Sproul --- .../execution_layer/src/engine_api/http.rs | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/beacon_node/execution_layer/src/engine_api/http.rs b/beacon_node/execution_layer/src/engine_api/http.rs index fabe9a437..7aa1ca9d8 100644 --- a/beacon_node/execution_layer/src/engine_api/http.rs +++ b/beacon_node/execution_layer/src/engine_api/http.rs @@ -569,7 +569,7 @@ mod test { VariableList, E::MaxTransactionsPerPayload>, serde_json::Error, > { - let json = json!({ + let mut json = json!({ "parentHash": HASH_00, "coinbase": ADDRESS_01, "stateRoot": HASH_01, @@ -583,8 +583,11 @@ mod test { "extraData": "0x", "baseFeePerGas": "0x1", "blockHash": HASH_01, - "transactions": transactions, }); + // Take advantage of the fact that we own `transactions` and don't need to reserialize it. + json.as_object_mut() + .unwrap() + .insert("transactions".into(), transactions); let ep: JsonExecutionPayload = serde_json::from_value(json)?; Ok(ep.transactions) } @@ -671,24 +674,6 @@ mod test { decode_transactions::(serde_json::to_value(too_many_txs).unwrap()) .is_err() ); - - /* - * Check for transaction too large - */ - - use eth2_serde_utils::hex; - - let num_max_bytes = ::MaxBytesPerTransaction::to_usize(); - let max_bytes = (0..num_max_bytes).map(|_| 0_u8).collect::>(); - let too_many_bytes = (0..=num_max_bytes).map(|_| 0_u8).collect::>(); - decode_transactions::( - serde_json::to_value(&[hex::encode(&max_bytes)]).unwrap(), - ) - .unwrap(); - assert!(decode_transactions::( - serde_json::to_value(&[hex::encode(&too_many_bytes)]).unwrap() - ) - .is_err()); } #[tokio::test]