-
Notifications
You must be signed in to change notification settings - Fork 117
feat(ethexe): Added separate type for network announces #4957
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
base: master
Are you sure you want to change the base?
Conversation
…-offchain-tx # Conflicts: # ethexe/service/src/lib.rs
…x' into laz/ethexe/3-blocks/network-announce # Conflicts: # ethexe/consensus/src/validator/producer.rs # ethexe/consensus/src/validator/subordinate.rs # ethexe/consensus/src/validator/tx_pool.rs # ethexe/db/src/database.rs # ethexe/network/src/db_sync/responses.rs # ethexe/processor/src/handling/mod.rs # ethexe/processor/src/lib.rs
…x' into laz/ethexe/3-blocks/network-announce # Conflicts: # ethexe/processor/src/lib.rs
…/network-announce # Conflicts: # core/src/rpc.rs # ethexe/common/src/db.rs # ethexe/common/src/injected.rs # ethexe/common/src/primitives.rs # ethexe/consensus/src/connect/mod.rs # ethexe/consensus/src/lib.rs # ethexe/consensus/src/validator/producer.rs # ethexe/consensus/src/validator/subordinate.rs # ethexe/consensus/src/validator/tx_pool.rs # ethexe/db/src/database.rs # ethexe/db/src/verifier.rs # ethexe/processor/src/handling/mod.rs # ethexe/processor/src/lib.rs # ethexe/rpc/Cargo.toml # ethexe/rpc/src/test_utils.rs # ethexe/service/src/lib.rs # ethexe/service/src/tests/mod.rs
…/network-announce # Conflicts: # ethexe/common/src/network.rs # ethexe/consensus/src/connect/mod.rs # ethexe/consensus/src/validator/producer.rs # ethexe/consensus/src/validator/subordinate.rs # ethexe/consensus/src/validator/tx_pool.rs # ethexe/network/src/db_sync/responses.rs # ethexe/processor/src/tests.rs # ethexe/service/src/lib.rs # ethexe/service/src/tests/mod.rs
…/network-announce
…/network-announce
…/network-announce # Conflicts: # ethexe/network/src/validator/topic.rs # ethexe/service/src/fast_sync.rs # ethexe/service/src/tests/mod.rs
…/network-announce # Conflicts: # ethexe/common/src/injected.rs # ethexe/consensus/src/tx_validation.rs # ethexe/consensus/src/validator/producer.rs # ethexe/consensus/src/validator/tx_pool.rs # ethexe/network/src/validator/topic.rs # ethexe/service/src/tests/mod.rs
| } | ||
| } | ||
|
|
||
| impl NetworkAnnounce { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pls add comments to differences in methods announce_hash and to_hash?
Or maybe should remove announce_hash method to avoid possible future errors connected with hashing
| std = [ | ||
| "nonempty/std", | ||
| "gear-core/std", | ||
| "sp-core/std", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already exists, pls remove this line
| } | ||
| } | ||
|
|
||
| impl ToDigest for NetworkAnnounce { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I am not sure about this implementation. And I am not sure, that we need it
| let tx_hash = tx.data().to_hash(); | ||
| for tx_hash in announce.injected_transactions.iter() { | ||
| let Some(tx) = self.ctx.core.db.injected_transaction(*tx_hash) else { | ||
| tracing::warn!(?tx_hash, "Not found injected transaction body"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls use here
tracing::warn!(%tx_hash, "Not found injected transaction body");| let Some(promise) = self.ctx.core.db.promise(tx_hash) else { | ||
| tracing::warn!(tx_hash = ?tx_hash, "Not found promise for injected transaction"); | ||
| let Some(promise) = self.ctx.core.db.promise(tx.data().to_hash()) else { | ||
| tracing::warn!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls use here:
tracing::warn!(tx_hash = %tx.data().to_hash(), "Not found promise for injected transaction");| let mut outdated_txs = vec![]; | ||
|
|
||
| for (reference_block, tx_hash) in self.inner.iter() { | ||
| let Some(tx) = self.db.injected_transaction(*tx_hash) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls remove this. You will get full tx body in TxValidityChecker, so it is a unnecessary db query.
| match tx_checker.check_tx_validity(&tx)? { | ||
| match tx_checker.check_tx_validity(tx_hash)? { | ||
| TxValidity::Valid => { | ||
| tracing::trace!(tx_hash = ?tx_hash, tx = ?tx.data(), "tx is valid, including to announce"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove pls here tx = ?tx.data(), we don't need to log here a full tx data, the hash is enough
| mem::take(chain), | ||
| self.commitment_delay_limit, | ||
| announces.into_iter().map(|a| (a.to_hash(), a)).collect(), | ||
| announces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we set injected transactions in database when receive result from db_sync?
| .1 | ||
| .into_iter() | ||
| .map(|a| (a.to_hash(), a)) | ||
| .map(|a| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here I am not sure now that we save transactions to database
| AnnounceNotFound(HashOf<Announce>), | ||
| AnnounceIsNotComputed(HashOf<Announce>), | ||
| AnnounceIsNotIncluded(HashOf<Announce>), | ||
| AnnounceOffChainTransactionsNotEmpty(HashOf<Announce>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a good one
I can no understand why we have this error variant
No description provided.