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

x/group sims fail with unique constraint violation #14833

Closed
akhilkumarpilli opened this issue Jan 30, 2023 · 9 comments
Closed

x/group sims fail with unique constraint violation #14833

akhilkumarpilli opened this issue Jan 30, 2023 · 9 comments

Comments

@akhilkumarpilli
Copy link
Contributor

akhilkumarpilli commented Jan 30, 2023

Summary of Bug

x/group sims are failing with unique constraint violation panic when running AppImportExport simulation tests.

related: #11984

Version

v0.46.8

Steps to Reproduce

go test ./simapp -run TestAppImportExport -Enabled=true -NumBlocks=50 -Genesis= -Verbose=true -Commit=true -Seed=2 -Period=5 -ExportParamsPath /tmp/sim-logs-492341770/sim_params-2.json -ExportStatePath /tmp/sim-logs-492341770/sim_state-2.json -v -timeout 24h

Output:

=== RUN   TestAppImportExport
Starting SimulateFromSeed with randomness created with seed 11
Randomized simulation params: 
{}
Selected randomly generated parameters for simulated genesis:
{
  stake_per_account: "{824659424000}",
  initially_bonded_validators: "51"
}
Selected randomly generated auth parameters:
{
 "max_memo_characters": 183,
 "tx_sig_limit": 11,
 "tx_size_cost_per_byte": 14,
 "sig_verify_cost_ed25519": 985,
 "sig_verify_cost_secp256k1": 771
}
Selected randomly generated bank parameters:
{
 "default_send_enabled": true
}
Selected randomly generated capability parameters:
{
 "index": 207,
 "owners": null
}
Selected randomly generated distribution parameters:
{
 "params": {
  "community_tax": "0.260000000000000000",
  "base_proposer_reward": "0.290000000000000000",
  "bonus_proposer_reward": "0.120000000000000000",
  "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 evidence parameters:
{}
Selected randomly generated governance parameters:
{
 "starting_proposal_id": 35,
 "deposit_params": {
  "min_deposit": [
   {
    "denom": "stake",
    "amount": "886"
   }
  ],
  "max_deposit_period": 229325000000000
 },
 "voting_params": {
  "voting_period": 174799000000000
 },
 "tally_params": {
  "quorum": "0.434000000000000000",
  "threshold": "0.506000000000000000",
  "veto_threshold": "0.305000000000000000"
 }
}
Selected randomly generated governance parameters:
{
 "starting_proposal_id": 65,
 "deposit_params": {
  "min_deposit": [
   {
    "denom": "stake",
    "amount": "106"
   }
  ],
  "max_deposit_period": 272313000000000
 },
 "voting_params": {
  "voting_period": 234973000000000
 },
 "tally_params": {
  "quorum": "0.445000000000000000",
  "threshold": "0.472000000000000000",
  "veto_threshold": "0.316000000000000000"
 }
}
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 minting parameters:
{
 "minter": {
  "inflation": "0.610000000000000000",
  "annual_provisions": "0.000000000000000000"
 },
 "params": {
  "mint_denom": "stake",
  "inflation_rate_change": "0.070000000000000000",
  "inflation_max": "0.200000000000000000",
  "inflation_min": "0.070000000000000000",
  "goal_bonded": "0.670000000000000000",
  "blocks_per_year": 6311520
 }
}
Selected randomly generated slashing parameters:
{
 "params": {
  "signed_blocks_window": 41,
  "min_signed_per_window": "0.600000000000000000",
  "downtime_jail_duration": 51254000000000,
  "slash_fraction_double_sign": "0.035714285714285714",
  "slash_fraction_downtime": "0.009523809523809524"
 },
 "signing_infos": [],
 "missed_blocks": []
}
Selected randomly generated staking parameters:
{
 "unbonding_time": 420246000000000,
 "max_validators": 193,
 "max_entries": 7,
 "historical_entries": 1338,
 "bond_denom": "stake",
 "min_commission_rate": "0"
}
Selected randomly generated transfer parameters:
{
 "port_id": "jydstbwmtxvoqretdelp",
 "denom_traces": [],
 "params": {
  "send_enabled": true,
  "receive_enabled": true
 }
}
Selected randomly generated consensus parameters:
{
 "block": {
  "max_bytes": 28802051,
  "max_gas": -1
 },
 "evidence": {
  "max_age_num_blocks": 70041,
  "max_age_duration": 420246000000000
 },
 "validator": {
  "pub_key_types": [
   "ed25519"
  ]
 }
}
I[2023-01-30|16:31:46.709] initializing blockchain state from genesis.json 
D[2023-01-30|16:31:46.709] running initialization for module            module=capability 
D[2023-01-30|16:31:46.709] running initialization for module            module=auth 
D[2023-01-30|16:31:46.752] running initialization for module            module=bank 
D[2023-01-30|16:31:46.778] running initialization for module            module=distribution 
D[2023-01-30|16:31:46.779] running initialization for module            module=staking 
D[2023-01-30|16:31:46.786] running initialization for module            module=slashing 
D[2023-01-30|16:31:46.787] running initialization for module            module=gov 
D[2023-01-30|16:31:46.787] running initialization for module            module=mint 
D[2023-01-30|16:31:46.787] running initialization for module            module=ibc 
D[2023-01-30|16:31:46.787] running initialization for module            module=crisis 
I[2023-01-30|16:31:46.787] asserting crisis invariants                  module=x/crisis inv=1/12 name=staking/module-accounts
I[2023-01-30|16:31:46.788] asserting crisis invariants                  module=x/crisis inv=2/12 name=staking/nonnegative-power
I[2023-01-30|16:31:46.788] asserting crisis invariants                  module=x/crisis inv=3/12 name=staking/positive-delegation
I[2023-01-30|16:31:46.788] asserting crisis invariants                  module=x/crisis inv=4/12 name=staking/delegator-shares
I[2023-01-30|16:31:46.788] asserting crisis invariants                  module=x/crisis inv=5/12 name=bank/nonnegative-outstanding
I[2023-01-30|16:31:46.790] asserting crisis invariants                  module=x/crisis inv=6/12 name=bank/total-supply
I[2023-01-30|16:31:46.793] asserting crisis invariants                  module=x/crisis inv=7/12 name=group/Group-TotalWeight
I[2023-01-30|16:31:46.793] asserting crisis invariants                  module=x/crisis inv=8/12 name=gov/module-account
I[2023-01-30|16:31:46.793] asserting crisis invariants                  module=x/crisis inv=9/12 name=distribution/nonnegative-outstanding
I[2023-01-30|16:31:46.793] asserting crisis invariants                  module=x/crisis inv=10/12 name=distribution/can-withdraw
I[2023-01-30|16:31:46.796] asserting crisis invariants                  module=x/crisis inv=11/12 name=distribution/reference-count
I[2023-01-30|16:31:46.796] asserting crisis invariants                  module=x/crisis inv=12/12 name=distribution/module-account
I[2023-01-30|16:31:46.796] asserted all invariants                      module=x/crisis duration=8.42185ms height=0
D[2023-01-30|16:31:46.796] running initialization for module            module=genutil 
D[2023-01-30|16:31:46.796] running initialization for module            module=evidence 
D[2023-01-30|16:31:46.796] running initialization for module            module=transfer 
I[2023-01-30|16:31:46.796] created new capability                       module=ibc name=ports/jydstbwmtxvoqretdelp
I[2023-01-30|16:31:46.796] port binded                                  module=x/ibc/port port=jydstbwmtxvoqretdelp
I[2023-01-30|16:31:46.796] claimed capability                           module=transfer name=ports/jydstbwmtxvoqretdelp capability=207
D[2023-01-30|16:31:46.796] running initialization for module            module=authz 
D[2023-01-30|16:31:46.853] running initialization for module            module=feegrant 
D[2023-01-30|16:31:46.918] running initialization for module            module=params 
D[2023-01-30|16:31:46.918] running initialization for module            module=upgrade 
D[2023-01-30|16:31:46.918] running initialization for module            module=vesting 
D[2023-01-30|16:31:46.918] running initialization for module            module=nft 
D[2023-01-30|16:31:46.985] running initialization for module            module=group 
--- FAIL: TestAppImportExport (0.68s)
panic: group policies: unique constraint violation [recovered]
        panic: group policies: unique constraint violation

goroutine 11 [running]:
testing.tRunner.func1.2({0x1e760c0, 0xc001358a40})
        /usr/local/go/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1399 +0x39f
panic({0x1e760c0, 0xc001358a40})
        /usr/local/go/src/runtime/panic.go:884 +0x212
github.com/cosmos/cosmos-sdk/x/group/keeper.Keeper.InitGenesis({{0x2faad38, 0xc000eaf3d0}, {0x2fc18c0, 0xc00123cd20}, {0xc00102e660, {0x1}}, {0x2fc6b00, 0xc00125ff80}, {0xc00102e6c0}, {0x2fc6b00, ...}, ...}, ...)
        /home/user/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.46.4-0.20230130055149-00053f52d6f8/x/group/keeper/genesis.go:27 +0x665
github.com/cosmos/cosmos-sdk/x/group/module.AppModule.InitGenesis(...)
        /home/user/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.46.4-0.20230130055149-00053f52d6f8/x/group/module/module.go:129
github.com/cosmos/cosmos-sdk/types/module.(*Manager).InitGenesis(_, {{0x2fc2c18, 0xc0000560b8}, {0x2fd1a80, 0xc001da2e40}, {{0x0, 0x0}, {0x204177a, 0xe}, 0x0, ...}, ...}, ...)
        /home/user/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.46.4-0.20230130055149-00053f52d6f8/types/module/module.go:322 +0x423
github.com/cosmos/cosmos-sdk/simapp.(*SimApp).InitChainer(_, {{0x2fc2c18, 0xc0000560b8}, {0x2fd1a80, 0xc001da2e40}, {{0x0, 0x0}, {0x204177a, 0xe}, 0x0, ...}, ...}, ...)
        /home/user/go/src/github.com/cosmos/cosmos-sdk/simapp/app.go:714 +0x38e
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).InitChain(0xc000f928c0, {{0x0, 0xf59bb15c4, 0x3fd8a40}, {0x204177a, 0xe}, 0xc00194f3a0, {0x0, 0x0, 0x0}, ...})
        /home/user/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.46.4-0.20230130055149-00053f52d6f8/baseapp/abci.go:71 +0x3f5
github.com/cosmos/cosmos-sdk/x/simulation.initChain(0xc000eaf280?, {0x3fb76b1130802819, 0x77d, _, {_, _, _}, {_, _}, {_, ...}}, ...)
        /home/user/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.46.4-0.20230130055149-00053f52d6f8/x/simulation/simulate.go:42 +0x265
github.com/cosmos/cosmos-sdk/x/simulation.SimulateFromSeed({0x2fd7a40?, 0xc00105bba0?}, {0x2fa71e0?, _}, _, _, _, {0xc001067080, 0x56, 0x58}, ...)
        /home/user/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.46.4-0.20230130055149-00053f52d6f8/x/simulation/simulate.go:76 +0x4d0
github.com/cosmos/cosmos-sdk/simapp.TestAppImportExport(0xc00105bba0)
        /home/user/go/src/github.com/cosmos/cosmos-sdk/simapp/sim_test.go:123 +0x5ec
testing.tRunner(0xc00105bba0, 0x2c0afa0)
        /usr/local/go/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1493 +0x35f
FAIL    github.com/cosmos/cosmos-sdk/simapp  0.714s
FAIL
@akhilkumarpilli akhilkumarpilli changed the title x/group sims fail with unique constrain violation x/group sims fail with unique constraint violation Jan 30, 2023
@tac0turtle
Copy link
Member

@julienrbrt is this similar to your fix over the weekend

@julienrbrt
Copy link
Member

Nope, this is unrelated. However, I cannot reproduce it, and our Sims v0.46 GH Actions is ok too: https://github.com/cosmos/cosmos-sdk/actions/workflows/sims-046.yml

@alexanderbez
Copy link
Contributor

Nope, this is unrelated. However, I cannot reproduce it, and our Sims v0.46 GH Actions is ok too: https://github.com/cosmos/cosmos-sdk/actions/workflows/sims-046.yml

Even with the same seed?

@atheeshp
Copy link
Contributor

atheeshp commented Feb 2, 2023

Nope, this is unrelated. However, I cannot reproduce it, and our Sims v0.46 GH Actions is ok too: https://github.com/cosmos/cosmos-sdk/actions/workflows/sims-046.yml

Even with the same seed?

no error thrown with the same seed.

@julienrbrt
Copy link
Member

I have been able to reproduce today with latest main:

--- FAIL: TestAppStateDeterminism (56.18s)
panic: group policies: unique constraint violation [recovered]
        panic: group policies: unique constraint violation

goroutine 469 [running]:
testing.tRunner.func1.2({0x23e47c0, 0xc022b38f20})
        /usr/local/go/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1529 +0x39f
panic({0x23e47c0, 0xc022b38f20})
        /usr/local/go/src/runtime/panic.go:884 +0x213
github.com/cosmos/cosmos-sdk/x/group/keeper.Keeper.InitGenesis({{0x3012060, 0xc00191a5e0}, {0x7f8fe0641c98, 0xc00fa20420}, {0xc00fa207e0, {0x1}}, {0x3032420, 0xc000b33580}, {0xc00fa20840}, {0x3032420, ...}, ...}, ...)
        /home/julien/projects/cosmos/cosmos-sdk/x/group/keeper/genesis.go:28 +0x6b4
github.com/cosmos/cosmos-sdk/x/group/module.AppModule.InitGenesis(...)
        /home/julien/projects/cosmos/cosmos-sdk/x/group/module/module.go:135
github.com/cosmos/cosmos-sdk/types/module.(*Manager).InitGenesis(_, {{0x302d698, 0xc000056178}, {0x303f800, 0xc002226d80}, {{0x0, 0x0}, {0x263d30b, 0xe}, 0x0, ...}, ...}, ...)
        /home/julien/projects/cosmos/cosmos-sdk/types/module/module.go:404 +0x3da
github.com/cosmos/cosmos-sdk/runtime.(*App).InitChainer(_, {{0x302d698, 0xc000056178}, {0x303f800, 0xc002226d80}, {{0x0, 0x0}, {0x263d30b, 0xe}, 0x0, ...}, ...}, ...)
        /home/julien/projects/cosmos/cosmos-sdk/runtime/app.go:134 +0x12e
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).InitChain(0xc01074e1e0, {{0x0, 0x101d3c1e5d, 0x4427b80}, {0x263d30b, 0xe}, 0xc023956ea0, {0x0, 0x0, 0x0}, ...})
        /home/julien/projects/cosmos/cosmos-sdk/baseapp/abci.go:76 +0x655
