-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Transaction permissioning #6441
Conversation
How about short description of the feature? :) |
ethcore/src/tx_filter.rs
Outdated
|
||
pub fn register_client(&self, client: Weak<BlockChainClient>) { | ||
*self.client.write() = Some(client); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant empty line
ethcore/src/tx_filter.rs
Outdated
self.permission_cache.lock().clear(); | ||
} | ||
|
||
pub fn register_client(&self, client: Weak<BlockChainClient>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undocumented public method
ethcore/src/tx_filter.rs
Outdated
|
||
} | ||
|
||
pub fn transaction_allowed(&self, parent_hash: &H256, transaction: &SignedTransaction) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undocumented public method
ethcore/src/tx_filter.rs
Outdated
|
||
mod tx_permissions { | ||
pub const _ALL: u32 = 0xffffffff; | ||
pub const NONE: u32 = 0x0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces instead of tabs
ethcore/src/tx_filter.rs
Outdated
const MAX_CACHE_SIZE: usize = 4096; | ||
|
||
mod tx_permissions { | ||
pub const _ALL: u32 = 0xffffffff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why _ALL
and not ALL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use the bitflags crate for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not want to introduce another dependency just for this. This type is used internally so a simple u32
is enough.
ethcore/src/tx_filter.rs
Outdated
pub const BASIC: u32 = 0b00000001; | ||
pub const CALL: u32 = 0b00000010; | ||
pub const CREATE: u32 = 0b00000100; | ||
pub const _PRIVATE: u32 = 0b00001000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why _PRIVATE
and not PRIVATE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To suppress compiler warning. This is currently unused
} | ||
|
||
impl ChainNotify for TransactionFilter { | ||
fn new_blocks(&self, imported: Vec<H256>, _invalid: Vec<H256>, _enacted: Vec<H256>, _retracted: Vec<H256>, _sealed: Vec<H256>, _proposed: Vec<Bytes>, _duration: u64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we're adding so many new chain-notify implementations, would be nice to not be cloning each of these vectors each time, especially since most of them only read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, although most of the time they only contain 0 or 1 elements.
|
||
fn register_client(&self, client: Weak<Client>) { | ||
if let Some(ref filter) = self.tx_filter { | ||
filter.register_client(client as Weak<BlockChainClient>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
engines are used in light clients too. requiring a full node to run consensus logic should have been a blocker for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
furthermore, I don't see why TX filtering would be coupled with the Ethash memory-hard PoW consensus system in the first place. it makes more sense in a permissioned environment anyway (and the way to make that happen is not by copy-pasting this feature to other engines whenever we want to use them together...)
* Update token updates * Update token info fetching * Update logger * Minor fixes to updates and notifications for balances * Use Pubsub * Fix timeout. * Use pubsub for status. * Fix signer subscription. * Process tokens in chunks. * Fix tokens loaded by chunks * Linting * Dispatch tokens asap * Fix chunks processing. * Better filter options * Parallel log fetching. * Fix signer polling. * Fix initial block query. * Token balances updates : the right(er) way * Better tokens info fetching * Fixes in token data fetching * Only fetch what's needed (tokens) * Fix linting issues * Revert "Transaction permissioning (#6441)" This reverts commit eed0e8b. * Revert "Revert "Transaction permissioning (#6441)"" This reverts commit 8f96415. * Update wasm-tests. * Fixing balances fetching * Fix requests tracking in UI * Fix request watching * Update the Logger * PR Grumbles Fixes * PR Grumbles fixes * Linting...
* Update token updates * Update token info fetching * Update logger * Minor fixes to updates and notifications for balances * Use Pubsub * Fix timeout. * Use pubsub for status. * Fix signer subscription. * Process tokens in chunks. * Fix tokens loaded by chunks * Linting * Dispatch tokens asap * Fix chunks processing. * Better filter options * Parallel log fetching. * Fix signer polling. * Fix initial block query. * Token balances updates : the right(er) way * Better tokens info fetching * Fixes in token data fetching * Only fetch what's needed (tokens) * Fix linting issues * Revert "Transaction permissioning (#6441)" This reverts commit eed0e8b. * Revert "Revert "Transaction permissioning (#6441)"" This reverts commit 8f96415. * Update wasm-tests. * Fixing balances fetching * Fix requests tracking in UI * Fix request watching * Update the Logger * PR Grumbles Fixes * PR Grumbles fixes * Linting...
* Fix slow balances (#6471) * Update token updates * Update token info fetching * Update logger * Minor fixes to updates and notifications for balances * Use Pubsub * Fix timeout. * Use pubsub for status. * Fix signer subscription. * Process tokens in chunks. * Fix tokens loaded by chunks * Linting * Dispatch tokens asap * Fix chunks processing. * Better filter options * Parallel log fetching. * Fix signer polling. * Fix initial block query. * Token balances updates : the right(er) way * Better tokens info fetching * Fixes in token data fetching * Only fetch what's needed (tokens) * Fix linting issues * Revert "Transaction permissioning (#6441)" This reverts commit eed0e8b. * Revert "Revert "Transaction permissioning (#6441)"" This reverts commit 8f96415. * Update wasm-tests. * Fixing balances fetching * Fix requests tracking in UI * Fix request watching * Update the Logger * PR Grumbles Fixes * PR Grumbles fixes * Linting... * eth_call returns output of contract creations (#6420) * eth_call returns output of contract creations * Fix parameters order. * Save outputs for light client as well. * Don't accept transactions above block gas limit. * Expose health status over RPC (#6274) * Node-health to a separate crate. * Initialize node_health outside of dapps. * Expose health over RPC. * Bring back 412 and fix JS. * Add health to workspace and tests. * Fix compilation without default features. * Fix borked merge. * Revert to generics to avoid virtual calls. * Fix node-health tests. * Add missing trailing comma. * Fixing/removing failing JS tests. * do not activate genesis epoch in immediate transition validator contract (#6349) * Fix memory tracing. * Add test to cover that. * ensure balances of constructor accounts are kept * test balance of spec-constructed account is kept
This adds a smart contract that governs transaction permissions. The contract accepts sender address and returns a mask of allowed transaction types for this address.