metaplex-foundation / metaplex-program-library

Smart contracts maintained by the Metaplex team
Other
580 stars 511 forks source link

[Bug]: CM charging bot fee when there's clock drift #502

Closed alfongj closed 2 years ago

alfongj commented 2 years ago

Which package is this bug report for?

candy-machine

Which Type of Package is this bug report for?

Rust Contract

Issue description

Steps to repro:

  1. Set Candy Machine goLiveDate to X
  2. Tell users "you can mint at time X! :DD"
  3. Solana drift happens and Solana clock is 1hr behind real world clock
  4. Users go to mint at time X and all they get is a lousy empty token and -0.01 SOL in bot fees

Impact: Seems decent, by looking at the amount of bot tax paid the days since the drift: https://dune.com/queries/860510

Possible solutions:

Relevant log output

No response

Priority this issue should have

Medium (should be fixed soon)

alfongj commented 2 years ago

Example of a recent Candy Machine:

Screen Shot 2022-05-28 at 6 18 55 PM

In red: a spike of users who attempted to mint around 15 min of the goLiveDate, presumably because IRL / in the front end it was already time to mint

In green: requests when the mint actually opened

(I am not sure what explains the green requests pre goLiveDate, but they may be whitelisted mints)

https://dune.com/queries/860542

blockiosaurus commented 2 years ago

Hey @alfongj we definitely are tracking the occurrences on this issue, but due to the nature being derived from Solana's on-chain time our official stance is that all front-ends should use Solana's time as their source instead of off-chain time. This prevents the complexity of using an oracle and the backwards compatibility issues that that would cause. We've updated our front-end examples to reflect this stance, as well.

Solana's latest runtime release has also resolved the clock-drift issue, but feel free to re-open this ticket for further discussion should it occur again.

alfongj commented 2 years ago

Ok thanks. That was one of the suggested solutions on the OP.

Having said that this is still a bad UX if solaan drifts as users will need to know that launch dates will be delayed. But I get that solving it doesn't seem worth it if we think solana drift is not going to be that common