@@ -40,7 +40,6 @@ import (
40
40
"code.vegaprotocol.io/vega/core/idgeneration"
41
41
"code.vegaprotocol.io/vega/core/netparams"
42
42
"code.vegaprotocol.io/vega/core/pow"
43
- "code.vegaprotocol.io/vega/core/processor/ratelimit"
44
43
"code.vegaprotocol.io/vega/core/snapshot"
45
44
"code.vegaprotocol.io/vega/core/teams"
46
45
"code.vegaprotocol.io/vega/core/txn"
@@ -211,7 +210,6 @@ type App struct {
211
210
log * logging.Logger
212
211
cancelFn func ()
213
212
stopBlockchain func () error
214
- rates * ratelimit.Rates
215
213
216
214
// service injection
217
215
assets Assets
@@ -306,15 +304,11 @@ func NewApp(log *logging.Logger,
306
304
app := & App {
307
305
abci : abci .New (codec ),
308
306
309
- log : log ,
310
- vegaPaths : vegaPaths ,
311
- cfg : config ,
312
- cancelFn : cancelFn ,
313
- stopBlockchain : stopBlockchain ,
314
- rates : ratelimit .New (
315
- config .Ratelimit .Requests ,
316
- config .Ratelimit .PerNBlocks ,
317
- ),
307
+ log : log ,
308
+ vegaPaths : vegaPaths ,
309
+ cfg : config ,
310
+ cancelFn : cancelFn ,
311
+ stopBlockchain : stopBlockchain ,
318
312
assets : assets ,
319
313
banking : banking ,
320
314
broker : broker ,
@@ -1048,7 +1042,6 @@ func (app *App) OnBeginBlock(blockHeight uint64, blockHash string, blockTime tim
1048
1042
app .blockCtx = ctx
1049
1043
now := blockTime
1050
1044
app .time .SetTimeNow (ctx , now )
1051
- app .rates .NextBlock ()
1052
1045
app .currentTimestamp = app .time .GetTimeNow ()
1053
1046
app .previousTimestamp = app .time .GetTimeLastBatch ()
1054
1047
app .log .Debug ("ABCI service BEGIN completed" ,
@@ -1330,10 +1323,6 @@ func (app *App) OnCheckTx(ctx context.Context, _ *tmtypes.RequestCheckTx, tx abc
1330
1323
return ctx , & resp
1331
1324
}
1332
1325
1333
- // Check ratelimits
1334
- // FIXME(): temporary disable all rate limiting
1335
- _ , isval := app .limitPubkey (tx .PubKeyHex ())
1336
-
1337
1326
gasWanted , err := app .gastimator .CalcGasWantedForTx (tx )
1338
1327
if err != nil { // this error means the transaction couldn't be parsed
1339
1328
app .log .Error ("error getting gas estimate" , logging .Error (err ))
@@ -1347,30 +1336,9 @@ func (app *App) OnCheckTx(ctx context.Context, _ *tmtypes.RequestCheckTx, tx abc
1347
1336
app .log .Debug ("transaction passed checkTx" , logging .String ("tid" , tx .GetPoWTID ()), logging .String ("command" , tx .Command ().String ()))
1348
1337
}
1349
1338
1350
- if isval {
1351
- return ctx , & resp
1352
- }
1353
-
1354
1339
return ctx , & resp
1355
1340
}
1356
1341
1357
- // limitPubkey returns whether a request should be rate limited or not.
1358
- func (app * App ) limitPubkey (pk string ) (limit bool , isValidator bool ) {
1359
- // Do not rate limit validators nodes.
1360
- if app .top .IsValidatorVegaPubKey (pk ) {
1361
- return false , true
1362
- }
1363
-
1364
- key := ratelimit .Key (pk ).String ()
1365
- if ! app .rates .Allow (key ) {
1366
- app .log .Debug ("Rate limit exceeded" , logging .String ("key" , key ))
1367
- return true , false
1368
- }
1369
-
1370
- app .log .Debug ("RateLimit allowance" , logging .String ("key" , key ), logging .Int ("count" , app .rates .Count (key )))
1371
- return false , false
1372
- }
1373
-
1374
1342
func (app * App ) canSubmitTx (tx abci.Tx ) (err error ) {
1375
1343
defer func () {
1376
1344
if err != nil {
0 commit comments