From 27a231cbfeab2deb09b8f213fc8772dde146b7dd Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Wed, 26 Oct 2022 23:53:38 -0400 Subject: [PATCH 01/17] rebase --- aclmapping/bank/mapping_test.go | 159 ++++++++++++++++++++ aclmapping/bank/mappings.go | 37 +++-- aclmapping/staking/mappings.go | 2 +- aclmapping/tokenfactory/mappings.go | 2 +- aclmapping/utils/identifier_templates.go | 2 +- aclmapping/utils/map[utils.Comparator]bool{ | 26 ++++ aclmapping/utils/validation.go | 103 +++++++++++++ app/app.go | 46 ++++-- go.mod | 4 +- go.sum | 8 +- 10 files changed, 355 insertions(+), 34 deletions(-) create mode 100644 aclmapping/bank/mapping_test.go create mode 100644 aclmapping/utils/map[utils.Comparator]bool{ create mode 100644 aclmapping/utils/validation.go diff --git a/aclmapping/bank/mapping_test.go b/aclmapping/bank/mapping_test.go new file mode 100644 index 0000000000..7c9ede0eec --- /dev/null +++ b/aclmapping/bank/mapping_test.go @@ -0,0 +1,159 @@ +package aclbankmapping + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" + acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/bank" + "github.com/cosmos/cosmos-sdk/x/bank/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + pp "github.com/k0kubun/pp/v3" + oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +) + + +func cacheTxContext(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) { + ms := ctx.MultiStore() + // TODO: https://github.com/cosmos/cosmos-sdk/issues/2824 + msCache := ms.CacheMultiStore() + return ctx.WithMultiStore(msCache), msCache +} + +func TestMsgBankSendAclOps(t *testing.T) { + priv1 := secp256k1.GenPrivKey() + addr1 := sdk.AccAddress(priv1.PubKey().Address()) + priv2 := secp256k1.GenPrivKey() + addr2 := sdk.AccAddress(priv2.PubKey().Address()) + coins := sdk.Coins{sdk.NewInt64Coin("foocoin", 10)} + + tests := []struct { + name string + expectedError error + msg *types.MsgSend + dynamicDep bool + }{ + { + name: "default send", + msg: types.NewMsgSend(addr1, addr2, coins), + expectedError: nil, + dynamicDep: true, + }, + { + name: "dont check synchronous", + msg: types.NewMsgSend(addr1, addr2, coins), + expectedError: nil, + dynamicDep: false, + }, + } + + acc1 := &authtypes.BaseAccount{ + Address: addr1.String(), + } + acc2 := &authtypes.BaseAccount{ + Address: addr2.String(), + } + accs := authtypes.GenesisAccounts{acc1, acc2} + balances := []types.Balance{ + { + Address: addr1.String(), + Coins: coins, + }, + { + Address: addr2.String(), + Coins: coins, + }, + } + + app := simapp.SetupWithGenesisAccounts(accs, balances...) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + handler := bank.NewHandler(app.BankKeeper) + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + handlerCtx, cms := cacheTxContext(ctx) + _, err := handler(handlerCtx, tc.msg) + + depdenencies , _ := MsgSendDependencyGenerator(app.AccessControlKeeper, handlerCtx, tc.msg) + + if !tc.dynamicDep { + depdenencies = sdkacltypes.GetDefaultSynchronousAccessOps() + } + + if tc.expectedError != nil { + require.EqualError(t, err, tc.expectedError.Error()) + } else { + require.NoError(t, err) + } + + // pp.Println(cms.GetEvents()) + missing := (sdkacltypes.ValidateAccessOperations(depdenencies, cms.GetEvents())) + pp.Println(missing) + require.Empty(t, missing) + }) + } +} + +func TestGeneratorInvalidMessageTypes(t *testing.T) { + accs := authtypes.GenesisAccounts{} + balances := []types.Balance{} + + app := simapp.SetupWithGenesisAccounts(accs, balances...) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + oracleVote := oracletypes.MsgAggregateExchangeRateVote{ + ExchangeRates: "1usei", + Feeder: "test", + Validator: "validator", + } + + _, err := MsgSendDependencyGenerator(app.AccessControlKeeper, ctx, &oracleVote) + require.Error(t, err) +} + +func TestMsgBeginBankSendGenerator(t *testing.T) { + priv1 := secp256k1.GenPrivKey() + addr1 := sdk.AccAddress(priv1.PubKey().Address()) + priv2 := secp256k1.GenPrivKey() + addr2 := sdk.AccAddress(priv2.PubKey().Address()) + coins := sdk.Coins{sdk.NewInt64Coin("foocoin", 10)} + + acc1 := &authtypes.BaseAccount{ + Address: addr1.String(), + } + acc2 := &authtypes.BaseAccount{ + Address: addr2.String(), + } + accs := authtypes.GenesisAccounts{acc1, acc2} + balances := []types.Balance{ + { + Address: addr1.String(), + Coins: coins, + }, + { + Address: addr2.String(), + Coins: coins, + }, + } + + app := simapp.SetupWithGenesisAccounts(accs, balances...) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + sendMsg := banktypes.MsgSend{ + FromAddress: addr1.String(), + ToAddress: addr2.String(), + Amount: coins, + } + + accessOps, err := MsgSendDependencyGenerator(app.AccessControlKeeper, ctx, &sendMsg) + require.NoError(t, err) + err = acltypes.ValidateAccessOps(accessOps) + require.NoError(t, err) +} diff --git a/aclmapping/bank/mappings.go b/aclmapping/bank/mappings.go index 3d65fa90ba..8ee202231c 100644 --- a/aclmapping/bank/mappings.go +++ b/aclmapping/bank/mappings.go @@ -7,6 +7,7 @@ import ( sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" aclkeeper "github.com/cosmos/cosmos-sdk/x/accesscontrol/keeper" acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" utils "github.com/sei-protocol/sei-chain/aclmapping/utils" ) @@ -23,12 +24,13 @@ func GetBankDepedencyGenerator() aclkeeper.DependencyGeneratorMap { return dependencyGeneratorMap } -// TODO:: we can make resource types more granular (e.g KV_PARAM or KV_BANK_BALANCE) func MsgSendDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sdk.Msg) ([]sdkacltypes.AccessOperation, error) { msgSend, ok := msg.(*banktypes.MsgSend) if !ok { return []sdkacltypes.AccessOperation{}, ErrorInvalidMsgType } + fromAddrIdentifier := string(banktypes.CreateAccountBalancesPrefixFromBech32(msgSend.FromAddress)) + toAddrIdentifier := string(banktypes.CreateAccountBalancesPrefixFromBech32(msgSend.ToAddress)) accessOperations := []sdkacltypes.AccessOperation{ // MsgSend also checks if the coin denom is enabled, but the information is from the params. @@ -37,46 +39,53 @@ func MsgSendDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sd // Checks balance of sender { AccessType: sdkacltypes.AccessType_READ, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetIdentifierTemplatePerModule(utils.BANK, msgSend.FromAddress), + ResourceType: sdkacltypes.ResourceType_KV_BANK, + IdentifierTemplate: fromAddrIdentifier, }, // Reduce the amount from the sender's balance { AccessType: sdkacltypes.AccessType_WRITE, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetIdentifierTemplatePerModule(utils.BANK, msgSend.FromAddress), + ResourceType: sdkacltypes.ResourceType_KV_BANK, + IdentifierTemplate: fromAddrIdentifier, }, // Checks balance for receiver { AccessType: sdkacltypes.AccessType_READ, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetIdentifierTemplatePerModule(utils.BANK, msgSend.ToAddress), + ResourceType: sdkacltypes.ResourceType_KV_BANK, + IdentifierTemplate: toAddrIdentifier, }, { AccessType: sdkacltypes.AccessType_WRITE, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetIdentifierTemplatePerModule(utils.BANK, msgSend.ToAddress), + ResourceType: sdkacltypes.ResourceType_KV_BANK, + IdentifierTemplate: toAddrIdentifier, }, // Tries to create the reciever's account if it doesn't exist { AccessType: sdkacltypes.AccessType_READ, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetIdentifierTemplatePerModule(utils.AUTH, msgSend.ToAddress), + ResourceType: sdkacltypes.ResourceType_KV_AUTH, + IdentifierTemplate: string(authtypes.CreateAddressStoreKeyFromBech32(msgSend.ToAddress)), }, { AccessType: sdkacltypes.AccessType_WRITE, - ResourceType: sdkacltypes.ResourceType_KV, - IdentifierTemplate: utils.GetIdentifierTemplatePerModule(utils.AUTH, msgSend.ToAddress), + ResourceType: sdkacltypes.ResourceType_KV_AUTH, + IdentifierTemplate: string(authtypes.CreateAddressStoreKeyFromBech32(msgSend.ToAddress)), + }, + + // Gets Account Info for the sender + { + AccessType: sdkacltypes.AccessType_READ, + ResourceType: sdkacltypes.ResourceType_KV_AUTH, + IdentifierTemplate: string(authtypes.CreateAddressStoreKeyFromBech32(msgSend.FromAddress)), }, - // Last Operation should always be a commit { ResourceType: sdkacltypes.ResourceType_ANY, AccessType: sdkacltypes.AccessType_COMMIT, IdentifierTemplate: utils.DefaultIDTemplate, }, } + return accessOperations, nil } diff --git a/aclmapping/staking/mappings.go b/aclmapping/staking/mappings.go index ed3eb9fc8c..1faeeeb1ac 100644 --- a/aclmapping/staking/mappings.go +++ b/aclmapping/staking/mappings.go @@ -96,7 +96,7 @@ func MsgDelegateDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, ms func MsgUndelegateDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sdk.Msg) ([]sdkacltypes.AccessOperation, error) { msgUndelegate, ok := msg.(*stakingtypes.MsgUndelegate) if !ok { - return []sdkacltypes.AccessOperation{}, ErrorInvalidMsgType + return acltypes.SynchronousMessageDependencyMapping(acltypes.GenerateMessageKey(msgUndelegate)).AccessOps, ErrorInvalidMsgType } accessOperations := []sdkacltypes.AccessOperation{ diff --git a/aclmapping/tokenfactory/mappings.go b/aclmapping/tokenfactory/mappings.go index 0eda913365..1380e2b77a 100644 --- a/aclmapping/tokenfactory/mappings.go +++ b/aclmapping/tokenfactory/mappings.go @@ -27,7 +27,7 @@ func GetTokenFactoryDependencyGenerators() aclkeeper.DependencyGeneratorMap { func TokenFactoryMintDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sdk.Msg) ([]sdkacltypes.AccessOperation, error) { mintMsg, ok := msg.(*tokenfactorymoduletypes.MsgMint) if !ok { - return []sdkacltypes.AccessOperation{}, ErrInvalidMessageType + return acltypes.SynchronousMessageDependencyMapping(acltypes.GenerateMessageKey(mintMsg)).AccessOps, ErrInvalidMessageType } denom := mintMsg.GetAmount().Denom diff --git a/aclmapping/utils/identifier_templates.go b/aclmapping/utils/identifier_templates.go index 2eeea12ea3..ba79cecc2a 100644 --- a/aclmapping/utils/identifier_templates.go +++ b/aclmapping/utils/identifier_templates.go @@ -1,4 +1,4 @@ -package util +package utils import ( "fmt" diff --git a/aclmapping/utils/map[utils.Comparator]bool{ b/aclmapping/utils/map[utils.Comparator]bool{ new file mode 100644 index 0000000000..9e9d6f0f76 --- /dev/null +++ b/aclmapping/utils/map[utils.Comparator]bool{ @@ -0,0 +1,26 @@ +map[utils.Comparator]bool{ + utils.Comparator{ + AccessType: 2, + Identifier: "bank/SendEnabled", + }: true, + utils.Comparator{ + AccessType: 2, + Identifier: "bank/DefaultSendEnabled", + }: true, + utils.Comparator{ + AccessType: 2, + Identifier: "\x02\x14)k6\x92\x8c\xc7\xea\xd0$&\xb0\xb4r\uf831g#\xa6\xc5foocoin", + }: true, + utils.Comparator{ + AccessType: 2, + Identifier: "\x02\x14\xe5K\xfeW\xac\x1c^\x13\x00\x9dY\xa9\xc3\xdf~\x92\x04\xe1dFfoocoin", + }: true, + utils.Comparator{ + AccessType: 2, + Identifier: "\x01)k6\x92\x8c\xc7\xea\xd0$&\xb0\xb4r\uf831g#\xa6\xc5", + }: true, + utils.Comparator{ + AccessType: 2, + Identifier: "\x01\xe5K\xfeW\xac\x1c^\x13\x00\x9dY\xa9\xc3\xdf~\x92\x04\xe1dF", + }: true, +} diff --git a/aclmapping/utils/validation.go b/aclmapping/utils/validation.go new file mode 100644 index 0000000000..dad502e53e --- /dev/null +++ b/aclmapping/utils/validation.go @@ -0,0 +1,103 @@ +package utils + +import ( + "fmt" + "strings" + + sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" + abci "github.com/tendermint/tendermint/abci/types" +) + +var ( + // Param Store Values can only be set during genesis and updated + // through a gov proposal and those are always processed sequentially + identifierWhitelistParams = map[string]bool{ + "bank/SendEnabled": true, + "bank/DefaultSendEnabled": true, + } +) + + +type Comparator struct { + AccessType sdkacltypes.AccessType + Identifier string +} + +func (c *Comparator) Contains(comparator Comparator) bool { + return c.AccessType == comparator.AccessType && strings.Contains(c.Identifier, comparator.Identifier) +} + +func (c *Comparator) IsWhitelistedIdentifier() bool { + return identifierWhitelistParams[c.Identifier] +} + +func AccessTypeStringToEnum(accessType string) sdkacltypes.AccessType { + switch strings.ToUpper(accessType) { + case "WRITE": + return sdkacltypes.AccessType_WRITE + case "READ": + return sdkacltypes.AccessType_READ + default: + panic(fmt.Sprintf("unknown accessType=%s", accessType)) + } +} + +func BuildComparatorFromAccessOp(accessOps []sdkacltypes.AccessOperation) (comparators []Comparator) { + for _, accessOp := range accessOps { + comparators = append(comparators, Comparator{ + AccessType: accessOp.GetAccessType(), + Identifier: accessOp.GetIdentifierTemplate(), + }) + } + return comparators +} + +func BuildComparatorFromEvents(events []abci.Event) (comparators []Comparator) { + for _, event := range events { + if event.Type != "resource_access" { + continue + } + attributes := event.GetAttributes() + + identifier := "" + accessType := sdkacltypes.AccessType_UNKNOWN + for _, attribute := range attributes { + if attribute.Key == "key" { + identifier = attribute.Value + } + if attribute.Key == "access_type" { + accessType = AccessTypeStringToEnum(attribute.Value) + } + } + comparators = append(comparators, Comparator{ + AccessType: accessType, + Identifier: identifier, + }) + } + return comparators +} + +// ValidateAccessOperations compares a list of events and a predefined list of access operations and determines if all the +// events that occurred are represented in the accessOperations +func ValidateAccessOperations(accessOps []sdkacltypes.AccessOperation, events []abci.Event) map[Comparator]bool { + accessOpsComparators := BuildComparatorFromAccessOp(accessOps) + eventsComparators := BuildComparatorFromEvents(events) + + missingAccessOps := make(map[Comparator]bool) + for _, eventComparator := range eventsComparators { + matched := false + for _, accessOpComparator := range accessOpsComparators { + if eventComparator.IsWhitelistedIdentifier() || eventComparator.Contains(accessOpComparator){ + matched = true + break + } + } + + if !matched { + missingAccessOps[eventComparator] = true + } + + } + + return missingAccessOps +} diff --git a/app/app.go b/app/app.go index 5b1a7bca10..4f4907bb2c 100644 --- a/app/app.go +++ b/app/app.go @@ -32,15 +32,15 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - aclmodule "github.com/cosmos/cosmos-sdk/x/accesscontrol" aclclient "github.com/cosmos/cosmos-sdk/x/accesscontrol/client" aclkeeper "github.com/cosmos/cosmos-sdk/x/accesscontrol/keeper" acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -996,12 +996,13 @@ func (app *App) ProcessTxConcurrent( resultChan chan<- ChannelResult, txCompletionSignalingMap acltypes.MessageCompletionSignalMapping, txBlockingSignalsMap acltypes.MessageCompletionSignalMapping, + txMsgAccessOpMapping acltypes.MsgIndexToAccessOpMapping, ) { defer wg.Done() // Store the Channels in the Context Object for each transaction ctx = ctx.WithTxBlockingChannels(getChannelsFromSignalMapping(txBlockingSignalsMap)) ctx = ctx.WithTxCompletionChannels(getChannelsFromSignalMapping(txCompletionSignalingMap)) - + ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) // Deliver the transaction and store the result in the channel resultChan <- ChannelResult{txIndex, app.DeliverTxWithResult(ctx, txBytes)} @@ -1011,9 +1012,8 @@ func (app *App) ProcessTxConcurrent( func (app *App) ProcessBlockConcurrent( ctx sdk.Context, txs [][]byte, - completionSignalingMap map[int]acltypes.MessageCompletionSignalMapping, - blockingSignalsMap map[int]acltypes.MessageCompletionSignalMapping, -) []*abci.ExecTxResult { + dependencyDag *acltypes.Dag, +) ([]*abci.ExecTxResult, bool) { defer metrics.BlockProcessLatency(time.Now(), metrics.CONCURRENT) var waitGroup sync.WaitGroup @@ -1022,7 +1022,7 @@ func (app *App) ProcessBlockConcurrent( // If there's no transactions then return empty results if len(txs) == 0 { - return txResults + return txResults, true } // For each transaction, start goroutine and deliver TX @@ -1034,8 +1034,9 @@ func (app *App) ProcessBlockConcurrent( txBytes, &waitGroup, resultChan, - completionSignalingMap[txIndex], - blockingSignalsMap[txIndex], + dependencyDag.CompletionSignalingMap[txIndex], + dependencyDag.BlockingSignalsMap[txIndex], + dependencyDag.TxMsgAccessOpMapping[txIndex], ) } @@ -1059,10 +1060,19 @@ func (app *App) ProcessBlockConcurrent( txResults = append(txResults, txResultsMap[txIndex]) } - return txResults + ok := true + for _, result := range txResults { + if result.GetCode() == sdkerrors.ErrInvalidConcurrencyExecution.ABCICode() { + ctx.Logger().Error(fmt.Sprintf("Invalid concurrent execution of deliverTx: %s", result.GetLog())) + ok = false + } + } + + return txResults, ok } func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequest, lastCommit abci.CommitInfo) ([]abci.Event, []*abci.ExecTxResult, abci.ResponseEndBlock, error) { + // TODO:: Add concurrency validation for DEX MEM states goCtx := app.decorateContextWithDexMemState(ctx.Context()) ctx = ctx.WithContext(goCtx).WithContextMemCache(sdk.NewContextMemCache()) @@ -1115,9 +1125,17 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ // CacheMultiStore where it writes the data to the parent store (DeliverState) in sorted Key order to maintain // deterministic ordering between validators in the case of concurrent deliverTXs processBlockCtx, processBlockCache := app.CacheContext(ctx) - txResults = app.ProcessBlockConcurrent(processBlockCtx, txs, dependencyDag.CompletionSignalingMap, dependencyDag.BlockingSignalsMap) - // Write the results back to the concurrent contexts - processBlockCache.Write() + concurrentResults, ok := app.ProcessBlockConcurrent(processBlockCtx, txs, dependencyDag) + + if ok { + txResults = concurrentResults + // Write the results back to the concurrent contexts - if concurrent execution fails, + // this should not be called and the state is rolled back + processBlockCache.Write() + } else { + ctx.Logger().Info("Concurrent Execution failed, retrying with Synchronous") + txResults = app.ProcessBlockSynchronous(ctx, txs) + } case acltypes.ErrGovMsgInBlock: ctx.Logger().Info(fmt.Sprintf("Gov msg found while building DAG, processing synchronously: %s", err)) txResults = app.ProcessBlockSynchronous(ctx, txs) diff --git a/go.mod b/go.mod index af5c2bddbf..9313275345 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/k0kubun/pp/v3 v3.2.0 github.com/pkg/errors v0.9.1 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 @@ -88,6 +89,7 @@ require ( github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.6 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -131,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.200 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.217 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index 321f744059..c4b6f1c3b5 100644 --- a/go.sum +++ b/go.sum @@ -734,6 +734,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= +github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -800,6 +802,8 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -1098,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.200 h1:EbHDzt0aAASO7fy8Dac04lLzm0xhF1O1ILiA+UD3w98= -github.com/sei-protocol/sei-cosmos v0.1.200/go.mod h1:8ccWQxpBkWbpvBos/T4QO9K9gQxFs0duTqKRnagKo+0= +github.com/sei-protocol/sei-cosmos v0.1.217 h1:7wTlw/0y6YqI4U4L6a1Qlp9MQndlO2J9MNR9ecQqwlw= +github.com/sei-protocol/sei-cosmos v0.1.217/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 8d9ff377bbf19bf79138cfa7c9dbd1d949aa5dd5 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:01:03 -0400 Subject: [PATCH 02/17] lint --- aclmapping/utils/validation.go | 22 +++++++++------------- go.mod | 2 +- go.sum | 4 ++-- x/oracle/simulation/operations.go | 4 ++-- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/aclmapping/utils/validation.go b/aclmapping/utils/validation.go index dad502e53e..883c07d426 100644 --- a/aclmapping/utils/validation.go +++ b/aclmapping/utils/validation.go @@ -8,19 +8,15 @@ import ( abci "github.com/tendermint/tendermint/abci/types" ) -var ( - // Param Store Values can only be set during genesis and updated - // through a gov proposal and those are always processed sequentially - identifierWhitelistParams = map[string]bool{ - "bank/SendEnabled": true, - "bank/DefaultSendEnabled": true, - } -) - - +// Param Store Values can only be set during genesis and updated +// through a gov proposal and those are always processed sequentially +var identifierWhitelistParams = map[string]bool{ + "bank/SendEnabled": true, + "bank/DefaultSendEnabled": true, +} type Comparator struct { AccessType sdkacltypes.AccessType - Identifier string + Identifier string } func (c *Comparator) Contains(comparator Comparator) bool { @@ -66,7 +62,7 @@ func BuildComparatorFromEvents(events []abci.Event) (comparators []Comparator) { identifier = attribute.Value } if attribute.Key == "access_type" { - accessType = AccessTypeStringToEnum(attribute.Value) + accessType = AccessTypeStringToEnum(attribute.Value) } } comparators = append(comparators, Comparator{ @@ -87,7 +83,7 @@ func ValidateAccessOperations(accessOps []sdkacltypes.AccessOperation, events [] for _, eventComparator := range eventsComparators { matched := false for _, accessOpComparator := range accessOpsComparators { - if eventComparator.IsWhitelistedIdentifier() || eventComparator.Contains(accessOpComparator){ + if eventComparator.IsWhitelistedIdentifier() || eventComparator.Contains(accessOpComparator) { matched = true break } diff --git a/go.mod b/go.mod index 9313275345..e93b2a2d5c 100644 --- a/go.mod +++ b/go.mod @@ -133,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.217 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.218 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index c4b6f1c3b5..adb0ac63bd 100644 --- a/go.sum +++ b/go.sum @@ -1102,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.217 h1:7wTlw/0y6YqI4U4L6a1Qlp9MQndlO2J9MNR9ecQqwlw= -github.com/sei-protocol/sei-cosmos v0.1.217/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.218 h1:6ixoB7TEagS8Bz/LZNoW2lUkdLaa03ske/qQ2dCQjLQ= +github.com/sei-protocol/sei-cosmos v0.1.218/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index 2028e73625..3988c4b164 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -65,7 +65,7 @@ func WeightedOperations( } // SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values. -// nolint: funlen +//nolint: funlen func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, @@ -122,7 +122,7 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK } // SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values. -// nolint: funlen +//nolint: funlen func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, From 737759310d142103165faaf375cb4f750d863d88 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:01:44 -0400 Subject: [PATCH 03/17] revert --- aclmapping/staking/mappings.go | 2 +- aclmapping/tokenfactory/mappings.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aclmapping/staking/mappings.go b/aclmapping/staking/mappings.go index 1faeeeb1ac..ed3eb9fc8c 100644 --- a/aclmapping/staking/mappings.go +++ b/aclmapping/staking/mappings.go @@ -96,7 +96,7 @@ func MsgDelegateDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, ms func MsgUndelegateDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sdk.Msg) ([]sdkacltypes.AccessOperation, error) { msgUndelegate, ok := msg.(*stakingtypes.MsgUndelegate) if !ok { - return acltypes.SynchronousMessageDependencyMapping(acltypes.GenerateMessageKey(msgUndelegate)).AccessOps, ErrorInvalidMsgType + return []sdkacltypes.AccessOperation{}, ErrorInvalidMsgType } accessOperations := []sdkacltypes.AccessOperation{ diff --git a/aclmapping/tokenfactory/mappings.go b/aclmapping/tokenfactory/mappings.go index 1380e2b77a..0eda913365 100644 --- a/aclmapping/tokenfactory/mappings.go +++ b/aclmapping/tokenfactory/mappings.go @@ -27,7 +27,7 @@ func GetTokenFactoryDependencyGenerators() aclkeeper.DependencyGeneratorMap { func TokenFactoryMintDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sdk.Msg) ([]sdkacltypes.AccessOperation, error) { mintMsg, ok := msg.(*tokenfactorymoduletypes.MsgMint) if !ok { - return acltypes.SynchronousMessageDependencyMapping(acltypes.GenerateMessageKey(mintMsg)).AccessOps, ErrInvalidMessageType + return []sdkacltypes.AccessOperation{}, ErrInvalidMessageType } denom := mintMsg.GetAmount().Denom From b926cd120ad527fec7234d5518eb0da7a9d2cd87 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:05:29 -0400 Subject: [PATCH 04/17] typo --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e93b2a2d5c..b4268b6e08 100644 --- a/go.mod +++ b/go.mod @@ -133,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.218 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.219 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index adb0ac63bd..110f6e66d5 100644 --- a/go.sum +++ b/go.sum @@ -1102,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.218 h1:6ixoB7TEagS8Bz/LZNoW2lUkdLaa03ske/qQ2dCQjLQ= -github.com/sei-protocol/sei-cosmos v0.1.218/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.219 h1:VESrmOHAAIUIeRwUzSAyOdtIRRUtoXn6queQOsLXaEc= +github.com/sei-protocol/sei-cosmos v0.1.219/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From e1c9d1aafc8eacbe1aed1f79a8b9239a42d97e94 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:21:30 -0400 Subject: [PATCH 05/17] lint --- aclmapping/utils/validation.go | 1 + x/oracle/simulation/operations.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/aclmapping/utils/validation.go b/aclmapping/utils/validation.go index 883c07d426..42b7779cb4 100644 --- a/aclmapping/utils/validation.go +++ b/aclmapping/utils/validation.go @@ -14,6 +14,7 @@ var identifierWhitelistParams = map[string]bool{ "bank/SendEnabled": true, "bank/DefaultSendEnabled": true, } + type Comparator struct { AccessType sdkacltypes.AccessType Identifier string diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index 3988c4b164..2028e73625 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -65,7 +65,7 @@ func WeightedOperations( } // SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values. -//nolint: funlen +// nolint: funlen func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, @@ -122,7 +122,7 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK } // SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values. -//nolint: funlen +// nolint: funlen func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, From c4fcac342f32dd8e027601514a15e8f23680e164 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:40:43 -0400 Subject: [PATCH 06/17] asd --- aclmapping/bank/mapping_test.go | 4 ---- go.mod | 4 +--- go.sum | 8 ++------ 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/aclmapping/bank/mapping_test.go b/aclmapping/bank/mapping_test.go index 7c9ede0eec..e55192a6b9 100644 --- a/aclmapping/bank/mapping_test.go +++ b/aclmapping/bank/mapping_test.go @@ -12,7 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/bank/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - pp "github.com/k0kubun/pp/v3" oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types" "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -92,10 +91,7 @@ func TestMsgBankSendAclOps(t *testing.T) { } else { require.NoError(t, err) } - - // pp.Println(cms.GetEvents()) missing := (sdkacltypes.ValidateAccessOperations(depdenencies, cms.GetEvents())) - pp.Println(missing) require.Empty(t, missing) }) } diff --git a/go.mod b/go.mod index b4268b6e08..6afe682eab 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/k0kubun/pp/v3 v3.2.0 github.com/pkg/errors v0.9.1 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 @@ -89,7 +88,6 @@ require ( github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -133,7 +131,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.219 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.220 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index 110f6e66d5..d79d01c686 100644 --- a/go.sum +++ b/go.sum @@ -734,8 +734,6 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= -github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -802,8 +800,6 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -1102,8 +1098,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.219 h1:VESrmOHAAIUIeRwUzSAyOdtIRRUtoXn6queQOsLXaEc= -github.com/sei-protocol/sei-cosmos v0.1.219/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.220 h1:r2dz/YBlqSfc3BkKcE8ToyyaRvJUFyZkrlsKr9CxjsQ= +github.com/sei-protocol/sei-cosmos v0.1.220/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 4f756ee5f3363ca7cd4aa0234e3b03918c3efb0b Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:51:05 -0400 Subject: [PATCH 07/17] logigng --- app/app.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/app.go b/app/app.go index 4f4907bb2c..366b2b8d7b 100644 --- a/app/app.go +++ b/app/app.go @@ -1007,6 +1007,7 @@ func (app *App) ProcessTxConcurrent( resultChan <- ChannelResult{txIndex, app.DeliverTxWithResult(ctx, txBytes)} metrics.IncrTxProcessTypeCounter(metrics.CONCURRENT) + ctx.Logger().Info(fmt.Sprintf("Transactions Finished=%d", txIndex)) } func (app *App) ProcessBlockConcurrent( @@ -1051,6 +1052,8 @@ func (app *App) ProcessBlockConcurrent( // Gather Results and store it based on txIndex and read results from channel // Concurrent results may be in different order than the original txIndex txResultsMap := map[int]*abci.ExecTxResult{} + + ctx.Logger().Info(fmt.Sprintf("Waiting for Transactions=%d", len(txs))) for result := range resultChan { txResultsMap[result.txIndex] = result.result } From e9c7a43542c490a6ecc2f824c1d2971591e671d3 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 00:58:41 -0400 Subject: [PATCH 08/17] clean --- aclmapping/utils/map[utils.Comparator]bool{ | 26 ----- aclmapping/utils/validation.go | 100 -------------------- 2 files changed, 126 deletions(-) delete mode 100644 aclmapping/utils/map[utils.Comparator]bool{ delete mode 100644 aclmapping/utils/validation.go diff --git a/aclmapping/utils/map[utils.Comparator]bool{ b/aclmapping/utils/map[utils.Comparator]bool{ deleted file mode 100644 index 9e9d6f0f76..0000000000 --- a/aclmapping/utils/map[utils.Comparator]bool{ +++ /dev/null @@ -1,26 +0,0 @@ -map[utils.Comparator]bool{ - utils.Comparator{ - AccessType: 2, - Identifier: "bank/SendEnabled", - }: true, - utils.Comparator{ - AccessType: 2, - Identifier: "bank/DefaultSendEnabled", - }: true, - utils.Comparator{ - AccessType: 2, - Identifier: "\x02\x14)k6\x92\x8c\xc7\xea\xd0$&\xb0\xb4r\uf831g#\xa6\xc5foocoin", - }: true, - utils.Comparator{ - AccessType: 2, - Identifier: "\x02\x14\xe5K\xfeW\xac\x1c^\x13\x00\x9dY\xa9\xc3\xdf~\x92\x04\xe1dFfoocoin", - }: true, - utils.Comparator{ - AccessType: 2, - Identifier: "\x01)k6\x92\x8c\xc7\xea\xd0$&\xb0\xb4r\uf831g#\xa6\xc5", - }: true, - utils.Comparator{ - AccessType: 2, - Identifier: "\x01\xe5K\xfeW\xac\x1c^\x13\x00\x9dY\xa9\xc3\xdf~\x92\x04\xe1dF", - }: true, -} diff --git a/aclmapping/utils/validation.go b/aclmapping/utils/validation.go deleted file mode 100644 index 42b7779cb4..0000000000 --- a/aclmapping/utils/validation.go +++ /dev/null @@ -1,100 +0,0 @@ -package utils - -import ( - "fmt" - "strings" - - sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" - abci "github.com/tendermint/tendermint/abci/types" -) - -// Param Store Values can only be set during genesis and updated -// through a gov proposal and those are always processed sequentially -var identifierWhitelistParams = map[string]bool{ - "bank/SendEnabled": true, - "bank/DefaultSendEnabled": true, -} - -type Comparator struct { - AccessType sdkacltypes.AccessType - Identifier string -} - -func (c *Comparator) Contains(comparator Comparator) bool { - return c.AccessType == comparator.AccessType && strings.Contains(c.Identifier, comparator.Identifier) -} - -func (c *Comparator) IsWhitelistedIdentifier() bool { - return identifierWhitelistParams[c.Identifier] -} - -func AccessTypeStringToEnum(accessType string) sdkacltypes.AccessType { - switch strings.ToUpper(accessType) { - case "WRITE": - return sdkacltypes.AccessType_WRITE - case "READ": - return sdkacltypes.AccessType_READ - default: - panic(fmt.Sprintf("unknown accessType=%s", accessType)) - } -} - -func BuildComparatorFromAccessOp(accessOps []sdkacltypes.AccessOperation) (comparators []Comparator) { - for _, accessOp := range accessOps { - comparators = append(comparators, Comparator{ - AccessType: accessOp.GetAccessType(), - Identifier: accessOp.GetIdentifierTemplate(), - }) - } - return comparators -} - -func BuildComparatorFromEvents(events []abci.Event) (comparators []Comparator) { - for _, event := range events { - if event.Type != "resource_access" { - continue - } - attributes := event.GetAttributes() - - identifier := "" - accessType := sdkacltypes.AccessType_UNKNOWN - for _, attribute := range attributes { - if attribute.Key == "key" { - identifier = attribute.Value - } - if attribute.Key == "access_type" { - accessType = AccessTypeStringToEnum(attribute.Value) - } - } - comparators = append(comparators, Comparator{ - AccessType: accessType, - Identifier: identifier, - }) - } - return comparators -} - -// ValidateAccessOperations compares a list of events and a predefined list of access operations and determines if all the -// events that occurred are represented in the accessOperations -func ValidateAccessOperations(accessOps []sdkacltypes.AccessOperation, events []abci.Event) map[Comparator]bool { - accessOpsComparators := BuildComparatorFromAccessOp(accessOps) - eventsComparators := BuildComparatorFromEvents(events) - - missingAccessOps := make(map[Comparator]bool) - for _, eventComparator := range eventsComparators { - matched := false - for _, accessOpComparator := range accessOpsComparators { - if eventComparator.IsWhitelistedIdentifier() || eventComparator.Contains(accessOpComparator) { - matched = true - break - } - } - - if !matched { - missingAccessOps[eventComparator] = true - } - - } - - return missingAccessOps -} From 9670de37ee2347a6ed4f440b88dada08436cf8d1 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:00:19 -0400 Subject: [PATCH 09/17] asd --- app/app.go | 1 + go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 366b2b8d7b..ac1149a688 100644 --- a/app/app.go +++ b/app/app.go @@ -1005,6 +1005,7 @@ func (app *App) ProcessTxConcurrent( ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) // Deliver the transaction and store the result in the channel + ctx.Logger().Info(fmt.Sprintf("Transactions Started=%d", txIndex)) resultChan <- ChannelResult{txIndex, app.DeliverTxWithResult(ctx, txBytes)} metrics.IncrTxProcessTypeCounter(metrics.CONCURRENT) ctx.Logger().Info(fmt.Sprintf("Transactions Finished=%d", txIndex)) diff --git a/go.mod b/go.mod index 6afe682eab..8e34626ec3 100644 --- a/go.mod +++ b/go.mod @@ -131,7 +131,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.220 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.221 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index d79d01c686..ab4045bd55 100644 --- a/go.sum +++ b/go.sum @@ -1098,8 +1098,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.220 h1:r2dz/YBlqSfc3BkKcE8ToyyaRvJUFyZkrlsKr9CxjsQ= -github.com/sei-protocol/sei-cosmos v0.1.220/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.221 h1:EmvgBlQgD35HPUobeuWqKj0d6ECnV3ZXTmAKq2ZyaHE= +github.com/sei-protocol/sei-cosmos v0.1.221/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 1273b5eb08a273dd8695cff53959499fc2d0d48f Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:08:23 -0400 Subject: [PATCH 10/17] asd --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index ac1149a688..fb7392bb80 100644 --- a/app/app.go +++ b/app/app.go @@ -1000,8 +1000,8 @@ func (app *App) ProcessTxConcurrent( ) { defer wg.Done() // Store the Channels in the Context Object for each transaction - ctx = ctx.WithTxBlockingChannels(getChannelsFromSignalMapping(txBlockingSignalsMap)) ctx = ctx.WithTxCompletionChannels(getChannelsFromSignalMapping(txCompletionSignalingMap)) + ctx = ctx.WithTxBlockingChannels(getChannelsFromSignalMapping(txBlockingSignalsMap)) ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) // Deliver the transaction and store the result in the channel From 0cd7578da56a0f026576f01583757fa66e059d0b Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:14:54 -0400 Subject: [PATCH 11/17] priont dag --- app/app.go | 3 +++ go.mod | 2 ++ go.sum | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/app/app.go b/app/app.go index fb7392bb80..5285db5501 100644 --- a/app/app.go +++ b/app/app.go @@ -13,6 +13,7 @@ import ( "time" storetypes "github.com/cosmos/cosmos-sdk/store/types" + pp "github.com/k0kubun/pp/v3" "github.com/sei-protocol/sei-chain/aclmapping" appparams "github.com/sei-protocol/sei-chain/app/params" @@ -1027,6 +1028,8 @@ func (app *App) ProcessBlockConcurrent( return txResults, true } + pp.Printf("DAG=%s\n", dependencyDag) + // For each transaction, start goroutine and deliver TX for txIndex, txBytes := range txs { waitGroup.Add(1) diff --git a/go.mod b/go.mod index 8e34626ec3..00962191f1 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/k0kubun/pp/v3 v3.2.0 github.com/pkg/errors v0.9.1 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 @@ -88,6 +89,7 @@ require ( github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.6 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect diff --git a/go.sum b/go.sum index ab4045bd55..9a8b2804c8 100644 --- a/go.sum +++ b/go.sum @@ -734,6 +734,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= +github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -800,6 +802,8 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= From eb75e94929f9ca8668e3f02fa8a69006ee250676 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:20:42 -0400 Subject: [PATCH 12/17] asd --- app/app.go | 6 ++++-- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index 5285db5501..460e946798 100644 --- a/app/app.go +++ b/app/app.go @@ -1006,6 +1006,10 @@ func (app *App) ProcessTxConcurrent( ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) // Deliver the transaction and store the result in the channel + + pp.Printf("txCompletionSignalingMap=%s\n", txCompletionSignalingMap) + pp.Printf("txBlockingSignalsMap=%s\n", txBlockingSignalsMap) + ctx.Logger().Info(fmt.Sprintf("Transactions Started=%d", txIndex)) resultChan <- ChannelResult{txIndex, app.DeliverTxWithResult(ctx, txBytes)} metrics.IncrTxProcessTypeCounter(metrics.CONCURRENT) @@ -1028,8 +1032,6 @@ func (app *App) ProcessBlockConcurrent( return txResults, true } - pp.Printf("DAG=%s\n", dependencyDag) - // For each transaction, start goroutine and deliver TX for txIndex, txBytes := range txs { waitGroup.Add(1) diff --git a/go.mod b/go.mod index 00962191f1..d7f9f98353 100644 --- a/go.mod +++ b/go.mod @@ -133,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.221 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.222 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index 9a8b2804c8..e7fcc73e6a 100644 --- a/go.sum +++ b/go.sum @@ -1102,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.221 h1:EmvgBlQgD35HPUobeuWqKj0d6ECnV3ZXTmAKq2ZyaHE= -github.com/sei-protocol/sei-cosmos v0.1.221/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.222 h1:c3kP26ymHG9kbCEOV0RJHlJz8oZyOGT9lt69dM+h+Nk= +github.com/sei-protocol/sei-cosmos v0.1.222/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 76bf1b5bc317f531f4fa08a4d65260d93ba9f4f7 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:22:02 -0400 Subject: [PATCH 13/17] remove print --- app/app.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/app.go b/app/app.go index 460e946798..63ce564922 100644 --- a/app/app.go +++ b/app/app.go @@ -13,7 +13,6 @@ import ( "time" storetypes "github.com/cosmos/cosmos-sdk/store/types" - pp "github.com/k0kubun/pp/v3" "github.com/sei-protocol/sei-chain/aclmapping" appparams "github.com/sei-protocol/sei-chain/app/params" @@ -1005,11 +1004,6 @@ func (app *App) ProcessTxConcurrent( ctx = ctx.WithTxBlockingChannels(getChannelsFromSignalMapping(txBlockingSignalsMap)) ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) // Deliver the transaction and store the result in the channel - - - pp.Printf("txCompletionSignalingMap=%s\n", txCompletionSignalingMap) - pp.Printf("txBlockingSignalsMap=%s\n", txBlockingSignalsMap) - ctx.Logger().Info(fmt.Sprintf("Transactions Started=%d", txIndex)) resultChan <- ChannelResult{txIndex, app.DeliverTxWithResult(ctx, txBytes)} metrics.IncrTxProcessTypeCounter(metrics.CONCURRENT) From 0ed646805a02f743aafdfd53ab5803bcc7baecb4 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:25:33 -0400 Subject: [PATCH 14/17] asd --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index d7f9f98353..41d50148dd 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/k0kubun/pp/v3 v3.2.0 github.com/pkg/errors v0.9.1 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 @@ -84,6 +83,7 @@ require ( github.com/improbable-eng/grpc-web v0.14.1 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect + github.com/k0kubun/pp/v3 v3.2.0 // indirect github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect github.com/klauspost/compress v1.15.1 // indirect github.com/lib/pq v1.10.6 // indirect @@ -133,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.222 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.223 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index e7fcc73e6a..a16a5e39f9 100644 --- a/go.sum +++ b/go.sum @@ -1102,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.222 h1:c3kP26ymHG9kbCEOV0RJHlJz8oZyOGT9lt69dM+h+Nk= -github.com/sei-protocol/sei-cosmos v0.1.222/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.223 h1:SM+RIqnPZtpkD//Oiv8emf6mKF7yPmMvyZQqCR9f+nc= +github.com/sei-protocol/sei-cosmos v0.1.223/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 30f76ceef5c78df3aa259c186993d332222805a7 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:30:44 -0400 Subject: [PATCH 15/17] asd --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 41d50148dd..e872478ff1 100644 --- a/go.mod +++ b/go.mod @@ -133,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.223 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.224 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index a16a5e39f9..323129d8a8 100644 --- a/go.sum +++ b/go.sum @@ -1102,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.223 h1:SM+RIqnPZtpkD//Oiv8emf6mKF7yPmMvyZQqCR9f+nc= -github.com/sei-protocol/sei-cosmos v0.1.223/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.224 h1:Fk3TzHMrfu3qfZyGvaTFbsY/9QoNtLlWGhtjA/rEO4A= +github.com/sei-protocol/sei-cosmos v0.1.224/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 26ee358c3327f8b93bbdf1d62ba98f193ce28992 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:39:40 -0400 Subject: [PATCH 16/17] comment out --- app/app.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/app.go b/app/app.go index 63ce564922..2bc7083417 100644 --- a/app/app.go +++ b/app/app.go @@ -996,13 +996,15 @@ func (app *App) ProcessTxConcurrent( resultChan chan<- ChannelResult, txCompletionSignalingMap acltypes.MessageCompletionSignalMapping, txBlockingSignalsMap acltypes.MessageCompletionSignalMapping, - txMsgAccessOpMapping acltypes.MsgIndexToAccessOpMapping, + // txMsgAccessOpMapping acltypes.MsgIndexToAccessOpMapping, ) { defer wg.Done() // Store the Channels in the Context Object for each transaction ctx = ctx.WithTxCompletionChannels(getChannelsFromSignalMapping(txCompletionSignalingMap)) ctx = ctx.WithTxBlockingChannels(getChannelsFromSignalMapping(txBlockingSignalsMap)) - ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) + + // ctx = ctx.WithTxMsgAccessOps(txMsgAccessOpMapping) + // Deliver the transaction and store the result in the channel ctx.Logger().Info(fmt.Sprintf("Transactions Started=%d", txIndex)) resultChan <- ChannelResult{txIndex, app.DeliverTxWithResult(ctx, txBytes)} @@ -1013,7 +1015,9 @@ func (app *App) ProcessTxConcurrent( func (app *App) ProcessBlockConcurrent( ctx sdk.Context, txs [][]byte, - dependencyDag *acltypes.Dag, + // dependencyDag *acltypes.Dag, + completionSignalingMap map[int]acltypes.MessageCompletionSignalMapping, + blockingSignalsMap map[int]acltypes.MessageCompletionSignalMapping, ) ([]*abci.ExecTxResult, bool) { defer metrics.BlockProcessLatency(time.Now(), metrics.CONCURRENT) @@ -1035,9 +1039,11 @@ func (app *App) ProcessBlockConcurrent( txBytes, &waitGroup, resultChan, - dependencyDag.CompletionSignalingMap[txIndex], - dependencyDag.BlockingSignalsMap[txIndex], - dependencyDag.TxMsgAccessOpMapping[txIndex], + completionSignalingMap[txIndex], + blockingSignalsMap[txIndex], + // dependencyDag.CompletionSignalingMap[txIndex], + // dependencyDag.BlockingSignalsMap[txIndex], + // dependencyDag.TxMsgAccessOpMapping[txIndex], ) } @@ -1128,7 +1134,8 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ // CacheMultiStore where it writes the data to the parent store (DeliverState) in sorted Key order to maintain // deterministic ordering between validators in the case of concurrent deliverTXs processBlockCtx, processBlockCache := app.CacheContext(ctx) - concurrentResults, ok := app.ProcessBlockConcurrent(processBlockCtx, txs, dependencyDag) + // concurrentResults, ok := app.ProcessBlockConcurrent(processBlockCtx, txs, dependencyDag) + concurrentResults, ok := app.ProcessBlockConcurrent(processBlockCtx, txs, dependencyDag.CompletionSignalingMap, dependencyDag.BlockingSignalsMap) if ok { txResults = concurrentResults From 07ac148e595fb6224fb7739eee6bbd00a7d64627 Mon Sep 17 00:00:00 2001 From: Brandon Weng Date: Thu, 27 Oct 2022 01:46:48 -0400 Subject: [PATCH 17/17] 123 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e872478ff1..37f027d8cc 100644 --- a/go.mod +++ b/go.mod @@ -133,7 +133,7 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.224 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.225 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.59 diff --git a/go.sum b/go.sum index 323129d8a8..f446dfd629 100644 --- a/go.sum +++ b/go.sum @@ -1102,8 +1102,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/sei-protocol/sei-cosmos v0.1.224 h1:Fk3TzHMrfu3qfZyGvaTFbsY/9QoNtLlWGhtjA/rEO4A= -github.com/sei-protocol/sei-cosmos v0.1.224/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= +github.com/sei-protocol/sei-cosmos v0.1.225 h1:U5JHwN+RHUqJmMeNsuH3GK5/bpAn9B5Bc8ePekiSdpo= +github.com/sei-protocol/sei-cosmos v0.1.225/go.mod h1:r2yN7zERSjvq7pn7QFyWpLKu6Qk0Vs7x8hQkrtyrkzw= github.com/sei-protocol/sei-tendermint v0.1.59 h1:POGL60PumMQHF4EzAHzvkGfDnodQJLHpl65LuiwSO/Y= github.com/sei-protocol/sei-tendermint v0.1.59/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=