-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement perconfirmation distribution across the P2P network #71
Conversation
Node/src/utils/commit.rs
Outdated
@@ -5,19 +5,36 @@ use secp256k1::{ecdsa::Signature, Message, Secp256k1, SecretKey}; | |||
use serde::{Deserialize, Serialize}; | |||
use tiny_keccak::{Hasher, Keccak}; | |||
|
|||
// TODO add chain id to taiko | |||
const CHAIN_ID: [u8; 32] = [0u8; 32]; |
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 want to add a chain id as config parameter?
let block: Block = p2p_message.into(); | ||
tracing::debug!("Node received message from p2p: {:?}", block); | ||
// TODO: add block to preconfirmation queue | ||
let msg: PreconfirmationMessage = p2p_message.into(); |
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.
Would be nice to move the code for p2p message handling, into separate function
Node/src/node/mod.rs
Outdated
} | ||
} | ||
} else { | ||
tracing::warn!("Hash mismatch or failed to calculate hash."); |
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.
Why not match
result from L2TxListsCommit::from_preconf(msg.block_height, msg.tx_list_bytes).hash()
?
It would be possible to print the error from the hash function.
} else { | ||
tracing::error!("Failed to check signature"); | ||
} | ||
} |
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.
@smartprogrammer93 should we prove incorrect preconfirmation if the hash from the P2P message is wrong? Or just wait for blockProposed event and prove it then? And the same with the verification of the signature.
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.
I've just seen in the: https://www.notion.so/nethermind/EXT-Design-Doc-Taiko-Preconfirmation-PoC-74db78ff89df4aa8983ed1e640a05359?pvs=4#6e4d601afbeb481795a90894533627a0
That we ignore wrong preconfirmations from the P2P.
@mikhailUshakoff let's just log that we ignore it
Node/src/node/mod.rs
Outdated
tracing::error!("Failed to advance head: {}", e); | ||
} | ||
} else { | ||
tracing::error!("Failed to check signature"); |
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.
As above, printing error would be helpful :-)
Node/src/utils/config.rs
Outdated
@@ -195,6 +196,8 @@ impl Config { | |||
boot_nodes, | |||
}; | |||
|
|||
let taiko_chain_id = 1u64; |
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.
Let's read it from the ENV var.
No description provided.