This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Support a way to enforce certain rules for transactions
Solution
Add a new
PolicyMiddleware
type which wrapps a middleware and includes an instance of the newPolicy
trait, which is a single function to ensure a transaction is in compliance with this policy.Further work
common use cases could be to look up the receiver in a database and check if its address is whitelisted. Not sure yet what the most flexible implementation would be since a DB adapter is database specific and also how to check for a whitelisted address may be database model specific. So we could abstract basic use cases via some kind of
PolicyBackend
trait or smth which implements common functions for checkingis_whitelist(&self, recv: Address)
and also for checking the calldata maybe. We could also add a default persistent implementation of that (postgres for example) and aHashSet
based one and feature gate this.