Fixed Term Teller tokens can be created with an expiry in the past
The Fixed Term Teller does not allow tokens to be created with a timestamp in the past. This is a fact that protocols using this feature will expect to hold and build their systems around. However, users can submit expiry timestamps slightly in the future, which correlate to tokenIds in the past, which allows them to bypass this check.\\nIn `BondFixedTermTeller.sol`, the `create()` function allows protocols to trade their payout tokens directly for bond tokens. The expectation is that protocols will build their own mechanisms around this. It is explicitly required that they cannot do this for bond tokens that expire in the past, only those that have yet to expire:\\n```\\nif (expiry_ < block.timestamp) revert Teller_InvalidParams();\\n```\\n\\nHowever, because tokenIds round timestamps down to the latest day, protocols are able to get around this check.\\nHere's an example:\\nThe most recently expired token has an expiration time of 1668524400 (correlates to 9am this morning)\\nIt is currently 1668546000 (3pm this afternoon)\\nA protocol calls create() with an expiry of 1668546000 + 1\\nThis passes the check that `expiry_ >= block.timestamp`\\nWhen the expiry is passed to `getTokenId()` it rounds the time down to the latest day, which is the day corresponding with 9am this morning\\nThis expiry associated with this tokenId is 9am this morning, so they are able to redeem their tokens instantly
Before checking whether `expiry_ < block.timestamp`, expiry should be rounded to the nearest day:\\n```\\nexpiry = ((vesting_ + uint48(block.timestamp)) / uint48(1 days)) * uint48(1 days);\\n```\\n
Protocols can bypass the check that all created tokens must have an expiry in the future, and mint tokens with a past expiry that can be redeemed immediately.\\nThis may not cause a major problem for Bond Protocol itself, but protocols will be building on top of this feature without expecting this behavior.\\nLet's consider, for example, a protocol that builds a mechanism where users can stake some asset, and the protocol will trade payout tokens to create bond tokens for them at a discount, with the assumption that they will expire in the future. This issue could create an opening for a savvy user to stake, mint bond tokens, redeem and dump them immediately, buy more assets to stake, and continue this cycle to earn arbitrage returns and tank the protocol's token.\\nBecause there are a number of situations like the one above where this issue could lead to a major loss of funds for a protocol building on top of Bond, I consider this a high severity.
```\\nif (expiry_ < block.timestamp) revert Teller_InvalidParams();\\n```\\n