-
Notifications
You must be signed in to change notification settings - Fork 51
Block malicous users #1434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block malicous users #1434
Conversation
And what about the RPCs? |
I Implemented five RPCs requested in the issue#1414 with the name |
Why do you implement them on the account while I designed it on the mempool? |
I changed wrongly implemented account RPCs to intended mempool RPCs. |
@HoOngEe Please give a reason if your implementation is different from the spec. |
I renamed the |
LGTM. But let me merge it after the next release. |
b969477
to
5565f6b
Compare
core/src/miner/miner.rs
Outdated
.read() | ||
.is_local_transaction(hash) | ||
.expect("The tx is clearly fetched from the mem pool") => {} | ||
_ => { |
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.
Other errors are safe to ban the error creators?
And what can we do to reduce some bugs when we add a new RuntimeError?
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.
Currently I cannot sure that the left runtime errors are considered as malicious behaviors. It's better to use the blacklist method when some errors are problematic.
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 picked the two problematic runtime errors RuntimeError::AssetSupplyOverflow
and RuntimeError::InvalidScript
and blacklisted them.
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.
@foriequal0 @sgkim126 What do you think about judging a malicious user only if the user's transaction failed with the blacklisted error?
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 think it can be fixed later.
self.importer.miner.register_immune_users(immune_user_vec) | ||
} | ||
|
||
fn get_network_id(&self) -> NetworkId { |
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.
Network id can be retrieved with EngineInfo::common_params(Latest)?.network_id()
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.
Modified.
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 meant that get_network_id()
is unnecessary.
core/src/client/client.rs
Outdated
self.importer.miner.get_malicious_users() | ||
} | ||
|
||
fn release_trusty_users(&self, trusty_vec: Vec<Address>) { |
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.
The objective trusty user
is not matching with the malicious user
.
It is actually a method that releases a malicious user
before.
And it doesn't match with the RPC method name unban_accounts
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 changed the name of release_trusty_users
to release_malicious_users
. For internal function names, I used "imprison" and "release" in a pair unlike the rpc name "ban" and "unban". Hence, I kept the verb "release" here. Is it better to unify the rpc name and the name of the internally called function?
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 think unifying it would be better.
b8e9911
to
e50b9ed
Compare
Immune users are immune from getting banned.
I judged the two runtime errors |
It closes #1414