-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add nonce validation to trusted calls #225
Conversation
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.
you have added the two files block.rs
and test.rs
to this PR although they are actually missing commits from the previsous PR. this is not good. please make them their own PR which we will merge first, with their own commit message
* add trusted getter for nonce * exchange get_nonce client function with trusted getter * remove obsolete system api * remove pool validation (state must not be loaded for every tx)
All issues above should now be fixed in my opinion. The only thing missing is your proposal of the local storage of the nonce within the client. I opened issue #231 accordingly. Should we treat this as an seperate issue or do you want this to be included in this PR first? |
stf/src/sgx.rs
Outdated
} else { | ||
debug!("sender balance is zero"); | ||
ext.execute_with(|| { | ||
let mut root_account = AccountId::default(); |
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 do you use the term root
if it isn't meant as superuser? Why don't you clone the account in-place?
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.
or call it sender
instead?
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.
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.
fixed with commit 7f33b2a
stf/src/sgx.rs
Outdated
let result = match call.call { | ||
TrustedCall::balance_set_balance(root, who, free_balance, reserved_balance) => { | ||
root_account = root.clone(); | ||
validate_nonce(&root_account, call.nonce)?; |
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 don't you do this before match
?
It is a convention that the first argument of a TrustedCall is the caller's accountid, so you don't actually need to know what call it is to extract the accountid I guess?
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.
not sure if the problem is different number of arguments for enum values.....is there a idiomatic solution?
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.
fixed with commit 7f33b2a
closes #89
and some bug fixes (unit tests & block.rs went missing somewhere in the merging process..)