airswap-aips icon indicating copy to clipboard operation
airswap-aips copied to clipboard

AIP 14: Use block number instead of block timestamp

Open wjmelements opened this issue 4 years ago • 1 comments

Summary

Order expiration will switch from block timestamp to block number.

Specification

The next iteration of the airswap order validator shall substitute the uint256 expiration Order field with uint256 blockNumber. Thus no ABI change is required.

User interfaces shall estimate the expiration time using the block number and mean block time if the block is at least 2 blocks in the future, and discourage users from sending transactions that must succeed in the next block. This will be more accurate than the current assumption, that block timestamp is anywhere near the current time.

Motivation

Block producers have a lot of control over block timestamp. Block timestamp has been historically off by several minutes, punishing makers by executing otherwise expired orders. Sometimes this drift is larger than the actual order duration, which confuses interfaces.

By contrast, miners have little to no control over block number.

Copyright

Copyright and related rights waived via CC0.

wjmelements avatar Jan 04 '21 21:01 wjmelements

Interesting proposal! Great contribution and insight @wjmelements!

tesla809 avatar Jan 11 '21 19:01 tesla809