-
Notifications
You must be signed in to change notification settings - Fork 12
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
Implemented a call to reportMalicious with 0 gas price #59
Conversation
Does this include the infrastructure to allow some transactions to be done without gas being charged? |
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.
Does this include the infrastructure to allow some transactions to be done without gas being charged?
@DemiMarie: No, only the methods to create a gas price 0 transaction, but not to allow it. That will be #57.
Ok(_) => warn!(target: "engine", "Reported malicious validator {}", address), | ||
Err(s) => warn!(target: "engine", "Validator {} could not be reported {}", address, s), | ||
} | ||
} | ||
|
||
fn report_benign(&self, address: &Address, _set_block: BlockNumber, block: BlockNumber) { | ||
let data = validator_report::functions::report_benign::encode_input(*address, block); | ||
match self.transact(data) { | ||
match self.transact(data, None) { |
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.
Shouldn't this also be 0? I think we want to allow validators to fully work with empty 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 wasn't sure about benign misbehaviour but now that you asked about it I double-checked the wiki and there isn't a big difference in how the two kinds of misbehaviour are reported. So it makes sense to zero gas price on that one too.
Speaking of empty accounts, is it correct not to zero gas
as well? I think it is but I'd like to double-check.
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 that's correct, yes: Service transactions do consume gas, but the gas doesn't cost anything. (But take everything I say with a mountain of salt…)
@@ -207,7 +209,7 @@ mod tests { | |||
assert_eq!(client.chain_info().best_block_number, 2); | |||
|
|||
// Check if misbehaving validator was removed. | |||
client.transact_contract(Default::default(), Default::default()).unwrap(); | |||
client.transact(Action::Call(Default::default()), Default::default(), None, None).unwrap(); |
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.
Isn't that equivalent to client.transact_contract(Default::default(), Default::default()).unwrap();
?
(Also, I don't understand what this line does at all: It calls the contract at address 0 with data 0?)
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.
No, the default Yes, you are right. I thought you removed Action
is Create
.transact_contract
and replaced it with transact
.
The line appears to attempt to create a transaction after the validator has been removed. The last assertion below ensures that that transaction didn't appear in any block.
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
* Make calls service transactions i.e. zero gas price. * call reportMalicious with 0 gas price * call reportBenign with 0 gas price as well
Fixes #50.
The
transact
function was cherry-picked from #52.