Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect "deadline" field description in IERC20Permit #4892

Open
0xVolosnikov opened this issue Feb 12, 2024 · 4 comments
Open

Incorrect "deadline" field description in IERC20Permit #4892

0xVolosnikov opened this issue Feb 12, 2024 · 4 comments

Comments

@0xVolosnikov
Copy link
Contributor

This line states that deadline must be in the future

* - `deadline` must be a timestamp in the future.

However, in fact, the current timestamp can also be used.

@Amxx
Copy link
Collaborator

Amxx commented Feb 12, 2024

Using the current timestamps works if you can

  • sign the message
  • put it in a transaction
  • sign the transaction
  • broadcast the transaction
  • get the transaction included in a block

All in under one seconds.

So yes, that is theoretically possible, but in practice very unrealistic. I'm not sure anyone should ever assume that all that could happen that fast. For sure I would not encourage anyone do that.

How would you rewrite this line?

@0xVolosnikov
Copy link
Contributor Author

0xVolosnikov commented Feb 12, 2024

Maybe something like "must be a timestamp in the future or at the time the function is called"?

Also this scenario can be simpler: the transaction can simply be included in the block with this timestamp for some reason (especially on "slow" blockchains)

@Amxx
Copy link
Collaborator

Amxx commented Feb 12, 2024

the transaction can simply be included in the block with this timestamp for some reason (especially on "slow" blockchains)

That is what I'm saying above. You need to:

  • get the timestamp and use it in a structure
  • the signature of the EIP712 data,
  • wrap that in a transaction,
  • sign the transaction,
  • broadcast the transaction
  • get that into a block (miner/validator preparing the block) ... with the same timestamp that you got ... so all the above steps need to be in the same timestamp (second?)

If the blockchain is "slow", that last point does not happens very often. Its once every 12 seconds on mainnet. The slower the chain, the less likelly it is that a block will be produce at the same second, and that to work.

Again, I think its unrealistic that anyone would ever sign a Permit with a deadline less than 1 minute in the future.

@0xVolosnikov
Copy link
Contributor Author

You are right that this is not a normal and is a rare event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants