AztecProtocol/zk-money

Inconsistent speed and fee combinations

Closed this issue · 1 comments

The speed and fee-pricing combinations shown seems inconsistent. Looking below the user can pay a larger fee to get a slower transaction which don't sound right. Logically, paying to be included in the next rollup, should never be slower than going batched.

image

There seems to be a flaw in the logic that is used to derive the batched time. From the code:

formatAverageTimeoutSeconds(averageTimeoutSeconds?: number) {
  if (averageTimeoutSeconds) return '~' + moment(Date.now() + averageTimeoutSeconds * 1000).fromNow(true);
  return '';
}

it looks like the avereageTimeout is always applied to "now". Regardless of when the last execution happened, e.g., timestamp essentially assuming that bridge just executed.

A more correct guess should be to take last execution into account, e.g., if average time is 2 hours, and it was executed 1 hour ago, the expected time should be ~1 hour, not 2. Seems like it is only getting averageGasPerHour and averageTimeout when querying, so zk-money don't know when the last execution was.

Fixing it fully is larger setup that seems to require changes deeper down. Will make an initial fix for the weird look here, then make another issue for this comment.