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

l1-filter: Add TxFilterConfig #458

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

bewakes
Copy link
Contributor

@bewakes bewakes commented Nov 7, 2024

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

/// Addresses that are spent to
SpentToAddrs(Vec<BitcoinAddress>),
/// Blob ids that are expected
BlobIds(Vec<Buf32>),
Copy link
Contributor Author

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.

Copy link
Contributor

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();
Copy link
Contributor Author

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>),
Copy link
Contributor

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.

Comment on lines +47 to +48
/// For deposits that might be spent from.
expected_outpoints: Vec<(Buf32, u32)>,
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be max length.

Comment on lines +55 to +56
/// Deposit denomination
deposit_denomination: u64, // sats
Copy link
Contributor

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.

Comment on lines +58 to +59
/// Operators addr
operator_addr: BitcoinAddress,
Copy link
Contributor

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.

Comment on lines +63 to +66
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)?;

Copy link
Contributor

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> {
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants