mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-03-24 03:03:09 +00:00
clippy
This commit is contained in:
parent
a069004451
commit
0d46f0798a
@ -46,7 +46,7 @@ impl BedrockClient {
|
||||
info!("Creating Bedrock client with node URL {node_url}");
|
||||
let client = Client::builder()
|
||||
//Add more fields if needed
|
||||
.timeout(std::time::Duration::from_secs(60))
|
||||
.timeout(std::time::Duration::from_mins(1))
|
||||
.build()
|
||||
.context("Failed to build HTTP client")?;
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ impl SequencerClient {
|
||||
Ok(Self {
|
||||
client: Client::builder()
|
||||
// Add more fields if needed
|
||||
.timeout(std::time::Duration::from_secs(60))
|
||||
.timeout(std::time::Duration::from_mins(1))
|
||||
// Should be kept in sync with server keep-alive settings
|
||||
.pool_idle_timeout(std::time::Duration::from_secs(5))
|
||||
.build()?,
|
||||
|
||||
@ -177,11 +177,18 @@ pub fn TransactionPage() -> impl IntoView {
|
||||
encrypted_private_post_states,
|
||||
new_commitments,
|
||||
new_nullifiers,
|
||||
validity_window
|
||||
} = message;
|
||||
let WitnessSet {
|
||||
signatures_and_public_keys: _,
|
||||
proof,
|
||||
} = witness_set;
|
||||
let validity_window_formatted = match validity_window.0 {
|
||||
(Some(start), Some(end)) => format!("from {start} to {end}"),
|
||||
(Some(start), None) => format!("from {start}"),
|
||||
(None, Some(end)) => format!("until {end}"),
|
||||
(None, None) => "unbounded".to_owned(),
|
||||
};
|
||||
|
||||
let proof_len = proof.0.len();
|
||||
view! {
|
||||
@ -212,6 +219,10 @@ pub fn TransactionPage() -> impl IntoView {
|
||||
<span class="info-label">"Proof Size:"</span>
|
||||
<span class="info-value">{format!("{proof_len} bytes")}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">"Validity Window:"</span>
|
||||
<span class="info-value">{validity_window_formatted}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>"Public Accounts"</h3>
|
||||
|
||||
@ -13,7 +13,7 @@ use indexer_service_protocol::{
|
||||
CommitmentSetDigest, Data, EncryptedAccountData, HashType, MantleMsgId,
|
||||
PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage,
|
||||
ProgramDeploymentTransaction, ProgramId, PublicMessage, PublicTransaction, Signature,
|
||||
Transaction, WitnessSet,
|
||||
Transaction, WitnessSet, ValidityWindow
|
||||
};
|
||||
use jsonrpsee::{core::SubscriptionResult, types::ErrorObjectOwned};
|
||||
|
||||
@ -121,6 +121,7 @@ impl MockIndexerService {
|
||||
indexer_service_protocol::Nullifier([tx_idx as u8; 32]),
|
||||
CommitmentSetDigest([0xff; 32]),
|
||||
)],
|
||||
validity_window: ValidityWindow((None, None)),
|
||||
},
|
||||
witness_set: WitnessSet {
|
||||
signatures_and_public_keys: vec![],
|
||||
|
||||
@ -211,7 +211,7 @@ pub fn sequencer_config(
|
||||
max_block_size,
|
||||
mempool_max_size,
|
||||
block_create_timeout,
|
||||
retry_pending_blocks_timeout: Duration::from_secs(120),
|
||||
retry_pending_blocks_timeout: Duration::from_mins(2),
|
||||
port: 0,
|
||||
initial_accounts: initial_data.sequencer_initial_accounts(),
|
||||
initial_commitments: initial_data.sequencer_initial_commitments(),
|
||||
|
||||
@ -3044,7 +3044,7 @@ pub mod tests {
|
||||
if is_inside_validity_window {
|
||||
assert!(result.is_ok());
|
||||
} else {
|
||||
assert!(matches!(result, Err(NssaError::OutOfValidityWindow)))
|
||||
assert!(matches!(result, Err(NssaError::OutOfValidityWindow)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3106,7 +3106,7 @@ pub mod tests {
|
||||
if is_inside_validity_window {
|
||||
assert!(result.is_ok());
|
||||
} else {
|
||||
assert!(matches!(result, Err(NssaError::OutOfValidityWindow)))
|
||||
assert!(matches!(result, Err(NssaError::OutOfValidityWindow)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2741,7 +2741,7 @@ fn simple_amm_remove() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
@ -2822,7 +2822,7 @@ fn simple_amm_new_definition_inactive_initialized_pool_and_uninit_user_lp() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
@ -2907,7 +2907,7 @@ fn simple_amm_new_definition_inactive_initialized_pool_init_user_lp() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
@ -2980,7 +2980,7 @@ fn simple_amm_new_definition_uninitialized_pool() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
@ -3043,7 +3043,7 @@ fn simple_amm_add() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
@ -3101,7 +3101,7 @@ fn simple_amm_swap_1() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
@ -3152,7 +3152,7 @@ fn simple_amm_swap_2() {
|
||||
);
|
||||
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
state.transition_from_public_transaction(&tx).unwrap();
|
||||
state.transition_from_public_transaction(&tx, 1).unwrap();
|
||||
|
||||
let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id());
|
||||
let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id());
|
||||
|
||||
@ -336,7 +336,7 @@ impl<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> SequencerCore<BC, I
|
||||
fn next_block_id(&self) -> u64 {
|
||||
self.chain_height
|
||||
.checked_add(1)
|
||||
.expect(&format!("Max block height reached: {}", self.chain_height))
|
||||
.unwrap_or_else(|| panic!("Max block height reached: {}", self.chain_height))
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ mod tests {
|
||||
node_url: "http://not-used-in-unit-tests".parse().unwrap(),
|
||||
auth: None,
|
||||
},
|
||||
retry_pending_blocks_timeout: Duration::from_secs(60 * 4),
|
||||
retry_pending_blocks_timeout: Duration::from_mins(4),
|
||||
indexer_rpc_url: "ws://localhost:8779".parse().unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ mod tests {
|
||||
initial_accounts,
|
||||
initial_commitments: vec![],
|
||||
signing_key: *sequencer_sign_key_for_testing().value(),
|
||||
retry_pending_blocks_timeout: Duration::from_secs(60 * 4),
|
||||
retry_pending_blocks_timeout: Duration::from_mins(4),
|
||||
bedrock_config: BedrockConfig {
|
||||
backoff: BackoffConfig {
|
||||
start_delay: Duration::from_millis(100),
|
||||
|
||||
@ -77,8 +77,7 @@ pub unsafe extern "C" fn wallet_ffi_claim_pinata(
|
||||
match block_on(pinata.claim(pinata_id, winner_id, solution)) {
|
||||
Ok(response) => {
|
||||
let tx_hash = CString::new(response.tx_hash.to_string())
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -184,8 +183,7 @@ pub unsafe extern "C" fn wallet_ffi_claim_pinata_private_owned_already_initializ
|
||||
) {
|
||||
Ok((response, _shared_key)) => {
|
||||
let tx_hash = CString::new(response.tx_hash.to_string())
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -270,8 +268,7 @@ pub unsafe extern "C" fn wallet_ffi_claim_pinata_private_owned_not_initialized(
|
||||
match block_on(pinata.claim_private_owned_account(pinata_id, winner_id, solution)) {
|
||||
Ok((response, _shared_key)) => {
|
||||
let tx_hash = CString::new(response.tx_hash.to_string())
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
|
||||
@ -75,8 +75,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_public(
|
||||
match block_on(transfer.send_public_transfer(from_id, to_id, amount)) {
|
||||
Ok(response) => {
|
||||
let tx_hash = CString::new(response.tx_hash.to_string())
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -165,8 +164,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded(
|
||||
) {
|
||||
Ok((response, _shared_key)) => {
|
||||
let tx_hash = CString::new(response.tx_hash)
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -246,8 +244,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_deshielded(
|
||||
match block_on(transfer.send_deshielded_transfer(from_id, to_id, amount)) {
|
||||
Ok((response, _shared_key)) => {
|
||||
let tx_hash = CString::new(response.tx_hash)
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -335,8 +332,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_private(
|
||||
{
|
||||
Ok((response, _shared_key)) => {
|
||||
let tx_hash = CString::new(response.tx_hash)
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -419,8 +415,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded_owned(
|
||||
match block_on(transfer.send_shielded_transfer(from_id, to_id, amount)) {
|
||||
Ok((response, _shared_key)) => {
|
||||
let tx_hash = CString::new(response.tx_hash)
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -503,8 +498,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_private_owned(
|
||||
match block_on(transfer.send_private_transfer_to_owned_account(from_id, to_id, amount)) {
|
||||
Ok((response, _shared_keys)) => {
|
||||
let tx_hash = CString::new(response.tx_hash)
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -575,8 +569,7 @@ pub unsafe extern "C" fn wallet_ffi_register_public_account(
|
||||
match block_on(transfer.register_account(account_id)) {
|
||||
Ok(response) => {
|
||||
let tx_hash = CString::new(response.tx_hash.to_string())
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
@ -647,8 +640,7 @@ pub unsafe extern "C" fn wallet_ffi_register_private_account(
|
||||
match block_on(transfer.register_account_private(account_id)) {
|
||||
Ok((res, _secret)) => {
|
||||
let tx_hash = CString::new(res.tx_hash)
|
||||
.map(std::ffi::CString::into_raw)
|
||||
.unwrap_or(ptr::null_mut());
|
||||
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
|
||||
|
||||
unsafe {
|
||||
(*out_result).tx_hash = tx_hash;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user