Skip to content

Remove batching from event based decryption triggers#700

Open
konradkonrad wants to merge 3 commits into
mainfrom
fix/remove_event_based_batching
Open

Remove batching from event based decryption triggers#700
konradkonrad wants to merge 3 commits into
mainfrom
fix/remove_event_based_batching

Conversation

@konradkonrad
Copy link
Copy Markdown
Contributor

@konradkonrad konradkonrad commented May 5, 2026

This removes the "batching" when signing identities for event based decryption triggers. It also adds a mise based integration test, mise run test-event-decryption, to ensure the correct behavior.

Drive-by fixes:

  • I had to upgrade the postgres version from .tool-versions
  • There was a linting error that needed to be ignored (overflow warning when casting a blocknumber to uint).

Context is issue #698 / #699

Fixes #699

This adds (generated) integration tests and a `mise` test task for
ensuring the changed batching behavior when responding to event based
decryption triggers.

Context is #698
@konradkonrad konradkonrad force-pushed the fix/remove_event_based_batching branch from 422c1f9 to b4737dc Compare May 18, 2026 15:24
ActivationBlockNumber can not be negative, so no overflow risk here.
@konradkonrad konradkonrad marked this pull request as ready for review May 18, 2026 15:54
@konradkonrad konradkonrad marked this pull request as draft May 18, 2026 16:06
@konradkonrad konradkonrad marked this pull request as ready for review May 18, 2026 16:26
Copy link
Copy Markdown
Contributor

@jannikluhn jannikluhn left a comment

Choose a reason for hiding this comment

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

Fix itself looks good, but some comments on the tests

# ---------------------------------------------------------------------------


def query_db(sql: str, keyper_index: int = 0) -> str:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this function seems rather pointless and confusing, because all it does it flip arguments

return addr


def get_helper_bytecode(data_dir: Path) -> str:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we have a deploy script in the contracts repo that we can call instead, maybe even in the deploy task along the other contracts? Side effect would be that we don't redeploy it for every single run.

time.sleep(poll_interval)


def assert_no_batching(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this test is a bit too detailed and single purpose for an end to end test. Instead, I would only test that the expected decryption key(s) are produced (similar to what we do in test-decryption

@@ -0,0 +1,322 @@
#!/usr/bin/env -S uv run --script
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test setup is meant for setting up a testing environment and repeatedly running manual tests, like requesting keys and checking that it behaves as expected. This looks more like a full automated e2e test. I think we should have those and that they should use the test setup, but they should not be part of it itself. The same applies to the already existing test-decryption (which is much smaller though).

To make it fit, I think this should be split up:

  • the test contract should be deployed as part of the existing deploy task
  • there should be a submit-event-registration task (not sure which parameters are needed)
  • there should be something like a trigger-event task to trigger the earlier registered event (not sure how it should be identified)
  • there should be a task to wait for the generated key, either with wait-for-decryption-key or a new task (again not sure which parameter is needed to identify the event)

This allows to run tests manually and repeatedly with more freedom, maybe even with different event parameters or trigger conditions.

# DB exists with tables. Re-initialize if the stored address doesn't match the config.
config_addr = utils.keyper_address(config_path)
db_addr = db_ethereum_address(database_name)
if db_addr.lower() != config_addr.lower():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this (and the other changes in this file) seem unnecessary, why would the address change? And if they change, silently redeploying doesn't seem like the right fix

return None


def get_uups_proxy_address(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this function often returns None or continues instead of raising an error when there's actually a broken/unexpected input file

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.

Use one event identity per key-share/key-release message

2 participants