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

Change long to bigint #96

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Change long to bigint #96

merged 1 commit into from
Nov 15, 2024

Conversation

joon9823
Copy link
Collaborator

@joon9823 joon9823 commented Nov 15, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced handling of numeric values across various classes for better type consistency.
  • Bug Fixes

    • Improved conversion methods to ensure accurate parsing of numeric values from Proto format.
  • Documentation

    • Updated comments and descriptions to reflect changes in numeric handling and type conversions.
  • Refactor

    • Standardized conversion methods from toNumber() to Number() and introduced BigInt() for serialization.
  • Tests

    • Adjusted test cases to validate new numeric handling and serialization processes.

@joon9823 joon9823 requested a review from Vritra4 November 15, 2024 04:53
Copy link

coderabbitai bot commented Nov 15, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request involve multiple modifications across various files, primarily focusing on updating the handling of numeric values in serialization and deserialization processes. Many methods have shifted from using toNumber() to Number() for converting protobuf values to JavaScript numbers. Additionally, several properties are now converted to BigInt when serialized back to protobuf format, enhancing type consistency and potentially accommodating larger integers. These adjustments are reflected in classes related to transactions, governance, and various protocol interactions, ensuring improved numeric handling throughout the codebase.

Changes

File Path Change Summary
package.json Updated dependency versions: @initia/initia.proto from ^0.2.3 to ^0.2.4, @initia/opinit.proto from ^0.0.10 to ^0.0.11.
src/core/Duration.ts Updated fromProto and toProto methods to convert proto.seconds using Number() and BigInt.
src/core/auth/AuthParams.ts Modified fromProto and toProto methods to use Number() and BigInt for numeric conversions.
src/core/auth/BaseAccount.ts Updated toProto and fromProto methods to handle account_number and sequence as BigInt.
src/core/consensus/ABCIParams.ts Changed fromProto and toProto methods to convert voteExtensionsEnableHeight using Number() and BigInt.
src/core/consensus/BlockParams.ts Updated fromProto and toProto methods to handle maxBytes and maxGas as Number() and BigInt.
src/core/consensus/EvidenceParams.ts Modified fromProto and toProto methods to convert maxAgeNumBlocks and maxBytes using Number() and BigInt.
src/core/evidence/Equivocation.ts Updated fromProto and toProto methods to handle height and power as Number() and BigInt.
src/core/evm/EvmParams.ts Changed fromProto and toProto methods for extraEips to use Number() and BigInt.
src/core/evm/msgs/MsgCreate2.ts Updated fromProto and toProto methods for salt to use Number() and BigInt.
src/core/gov/Deposit.ts Modified fromProto and toProto methods for proposal_id to use Number() and BigInt.
src/core/gov/TallyResult.ts Updated fromProto and toProto methods to handle tallyHeight as Number() and BigInt.
src/core/gov/Vote.ts Changed fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/gov/msgs/MsgCancelProposal.ts Updated fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/gov/msgs/MsgDeposit.ts Modified fromProto and toProto methods to handle proposalId as Number() and BigInt.
src/core/gov/msgs/MsgDepositLegacy.ts Changed fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/gov/msgs/MsgVote.ts Updated fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/gov/msgs/MsgVoteLegacy.ts Modified fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/gov/msgs/MsgVoteWeighted.ts Changed fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/gov/proposals/Proposal.ts Updated fromProto and toProto methods to handle id as Number() and BigInt.
src/core/group/GroupInfo.ts Modified fromProto and toProto methods for id and version to use Number() and BigInt.
src/core/group/GroupMember.ts Updated fromProto and toProto methods for groupId to use Number() and BigInt.
src/core/group/GroupPolicyInfo.ts Changed fromProto and toProto methods for groupId and version to use Number() and BigInt.
src/core/group/GroupProposal.ts Updated fromProto and toProto methods to handle id, groupVersion, and groupPolicyVersion as Number() and BigInt.
src/core/group/GroupVote.ts Modified fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/group/msgs/MsgCreateGroupPolicy.ts Updated fromProto and toProto methods for groupId to use Number() and BigInt.
src/core/group/msgs/MsgGroupExec.ts Changed fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/group/msgs/MsgGroupVote.ts Updated fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/group/msgs/MsgLeaveGroup.ts Modified fromProto and toProto methods for groupId to use Number() and BigInt.
src/core/group/msgs/MsgUpdateGroupAdmin.ts Updated fromProto and toProto methods for groupId to use Number() and BigInt.
src/core/group/msgs/MsgUpdateGroupMembers.ts Changed fromProto and toProto methods for groupId to use Number() and BigInt.
src/core/group/msgs/MsgUpdateGroupMetadata.ts Updated fromProto and toProto methods for groupId to use Number() and BigInt.
src/core/group/msgs/MsgWithdrawProposal.ts Modified fromProto and toProto methods for proposalId to use Number() and BigInt.
src/core/ibc/applications/nft-transfer/msgs/MsgNftTransfer.ts Updated error handling and type conversions for timeout properties.
src/core/ibc/applications/transfer/msgs/MsgTransfer.ts Modified error handling and type conversions for timeout properties.
src/core/ibc/core/channel/Packet.ts Updated fromProto and toProto methods for sequence and timeout_timestamp to use BigInt.
src/core/ibc/core/channel/PacketId.ts Modified fromProto and toProto methods for sequence to use Number() and BigInt.
src/core/ibc/core/channel/Timeout.ts Updated fromProto and toProto methods for timestamp to use Number() and BigInt.
src/core/ibc/core/channel/msgs/MsgTimeout.ts Modified fromProto and toProto methods for next_sequence_recv to use Number() and BigInt.
src/core/ibc/core/channel/msgs/MsgTimeoutClose.ts Updated fromProto and toProto methods for next_sequence_recv to use Number() and BigInt.
src/core/ibc/core/client/Height.ts Modified fromProto and toProto methods for revisionNumber and revisionHeight to use Number() and BigInt.
src/core/ibc/core/client/msgs/tendermint/crypto.ts Updated fromProto and toProto methods for total and index to use Number() and BigInt.
src/core/ibc/core/client/msgs/tendermint/types.ts Modified fromProto and toProto methods for multiple classes to use Number() and BigInt.
src/core/ibc/core/client/msgs/tendermint/version.ts Updated fromProto and toProto methods for block and app to use Number() and BigInt.
src/core/ibc/core/connection/IbcConnectionParams.ts Modified fromProto and toProto methods for maxExpectedTimePerBlock to use Number() and BigInt.
src/core/ibc/core/connection/IdentifiedConnection.ts Updated fromProto and toProto methods for delay_period to use Number() and BigInt.
src/core/ibc/core/connection/msgs/MsgConnectionOpenInit.ts Modified fromProto and toProto methods for delay_period to use Number() and BigInt.
src/core/ibc/core/connection/msgs/MsgConnectionOpenTry.ts Updated fromProto and toProto methods for delay_period to use Number() and BigInt.
src/core/marketmap/Ticker.ts Changed fromProto and toProto methods for decimals and minProviderCount to use Number() and BigInt.
src/core/mstaking/MstakingParams.ts Updated fromProto and toProto methods for min_voting_power to use Number() and BigInt.
src/core/mstaking/Redelegation.ts Modified fromProto and toProto methods for creationHeight to use Number() and BigInt.
src/core/mstaking/UnbondingDelegation.ts Updated fromProto and toProto methods for creationHeight to use Number() and BigInt.
src/core/mstaking/Validator.ts Modified fromProto and toProto methods for unbondingHeight to use Number() and BigInt.
src/core/mstaking/msgs/MsgCancelUnbondingDelegation.ts Updated fromProto and toProto methods for creationHeight to use Number() and BigInt.
src/core/opchild/BridgeInfo.ts Changed fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/opchild/OpValidator.ts Updated fromProto and toProto methods for consPower to use Number() and BigInt.
src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts Modified fromProto and toProto methods for sequence and height to use Number() and BigInt.
src/core/opchild/msgs/MsgUpdateOracle.ts Updated fromProto and toProto methods for height to use Number() and BigInt.
src/core/ophost/BridgeConfig.ts Changed fromProto and toProto methods for submissionStartHeight to use Number() and BigInt.
src/core/ophost/Output.ts Updated fromProto and toProto methods for l1BlockNumber and l2BlockNumber to use Number() and BigInt.
src/core/ophost/msgs/MsgDeleteOutput.ts Modified fromProto and toProto methods for bridgeId and outputIndex to use Number() and BigInt.
src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts Updated fromProto and toProto methods for bridgeId, outputIndex, and sequence to use Number() and BigInt.
src/core/ophost/msgs/MsgInitiateTokenDeposit.ts Changed fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/ophost/msgs/MsgProposeOutput.ts Updated fromProto and toProto methods for bridgeId, outputIndex, and l2BlockNumber to use Number() and BigInt.
src/core/ophost/msgs/MsgRecordBatch.ts Modified fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/ophost/msgs/MsgUpdateBatchInfo.ts Updated fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/ophost/msgs/MsgUpdateChallenger.ts Changed fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/ophost/msgs/MsgUpdateMetadata.ts Updated fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/ophost/msgs/MsgUpdateOracleConfig.ts Modified fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/ophost/msgs/MsgUpdateProposer.ts Updated fromProto and toProto methods for bridgeId to use Number() and BigInt.
src/core/oracle/QuotePrice.ts Changed fromProto and toProto methods for blockHeight to use Number() and BigInt.
src/core/slashing/SlashingParams.ts Updated fromProto and toProto methods for signedBlocksWindow to use Number() and BigInt.
src/core/slashing/ValidatorSigningInfo.ts Modified fromProto and toProto methods for numeric fields to use Number() and BigInt.
src/core/tokenfactory/TokenfactoryParams.ts Updated fromProto and toProto methods for denom_creation_gas_consume to use Number() and BigInt.
src/core/tx/Fee.ts Changed fromProto and toProto methods for gasLimit to use Number() and BigInt.
src/core/tx/SignDoc.ts Updated toProto method for account_number to use BigInt.
src/core/tx/Tx.ts Modified fromProto and toProto methods for timeoutHeight and sequence to use Number() and BigInt.
src/core/tx/TxInfo.ts Updated fromProto and fromData methods for height and gas values to use Number() and parseInt().
src/core/upgrade/Plan.ts Changed fromProto and toProto methods for height to use Number() and BigInt.
src/core/wasm/AbsoluteTxPosition.ts Updated fromProto and toProto methods for blockHeight and txIndex to use Number() and BigInt.
src/core/wasm/authorizations/CombinedLimit.ts Modified fromProto and toProto methods for callsRemaining to use Number() and BigInt.

