Coder Social home page Coder Social logo

alliance's People

Contributors

dependabot[bot] avatar emidev98 avatar erichgorski avatar evanorti avatar faddat avatar gregnuj avatar javiersuweijie avatar madrezaz avatar phamminh0811 avatar thanhnhann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alliance's Issues

Create a force delete alliance proposal

The current DeleteAllianceProposal can only delete the alliance if there are 0 tokens staked which can be an issue in different situations like when there are dust delegations. Possible feature that forces deleting an alliance which given a denom if an alliance is available with that denom, deletes the alliance and return the stake to the stakers.

Query Alliances grouped by validators

Would be very useful to have an endpoint GET:/terra/alliances/{denom}/validators/{validator_addr}/delegators, that can return the alliances grouped by validators similar to GET:​/cosmos​/staking​/v1beta1​/validators​/{validator_addr}​/delegations because that way is faster and easier to index the alliance delegators or sometimes is even unnecessary to index that data because it can be queried directly from the lcd.

Asset take rate applied wrongly on the first delegation

How to replicate:

  1. Start a chain running for a while (X times the take rate interval)
  2. Add a new alliance asset with a positive take rate (0.001).
  3. Delegate N tokens to the asset

Expected: Take rate (0.001) will only be applied to N tokens after the next take interval (0.001 * N)

In actual: Take rate was retrospectively applied to the first delegation. (0.001 ^ X * N)

Proposed solution: Update the last take rate timestamp even if there are no assets to be deducted.

Amino codecs not registered correctly

Both versions v0.1.0 and main version of Alliance does not register Amino codecs correctly which provoke the following error when forcing a signature with amino encoding:

