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

refactor: migrate ante hanlders to middlewares #10028

Merged
merged 115 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
48da6e2
Replace abci calls with txHandler
amaury1093 Aug 12, 2021
3e4d7b6
still WIP
amaury1093 Aug 12, 2021
096d103
Use inner
amaury1093 Aug 12, 2021
11bd37f
runTx middleware
amaury1093 Aug 13, 2021
c666dc9
Fix some tests
amaury1093 Aug 13, 2021
664f8d7
Simplify runMsgs
amaury1093 Aug 13, 2021
25a643e
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am/m…
amaury1093 Aug 13, 2021
ac74030
Fix ante event emitting
amaury1093 Aug 13, 2021
0b8f940
Use context.Context
amaury1093 Aug 16, 2021
080c6af
Small refactor
amaury1093 Aug 16, 2021
c3911f8
Fix antehandler events
amaury1093 Aug 16, 2021
6582496
Add Simulate
amaury1093 Aug 16, 2021
a900541
Fix gasInfo
amaury1093 Aug 16, 2021
6b1f9d7
Add gas tx middleware
amaury1093 Aug 16, 2021
bbf2872
Fix baseapp_test
amaury1093 Aug 16, 2021
dd32108
Fix tests
amaury1093 Aug 17, 2021
60d43dc
Fix grpc SimulateTx test
amaury1093 Aug 18, 2021
4451a4b
Fix slashing test
amaury1093 Aug 18, 2021
7f071da
Merge branch 'master' into am/middleware
amaury1093 Aug 18, 2021
c5c0247
Fix mock tests
amaury1093 Aug 18, 2021
67a2cd5
Fix antehandlers test
amaury1093 Aug 19, 2021
788d7a0
Merge branch 'master' into am/middleware
alexanderbez Aug 20, 2021
8fee5b9
Address reviews
amaury1093 Aug 23, 2021
43c4de0
Merge branch 'am/middleware' of ssh://github.com/cosmos/cosmos-sdk in…
amaury1093 Aug 23, 2021
00fce8c
More reviews
amaury1093 Aug 23, 2021
e5a076f
Fix tests
amaury1093 Aug 23, 2021
dd70e91
Merge branch 'master' into am/middleware
alexanderbez Aug 23, 2021
61d1013
Switch ComposeMiddlewares order
amaury1093 Aug 24, 2021
74167e9
Fix test
amaury1093 Aug 24, 2021
0bb9c48
Merge branch 'master' into am/middleware
amaury1093 Aug 24, 2021
bcba471
migrate RejectExtensionOptions
amaury1093 Aug 25, 2021
8d763ba
migrate mempool to middleware
atheeshp Aug 25, 2021
2595b27
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Aug 30, 2021
16caed2
remove WithContext
atheeshp Aug 30, 2021
967b3a3
migrate `ValidateBasicDecorator` to middleware
atheeshp Aug 30, 2021
011b793
migrate `TxTimeoutHeightDecorator` to middleware
atheeshp Aug 30, 2021
5b15fd8
migrate `ValidateMemoDecorator` to middleware
atheeshp Aug 30, 2021
6d1f27c
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 1, 2021
ef64904
migrate `ConsumeGasForTxSize` to middleware
atheeshp Sep 1, 2021
3d4ee4a
migrate `DeductFee` ante to middleware
atheeshp Sep 1, 2021
ba7379d
migrate signature ante to middlewares
atheeshp Sep 3, 2021
49f6539
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 7, 2021
a92ba52
fix failing tests
atheeshp Sep 7, 2021
7f1e831
fix tests
atheeshp Sep 7, 2021
a04988d
fix tests
atheeshp Sep 7, 2021
39dab39
migrate ante tests
atheeshp Sep 8, 2021
57a0796
migrate tests
atheeshp Sep 8, 2021
4850b04
migrate tests
atheeshp Sep 8, 2021
a77202a
fix tests
atheeshp Sep 8, 2021
acb784f
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 8, 2021
8ff193a
refactor
atheeshp Sep 8, 2021
4864fd2
fix tests
atheeshp Sep 9, 2021
748501e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 9, 2021
404be63
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 13, 2021
ae35f45
fix lint
atheeshp Sep 13, 2021
83a1174
split baseapp_test.go
atheeshp Sep 14, 2021
e77f9b1
remove unused
atheeshp Sep 14, 2021
8a25fa7
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 14, 2021
ce31800
update docs
atheeshp Sep 16, 2021
d47dd19
fix error
atheeshp Sep 16, 2021
b0409e7
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 16, 2021
06ca566
update docs
atheeshp Sep 16, 2021
f6b0d66
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 16, 2021
0adee13
reivew suggestions
atheeshp Sep 16, 2021
6aee9bb
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 16, 2021
99e3155
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 16, 2021
9212400
fix tests
atheeshp Sep 17, 2021
0516575
remove alias
atheeshp Sep 17, 2021
bd3a861
fix tests
atheeshp Sep 18, 2021
8d72020
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 18, 2021
4066eef
fix tests
atheeshp Sep 18, 2021
8fc3c06
fix tests
atheeshp Sep 18, 2021
785a697
refactor
atheeshp Sep 18, 2021
adec5ff
refactor
atheeshp Sep 18, 2021
cf680e2
fix tests
atheeshp Sep 20, 2021
c01b79f
Merge branch 'atheesh/refactor-mw' of github.com:cosmos/cosmos-sdk in…
atheeshp Sep 20, 2021
13b9988
refactor
atheeshp Sep 20, 2021
2277aa9
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 20, 2021
d51d294
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 20, 2021
daf658d
fix test
atheeshp Sep 20, 2021
ff12cc3
fix tests
atheeshp Sep 21, 2021
0482ae0
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 21, 2021
e289188
fix msg service router
atheeshp Sep 21, 2021
9d5aead
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 21, 2021
9737db3
refactor msg service router tests
atheeshp Sep 21, 2021
f4a3040
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 22, 2021
0995d4a
fix rosetta
atheeshp Sep 22, 2021
f6c2e53
review changes
atheeshp Sep 22, 2021
24832b4
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 22, 2021
9b2c116
review changes
atheeshp Sep 22, 2021
0cf38e1
Use NewDefaultTxHandler where possible
amaury1093 Sep 23, 2021
7740e97
review changes
atheeshp Sep 23, 2021
9c554cf
Merge branch 'am/ah-to-mw-2' of github.com:cosmos/cosmos-sdk into ath…
atheeshp Sep 23, 2021
2a55b8b
review changes
atheeshp Sep 23, 2021
a3bf0b3
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 23, 2021
1ba2327
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 27, 2021
e5a30a5
refactor
atheeshp Sep 28, 2021
174a345
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 28, 2021
2ac74d5
merge middleware_test.go & baseapp_test.go
atheeshp Sep 28, 2021
31633eb
refactor some tests
amaury1093 Sep 28, 2021
04c4e6c
Refactor some more tests
amaury1093 Sep 28, 2021
d9613b0
address review changes
atheeshp Sep 29, 2021
8fd1631
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 29, 2021
3380782
Merge branch 'atheesh/ah-to-mw' of github.com:cosmos/cosmos-sdk into …
atheeshp Sep 29, 2021
bf037a8
revert baseapp_test
atheeshp Sep 29, 2021
c519525
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 29, 2021
736694b
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 30, 2021
03f27a9
address review changes
atheeshp Sep 30, 2021
cebf66f
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Sep 30, 2021
129408e
Merge branch 'master' into atheesh/ah-to-mw
alexanderbez Sep 30, 2021
f5e1104
address review changes
atheeshp Oct 1, 2021
9e51928
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Oct 1, 2021
8039aef
Merge branch 'atheesh/ah-to-mw' of github.com:cosmos/cosmos-sdk into …
atheeshp Oct 1, 2021
1b76b50
add todo
atheeshp Oct 1, 2021
5a4208a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/ah…
atheeshp Oct 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 28 additions & 27 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package baseapp
package baseapp_test

