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

Feat(blsagg): use block-based expiry instead of time-based #300

Open
samlaf opened this issue Jul 17, 2024 · 3 comments · May be fixed by #386
Open

Feat(blsagg): use block-based expiry instead of time-based #300

samlaf opened this issue Jul 17, 2024 · 3 comments · May be fixed by #386

Comments

@samlaf
Copy link
Collaborator

samlaf commented Jul 17, 2024

Is your feature request related to a problem? Please describe.

bls signature verification gas costs are linear in the # of non signers, so the fewer nonsigners, the cheaper the verification gas costs. Right now the API for the blsagg service to return an aggregate signature has 2 dofs:

  • minimum signed stake threshold (60%, 80%, etc.)
  • time to expiry (see this TODO)
    and the return condition is:
  • return whenever min threshold met
  • if threshold hasnt been met after n seconds, return an err

Describe the solution you'd like

AVSs that want low latency (at the cost of potential gas costs) need a more flexible API, in the form of:

  • minimum signed stake threshold
  • max # blocks of latency
  • num blocks to expiry
    with return condition being:
  • as soon as min signed stake threshold is met, return if max # blocks of latency have expired, otherwise keep aggregating for that many blocks. (this way can keep aggregating to reduce gas costs, but with a max # blocks of latency SLA)
  • if # blocks to expiry is met, return err

Describe alternatives you've considered

Mauro and Mariano, would this interface work for AlignedLayer?

@MauroToscano
Copy link

This would work. Thanks @samlaf. It could be max blocks or max time, whatever is easier to implement. If it's a block we would use it in 1 probably. Signatures are collected really fast, so waiting just 1 extra second would be enough.

@MauroToscano
Copy link

MauroToscano commented Oct 29, 2024

I'm adding some costs to have as data points, we collected using Aligned with different proportions of stake and amount of operators.

If you assume a uniform distribution of stake, the gas cost of the verification is this one:

Respond to Task costs, 2_3 of stake required, uniform distribution of stake

In reality, it's a paretto, that in the worst case, when only the biggest signers signatures are aggregated, works like this:

Respond to Task costs, 2_3 of stake required, Pareto distribution of stake (worst scenario)

As it can be seen, what should cost 280k quickly costs more than 1M.

In Aligned Testnet, numbers are in the middle of both cases, closer to Paretto worst case than the uniform case.

With the solution of waiting for more signature, costs should be 280k for all cases

@MauroToscano
Copy link

MauroToscano commented Oct 29, 2024

Also, just in case, title of the issue is misleading, since it doesn't matter if it's block or time based, but description is fine!

@TomasArrachea TomasArrachea linked a pull request Oct 30, 2024 that will close this issue
3 tasks
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 a pull request may close this issue.

2 participants