-
Notifications
You must be signed in to change notification settings - Fork 1
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
l1-filter: Add TxFilterConfig #458
base: main
Are you sure you want to change the base?
Conversation
/// Addresses that are spent to | ||
SpentToAddrs(Vec<BitcoinAddress>), | ||
/// Blob ids that are expected | ||
BlobIds(Vec<Buf32>), |
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.
These vecs can be sorted and then we can do binary search.
Having Vec
instead of Individual items lets us group the items, sort and do binary search as we want.
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.
It doesn't make sense to have a list of rules where there there's multiple entries of the same variant. And in most cases we expect that all variants will end up being present exactly once. The ticket specified using a struct for this instead of a list of enum instances, and we'd do the filtering based on that directly.
block: &Block, | ||
filter_config: TxFilterConfig, | ||
) -> Vec<ProtocolOpTxRef> { | ||
let filter_rules = filter_config.into_rules(); |
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.
The config is converted to existing rules with added variants. We can add complex logic here if needed. But this should probably suffice.
/// Addresses that are spent to | ||
SpentToAddrs(Vec<BitcoinAddress>), | ||
/// Blob ids that are expected | ||
BlobIds(Vec<Buf32>), |
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.
It doesn't make sense to have a list of rules where there there's multiple entries of the same variant. And in most cases we expect that all variants will end up being present exactly once. The ticket specified using a struct for this instead of a list of enum instances, and we'd do the filtering based on that directly.
/// For deposits that might be spent from. | ||
expected_outpoints: Vec<(Buf32, u32)>, |
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.
Should use a dedicated type for this.
// For bridge V1 deposits that do bitmap flagging for the multisig addr. | ||
// operator_key_tbl: PublickeyTable, | ||
/// EE addr length | ||
ee_addr_len: u8, |
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.
Should be max length.
/// Deposit denomination | ||
deposit_denomination: u64, // sats |
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.
Don't bake this in as a single value, it should be capable of being extended to support multiple denominations easily even if we don't support this today.
/// Operators addr | ||
operator_addr: BitcoinAddress, |
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.
Possibly redundant, this would be part of expected_addrs
.
pub fn from_rollup_params(rollup_params: &RollupParams) -> anyhow::Result<Self> { | ||
let operator_wallet_pks = get_operator_wallet_pks(rollup_params); | ||
let address = generate_taproot_address(&operator_wallet_pks, rollup_params.network)?; | ||
|
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.
We will be be computing the rules based on the last checkpoint's bridge state and the rollup params. I'm not sure this function should be on this type.
tx: &Transaction, | ||
filters: &[TxFilterRule], | ||
) -> Option<ProtocolOperation> { | ||
fn extract_protocol_op(tx: &Transaction, filters: &[TxFilterRule]) -> Option<ProtocolOperation> { |
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.
Rework this to operate with the config directly.
Description
Type of Change
Checklist
Related Issues