CosmosContracts / bounties

MIT License
25 stars 12 forks source link

Invariant check bounty #22

Closed blazeroni closed 1 year ago

blazeroni commented 1 year ago

This is a claim for the invariants check bounty.

I know the bounty says to provide multiple proofs, but simply running running junod on the genesis file is a quick enough test. Instead of 10 hours, it now takes about 30 seconds - less than 1% of the previous time.

The root problem was not the sequential nature of the invariant checks, but one particular method used by the "can-withdraw" check. The issue is fairly deep in the cosmos code -- ultimately it was an issue with a cache not getting processed appropriately.

I submitted a PR (https://github.com/cosmos/cosmos-sdk/pull/12885) on cosmos-sdk which contains a fix for this issue. It amortizes the cost of processing cache entries and speeds things up dramatically. Since it's a lower level fix, it may also improve/prevent other issues unrelated to this specific issue.

You can get a build of junod with the change included here: (https://github.com/blazeroni/juno-bounty/tree/v9.0.0-invariants).

Let me know if you have any questions or need any more info. Cheers!

the-frey commented 1 year ago

Thanks for this submission! We will keep an eye on the upstream progress/merge.

In the meantime, we'll run the build you've provided (cheers!) to verify at our end.

blazeroni commented 1 year ago

@the-frey the fix has been merged into cosmos-sdk. It's also being backported to 0.45.x and 0.46.x.

Let me know if there's anything else you need from me.

onivalidator commented 1 year ago

@blazeroni Can you please confirm your Juno address for the invariants bounty by signing a transaction (https://juno.tools/sign-verify/) from the wallet you provided?

blazeroni commented 1 year ago

@onivalidator sure, here's the wallet, message, and signature:

juno168njtnauuyd0rjh5cdp2hls762enz2lqn2453u invariant bounty J/7MxAu7rO7QQqPlpxj4k7ER9yrQYXMr1GBNSUGUwSo7mo8Z4wTaUYXp0Ya6Hzy0ADxZDC1soQ7TVlXHvHRlhA==

blazeroni commented 1 year ago

@onivalidator any update on this?

onivalidator commented 1 year ago

@blazeroni Bounty payment is currently up for vote through the Core-1 DAODAO. You can follow along here (https://daodao.zone/dao/juno1gpwekludv6vu8pkpnp2hwwf7f84a7mcvgm9t2cvp92hvpxk07kdq8z4xj2/proposals/A10). There's a 50% bonus on top of base bounty for pure excellence in speeding up the invariant checks.

blazeroni commented 1 year ago

@onivalidator great, thank you!