Skip to content

Commit bebff4d

Browse files
committed
disable liquidity provision submission
1 parent 7a523de commit bebff4d

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

processor/abci.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
var (
2626
ErrPublicKeyExceededRateLimit = errors.New("public key exceeded the rate limit")
2727
ErrPublicKeyCannotSubmitTransactionWithNoBalance = errors.New("public key cannot submit transaction with no balance")
28+
ErrLiquidityProvisionCommandNotSupported = errors.New("command LiquidityProvisionSubmittion is not supported")
2829
)
2930

3031
type App struct {
@@ -268,6 +269,33 @@ func (app *App) OnCommit() (resp tmtypes.ResponseCommit) {
268269
func (app *App) OnCheckTx(ctx context.Context, _ tmtypes.RequestCheckTx, tx abci.Tx) (context.Context, tmtypes.ResponseCheckTx) {
269270
resp := tmtypes.ResponseCheckTx{}
270271

272+
// FIXME(): The two following checks are here just to ensure
273+
// some features are disabled in the .30.0 release.
274+
275+
// First we do not allow parties to create LiquidityProvision
276+
if tx.Command() == txn.LiquidityProvisionCommand {
277+
resp.Code = abci.AbciTxnValidationFailure
278+
resp.Data = []byte(ErrLiquidityProvisionCommandNotSupported.Error())
279+
return ctx, resp
280+
}
281+
282+
// Second we check the proposal for a market
283+
// would not submit a liquidity provision as part of it too.
284+
if tx.Command() == txn.ProposeCommand {
285+
s := &types.Proposal{}
286+
if err := tx.Unmarshal(s); err != nil {
287+
resp.Code = abci.AbciTxnDecodingFailure
288+
return ctx, resp
289+
}
290+
if s.GetTerms() != nil &&
291+
s.Terms.GetNewMarket() != nil &&
292+
s.Terms.GetNewMarket().GetLiquidityCommitment() != nil {
293+
resp.Code = abci.AbciTxnValidationFailure
294+
resp.Data = []byte(ErrLiquidityProvisionCommandNotSupported.Error())
295+
return ctx, resp
296+
}
297+
}
298+
271299
// Check ratelimits
272300
limit, isval := app.limitPubkey(tx.PubKey())
273301
if isval {

0 commit comments

Comments
 (0)