import (
"fmt"
Expand All @@ -9,6 +9,7 @@ import (
tmprototypes "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -18,81 +19,81 @@ func TestGetBlockRentionHeight(t *testing.T) {
name := t.Name()

testCases := map[string]struct {
bapp *BaseApp
bapp *baseapp.BaseApp
maxAgeBlocks int64
commitHeight int64
expected int64
}{
"defaults": {
bapp: NewBaseApp(name, logger, db, nil),
bapp: baseapp.NewBaseApp(name, logger, db, nil),
maxAgeBlocks: 0,
commitHeight: 499000,
expected: 0,
},
"pruning unbonding time only": {
bapp: NewBaseApp(name, logger, db, nil, SetMinRetainBlocks(1)),
bapp: baseapp.NewBaseApp(name, logger, db, nil, baseapp.SetMinRetainBlocks(1)),
maxAgeBlocks: 362880,
commitHeight: 499000,
expected: 136120,
},
"pruning iavl snapshot only": {
bapp: NewBaseApp(
bapp: baseapp.NewBaseApp(
name, logger, db, nil,
SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
SetMinRetainBlocks(1),
baseapp.SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
baseapp.SetMinRetainBlocks(1),
),
maxAgeBlocks: 0,
commitHeight: 499000,
expected: 490000,
},
"pruning state sync snapshot only": {
bapp: NewBaseApp(
bapp: baseapp.NewBaseApp(
name, logger, db, nil,
SetSnapshotInterval(50000),
SetSnapshotKeepRecent(3),
SetMinRetainBlocks(1),
baseapp.SetSnapshotInterval(50000),
baseapp.SetSnapshotKeepRecent(3),
baseapp.SetMinRetainBlocks(1),
),
maxAgeBlocks: 0,
commitHeight: 499000,
expected: 349000,
},
"pruning min retention only": {
bapp: NewBaseApp(
bapp: baseapp.NewBaseApp(
name, logger, db, nil,
SetMinRetainBlocks(400000),
baseapp.SetMinRetainBlocks(400000),
),
maxAgeBlocks: 0,
commitHeight: 499000,
expected: 99000,
},
"pruning all conditions": {
bapp: NewBaseApp(
bapp: baseapp.NewBaseApp(
name, logger, db, nil,
SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
SetMinRetainBlocks(400000),
SetSnapshotInterval(50000), SetSnapshotKeepRecent(3),
baseapp.SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
baseapp.SetMinRetainBlocks(400000),
baseapp.SetSnapshotInterval(50000), baseapp.SetSnapshotKeepRecent(3),
),
maxAgeBlocks: 362880,
commitHeight: 499000,
expected: 99000,
},
"no pruning due to no persisted state": {
bapp: NewBaseApp(
bapp: baseapp.NewBaseApp(
name, logger, db, nil,
SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
SetMinRetainBlocks(400000),
SetSnapshotInterval(50000), SetSnapshotKeepRecent(3),
baseapp.SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
baseapp.SetMinRetainBlocks(400000),
baseapp.SetSnapshotInterval(50000), baseapp.SetSnapshotKeepRecent(3),
),
maxAgeBlocks: 362880,
commitHeight: 10000,
expected: 0,
},
"disable pruning": {
bapp: NewBaseApp(
bapp: baseapp.NewBaseApp(
name, logger, db, nil,
SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
SetMinRetainBlocks(0),
SetSnapshotInterval(50000), SetSnapshotKeepRecent(3),
baseapp.SetPruning(sdk.PruningOptions{KeepEvery: 10000}),
baseapp.SetMinRetainBlocks(0),
baseapp.SetSnapshotInterval(50000), baseapp.SetSnapshotKeepRecent(3),
),
maxAgeBlocks: 362880,
commitHeight: 499000,
Expand Down Expand Up @@ -126,14 +127,14 @@ func TestBaseAppCreateQueryContextRejectsNegativeHeights(t *testing.T) {
logger := defaultLogger()
db := dbm.NewMemDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil)
app := baseapp.NewBaseApp(name, logger, db, nil)

proves := []bool{
false, true,
}
for _, prove := range proves {
t.Run(fmt.Sprintf("prove=%t", prove), func(t *testing.T) {
sctx, err := app.createQueryContext(-10, true)
sctx, err := app.CreateQueryContext(-10, true)
require.Error(t, err)
require.Equal(t, sctx, sdk.Context{})
})
Expand Down
Loading