-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
block.timestamp
asserter for AA (#3031)
This PR adds the ability to use `block.timestamp` in custom AA contracts. AAs will still not have direct access to `block.timestamp`, but can utilize it via a proxy that enforces certain constraints. The PR introduces a `TimestampAsserter` contract that is deployed on every chain to the user space, similar to `Multicall3`. This contract has a single function, `assertTimestampInRange(start, end)`, which can be used by AAs at their discretion. The `TimestampAsserter` contract ensures that `block.timestamp` falls within the specified `(start, end)` range. Additionally, the sequencer verifies that the `block.timestamp` is sufficiently far from the range’s end. This is to prevent DoS attacks where transactions pass validation but get stuck in the mempool during execution. This constraint is configurable and can be adjusted without requiring protocol update. The PR also introduces two new fields to the `transactions` table: `timestamp_asserter_range_start` and `timestamp_asserter_range_end`. These fields are extracted during transaction execution in the sandbox by the `ValidationTracer`. If multiple assertions are made in a single transaction, the system captures the maximum of the starts and the minimum of the ends, resulting in the narrowest possible time range. Transactions with time range constraints will undergo additional verification before being included in a block. If the current time falls outside the transaction’s specified time range, the transaction will be rejected with an appropriate message. Sister PR in `era-contracts`: matter-labs/era-contracts#843 --------- Signed-off-by: Danil <[email protected]> Co-authored-by: Danil <[email protected]>
- Loading branch information
1 parent
1cfd426
commit 069d38d
Showing
87 changed files
with
1,491 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...lib/dal/.sqlx/query-1689c212d411ebd99a22210519ea2d505a1aabf52ff4136d2ed1b39c70dd1632.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...lib/dal/.sqlx/query-72a4f50355324cce85ebaef9fa32826095e9290f0c1157094bd0c44e06012e42.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.