AIP 14: Use block number instead of block timestamp

Migrated from AIP 14: Use block number instead of block timestamp · Issue #14 · airswap/AIPs · GitHub

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.