recovered: expected *legacytx.LegacyMsg when using amino JSON stack: goroutine 7063 [running]: runtime/debug.Stack() runtime/debug/stack.go:24 +0x65 github.com/cosmos/cosmos-sdk/baseapp.newDefaultRecoveryMiddleware.func1({0x1fb8d40, 0xc004098e60}) github.com/cosmos/[email protected]/baseapp/recovery.go:71 +0x27 github.com/cosmos/cosmos-sdk/baseapp.newRecoveryMiddleware.func1({0x1fb8d40?, 0xc004098e60?}) github.com/cosmos/[email protected]/baseapp/recovery.go:39 +0x30 github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x1fb8d40, 0xc004098e60}, 0xc0043dc000?) github.com/cosmos/[email protected]/baseapp/recovery.go:28 +0x37 github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x1fb8d40, 0xc004098e60}, 0x30777c0?) github.com/cosmos/[email protected]/baseapp/recovery.go:33 +0x5e github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1() github.com/cosmos/[email protected]/baseapp/baseapp.go:633 +0xf0 panic({0x1fb8d40, 0xc004098e60}) runtime/panic.go:884 +0x213 github.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle.func1() github.com/cosmos/[email protected]/x/auth/ante/setup.go:57 +0x1e6 panic({0x1fb8d40, 0xc004098e60}) runtime/panic.go:884 +0x213 github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx.StdSignBytes({0xc0055dadb0, 0x12}, 0x0, 0x3, 0x0, {{0xc0056b3c08, 0x1, 0x1}, 0x19fbf, {0x0, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/migrations/legacytx/stdsign.go:60 +0x445 github.com/cosmos/cosmos-sdk/x/auth/tx.signModeLegacyAminoJSONHandler.GetSignBytes({}, 0x413588?, {{0xc00005dad0, 0x2d}, {0xc0055dadb0, 0x12}, 0x0, 0x3, {0x30718b0, 0xc0056b3db8}}, ...) github.com/cosmos/[email protected]/x/auth/tx/legacy_amino_json.go:68 +0x40c github.com/cosmos/cosmos-sdk/x/auth/signing.SignModeHandlerMap.GetSignBytes({0x1, {0xc0001aeca0, 0x3, 0x4}, 0xc000231770}, 0x408f54?, {{0xc00005dad0, 0x2d}, {0xc0055dadb0, 0x12}, ...}, ...) github.com/cosmos/[email protected]/x/auth/signing/handler_map.go:59 +0xbe github.com/cosmos/cosmos-sdk/x/auth/signing.VerifySignature({0x30718b0?, 0xc0056b3db8}, {{0xc00005dad0, 0x2d}, {0xc0055dadb0, 0x12}, 0x0, 0x3, {0x30718b0, 0xc0056b3db8}}, ...) github.com/cosmos/[email protected]/x/auth/signing/verify.go:17 +0xdb github.com/cosmos/cosmos-sdk/x/auth/ante.SigVerificationDecorator.AnteHandle({{_, _}, {_, _}}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/sigverify.go:292 +0x65a github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.SigGasConsumeDecorator.AnteHandle({{_, _}, _}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/sigverify.go:194 +0x577 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateSigCountDecorator.AnteHandle({{_, _}}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/sigverify.go:384 +0x3f7 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.SetPubKeyDecorator.AnteHandle({{_, _}}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/sigverify.go:126 +0xad7 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.DeductFeeDecorator.AnteHandle({{_, _}, {_, _}, {_, _}, _}, {{0x3067380, 0xc000058050}, {0x30777c0, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/fee.go:67 +0x337 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.ConsumeTxSizeGasDecorator.AnteHandle({{_, _}}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/basic.go:142 +0x5c6 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateMemoDecorator.AnteHandle({{_, _}}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/basic.go:66 +0x2f7 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.TxTimeoutHeightDecorator.AnteHandle({}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/basic.go:205 +0x297 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateBasicDecorator.AnteHandle({}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/basic.go:34 +0x157 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.RejectExtensionOptionsDecorator.AnteHandle({_}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/ext.go:52 +0x137 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle({}, {{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, ...}, ...}, ...) github.com/cosmos/[email protected]/x/auth/ante/setup.go:62 +0x593 github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1({{0x3067380, 0xc000058050}, {0x30777c0, 0xc005a09c40}, {{0xb, 0x0}, {0xc0055dadb0, 0x12}, 0x46, {0x15fb9dc5, ...}, ...}, ...}, ...) github.com/cosmos/[email protected]/types/handler.go:40 +0x136 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0xc0017da380, 0x0, {0xc00430e2c0, 0x14b, 0x14d}) github.com/cosmos/[email protected]/baseapp/baseapp.go:685 +0x726 github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).CheckTx(0xc0017da380, {{0xc00430e2c0?, 0xc005aedba8?, 0x5b0f2e?}, 0x5aedc98?}) github.com/cosmos/[email protected]/baseapp/abci.go:244 +0x86 github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync(0xc000df5800, {{0xc00430e2c0?, 0xe56640?, 0xc000e10ee0?}, 0x5aede08?}) github.com/tendermint/[email protected]/abci/client/local_client.go:104 +0x118 github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync(0xc000e10ee0?, {{0xc00430e2c0?, 0x5b6da5?, 0xc005aedeb0?}, 0x5aedeb8?}) github.com/tendermint/[email protected]/proxy/app_conn.go:126 +0x26 github.com/tendermint/tendermint/mempool/v0.(*CListMempool).CheckTx(0xc000625bc0, {0xc00430e2c0, 0x14b, 0x14d}, 0xc00581ea00?, {0xea00?, {0x0?, 0x8?}}) github.com/tendermint/[email protected]/mempool/v0/clist_mempool.go:254 +0x30d github.com/tendermint/tendermint/rpc/core.BroadcastTxSync(0xc0006962c0, {0xc00430e2c0, 0x14b, 0x14d}) github.com/tendermint/[email protected]/rpc/core/mempool.go:36 +0xf6 github.com/tendermint/tendermint/rpc/client/local.(*Local).BroadcastTxSync(0x16?, {0x4292d80?, 0x412dfe?}, {0xc00430e2c0?, 0x9c04f1?, 0xc0045ac980?}) github.com/tendermint/[email protected]/rpc/client/local/local.go:99 +0x2b github.com/cosmos/cosmos-sdk/client.Context.BroadcastTxSync({{0x0, 0x0, 0x0}, {0x3088a68, 0xc0006962a0}, 0xc000e4a000, {0xc0017ea018, 0x12}, {0x307d9d8, 0xc00011e650}, ...}, ...) github.com/cosmos/[email protected]/client/broadcast.go:125 +0x12e github.com/cosmos/cosmos-sdk/client.Context.BroadcastTx({{0x0, 0x0, 0x0}, {0x3088a68, 0xc0006962a0}, 0xc000e4a000, {0xc0017ea018, 0x12}, {0x307d9d8, 0xc00011e650}, ...}, ...) github.com/cosmos/[email protected]/client/broadcast.go:26 +0x78 github.com/cosmos/cosmos-sdk/client.TxServiceBroadcast({_, _}, {{0x0, 0x0, 0x0}, {0x3088a68, 0xc0006962a0}, 0xc000e4a000, {0xc0017ea018, 0x12}, ...}, ...) github.com/cosmos/[email protected]/client/broadcast.go:157 +0x125 github.com/cosmos/cosmos-sdk/client.Context.Invoke({{0x0, 0x0, 0x0}, {0x3088a68, 0xc0006962a0}, 0xc000e4a000, {0xc0017ea018, 0x12}, {0x307d9d8, 0xc00011e650}, ...}, ...) github.com/cosmos/[email protected]/client/grpc_query.go:51 +0x1e5 github.com/cosmos/cosmos-sdk/types/tx.(*serviceClient).BroadcastTx(0xc001517130, {0x30673f0, 0xc004752ea0}, 0x2007980?, {0xc004596680, 0x2, 0x2}) github.com/cosmos/[email protected]/types/tx/service.pb.go:855 +0xce github.com/cosmos/cosmos-sdk/types/tx.request_Service_BroadcastTx_0({0x30673f0, 0xc004752ea0}, {0x306ab00, 0xc001794780}, {0x3069b80, 0xc001517130}, 0xc0043b8f00, 0x1fec1c0?) github.com/cosmos/[email protected]/types/tx/service.pb.gw.go:136 +0x283 github.com/cosmos/cosmos-sdk/types/tx.RegisterServiceHandlerClient.func3({0x30649e0, 0xc0056b3980}, 0xc0043b8f00, 0xc0000db100?) github.com/cosmos/[email protected]/types/tx/service.pb.gw.go:477 +0x165 github.com/grpc-ecosystem/grpc-gateway/runtime.(*ServeMux).ServeHTTP(0xc0017a8070, {0x30649e0, 0xc0056b3980}, 0xc0043b8f00) github.com/grpc-ecosystem/[email protected]/runtime/mux.go:240 +0x856 github.com/gorilla/mux.(*Router).ServeHTTP(0xc001790180, {0x30649e0, 0xc0056b3980}, 0xc0043b8d00) github.com/gorilla/[email protected]/mux.go:210 +0x1cf github.com/tendermint/tendermint/rpc/jsonrpc/server.maxBytesHandler.ServeHTTP({{0x3047ec0?, 0xc001790180?}, 0x413967?}, {0x30649e0?, 0xc0056b3980}, 0xc0043b8d00) github.com/tendermint/[email protected]/rpc/jsonrpc/server/http_server.go:256 +0x124 github.com/tendermint/tendermint/rpc/jsonrpc/server.RecoverAndLogHandler.func1({0x3065f40?, 0xc0043ae1c0}, 0xc0043b8d00) github.com/tendermint/[email protected]/rpc/jsonrpc/server/http_server.go:229 +0x37f net/http.HandlerFunc.ServeHTTP(0x0?, {0x3065f40?, 0xc0043ae1c0?}, 0x70e174?) net/http/server.go:2122 +0x2f net/http.serverHandler.ServeHTTP({0x30510e0?}, {0x3065f40, 0xc0043ae1c0}, 0xc0043b8d00) net/http/server.go:2936 +0x316 net/http.(*conn).serve(0xc0043bc000, {0x30673f0, 0xc001795350}) net/http/server.go:1995 +0x612 created by net/http.(*Server).Serve net/http/server.go:3089 +0x5ed : panic

Open details clicking the arrow.

TypeScript code to reproduce the previous issue:

import { SignMode } from "@terra-money/legacy.proto/cosmos/tx/signing/v1beta1/signing"; import { LCDClient, MnemonicKey, MsgAllianceDelegate, Wallet, } from "."; const lcd = new LCDClient({ "alliance-testnet-1": { lcd: "http://localhost:1317", chainID: "alliance-testnet-1", gasPrices: { stake: 0, }, gasAdjustment: 1, prefix: "cosmos", } }); const mnemonic = new MnemonicKey({ mnemonic: "staff upgrade rule private abstract goddess nothing dignity piece decline drill crystal lumber deposit people three survey nest sure asset speed escape one bomb", coinType: 118, }); const wallet = new Wallet(lcd, mnemonic); const address = wallet.key.accAddress("cosmos"); console.log(address); (async () => { const balances = await lcd.bank.balance(address); const azCoin = balances[0].toArray()[0]; const validator = await lcd.staking.validators("alliance-testnet-1"); console.log(azCoin); // Sign a MsgDelegate transaction try { const tx = await wallet.createAndSignTx({ msgs: [ new MsgAllianceDelegate( address, validator[0][0].operator_address, azCoin.div(10000), ) ], chainID: "alliance-testnet-1", signMode: SignMode.SIGN_MODE_LEGACY_AMINO_JSON, }); // boradcast the tx const txResult = await lcd.tx.broadcast(tx, "alliance-testnet-1"); console.log(txResult.raw_log); } catch (e) { console.log(e) } })() ```

Fix being applied here #173

Emit event on asset take rate deduction

The current implementation of alliance module does not emit any events when deducts alliance assets using the take_rate parameter.

Possible Solution

A type is defined as the event and emitted in DeductAssetsWithTakeRate keeper method.

Querying bank balance returns error

Calling /cosmos/bank/v1beta1/balances/<addr> returns an error with the modified bank module. RPC queries are not registered correctly.

{
  "code": 12,
  "message": "unknown service cosmos.bank.v1beta1.Query",
  "details": []
}

Query alliances with special characters

Since the primary key for alliance assets is the denom, there are Denoms like the ones from Token Factory that include slashes or other special characters which will produce the following error in the service when requesting a denom using the LCD:
image

Look into how alliance assets can be removed and delegations returned

Currently, in order to remove an alliance asset. Governance needs to set reward weights first to zero and make sure all delegators un-delegate before another proposal can be raised to delete the alliance.

Proposal: Update the delete alliance flow to perform the below steps:

  1. Move delegator assets to a module account
  2. Allows delegators to claim/un-delegate their assets
  3. Delete the alliance asset

Fail when run BenchmarkSimulation

Context

When I run BenchmarkSimulation with this command below, It shows the fail result, and the parameters like total_tokens and total_validator_shares are always equal zero :

// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true`

Log:

Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -bench ^BenchmarkSimulation$ github.com/terra-money/alliance/app

goos: darwin
goarch: arm64
pkg: github.com/terra-money/alliance/app
BenchmarkSimulation
Starting SimulateFromSeed with randomness created with seed 42
Randomized simulation params:
{}
Selected randomly generated parameters for simulated genesis:
{
  stake_per_account: "{1374406609344}",
  initially_bonded_validators: "246"
}
Selected randomly generated auth parameters:
{
 "max_memo_characters": 147,
 "tx_sig_limit": 6,
 "tx_size_cost_per_byte": 7,
 "sig_verify_cost_ed25519": 565,
 "sig_verify_cost_secp256k1": 567
}
Selected randomly generated bank parameters:
{
 "default_send_enabled": true
}
Selected randomly generated capability parameters:
{
 "index": 9,
 "owners": null
}
Selected randomly generated governance parameters:
{
 "starting_proposal_id": 70,
 "deposit_params": {
  "min_deposit": [
   {
    "denom": "stake",
    "amount": "294"
   }
  ],
  "max_deposit_period": 247366000000000
 },
 "voting_params": {
  "voting_period": 193920000000000
 },
 "tally_params": {
  "quorum": "0.362000000000000000",
  "threshold": "0.543000000000000000",
  "veto_threshold": "0.272000000000000000"
 }
}
Selected randomly generated minting parameters:
{
 "minter": {
  "inflation": "0.850000000000000000",
  "annual_provisions": "0.000000000000000000"
 },
 "params": {
  "mint_denom": "stake",
  "inflation_rate_change": "0.180000000000000000",
  "inflation_max": "0.200000000000000000",
  "inflation_min": "0.070000000000000000",
  "goal_bonded": "0.670000000000000000",
  "blocks_per_year": 6311520
 }
}
Selected randomly generated staking parameters:
{
 "unbonding_time": 102843000000000,
 "max_validators": 205,
 "max_entries": 7,
 "historical_entries": 7494,
 "bond_denom": "stake",
 "min_commission_rate": "0"
}
Selected randomly generated distribution parameters:
{
 "params": {
  "community_tax": "0.100000000000000000",
  "base_proposer_reward": "0.160000000000000000",
  "bonus_proposer_reward": "0.110000000000000000",
  "withdraw_addr_enabled": true
 },
 "fee_pool": {
  "community_pool": []
 },
 "delegator_withdraw_infos": null,
 "outstanding_rewards": null,
 "validator_accumulated_commissions": null,
 "validator_historical_rewards": null,
 "validator_current_rewards": null,
 "delegator_starting_infos": null,
 "validator_slash_events": null
}
Selected randomly generated slashing parameters:
{
 "params": {
  "signed_blocks_window": 426,
  "min_signed_per_window": "0.300000000000000000",
  "downtime_jail_duration": 38914000000000,
  "slash_fraction_double_sign": "0.045454545454545455",
  "slash_fraction_downtime": "0.017241379310344828"
 },
 "signing_infos": [],
 "missed_blocks": []
}
Selected randomly generated evidence parameters:
{}
Selected randomly generated ibc parameters:
{
 "client_genesis": {
  "clients": [],
  "clients_consensus": [],
  "clients_metadata": null,
  "params": {
   "allowed_clients": [
    "06-solomachine",
    "07-tendermint"
   ]
  }
 },
 "connection_genesis": {
  "connections": [],
  "client_connection_paths": [],
  "params": {
   "max_expected_time_per_block": 30000000000
  }
 },
 "channel_genesis": {
  "channels": [],
  "acknowledgements": [],
  "commitments": [],
  "receipts": [],
  "send_sequences": [],
  "recv_sequences": [],
  "ack_sequences": []
 }
}
Selected randomly generated transfer parameters:
{
 "port_id": "hkpupinotjkaetodrfnm",
 "denom_traces": [],
 "params": {
  "receive_enabled": true
 }
}
Selected randomly generated alliance parameters:
{
 "params": {
  "reward_delay_time": "100005000000000",
  "take_rate_claim_interval": "499000000000",
  "last_take_rate_claim_time": "2248-05-21T15:21:12Z"
 },
 "assets": [
  {
   "denom": "ASSET0",
   "reward_weight": "2.096850672408960368",
   "take_rate": "0.500000000000000000",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-12T03:16:07.719783Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-12T03:16:07.719783Z"
  },
  {
   "denom": "ASSET1",
   "reward_weight": "5.000000000000000000",
   "take_rate": "0.180362719407280665",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-10T11:05:46.719785Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-10T11:05:46.719785Z"
  },
  {
   "denom": "ASSET2",
   "reward_weight": "2.648049041844417473",
   "take_rate": "0.000000000000000000",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-12T17:01:56.719787Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-12T17:01:56.719787Z"
  },
  {
   "denom": "ASSET3",
   "reward_weight": "2.894942824942787066",
   "take_rate": "0.074591352662639133",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-11T06:12:44.719788Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-11T06:12:44.719788Z"
  },
  {
   "denom": "ASSET4",
   "reward_weight": "3.485970446215046101",
   "take_rate": "0.006011058643479254",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-14T14:17:56.71979Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-14T14:17:56.71979Z"
  },
  {
   "denom": "ASSET5",
   "reward_weight": "2.805423148740658227",
   "take_rate": "0.420595395807458750",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-12T11:42:02.719791Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-12T11:42:02.719791Z"
  },
  {
   "denom": "ASSET6",
   "reward_weight": "0.474644880011687495",
   "take_rate": "0.000000000000000000",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-13T20:32:18.719792Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-13T20:32:18.719792Z"
  },
  {
   "denom": "ASSET7",
   "reward_weight": "2.604381502290754446",
   "take_rate": "0.432485526985551096",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-11T09:17:50.719793Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-11T09:17:50.719793Z"
  },
  {
   "denom": "ASSET8",
   "reward_weight": "0.182200865604443784",
   "take_rate": "0.432156645596732076",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-14T18:42:42.719794Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-14T18:42:42.719794Z"
  },
  {
   "denom": "ASSET9",
   "reward_weight": "2.492604973481160539",
   "take_rate": "0.000000000000000000",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-11T02:33:56.719796Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-11T02:33:56.719796Z"
  },
  {
   "denom": "ASSET10",
   "reward_weight": "5.000000000000000000",
   "take_rate": "0.382041768833035912",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-14T23:49:55.719796Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-14T23:49:55.719796Z"
  },
  {
   "denom": "ASSET11",
   "reward_weight": "2.201330391709655945",
   "take_rate": "0.392162695059891772",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-12T10:43:41.719797Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-12T10:43:41.719797Z"
  },
  {
   "denom": "ASSET12",
   "reward_weight": "5.000000000000000000",
   "take_rate": "0.456916490301012019",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-13T10:21:13.719798Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-13T10:21:13.719798Z"
  },
  {
   "denom": "ASSET13",
   "reward_weight": "0.317908834246539636",
   "take_rate": "0.387611019211537593",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-15T06:33:45.719799Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-15T06:33:45.719799Z"
  },
  {
   "denom": "ASSET14",
   "reward_weight": "4.277115703730389227",
   "take_rate": "0.258433378811351581",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-13T08:27:11.719801Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-13T08:27:11.719801Z"
  },
  {
   "denom": "ASSET15",
   "reward_weight": "0.829942623468886161",
   "take_rate": "0.500000000000000000",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-11T18:04:49.719801Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-11T18:04:49.719801Z"
  },
  {
   "denom": "ASSET16",
   "reward_weight": "0.529834113681662237",
   "take_rate": "0.427764237444213413",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-12T05:48:35.719803Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-12T05:48:35.719803Z"
  },
  {
   "denom": "ASSET17",
   "reward_weight": "3.325845775061439424",
   "take_rate": "0.000000000000000000",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-11T15:38:39.719805Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-11T15:38:39.719805Z"
  },
  {
   "denom": "ASSET18",
   "reward_weight": "2.582529527738531650",
   "take_rate": "0.487635726735120429",
   "total_tokens": "0",
   "total_validator_shares": "0.000000000000000000",
   "reward_start_time": "2023-02-12T17:43:59.719806Z",
   "reward_change_rate": "1.000000000000000000",
   "reward_change_interval": "0",
   "last_reward_change_time": "2023-02-12T17:43:59.719806Z"
  }
 ],
 "validator_infos": null,
 "reward_weight_change_snaphots": null,
 "delegations": null,
 "redelegations": null,
 "undelegations": null
}
Selected randomly generated consensus parameters:
{
 "block": {
  "max_bytes": 26693402,
  "max_gas": -1
 },
 "evidence": {
  "max_age_num_blocks": 17140,
  "max_age_duration": 102843000000000
 },
 "validator": {
  "pub_key_types": [
   "ed25519"
  ]
 }
}
Starting the simulation from time Sun May 21 15:21:12 UTC 2248 (unixtime 8785034472)
Simulating... block 3/500, operation 0/70.    /Users/nhan/Documents/go-workspace/notional/alliance/app/simulate.go:302: error on block  3/500, operation (43/129) from x/staking:
        delegation addr: cosmos1srd5yxrg346qd7mne893gy3g43elh2sw7lz0s3 does not exist in simulation accounts
        Comment: account private key is nil
--- FAIL: BenchmarkSimulation
FAIL
exit status 1
FAIL    github.com/terra-money/alliance/app     0.966s

Cosmwasm custom query bindings

The alliance module is missing cosmwasm custom query bindings.

For "execution" messages, we can use stargate which already works.

Allow alliance reward weight to be zero

Currently create alliance proposals does not allow RewardRate to be zero. An alliance asset with zero reward rate signifies that an alliance has no voting power and is disabled.

if m.RewardWeight.IsNil() || m.RewardWeight.LTE(sdk.ZeroDec()) {

if m.RewardWeight.IsNil() || m.RewardWeight.LTE(sdk.ZeroDec()) {

Solution:
Update such that we allow zero RewardRate to be used.

Allow asset participation in governance to be configurable

Not all assets should be allowed to participate in governance as there might be conflict of interests in some cases.

  • Wrap the governance module (x/gov) Tally method with a modified implementation that checks if assets should be part of the voting power calculation.
  • Update SDK initialization to wire the modified x/gov module
  • Update docs on how to integrate

[Bug] Division by zero stack

When creating an Alliance, delegating "x" tokens and undelegating all or almost all the tokens a division by zero happens when trying to delegate again before the rewards starting time.

To reproduce the bug:

  • Create an Alliance,
  • Delegate to the Alliance,
  • Withdraw all the previously delegated tokens before rewards_start_time,
  • Try to delegate again and the following error will happen:

Error stack

recovered: division by zero stack: goroutine 5813515 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 github.com/cosmos/cosmos-sdk/baseapp.newDefaultRecoveryMiddleware.func1({0x2269180, 0x3445a60}) /go/pkg/mod/github.com/cosmos/[email protected]/baseapp/recovery.go:71 +0x27 github.com/cosmos/cosmos-sdk/baseapp.newRecoveryMiddleware.func1({0x2269180?, 0x3445a60?}) /go/pkg/mod/github.com/cosmos/[email protected]/baseapp/recovery.go:39 +0x30 github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x2269180, 0x3445a60}, 0xc007df6d80?) /go/pkg/mod/github.com/cosmos/[email protected]/baseapp/recovery.go:28 +0x37 github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x2269180, 0x3445a60}, 0x347eec0?) /go/pkg/mod/github.com/cosmos/[email protected]/baseapp/recovery.go:33 +0x5e github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1() /go/pkg/mod/github.com/cosmos/[email protected]/baseapp/baseapp.go:632 +0xf0 panic({0x2269180, 0x3445a60}) /usr/local/go/src/runtime/panic.go:838 +0x207 math/big.nat.div({0xc01391f3b0?, 0x10?, 0x100c00193b2c0?}, {0x0?, 0x0?, 0x7fb0668a4108?}, {0xc01391f3b0?, 0xc000073c00?, 0xc0352952d0?}, {0x0, ...}) /usr/local/go/src/math/big/natdiv.go:507 +0x348 math/big.(*Int).Quo(0xc04a644920, 0xc04a644920, 0xc04a644900) /usr/local/go/src/math/big/int.go:212 +0x78 github.com/cosmos/cosmos-sdk/types.Dec.QuoMut({0x300000000?}, {0xc04a644140?}) /go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:355 +0x57 github.com/cosmos/cosmos-sdk/types.Dec.ImmutOp({0x8?}, 0x3071300, {0xc00bb20578?}) /go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:235 +0x162 github.com/cosmos/cosmos-sdk/types.Dec.Quo(...) /go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:347 github.com/terra-money/alliance/x/alliance/types.ConvertNewTokenToShares({0x412027?}, {0x0?}, {0x2675200?}) /allianced/x/alliance/types/asset.go:27 +0x66 github.com/terra-money/alliance/x/alliance/types.GetValidatorShares({{0xc0058e3a90, 0x44}, {0xc04a644340}, {0xc04a644360}, {0xc04a644380}, {0xc04a6443a0}, {0x1df34db3, 0xedb5753a9, 0x0}, {0xc04a6443c0}, ...}, ...) /allianced/x/alliance/types/asset.go:54 +0x37 github.com/terra-money/alliance/x/alliance/keeper.Keeper.Delegate({{0x3451c90, 0xc00005b090}, {{0x347cf70, 0xc000d705e0}, 0xc000010e00, {0x3451c90, 0xc00005ab40}, {0x3451ce0, 0xc00005b510}, {0xc000dcbe00, ...}, ...}, ...}, ...) /allianced/x/alliance/keeper/delegation.go:45 +0x4a5 github.com/terra-money/alliance/x/alliance/keeper.MsgServer.Delegate({{{0x3451c90, 0xc00005b090}, {{0x347cf70, 0xc000d705e0}, 0xc000010e00, {0x3451c90, 0xc00005ab40}, {0x3451ce0, 0xc00005b510}, {0xc000dcbe00, ...}, ...}, ...}}, ...) /allianced/x/alliance/keeper/msg_server.go:38 +0x439 github.com/terra-money/alliance/x/alliance/types._Msg_Delegate_Handler.func1({0x346d808, 0xc05ef999e0}, {0x25d6b00?, 0xc044f737c0}) /allianced/x/alliance/types/tx.pb.go:492 +0x78 github.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).RegisterService.func2.1({0x346edb0, 0xc007df6900}, {0xc00193d070?, 0x40f6ab?}, 0x267b9c0?, 0xc0243a9710) /go/pkg/mod/github.com/cosmos/[email protected]/baseapp/msg_service_router.go:113 +0xd2 github.com/terra-money/alliance/x/alliance/types._Msg_Delegate_Handler({0x267a6c0?, 0xc000d02000}, {0x346edb0, 0xc007df6900}, 0x30710c8, 0xc04a644060) /allianced/x/alliance/types/tx.pb.go:494 +0x138 ...

How to reproduce:

After executing all the undelegations the following amount 2.020002 of tokens remains in the pool.

Withdrawn rewards defaulting to stake instead of uluna on pisco-1

When undelegating funds on pisco-1, the rewards coin type is defaulting to STAKE instead of LUNA. Transaction details of example: https://terrasco.pe/testnet/tx/0EA4417C398AE4B745DE6BF535800A1127D79A720F3AEE0811BD240465F142BF

      {
        "type": "unbond",
        "attributes": [
          {
            "key": "validator",
            "value": "terravaloper1gtw2uxdkdt3tvq790ckjz8jm8qgwkdw3uptstn"
          },
          {
            "key": "amount",
            "value": "2000000uluna"
          },
          {
            "key": "completion_time",
            "value": "2023-05-07T14:45:48Z"
          }
        ]
      },
      {
        "type": "withdraw_rewards",
        "attributes": [
          {
            "key": "amount",
            "value": "0stake"
          },
          {
            "key": "validator",
            "value": "terravaloper1gtw2uxdkdt3tvq790ckjz8jm8qgwkdw3uptstn"
          }
        ]
      }

SDK 50

Hi, we're planning to use alliance in eve.

Would you accept a PR that upgrades alliance to sdk 50?

Update Alliance submission through CLI fails

Running update alliance proposal from CLI fails with

raw_log: 'failed to execute message; message index: 0: failed to run legacy handler
  alliance, rpc error: code = AlreadyExists desc = Asset with denom: ibc/C02E95358F7A86EBB8CFDA9661FA2819AF548F637886987B8722F43925F1FC64
  already exists: invalid proposal content: no handler exists for proposal type'

Wrong decimal place represented on get validators (?)

When requesting the validators info from GET:/terra/alliances/validators and GET:/terra/alliances/validators/{validator_addr} a response like the one below is returned. None of the decimal places are correct n in the amount property.

{
  "validators": [
    {
      "validator_addr": "terravaloper1zdpgj8am5nqqvht927k3etljyl6a52kwqndjz2",
      "total_delegation_shares": [
        {
          "denom": "factory/terra1majrm6e6n0eg760n9fs4g5jvwzh4ytp8e2d99mfgzv2e7mjmdwxse0ty73/ualliance",
          "amount": "1000000.000000000000000000"
        },
        {
          "denom": "factory/terra1zdpgj8am5nqqvht927k3etljyl6a52kwqup0je/utest766e",
          "amount": "199950000.000000000000000000"
        }
      ],
      "validator_shares": [
        {
          "denom": "factory/terra1majrm6e6n0eg760n9fs4g5jvwzh4ytp8e2d99mfgzv2e7mjmdwxse0ty73/ualliance",
          "amount": "1000000.000000000000000000"
        },
        {
          "denom": "factory/terra1zdpgj8am5nqqvht927k3etljyl6a52kwqup0je/utest766e",
          "amount": "199950000.000000000000000000"
        }
      ],
      "total_staked": [
        {
          "denom": "factory/terra1majrm6e6n0eg760n9fs4g5jvwzh4ytp8e2d99mfgzv2e7mjmdwxse0ty73/ualliance",
          "amount": "1000000.000000000000000000"
        },
        {
          "denom": "factory/terra1zdpgj8am5nqqvht927k3etljyl6a52kwqup0je/utest766e",
          "amount": "199950000.000000000016443600"
        }
      ]
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

Since the decimal place is not available always on chain the best possible solution can be to replace the DecCoin with Coin

Allow querying of undelegated tokens that are being unbonded

Currently unbonding on alliance delegations follows the unbonding period of the staking module. However, there is no API to query for how many tokens are currently being unbonded given a delegation address.

Add a new API to allow querying. A new index that keeps tracks of undelegation by delegation address is needed.

Allow user-provided fee collector module account

The current implementation of alliance module statically uses authtypes.FeeCollectorName as the fee collector module account and transfers the rewards to this account. This can be replaced by a user-provided account for more flexibility.

Possible Solution

Similar to other cosmos-sdk modules such as mint or distribution, module account name for fee collection can be made into a field on Keeper and passed to the Keeper factory method. Users must provide the account during the app wiring.

Query redelegations in progress by denom and delegator

At the moment is impossible to query the redelegations that are in progress. A QueryService must be implemented to query the delegations that are in progress by denom and delegator similart to GET:/terra/alliances/redelegations/{denom}/{delegator_addr}.

Set a min and max reward weight to bound how much it can scale

Currently, there is no way to set a range in which the reward weight can scale. With a high enough reward change rate and a long enough duration, the reward rate could scale to numbers that could skew voting power by too much.

Solution

Add a new variable AllianceAsset.RewardWeightRange: [min, max] to limit how much reward weights can scale.

Chain simulations throws panic for certain seeds

When take rate is set too high in simulations, asset.TotalTokens decay too quickly such that there isn't enough tokens to calculate reward distribution.

Stacktrace

Simulating... block 153/200, operation 0/16.panic: failed to rebalance assets in x/alliance module: there are no delegations yet

goroutine 866 [running]:
github.com/terra-money/alliance/x/alliance.EndBlocker({{0x106c93848, 0x14000128008}, {0x106ca3360, 0x140224193c0}, {{0x0, 0x0}, {0x105b70a86, 0xe}, 0x99, {0x0, ...}, ...}, ...}, ...)
        /Users/javiersuweijie/go/pkg/mod/github.com/terra-money/[email protected]/x/alliance/abci.go:31 +0x35c
github.com/terra-money/alliance/x/alliance.AppModule.EndBlock(...)
        /Users/javiersuweijie/go/pkg/mod/github.com/terra-money/[email protected]/x/alliance/module.go:103
github.com/cosmos/cosmos-sdk/types/module.(*Manager).EndBlock(_, {{0x106c93848, 0x14000128008}, {0x106ca3360, 0x140224193c0}, {{0x0, 0x0}, {0x105b70a86, 0xe}, 0x99, ...}, ...}, ...)
        /Users/javiersuweijie/go/pkg/mod/github.com/terra-money/[email protected]/types/module/module.go:505 +0x1a4
github.com/terra-money/core/v2/app.(*TerraApp).EndBlocker(...)
        /Users/javiersuweijie/Projects/core/app/app.go:876
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).EndBlock(0x14001098380, {0x14000128008?})
        /Users/javiersuweijie/go/pkg/mod/github.com/terra-money/[email protected]/baseapp/abci.go:206 +0x134
github.com/cosmos/cosmos-sdk/x/simulation.SimulateFromSeed({0x106ca8a00?, 0x1400013ca00}, {0x106c75640?, 0x14000126008}, 0x43e2cf?, 0x1090b63a0?, 0x106c65030, {0x140001e7180, 0x24, 0x28}, ...)
        /Users/javiersuweijie/go/pkg/mod/github.com/terra-money/[email protected]/x/simulation/simulate.go:188 +0x11b0
github.com/terra-money/core/v2/app_test.BenchmarkSimulation(0x1400013ca00)
        /Users/javiersuweijie/Projects/core/app/simulation_test.go:74 +0x420
testing.(*B).runN(0x1400013ca00, 0x1)
        /usr/local/go/src/testing/benchmark.go:193 +0x128
testing.(*B).run1.func1()
        /usr/local/go/src/testing/benchmark.go:233 +0x50
created by testing.(*B).run1
        /usr/local/go/src/testing/benchmark.go:226 +0x8c
exit status 2
FAIL    github.com/terra-money/core/v2/app      28.802s
FAIL

Unbonding name harmonization

Harmonize the unboundings because at the moment we have unbondings and undelegations. Technically when we talk about undelegation it is an unbound. I would recommend to create a naming definition that talks about:

  • BeginUnbonding: when the unbond action is requested by the user (e.g method name Undelegate should be BeginUnbonding,
  • CompleteUnbond: when the action of transferring the tokens from the x/alliance account to the user account happens (e.g. the method CompleteUndelegations must be renamed to CompleteUnbond.

there are more places in the code where this modifications need to be applied but these were just two of the many examples where the wording should be changed from undelegation to unbonding

Is important to take in consideration that the old entry points with the undelegations name must remain the same as now but must be deprecated, that way can be removed in a future release.

Delegations before RewardStartTime does not trigger auto-rebalancing

How to replicate:

  1. Set RewardStartTime = 5m
  2. Add a new alliance asset
  3. Delegate using the asset
  4. Wait for 5m
  5. Check validator's stakers (There will not be any stake by the alliance module)

Solution:
When rebalancing, if an asset is not yet ready to get rewards, requeue another rebalancing event so that the next block will check if the asset is ready.

Endpoints to query the unbondings and redelegations simplified

At the moment whenever we want to query unbondings or redelegations we need to have the denom and address of the account to query these values for. To make it easier for the developers a new index can be created, that way devs can be required only one parameter to query the unbondings or redelegations which will be the address of the account

Remove deprecated endpoints on the next major release

The endpoints that must be are the following ones:

⚠️ Remove their internal code, remove the tests and re-generate the proto files.

Codebase to work this feature must be release/v0.3.x and it will be integrated in the release/v0.4.x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.