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

add bloom filter to payment received endpoint #110

Open
yenicelik opened this issue Jun 8, 2023 · 2 comments
Open

add bloom filter to payment received endpoint #110

yenicelik opened this issue Jun 8, 2023 · 2 comments

Comments

@yenicelik
Copy link
Contributor

yenicelik commented Jun 8, 2023

A first version is already there, but it's not working properly. I'm actually unsure if bloom filters have a 100% search guarantee.


    let payment_factory_address = app
        .config
        .deposit_factory_contract
        .context("A deposit_contract must be provided in the config to parse payments")?;

    let payment_factory_contract =
        PaymentFactory::new(payment_factory_address, app.internal_provider().clone());

    // check bloom filter to be sure this transaction contains any relevant logs
    if let Some(ValueOrArray::Value(Some(x))) = payment_factory_contract
        .payment_received_filter()
        .filter
        .topics[0]
    {
        let bloom_input = BloomInput::Hash(x.as_fixed_bytes());

        // do a quick check that this transaction contains the required log
        if !transaction_receipt.logs_bloom.contains_input(bloom_input) {
            return Err(Web3ProxyError::BadRequest("no matching logs found".into()));
        }
    }

@BlinkyStitt
Copy link
Contributor

There are false positives, but never false negatives

@BlinkyStitt
Copy link
Contributor

We can save this for after launch

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

No branches or pull requests

2 participants