From d1d3aff3698ba5fe2df5d312a953e04b97485051 Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:41:28 -0400 Subject: [PATCH] more tests --- protocol/x/clob/e2e/permissioned_keys_test.go | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/protocol/x/clob/e2e/permissioned_keys_test.go b/protocol/x/clob/e2e/permissioned_keys_test.go index 03d1906360..6a84b94733 100644 --- a/protocol/x/clob/e2e/permissioned_keys_test.go +++ b/protocol/x/clob/e2e/permissioned_keys_test.go @@ -116,6 +116,76 @@ func TestPlaceOrder_PermissionedKeys_Failures(t *testing.T) { constants.Order_Bob_Num0_Id11_Clob1_Buy5_Price40_GTB20.OrderId: false, }, }, + "Txn has authenticators specified, but it was removed": { + smartAccountEnabled: true, + blocks: []TestBlockWithMsgs{ + { + Block: 2, + Msgs: []TestSdkMsg{ + { + Msg: &aptypes.MsgAddAuthenticator{ + Sender: constants.BobAccAddress.String(), + AuthenticatorType: "MessageFilter", + Data: []byte("/cosmos.bank.v1beta1.MsgSend"), + }, + + Fees: constants.TestFeeCoins_5Cents, + Gas: 300_000, + AccountNum: []uint64{1}, + SeqNum: []uint64{1}, + Signers: []cryptotypes.PrivKey{constants.BobPrivateKey}, + + ExpectedRespCode: 0, + }, + }, + }, + { + Block: 4, + Msgs: []TestSdkMsg{ + { + Msg: &aptypes.MsgRemoveAuthenticator{ + Sender: constants.BobAccAddress.String(), + Id: 0, + }, + + Fees: constants.TestFeeCoins_5Cents, + Gas: 300_000, + AccountNum: []uint64{1}, + SeqNum: []uint64{2}, + Signers: []cryptotypes.PrivKey{constants.BobPrivateKey}, + + ExpectedRespCode: 0, + }, + }, + }, + { + Block: 6, + Msgs: []TestSdkMsg{ + { + Msg: clobtypes.NewMsgPlaceOrder( + testapp.MustScaleOrder( + constants.Order_Bob_Num0_Id11_Clob1_Buy5_Price40_GTB20, + testapp.DefaultGenesis(), + ), + ), + Authenticators: []uint64{0}, + + Fees: constants.TestFeeCoins_5Cents, + Gas: 0, + AccountNum: []uint64{1}, + SeqNum: []uint64{0}, + Signers: []cryptotypes.PrivKey{constants.BobPrivateKey}, + + ExpectedRespCode: aptypes.ErrAuthenticatorNotFound.ABCICode(), + ExpectedLog: aptypes.ErrAuthenticatorNotFound.Error(), + }, + }, + }, + }, + expectedOrderIdsInMemclob: map[clobtypes.OrderId]bool{ + constants.Order_Bob_Num0_Id11_Clob1_Buy5_Price40_GTB20.OrderId: false, + }, + }, "Txn rejected by signature verification authenticator": { smartAccountEnabled: true, blocks: []TestBlockWithMsgs{