Poem

🐇 In code we hop, with numbers anew,
From toNumber() to Number(), we flew.
BigInts now reign, for values so grand,
In protobufs tight, we take a firm stand.
With each little change, our types align,
A hop and a skip, our code will shine! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 2 package(s) with unknown licenses.
See the Details below.

License Issues

package-lock.json

PackageVersionLicenseIssue Type
@initia/opinit.proto0.0.11NullUnknown License

package.json

PackageVersionLicenseIssue Type
@initia/opinit.proto^0.0.11NullUnknown License
Denied Licenses: GPL-1.0-or-later, LGPL-2.0-or-later

OpenSSF Scorecard

PackageVersionScoreDetails
npm/@initia/initia.proto 0.2.4 UnknownUnknown
npm/@initia/opinit.proto 0.0.11 UnknownUnknown
npm/@initia/initia.proto ^0.2.4 UnknownUnknown
npm/@initia/opinit.proto ^0.0.11 UnknownUnknown

Scanned Files

  • package-lock.json
  • package.json

Copy link
Contributor

@Vritra4 Vritra4 left a comment

Choose a reason for hiding this comment

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

LGTM

@Vritra4 Vritra4 merged commit 80d666a into main Nov 15, 2024
3 of 4 checks passed
@Vritra4 Vritra4 deleted the feat/bigint branch November 15, 2024 05:03
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.

2 participants