-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
x/auth: Get accounts 1 by 1 #3093
Labels
T: Performance
Performance improvements
Comments
This is the context of the ante handler I take it? |
Yes |
func getSignerAccs(ctx sdk.Context, am AccountKeeper, addrs []sdk.AccAddress) (accs []Account, res sdk.Result) {
accs = make([]Account, len(addrs))
for i := 0; i < len(accs); i++ {
accs[i] = am.GetAccount(ctx, addrs[i])
if accs[i] == nil {
return nil, sdk.ErrUnknownAddress(addrs[i].String()).Result()
}
}
return
} |
5 tasks
alessio
pushed a commit
that referenced
this issue
Dec 14, 2018
- Don't read all accounts in one go as signature verification could fail before last signature is checked. - TestAnteHandlerFees now checks whether fees were actually deducted from the account as well as the fee keeper collected them. Thanks: @ValarDragon for pointing this out Closes: #3093
alessio
pushed a commit
that referenced
this issue
Dec 18, 2018
- Don't read all accounts in one go as signature verification could fail before last signature is checked. - TestAnteHandlerFees now checks whether fees were actually deducted from the account as well as the fee keeper collected them. Thanks: @ValarDragon for pointing this out Closes: #3093
alessio
pushed a commit
that referenced
this issue
Dec 18, 2018
- Don't read all accounts in one go as signature verification could fail before last signature is checked. - TestAnteHandlerFees now checks whether fees were actually deducted from the account as well as the fee keeper collected them. Thanks: @ValarDragon for pointing this out Closes: #3093
cwgoes
pushed a commit
that referenced
this issue
Dec 18, 2018
* x/auth: fetch one account after another - Don't read all accounts in one go as signature verification could fail before last signature is checked. - TestAnteHandlerFees now checks whether fees were actually deducted from the account as well as the fee keeper collected them. Thanks: @ValarDragon for pointing this out Closes: #3093
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In auth we currently do the state read for all accounts, and then verify signatures one by one, stopping at the first failed signature. This is sub-optimal, as the first signature may be invalid but we've done the IO for all the other accounts. We should instead get the accounts one by one, and then verify its signature. This is important to do since this account checking logic can get spammed via CheckTx.
This should end up not being a honest-case significant performance hit as we don't gain much speed by batching those I/O operations. (IAVL isn't doing a batch read, and the relevant memory pages won't leave RAM under decent RAM assumptions. This will hurt instruction caching, but I think its worth it given that each of these I/O reads are independent and saving one I/O read far outweighs time lossed due to instruction cache misses. )
The text was updated successfully, but these errors were encountered: