github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/store/rootmulti/store_mpt_adapter.go (about)

     1  package rootmulti
     2  
     3  import (
     4  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/store/mpt"
     5  	tmtypes "github.com/fibonacci-chain/fbc/libs/tendermint/types"
     6  )
     7  
     8  const (
     9  	AccStore = "acc"
    10  	EvmStore = "evm"
    11  	MptStore = "mpt" // new store for acc module, will use mpt instead of iavl as store engine
    12  )
    13  
    14  func evmAccStoreFilter(sName string, ver int64, forceFilter ...bool) bool {
    15  	if (sName == AccStore || sName == EvmStore) && tmtypes.HigherThanMars(ver) {
    16  		if len(forceFilter) > 0 && forceFilter[0] {
    17  			return true
    18  		}
    19  
    20  		// if mpt.TrieDirtyDisabled == true, means is a full node, should still use acc and evm store to query history state, keep them!
    21  		// else, no longer need them any more, filter them !!!
    22  		return !mpt.TrieDirtyDisabled
    23  	}
    24  	return false
    25  }
    26  
    27  func newMptStoreFilter(sName string, ver int64) bool {
    28  	if (sName == MptStore) && !tmtypes.HigherThanMars(ver) {
    29  		return true
    30  	}
    31  	return false
    32  }
    33  
    34  func (rs *Store) commitInfoFilter(infos map[string]storeInfo, ver int64, storeName string) {
    35  	evmConfigInfo := infos[storeName]
    36  	if evmConfigInfo.Core.CommitID.Version == 0 {
    37  		evmConfigInfo.Core.CommitID.Version = ver
    38  		infos[storeName] = evmConfigInfo
    39  
    40  		for key, param := range rs.storesParams {
    41  			if key.Name() == storeName {
    42  				param.initialVersion = uint64(ver)
    43  				rs.storesParams[key] = param
    44  			}
    45  		}
    46  	}
    47  }