osmosis-labs / mesh-security-sdk

MIT License
24 stars 12 forks source link

epoch query for x/meshsecurity #52

Open Anmol1696 opened 1 year ago

Anmol1696 commented 1 year ago

Overview

Currently there is no way of knowing what the current epoch is and when the next epoch is going to be.

Proposal

Add meshd q meshsecurity epoch query to get the current and next epoch. Should follow the interface as the epoch module in osmosis.

EpochInfos and current epochs: https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/epochs/query.proto#L12

NOTE: Default genesis creation does not have epoch information in the params. So it would be nice to be added too. Overwriting the genesis file would be enabled then.

Anmol1696 commented 1 year ago

Ahh, I guess this is a bit more tricky than that, since the default epoch module is not being used here, and the code seems to be such that, each task has a block at which it is scheduled based on the epoch length.

@alexanderbez @ethanfrey would that be correct? I am not sure in that case this epoch info would be useful.

Use case I had in mind was to know how much time/block to wait, so that specific tasks are triggered. I think this information should be generically available as well.

// when an epoch ends, the delegation rebalance is triggered

Maybe we can expose of the block on which the task is supposed to take black then?

alpe commented 1 year ago

It makes sense to have a query to return the next scheduled block for an rebalance.
It is not necessarily calculable by the fixed block distance as epoch but may be triggered by a slashing or other chain event as well.

Can you elaborate on your use case so that we return the "right data"?