Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy todo comments #845

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ func (app *BinanceChain) initStaking() {
MinDelegationChange: 1e8,
})
app.stakeKeeper.SetPool(newCtx, stake.Pool{
// TODO: optimize these parameters
LooseTokens: sdk.NewDec(5e15),
})
})
Expand Down Expand Up @@ -755,10 +754,6 @@ func (app *BinanceChain) PreDeliverTx(req abci.RequestDeliverTx) (res abci.Respo
if res.IsErr() {
txHash := cmn.HexBytes(tmhash.Sum(req.Tx)).String()
app.Logger.Error("failed to process invalid tx during pre-deliver", "tx", txHash, "res", res.String())
// TODO(#446): comment out temporally for thread safety
//if app.publicationConfig.PublishOrderUpdates {
// app.processErrAbciResponseForPub(txBytes)
//}
}
return res
}
Expand Down Expand Up @@ -855,7 +850,6 @@ func (app *BinanceChain) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) a
pub.Pool.Clean()
//match may end with transaction failure, which is better to save into
//the EndBlock response. However, current cosmos doesn't support this.
//future TODO: add failure info.
return abci.ResponseEndBlock{
ValidatorUpdates: validatorUpdates,
Events: ctx.EventManager().ABCIEvents(),
Expand Down
4 changes: 1 addition & 3 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,8 @@ type UpgradeConfig struct {
LotSizeUpgradeHeight int64 `mapstructure:"LotSizeUpgradeHeight"`
ListingRuleUpgradeHeight int64 `mapstructure:"ListingRuleUpgradeHeight"`
FixZeroBalanceHeight int64 `mapstructure:"FixZeroBalanceHeight"`
// TODO: add upgrade name
LaunchBscUpgradeHeight int64 `mapstructure:"LaunchBscUpgradeHeight"`
LaunchBscUpgradeHeight int64 `mapstructure:"LaunchBscUpgradeHeight"`

// TODO: add upgrade name
BEP8Height int64 `mapstructure:"BEP8Height"`
BEP67Height int64 `mapstructure:"BEP67Height"`
BEP70Height int64 `mapstructure:"BEP70Height"`
Expand Down
2 changes: 0 additions & 2 deletions app/fee_distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ func distributeFee(ctx sdk.Context, am auth.AccountKeeper, valAddrCache *ValAddr
avgTokens := sdk.Coins{}
roundingTokens := sdk.Coins{}
for _, token := range fee.Tokens {
// TODO: int64 is enough, will drop big.Int
// TODO: temporarily, the validators average the fees. Will change to use power as a weight to calc fees.
amount := token.Amount
avgAmount := amount / valSize
roundingAmount := amount - avgAmount*valSize
Expand Down
1 change: 0 additions & 1 deletion app/pub/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func (msg *ExecutionResults) ToNativeMap() map[string]interface{} {
func (msg *ExecutionResults) EssentialMsg() string {
// mainly used to recover for large breathe block expiring message, there should be no trade on breathe block
orders := msg.Orders.EssentialMsg()
//TODO output other fields: trades, stakeUpdate etc.
return fmt.Sprintf("height:%d\ntime:%d\norders:\n%s\n", msg.Height, msg.Timestamp, orders)
}

Expand Down
2 changes: 1 addition & 1 deletion common/log/async_file_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (w *AsyncFileWriter) Stop() {
}

func (w *AsyncFileWriter) Write(msg []byte) (n int, err error) {
// TODO(wuzhenxing): for the underlying array may change, is there a better way to avoid copying slice?
// TODO: for the underlying array may change, is there a better way to avoid copying slice?
buf := make([]byte, len(msg))
copy(buf, msg)

Expand Down
2 changes: 0 additions & 2 deletions common/tx/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ func NewAnteHandler(am auth.AccountKeeper) sdk.AnteHandler {
}

// collect signer accounts
// TODO: abort if there is more than one signer?
var signerAccs = make([]sdk.Account, len(signerAddrs))
txHash, _ := ctx.Value(baseapp.TxHashKey).(string)
chainID := ctx.ChainID()
Expand Down Expand Up @@ -321,7 +320,6 @@ func processSig(txHash string,

func calcAndCollectFees(ctx sdk.Context, am auth.AccountKeeper, acc sdk.Account, msg sdk.Msg, txHash string) sdk.Result {
// first sig pays the fees
// TODO: Add min fees
// Can this function be moved outside of the loop?

fee, err := calculateFees(msg)
Expand Down
2 changes: 1 addition & 1 deletion common/types/mini_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type MiniToken struct {
Owner sdk.AccAddress `json:"owner"`
Mintable bool `json:"mintable"`
TokenType SupplyRangeType `json:"token_type"`
TokenURI string `json:"token_uri"` //TODO set max length
TokenURI string `json:"token_uri"`
ContractAddress string `json:"contract_address,omitempty"`
ContractDecimals int8 `json:"contract_decimals,omitempty"`
}
Expand Down
1 change: 0 additions & 1 deletion common/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const (
ListingRuleUpgrade = "ListingRuleUpgrade" // Remove restriction that only the owner of base asset can list trading pair
FixZeroBalance = "FixZeroBalance"

// TODO: add upgrade name
LaunchBscUpgrade = sdk.LaunchBscUpgrade

EnableAccountScriptsForCrossChainTransfer = "EnableAccountScriptsForCrossChainTransfer"
Expand Down
3 changes: 0 additions & 3 deletions plugins/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ func (s *server) bindRoutes() *server {
Queries("offset", "{offset:[0-9]+}", "limit", "{limit:[0-9]+}").
Methods("GET")

// legacy plugin routes
// TODO: make these more like the above for simplicity.

// keys rest routes disabled for security. while the nodes with keys (validators) run in a secure ringfenced environment,
// disabling this is a precaution to protect third-party validators that might not have protected their networks adequately.
//keys.RegisterRoutes(r, true)
Expand Down
2 changes: 0 additions & 2 deletions plugins/dex/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/binance-chain/node/plugins/dex/utils"
)

// TODO: improve, should be configurable
const MaxDepthLevels = 1000 // matches UI requirement
const DefaultDepthLevels = 100 // matches UI requirement

Expand Down Expand Up @@ -91,7 +90,6 @@ func createAbciQueryHandler(keeper *DexKeeper, abciQueryPrefix string) app.AbciQ
queryPrefix, path),
}
}
//TODO: sync lock, validate pair
if len(path) < 3 {
return &abci.ResponseQuery{
Code: uint32(sdk.CodeUnknownRequest),
Expand Down
1 change: 0 additions & 1 deletion plugins/dex/matcheng/unrolledlinkedlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func (b *bucket) insert(p *PriceLevel, compare Comparator) int {
k := len(b.elements)
i := sort.Search(k, func(i int) bool { return compare(b.elements[i].Price, p.Price) < 0 })
if i > 0 && compare(b.elements[i-1].Price, p.Price) == 0 {
//TODO: overwrite?
return 0 // duplicated
}
if i == k { // not found
Expand Down
3 changes: 1 addition & 2 deletions plugins/dex/order/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ func (kp *DexKeeper) ClearAfterMatch() {
}

func (kp *DexKeeper) StoreTradePrices(ctx sdk.Context) {
// TODO: check block height != 0
if ctx.BlockHeight()%pricesStoreEvery == 0 {
lastTradePrices := make(map[string]int64, len(kp.engines))
for symbol, engine := range kp.engines {
Expand Down Expand Up @@ -920,7 +919,7 @@ func (kp *DexKeeper) CanDelistTradingPair(ctx sdk.Context, baseAsset, quoteAsset
}

tradingPairs := kp.PairMapper.ListAllTradingPairs(ctx)
for _, pair := range tradingPairs { //TODO
for _, pair := range tradingPairs {
if (pair.BaseAssetSymbol == symbolToCheck && pair.QuoteAssetSymbol != types.NativeTokenSymbol) ||
(pair.QuoteAssetSymbol == symbolToCheck && pair.BaseAssetSymbol != types.NativeTokenSymbol) {
return fmt.Errorf("trading pair %s_%s should not exist before delisting %s_%s",
Expand Down
2 changes: 0 additions & 2 deletions plugins/tokens/client/rest/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func GetBalances(
for _, coin := range coins {
denom := coin.Denom
exists := tokens.ExistsCC(ctx, denom)
// TODO: we probably actually want to show zero balances.
// if exists && !sdk.Int.IsZero(coins.AmountOf(denom)) {
if exists {
denoms[denom] = true
}
Expand Down