-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add coinbase depth and tx id inclusion proof to BitcoinLightClient
#1863
base: nightly
Are you sure you want to change the base?
Conversation
plan is to merge #1935 then update genesises for tests that start with Fork2 in this PR. we might want to implement fork2 function here so that we can keep backwards compatibility easily. this would also mean we should update the bridge to use this new function. that can be this PR or another one. only after these we can merge this PR. then we'll need a followup PR for #1913 |
@@ -32,6 +38,7 @@ contract BitcoinLightClient is IBitcoinLightClient { | |||
blockNumber = _blockNumber; | |||
} | |||
|
|||
/// @notice Kept for backwards compatibility |
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.
add warning that this should not be called and calling it will invalidate L2 block after Fork2 activates
/// @param _proof Merkle proof | ||
/// @param _index Index of the transaction | ||
/// @return If the transaction ID is included in the merkle root hash of the block | ||
function verifyInclusionByTxId(uint256 _blockNumber, bytes32 _txId, bytes calldata _blockHeader, bytes calldata _proof, uint256 _index) external view returns (bool) { |
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.
sneaking in features I see :)
}); | ||
system_events | ||
} | ||
|
||
/// Populates system events based on the current soft confirmation info. | ||
pub fn populate_system_events<'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.
I might rewrite this
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.
taking notes
@@ -447,6 +450,7 @@ where | |||
|
|||
let evm_txs = self.get_best_transactions()?; | |||
|
|||
let coinbase_depth = short_header_proof.verify().unwrap().coinbase_txid_merkle_proof_height.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.
shouldn't handle it like this
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.
what's wrong with it
Description
BitcoinLightClient
to solve the merkle tree leaf node weakness issue.verifyInclusionByTxId
function that acts the same asverifyInclusion
but usestxId
instead ofwtxId
, as such, it requires a Bitcoin header parameter that is later validated against stored Bitcoin block hash.Linked Issues
BitcoinLightClient::setBlockInfo()
with coinbase txid merkle proof depth #1777Testing
Added unit tests for coinbase depth fail case and verifying inclusion through tx id.