From b739ffb22a5c1cde1cf08a8a444e054071bdf62c Mon Sep 17 00:00:00 2001 From: Gaston Ponti Date: Wed, 26 Jul 2023 15:23:22 -0300 Subject: [PATCH] Mycelo election's validators max, at least env validators (#2166) --- mycelo/genesis/genesis_state.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mycelo/genesis/genesis_state.go b/mycelo/genesis/genesis_state.go index ce4b3c87a6..84792825d5 100644 --- a/mycelo/genesis/genesis_state.go +++ b/mycelo/genesis/genesis_state.go @@ -635,10 +635,14 @@ func (ctx *deployContext) deployValidators() error { func (ctx *deployContext) deployElection() error { return ctx.deployCoreContract("contracts", "Election", func(contract *contract.EVMBackend) error { + maxValidators := ctx.genesisConfig.Election.MaxElectableValidators + if uint64(ctx.accounts.NumValidators) > maxValidators { + maxValidators = uint64(ctx.accounts.NumValidators) + } return contract.SimpleCall("initialize", env.MustProxyAddressFor("Registry"), newBigInt(ctx.genesisConfig.Election.MinElectableValidators), - newBigInt(ctx.genesisConfig.Election.MaxElectableValidators), + newBigInt(maxValidators), ctx.genesisConfig.Election.MaxVotesPerAccount, ctx.genesisConfig.Election.ElectabilityThreshold.BigInt(), )