@@ -9,10 +9,7 @@ import (
9
9
"github.com/cosmos/cosmos-sdk/types/accesscontrol"
10
10
"github.com/cosmos/cosmos-sdk/x/staking"
11
11
"github.com/sei-protocol/sei-chain/app/antedecorators"
12
- keepertest "github.com/sei-protocol/sei-chain/testutil/keeper"
13
12
"github.com/sei-protocol/sei-chain/x/dex/types"
14
- nitrokeeper "github.com/sei-protocol/sei-chain/x/nitro/keeper"
15
- nitrotypes "github.com/sei-protocol/sei-chain/x/nitro/types"
16
13
oraclekeeper "github.com/sei-protocol/sei-chain/x/oracle/keeper"
17
14
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
18
15
"github.com/stretchr/testify/require"
@@ -96,9 +93,9 @@ func (t FakeTx) FeeGranter() sdk.AccAddress {
96
93
return nil
97
94
}
98
95
99
- func CallGaslessDecoratorWithMsg (ctx sdk.Context , msg sdk.Msg , oracleKeeper oraclekeeper.Keeper , nitroKeeper nitrokeeper. Keeper ) error {
96
+ func CallGaslessDecoratorWithMsg (ctx sdk.Context , msg sdk.Msg , oracleKeeper oraclekeeper.Keeper ) error {
100
97
anteDecorators := []sdk.AnteFullDecorator {
101
- antedecorators .NewGaslessDecorator ([]sdk.AnteFullDecorator {sdk .DefaultWrappedAnteDecorator (FakeAnteDecoratorGasReqd {})}, oracleKeeper , nitroKeeper ),
98
+ antedecorators .NewGaslessDecorator ([]sdk.AnteFullDecorator {sdk .DefaultWrappedAnteDecorator (FakeAnteDecoratorGasReqd {})}, oracleKeeper ),
102
99
}
103
100
chainedHandler , depGen := sdk .ChainAnteDecorators (anteDecorators ... )
104
101
fakeTx := FakeTx {
@@ -118,7 +115,7 @@ func TestGaslessDecorator(t *testing.T) {
118
115
output = ""
119
116
anteDecorators := []sdk.AnteFullDecorator {
120
117
FakeAnteDecoratorOne {},
121
- antedecorators .NewGaslessDecorator ([]sdk.AnteFullDecorator {FakeAnteDecoratorTwo {}}, oraclekeeper.Keeper {}, nitrokeeper. Keeper {} ),
118
+ antedecorators .NewGaslessDecorator ([]sdk.AnteFullDecorator {FakeAnteDecoratorTwo {}}, oraclekeeper.Keeper {}),
122
119
FakeAnteDecoratorThree {},
123
120
}
124
121
chainedHandler , depGen := sdk .ChainAnteDecorators (anteDecorators ... )
@@ -166,12 +163,12 @@ func TestOracleVoteGasless(t *testing.T) {
166
163
}
167
164
168
165
// reset gasless
169
- err = CallGaslessDecoratorWithMsg (ctx , & vote1 , input .OracleKeeper , nitrokeeper. Keeper {} )
166
+ err = CallGaslessDecoratorWithMsg (ctx , & vote1 , input .OracleKeeper )
170
167
require .Error (t , err )
171
168
172
169
// reset gasless
173
170
gasless = true
174
- err = CallGaslessDecoratorWithMsg (ctx , & vote2 , input .OracleKeeper , nitrokeeper. Keeper {} )
171
+ err = CallGaslessDecoratorWithMsg (ctx , & vote2 , input .OracleKeeper )
175
172
require .NoError (t , err )
176
173
require .True (t , gasless )
177
174
}
@@ -180,7 +177,7 @@ func TestDexPlaceOrderGasless(t *testing.T) {
180
177
// this needs to be updated if its changed from constant true
181
178
// reset gasless
182
179
gasless = true
183
- err := CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & types.MsgPlaceOrders {}, oraclekeeper.Keeper {}, nitrokeeper. Keeper {} )
180
+ err := CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & types.MsgPlaceOrders {}, oraclekeeper.Keeper {})
184
181
require .NoError (t , err )
185
182
require .True (t , gasless )
186
183
}
@@ -202,44 +199,14 @@ func TestDexCancelOrderGasless(t *testing.T) {
202
199
// not whitelisted
203
200
// reset gasless
204
201
gasless = true
205
- err := CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & cancelMsg1 , oraclekeeper.Keeper {}, nitrokeeper. Keeper {} )
202
+ err := CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & cancelMsg1 , oraclekeeper.Keeper {})
206
203
require .NoError (t , err )
207
204
require .False (t , gasless )
208
205
209
206
// whitelisted
210
207
// reset gasless
211
208
gasless = true
212
- err = CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & cancelMsg2 , oraclekeeper.Keeper {}, nitrokeeper.Keeper {})
213
- require .NoError (t , err )
214
- require .True (t , gasless )
215
- }
216
-
217
- func TestNitroRecordTxDataGasless (t * testing.T ) {
218
- keeper , ctx := keepertest .NitroKeeper (t )
219
- // set with non-whitelisted addr
220
- nonWhitelistedMsg := nitrotypes.MsgRecordTransactionData {
221
- Sender : "someone" ,
222
- Slot : 1 ,
223
- StateRoot : "1234" ,
224
- Txs : []string {"5678" },
225
- }
226
- // reset gasless
227
- gasless = true
228
- err := CallGaslessDecoratorWithMsg (ctx , & nonWhitelistedMsg , oraclekeeper.Keeper {}, * keeper )
229
- require .NoError (t , err )
230
- require .False (t , gasless )
231
-
232
- // set with whitelisted addr
233
- keeper .SetParams (ctx , nitrotypes.Params {WhitelistedTxSenders : []string {"sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m" }})
234
- whitelistedMsg := nitrotypes.MsgRecordTransactionData {
235
- Sender : "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m" ,
236
- Slot : 1 ,
237
- StateRoot : "1234" ,
238
- Txs : []string {"5678" },
239
- }
240
- // reset gasless
241
- gasless = true
242
- err = CallGaslessDecoratorWithMsg (ctx , & whitelistedMsg , oraclekeeper.Keeper {}, * keeper )
209
+ err = CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & cancelMsg2 , oraclekeeper.Keeper {})
243
210
require .NoError (t , err )
244
211
require .True (t , gasless )
245
212
}
@@ -248,7 +215,7 @@ func TestNonGaslessMsg(t *testing.T) {
248
215
// this needs to be updated if its changed from constant true
249
216
// reset gasless
250
217
gasless = true
251
- err := CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & types.MsgRegisterContract {}, oraclekeeper.Keeper {}, nitrokeeper. Keeper {} )
218
+ err := CallGaslessDecoratorWithMsg (sdk .NewContext (nil , tmproto.Header {}, false , nil ), & types.MsgRegisterContract {}, oraclekeeper.Keeper {})
252
219
require .NoError (t , err )
253
220
require .False (t , gasless )
254
221
}
0 commit comments