Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
playX18 committed Dec 6, 2024
1 parent c5c6b86 commit 618b7fb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
5 changes: 4 additions & 1 deletion gear-programs/ethereum-event-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ fn main() {

let mut idl_path = PathBuf::from(bin_path);
idl_path.set_extension("idl");
sails_idl_gen::generate_idl_to_file::<ethereum_event_client_app::EthereumEventClientProgram>(idl_path).unwrap();
sails_idl_gen::generate_idl_to_file::<ethereum_event_client_app::EthereumEventClientProgram>(
idl_path,
)
.unwrap();
}
10 changes: 7 additions & 3 deletions gear-programs/ethereum-event-client/client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ fn main() {
let idl_file_path = out_dir_path.join("ethereum_event_client.idl");

// Generate IDL file for the program
sails_idl_gen::generate_idl_to_file::<ethereum_event_client_app::EthereumEventClientProgram>(&idl_file_path)
.unwrap();
sails_idl_gen::generate_idl_to_file::<ethereum_event_client_app::EthereumEventClientProgram>(
&idl_file_path,
)
.unwrap();

// Generate client code from IDL file
ClientGenerator::from_idl_path(&idl_file_path)
Expand All @@ -19,6 +21,8 @@ fn main() {
"ExecutionPayload",
"ethereum_common::beacon::light::ExecutionPayload",
)
.generate_to(PathBuf::from(env::var("OUT_DIR").unwrap()).join("ethereum_event_client_client.rs"))
.generate_to(
PathBuf::from(env::var("OUT_DIR").unwrap()).join("ethereum_event_client_client.rs"),
)
.unwrap();
}
8 changes: 6 additions & 2 deletions gear-programs/historical-proxy/app/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ where
drop(state);
// 1) check if proofs are correct and receive data for further processing
let check_proofs = {
let mut payload = ethereum_event_client_::ethereum_event_client::io::CheckProofs::ROUTE.to_vec();
let mut payload =
ethereum_event_client_::ethereum_event_client::io::CheckProofs::ROUTE.to_vec();
payload.extend_from_slice(&proofs);
payload
};
Expand All @@ -121,7 +122,10 @@ where
})?,
)
.map_err(|e| {
ProxyError::DecodeFailure(format!("failed to decode reply from ethereum-event-client: {:?}", e))
ProxyError::DecodeFailure(format!(
"failed to decode reply from ethereum-event-client: {:?}",
e
))
})?
.map_err(ProxyError::EthereumEventClient)?;
// 2) Invoke client with a receipt. Uses route and address suplied by the user.
Expand Down
14 changes: 11 additions & 3 deletions gear-programs/historical-proxy/app/tests/gclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ async fn connect_to_node() -> (GearApi, ActorId, CodeId, CodeId, GasUnit, [u8; 4
let ethereum_event_client_code_id = match lock.2 {
Some(code_id) => code_id,
None => {
let (code_id, _) = api.upload_code(ethereum_event_client::WASM_BINARY).await.unwrap();
let (code_id, _) = api
.upload_code(ethereum_event_client::WASM_BINARY)
.await
.unwrap();
lock.2 = Some(code_id);
code_id
}
Expand Down Expand Up @@ -75,7 +78,9 @@ async fn proxy() {

let (api, admin, proxy_code_id, relay_code_id, gas_limit, salt) = connect_to_node().await;
println!("node spun up, code uploaded, gas_limit={}", gas_limit);
let factory = ethereum_event_client_client::EthereumEventClientFactory::new(GClientRemoting::new(api.clone()));
let factory = ethereum_event_client_client::EthereumEventClientFactory::new(
GClientRemoting::new(api.clone()),
);
let ethereum_event_client_program_id = factory
.new(admin)
.with_gas_limit(gas_limit)
Expand All @@ -95,7 +100,10 @@ async fn proxy() {
historical_proxy_client::HistoricalProxy::new(GClientRemoting::new(api.clone()));

proxy_client
.add_endpoint(message.proof_block.block.slot, ethereum_event_client_program_id)
.add_endpoint(
message.proof_block.block.slot,
ethereum_event_client_program_id,
)
.send_recv(proxy_program_id)
.await
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion gear-programs/historical-proxy/app/tests/shared.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use alloy::rpc::types::TransactionReceipt;
use alloy_rlp::Encodable;
use ethereum_event_client_client::{BlockInclusionProof, EthToVaraEvent};
use ethereum_common::{
beacon::light::Block,
utils::{self as eth_utils, BeaconBlockHeaderResponse, BeaconBlockResponse, MerkleProof},
};
use ethereum_event_client_client::{BlockInclusionProof, EthToVaraEvent};
use serde::Deserialize;

pub const HOLESKY_RECEIPTS_2_498_456: &[u8; 160_144] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use checkpoint_light_client_io::ethereum_common::{
utils::{self as eth_utils, MerkleProof},
SLOTS_PER_EPOCH,
};
use ethereum_event_client_client::{BlockInclusionProof, EthToVaraEvent};
use ethereum_client::EthApi;
use ethereum_event_client_client::{BlockInclusionProof, EthToVaraEvent};

pub async fn compose(
beacon_client: &BeaconClient,
Expand Down

0 comments on commit 618b7fb

Please sign in to comment.