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

Remove redundant Initialize() on TestUtils #3781

Open
OnedgeLee opened this issue May 9, 2024 · 0 comments
Open

Remove redundant Initialize() on TestUtils #3781

OnedgeLee opened this issue May 9, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@OnedgeLee
Copy link
Contributor

txs.AddRange(
validatorSet.Validators.Select(
validator => Transaction.Create(
nonce++,
GenesisProposer,
null,
actions: new IAction[]
{
new Initialize(
validatorSet: validatorSet,
states: ImmutableDictionary.Create<Address, IValue>()),
}.Select(x => x.PlainValue),
timestamp: DateTimeOffset.MinValue)));
txs = txs.OrderBy(tx => tx.Id).ToList();

Action Initialize() updates validator set of IWorld with given parameter validatorSet.
So above code, that iterates validatorSet, is redundant.
(Initialize() only needs to be called once.)

@OnedgeLee OnedgeLee added the good first issue Good for newcomers label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant