feat(hook): add allowlist hooks for pre-block transaction and contract filtering#233
Conversation
|
@ARR4N @StephenButtolph I am open to all types of comments and feedback here since this was my first time developing logic around libevm hooks and running them on the SAE side. I've tried my best to simulate the hook validation scenarios and I think that it is correct, but I might be missing something so your feedback here would be invaluable 🙏 |
|
We can't register any I recommend extending
Please don't refer to GitHub-specific entities in PR descriptions in lieu of details. It's OK to include them to trigger events (e.g. Closes <#>) but the descriptions become |
|
@ARR4N yes now I recalled that you mentioned that SAE should not register libevm hooks. It slipped my radar, sorry. I will adapt the implemntation via |
cf56218 to
fb07dc3
Compare
CanExecuteTransaction/CanCreateContract hookshook.Points for pre-block transaction and contract filtering
2976741 to
4a49643
Compare
…tion filtering Extend `hook.Points` with `CanExecuteTransaction`, mirroring `params.RulesAllowlistHooks` so consumers can use a single concrete type for both SAE and `libevm` hooks. Call `CanExecuteTransaction` via hooks in `worstcase.ApplyTx()` to exclude hook-rejected transactions before block inclusion, preventing fatal errors in the execution loop. - Add `CanExecuteTransaction` to `hook.Points` and `hookstest.Stub`. - Call `CanExecuteTransaction` in `worstcase.State.ApplyTx()` instead of through libevm rules hooks. - Remove dead rules field from `worstcase.State`. - Add `TestCanExecuteTransactionHook` in `worstcase` package verifying blocked senders are excluded and state is not modified. - Add `TestCanCreateContractSoftError` confirming `CanCreateContract` rejection produces a failed receipt, not a fatal crash. Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov@avalabs.org)
4a49643 to
6eb7be5
Compare
hook.Points for pre-block transaction and contract filteringSigned-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Extend
hook.PointswithCanExecuteTransaction, mirroringparams.RulesAllowlistHooksso consumers can use a single concrete type for both SAE andlibevmhooks. CallCanExecuteTransactionvia hooks inworstcase.ApplyTx()to exclude hook-rejected transactions before block inclusion, preventing fatal errors in the executionloop.
CanExecuteTransactiontohook.Pointsandhookstest.Stub.CanExecuteTransactioninworstcase.State.ApplyTx()instead of throughlibevmrules hooks.worstcase.State.TestCanExecuteTransactionHookinworstcasepackage verifying blocked senders are excluded and state is not modified.TestCanCreateContractSoftErrorconfirmingCanCreateContractrejection produces a failed receipt, not a fatal crash.Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov@avalabs.org)