-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: optimize gas usage #39
Conversation
logs gas consumption at fileLogger
if calculated fee rate is negative, then apply zeroFeeRate
…zsystm/lsm-gas-optimization
based on mainnet supply, rich account get fund when initialize genesis on simulation testing. each operation which needs token should get fund from rich account.
this is for optimizing gas consumption when QueueLiquidUnstake instead of Iterate chunks separately, iterate it once when calc net amount state essentials.
x/liquidstaking/types/insurance.go
Outdated
iValidator := validatorMap[iInsurance.GetValidator().String()] | ||
jValidator := validatorMap[jInsurance.GetValidator().String()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you had to change it like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No special reason for this.
I just thought GetValidator().String()
is more uniform than insurance.ValidatorAddress
because when create validatorMap in GetNetAmountStateEssentials
, it uses GetValidator().String()
as a key.
But, I saw that both GetValidator().String()
and insurance.ValidatorAddress
are used in liquidstaking module's code.
Both values are same, so it would be great to unify that usage in code base for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetValidator()
eventually computes using insurance.ValidatorAddress
, and already has the resulting string in the insurance.ValidatorAddress
, it doesn't seem necessary to compute it again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongsam
Oh.. I see why u comment for it.
I got it! Thanks for the detail.
I'll check other GetValidator
usages too and fix that(=duplicated computation). Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetValidator().String is a redundant computation. We can just use ValidatorAddress field.
Description
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...