yetanotherco / aligned_layer

Aligned is a verification layer for zero-knowledge proofs using EigenLayer. Our mission is to accelerate the adoption of zero-knowledge and validity proofs on Ethereum.
https://alignedlayer.com/
MIT License
136 stars 336 forks source link

feat: add limit on aggregator spending #910

Closed uri-99 closed 1 week ago

uri-99 commented 2 weeks ago

This PR

To Deploy

This PR changes no memory, so a normal upgrade must be run for both AlignedLayerServiceManager and BatcherPaymentService.

To Test

Happy Path

make anvil_start_with_block_time
make aggregator_start
make operator_register_and_start
make batcher_start_local
make run_explorer

And when they finish starting up, you can send proofs:

make batcher_send_risc0_burst

Playing around max_fee_allowed_to_respond

For this you can do, for example:

github-actions[bot] commented 2 weeks ago

Changes to gas cost

Generated at commit: 5340a87bb111fbd194e3c80221e2f758a57e3edd, compared to commit: 7c32f6180a5353ab9339b6db695cff4175db3111

šŸ§¾ Summary (10% most significant diffs)

Contract Method Avg (+/-) %
AlignedLayerServiceManager batchesState
createNewTask
+114 āŒ
+25,688 āŒ
+18.66%
+50.04%

Full diff report šŸ‘‡
| Contract | Deployment Cost (+/-) | Method | Min (+/-) | % | Avg (+/-) | % | Median (+/-) | % | Max (+/-) | % | # Calls (+/-) | |:-|-:|:-|-:|-:|-:|-:|-:|-:|-:|-:|-:| | **AlignedLayerServiceManager** | 4,667,209 (+43,467) | _batchesState_
_createNewTask_
_receive_ | 725 (+114)
56,931 (+5,793)
21,163 (-23,890) | **+18.66%**
**+11.33%**
**-53.03%** | 725 (+114)
77,020 (+25,688)
44,866 (-187) | **+18.66%**
**+50.04%**
**-0.42%** | 725 (+114)
77,035 (+25,813)
45,053 (0) | **+18.66%**
**+50.39%**
**0.00%** | 725 (+114)
78,128 (+26,240)
45,053 (0) | **+18.66%**
**+50.57%**
**0.00%** | 256 (0)
256 (0)
256 (0) |
taturosati commented 1 week ago

Happy path is not working, getting revert with 0x5c54305e0000000000000000000000007969c5ed335650692bc04293b07f5bf2e7a673c00000000000000000000000000000000000000000000000000002e357ab61e200000000000000000000000000000000000000000000000000000171abd5b0f100 which is InsufficientFunds

More info regarding this, doing a cast send does not fix this issue. I think the cause of this is that the batcher payment service needs to have balance and not the batcher itself.

I had to change the multiplier to 1 for some batches to get it started. This gives it some balance for it to have enough for the 2x multiplier.

Possible solution to this is adding a method on the batcher payment service to fund itself on the aligned service manager (which would basically be a transfer from contract to contract).

uri-99 commented 1 week ago

@taturosati Added deposit funds to AlignedLayerServiceManager in make anvil_deploy_aligned_contracts . No new function was needed to implement this, the existing depositToBatcher(address) was used