penumbra-zone / penumbra

Penumbra is a fully private proof-of-stake network and decentralized exchange for the Cosmos ecosystem.
https://penumbra.zone
Apache License 2.0
381 stars 295 forks source link

Improve error message for epoch mismatch in (un)delegation #2786

Open hdevalence opened 1 year ago

hdevalence commented 1 year ago

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

(un)delegation transactions have to be prepared with respect to a specific epoch. This means that there's a narrow window close to the epoch boundary where a client could start preparing the tx with respect to the current parameters, and then have those parameters change before the tx can be submitted. This results in errors like

could not broadcast transaction: Error submitting transaction: code 1, log: delegation was prepared for epoch 160 but the next epoch is 159

and users are confused because nothing indicates they could retry.

Describe the solution you'd like

Change the error message to add ; try re-building and re-submitting the transaction at the end.

conorsch commented 1 year ago

This error message can appear (and has appeared) if one runs an old version of pcli against a newer testnet. However, it also appears if one submits a tx exactly on the epoch boundary, in which case the suggested error message would be very helpful.

conorsch commented 1 year ago

Relatedly, we want to adjust the interface for epoch boundaries: @zbuc will file (or cross-link) a follow-up issue to track.