github.com/cosmos/cosmos-sdk/x/simulation.initChain(0x0?, {0x3f58785e02d4c7d8, 0x71, _, {_, _, _}, {_, _}, {_, ...}}, ...)
        /home/julien/projects/cosmos/cosmos-sdk/x/simulation/simulate.go:42 +0x265
github.com/cosmos/cosmos-sdk/x/simulation.SimulateFromSeed({0x3054e60?, 0xc000c181a0?}, {0x300e460?, _}, _, _, _, {0xc011a98000, 0x2e, 0x38}, ...)
        /home/julien/projects/cosmos/cosmos-sdk/x/simulation/simulate.go:76 +0x4b5
cosmossdk.io/simapp.TestAppStateDeterminism(0xc000c181a0)
        /home/julien/projects/cosmos/cosmos-sdk/simapp/sim_test.go:355 +0xac8
testing.tRunner(0xc000c181a0, 0x2ce4e38)
        /usr/local/go/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1629 +0x3ea
exit status 2
FAIL    cosmossdk.io/simapp     56.287s
make: *** [Makefile:276: test-sim-nondeterminism] Error 1

@alexanderbez
Copy link
Contributor

This is probably due to some faulty groups operation generation

@julienrbrt
Copy link
Member

@facundomedica
Copy link
Member

This is still an issue, can't replicate locally with the same seed: https://github.com/cosmos/cosmos-sdk/actions/runs/4501933075/jobs/7923042471?pr=15517

@julienrbrt
Copy link
Member

Closing this for #15741, as that issue has more information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants