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

Add value/numValidators for ValidatorsExit transactions mappings #1880

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

hectorgomezv
Copy link
Member

Summary

This PR adds missing fields to transaction mappings for the history/queue of Native Staking Validators Exit transactions.

Changes

  • Adds value and numValidators calculations based on the transaction data.

@hectorgomezv hectorgomezv self-assigned this Aug 30, 2024
@hectorgomezv hectorgomezv requested a review from a team as a code owner August 30, 2024 21:55
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10639604127

Details

  • 0 of 10 (0.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.07%) to 46.362%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/routes/transactions/mappers/common/native-staking.mapper.ts 0 10 0.0%
Files with Coverage Reduction New Missed Lines %
src/routes/transactions/mappers/common/transaction-info.mapper.ts 1 18.77%
src/routes/transactions/mappers/common/native-staking.mapper.ts 1 13.04%
Totals Coverage Status
Change from base Build 10636266225: -0.07%
Covered Lines: 4813
Relevant Lines: 8363

💛 - Coveralls

@hectorgomezv hectorgomezv merged commit 1705428 into main Aug 30, 2024
18 checks passed
@hectorgomezv hectorgomezv deleted the staking-validators-exit-transaction-mapping branch August 30, 2024 22:09
Comment on lines +235 to +250
private getValueFromDataDecoded(data: DataDecoded, chain: Chain): number {
if (data.method === 'requestValidatorsExit') {
const publicKeys =
data.parameters?.filter(
(parameter) => parameter.name === '_publicKeys',
) ?? [];
const decimals = chain.nativeCurrency.decimals;
return (
publicKeys.length *
Math.pow(10, decimals) *
NativeStakingMapper.ETH_ETHERS_PER_VALIDATOR
);
}

return 0;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we should add a comment/test for this as it's very intricate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included some documentation here: #1884

Please let me know if you find it's not clear enough. Thanks!

DenSmolonski pushed a commit to Zilliqa/safe-client-gateway that referenced this pull request Oct 24, 2024
…e-global#1880)

Adds `value` and `numValidators` calculations based on the transaction data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants