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

[NOT FOR MERGE] core-v24.7.1 #2231

Closed
wants to merge 5 commits into from
Closed
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

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 18 additions & 16 deletions core/lib/dal/src/transactions_web3_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use zksync_db_connection::{
match_query_as,
};
use zksync_types::{
api, api::TransactionReceipt, Address, L2BlockNumber, L2ChainId, Transaction,
ACCOUNT_CODE_STORAGE_ADDRESS, FAILED_CONTRACT_DEPLOYMENT_BYTECODE_HASH, H256, U256,
api, api::TransactionReceipt, event::DEPLOY_EVENT_SIGNATURE, Address, L2BlockNumber, L2ChainId,
Transaction, CONTRACT_DEPLOYER_ADDRESS, H256, U256,
};

use crate::{
Expand Down Expand Up @@ -35,22 +35,25 @@ impl TransactionsWeb3Dal<'_, '_> {
hashes: &[H256],
) -> DalResult<Vec<TransactionReceipt>> {
let hash_bytes: Vec<_> = hashes.iter().map(H256::as_bytes).collect();
// Clarification for first part of the query(`WITH` clause):
// Looking for `ContractDeployed` event in the events table
// to find the address of deployed contract
let mut receipts: Vec<TransactionReceipt> = sqlx::query_as!(
StorageTransactionReceipt,
r#"
WITH
sl AS (
events AS (
SELECT DISTINCT
ON (storage_logs.tx_hash) *
ON (events.tx_hash) *
FROM
storage_logs
events
WHERE
storage_logs.address = $1
AND storage_logs.tx_hash = ANY ($3)
events.address = $1
AND events.topic1 = $2
AND events.tx_hash = ANY ($3)
ORDER BY
storage_logs.tx_hash,
storage_logs.miniblock_number DESC,
storage_logs.operation_number DESC
events.tx_hash,
events.event_index_in_tx DESC
)
SELECT
transactions.hash AS tx_hash,
Expand All @@ -67,21 +70,20 @@ impl TransactionsWeb3Dal<'_, '_> {
transactions.gas_limit AS gas_limit,
miniblocks.hash AS "block_hash",
miniblocks.l1_batch_number AS "l1_batch_number?",
sl.key AS "contract_address?"
events.topic4 AS "contract_address?"
FROM
transactions
JOIN miniblocks ON miniblocks.number = transactions.miniblock_number
LEFT JOIN sl ON sl.value != $2
AND sl.tx_hash = transactions.hash
LEFT JOIN events ON events.tx_hash = transactions.hash
WHERE
transactions.hash = ANY ($3)
AND transactions.data != '{}'::jsonb
"#,
// ^ Filter out transactions with pruned data, which would lead to potentially incomplete / bogus
// transaction info.
ACCOUNT_CODE_STORAGE_ADDRESS.as_bytes(),
FAILED_CONTRACT_DEPLOYMENT_BYTECODE_HASH.as_bytes(),
&hash_bytes as &[&[u8]]
CONTRACT_DEPLOYER_ADDRESS.as_bytes(),
DEPLOY_EVENT_SIGNATURE.as_bytes(),
&hash_bytes as &[&[u8]],
)
.instrument("get_transaction_receipts")
.with_arg("hashes.len", &hashes.len())
Expand Down
2 changes: 1 addition & 1 deletion core/node/consensus/src/era.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub async fn run_main_node(
// For now in case of error we just log it and allow the server
// to continue running.
if let Err(err) = super::run_main_node(ctx, cfg, secrets, ConnectionPool(pool)).await {
tracing::error!(%err, "Consensus actor failed");
tracing::error!("Consensus actor failed: {err:#}");
} else {
tracing::info!("Consensus actor stopped");
}
Expand Down
13 changes: 11 additions & 2 deletions core/node/state_keeper/src/io/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::{
L1BatchParams, L2BlockParams, PendingBatchData, StateKeeperIO,
},
mempool_actor::l2_tx_filter,
metrics::KEEPER_METRICS,
metrics::{L2BlockSealReason, AGGREGATION_METRICS, KEEPER_METRICS},
seal_criteria::{IoSealCriteria, L2BlockMaxPayloadSizeSealer, TimeoutSealer},
updates::UpdatesManager,
MempoolGuard,
Expand Down Expand Up @@ -63,10 +63,19 @@ impl IoSealCriteria for MempoolIO {

fn should_seal_l2_block(&mut self, manager: &UpdatesManager) -> bool {
if self.timeout_sealer.should_seal_l2_block(manager) {
AGGREGATION_METRICS.l2_block_reason_inc(&L2BlockSealReason::Timeout);
return true;
}
self.l2_block_max_payload_size_sealer

if self
.l2_block_max_payload_size_sealer
.should_seal_l2_block(manager)
{
AGGREGATION_METRICS.l2_block_reason_inc(&L2BlockSealReason::PayloadSize);
return true;
}

false
}
}

Expand Down
Loading
Loading