Skip to content
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

benchmarks: Add benchmark for block time to bank module #1332

Merged
merged 9 commits into from
Jun 27, 2018
Prev Previous commit
Next Next commit
Merge branch 'develop' into dev/add_bench
  • Loading branch information
ValarDragon committed Jun 27, 2018
commit 733c54dd241e9222dc6aabc96af674807ccf048b
23 changes: 5 additions & 18 deletions x/auth/mock/auth_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var (
func getMockApp(t *testing.T) *App {
mapp := NewApp()

mapp.Router().AddRoute("auth", auth.NewHandler(mapp.AccountMapper))
mapp.Router().AddRoute(msgType, func(ctx sdk.Context, msg sdk.Msg) (res sdk.Result) { return })
require.NoError(t, mapp.CompleteSetup([]*sdk.KVStoreKey{}))
return mapp
Expand Down Expand Up @@ -79,31 +78,19 @@ func TestMsgChangePubKey(t *testing.T) {
// Run a CheckDeliver
SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{testMsg1}, []int64{0}, []int64{0}, true, priv1)

changePubKeyMsg := auth.MsgChangeKey{
Address: addr1,
NewPubKey: priv2.PubKey(),
}

mapp.BeginBlock(abci.RequestBeginBlock{})
ctxDeliver := mapp.BaseApp.NewContext(false, abci.Header{})
acc2 := mapp.AccountMapper.GetAccount(ctxDeliver, addr1)

// send a MsgChangePubKey
res := SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{changePubKeyMsg}, []int64{0}, []int64{1}, true, priv1)
assert.Equal(t, sdk.ToABCICode(sdk.CodespaceRoot, sdk.CodeOK), res.Code, res.Log)
acc2 := mapp.AccountMapper.GetAccount(ctxDeliver, addr2)

acc2 = mapp.AccountMapper.GetAccount(ctxDeliver, addr1)

assert.True(t, priv2.PubKey().Equals(acc2.GetPubKey()))

// signing a SendMsg with the old privKey should be an auth error
// signing a SendMsg with the wrong privKey should be an auth error
mapp.BeginBlock(abci.RequestBeginBlock{})
tx := GenTx([]sdk.Msg{testMsg1}, []int64{0}, []int64{2}, priv1)
res = mapp.Deliver(tx)
assert.Equal(t, sdk.ToABCICode(sdk.CodespaceRoot, sdk.CodeUnauthorized), res.Code, res.Log)

// resigning the tx with the new correct priv key should work
res = SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{testMsg1}, []int64{0}, []int64{2}, true, priv2)
// resigning the tx with the old priv key should still work
res = SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{testMsg1}, []int64{0}, []int64{2}, true, priv1)

assert.Equal(t, sdk.ToABCICode(sdk.CodespaceRoot, sdk.CodeOK), res.Code, res.Log)
}

You are viewing a condensed version of this merge commit. You can view the full changes here.