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

feat(oracle): register new token and set up feeder through assets-module #159

Merged

Conversation

leonz789
Copy link
Contributor

@leonz789 leonz789 commented Aug 8, 2024

Description

When register a new token through assets-module, set and bonded it to a token in oracle module, and set up a tokenFeeder for that token to update price.

Notable Changes

  • support multiple assetIDs bonded to on one same token
  • use BasicAssetInfo.MetaInfo to set oracle related information for oracle params update
  • restrict fields available to be modified through RegisterOrUpdateClientToken, only allow: TotalSupply, MetaInfo to be updated

Closes #XXX

Summary by CodeRabbit

  • New Features

    • Enhanced asset management for staking assets with improved validation and updating processes.
    • Introduced distinct methods for registering new tokens and updating existing tokens.
    • Added support for additional oracle information in asset creation and management.
    • Expanded functionality to handle multiple asset identifiers in token management.
    • New method for registering tokens and setting their feeders, improving dynamic management.
  • Bug Fixes

    • Improved error handling in token registration and metadata parsing to ensure correctness.
    • Introduced specific error messages for invalid oracle information.

Copy link
Contributor

coderabbitai bot commented Aug 8, 2024

Walkthrough

The recent changes refine the asset management system by restructuring the processes for token registration and updates. The registerOrUpdateTokens function has been divided into two distinct functions: registerToken and updateToken. An oracleInfo parameter has been introduced, and error handling has been improved. Additionally, a new method for registering tokens and their feeders has been added, enhancing the overall functionality of the oracle system.

Changes

Files Change Summary
precompiles/assets/IAssets.sol, precompiles/assets/abi.json Split registerOrUpdateTokens into registerToken and updateToken, added oracleInfo parameter, and updated return values for clarity.
precompiles/assets/assets.go, precompiles/assets/tx.go, precompiles/assets/types.go Updated method handling in Run and IsTransaction, improved error handling, and added new methods for distinct token operations.
x/oracle/types/params.go, x/oracle/keeper/params.go Modified GetTokenIDFromAssetID to handle multiple AssetIDs and added RegisterNewTokenAndSetTokenFeeder for dynamic token and feeder management.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Assets
    participant OracleKeeper
    participant Keeper

    User->>Assets: Request Token Registration
    Assets->>Assets: Validate Token Metadata
    Assets->>OracleKeeper: Check if Token Registered
    alt Token Exists
        OracleKeeper->>Assets: Update Token Information
    else New Token
        Assets->>Assets: Create New Token Info
        Assets->>OracleKeeper: Register New Token
    end
    OracleKeeper->>Keeper: Register Token and Feeder
    Keeper->>Keeper: Store Updated Parameters
    Keeper->>User: Confirmation of Registration
Loading

🐰 "In fields so bright, where tokens leap,
New oracles whisper, secrets to keep.
With every update, the ledger grows,
A dance of data, as progress flows!
Celebrate the hops, the joy, the cheer,
For better assets are finally here!" 🌼

Possibly related issues


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 or @coderabbitai title 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
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (3)
x/assets/types/expected_keepers.go (1)

10-10: Implement the new method in OracleKeeper implementations

The method RegisterNewTokenAndSetTokenFeeder has been added to the OracleKeeper interface but is not implemented in any of its current implementations. Please ensure that all structs implementing this interface include this method.

  • Interface definition found in x/assets/types/expected_keepers.go.
Analysis chain

Ensure the new method is implemented.

The method RegisterNewTokenAndSetTokenFeeder has been added to the OracleKeeper interface. Verify that all implementations of this interface have been updated to include this method.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all implementations of OracleKeeper have the new method implemented.

# Test: Search for implementations of the OracleKeeper interface. Expect: All implementations include the new method.
ast-grep --lang go --pattern $'type $_ OracleKeeper interface {
  $$$
  RegisterNewTokenAndSetTokenFeeder($_, $_, $_, $_, $_, $_, $_) error
  $$$
}'

Length of output: 688


Script:

#!/bin/bash
# Step 1: Find the definition of the OracleKeeper interface to ensure it is correctly identified.
ast-grep --lang go --pattern 'type OracleKeeper interface {
  $$$
}'

# Step 2: Find all types that implement the OracleKeeper interface.
rg --type go 'OracleKeeper' -A 5

# Step 3: Check if these types have the RegisterNewTokenAndSetTokenFeeder method implemented.
ast-grep --lang go --pattern 'func ($_).RegisterNewTokenAndSetTokenFeeder($_, $_, $_, $_, $_, $_, $_) error {
  $$$
}'

Length of output: 21159

x/oracle/keeper/params.go (1)

12-15: Define constants clearly.

The constants startAfterBlocks and defaultInterval are defined to manage token feeder configurations. Ensure these values are appropriate for the intended functionality and consider documenting their purpose.

+ // startAfterBlocks defines the number of blocks after which the token feeder starts.
+ // defaultInterval is the default interval for token feeder updates.
const (
  startAfterBlocks = 10
  defaultInterval  = 30
)
precompiles/assets/tx.go (1)

143-169: Ensure robust error handling in RegisterOrUpdateTokens.

The function RegisterOrUpdateTokens includes logic for parsing oracle information and registering tokens. Ensure that:

  1. The regex match count (len(oracleInfo)) is correct for all expected cases.
  2. The error message for missing oracle information is clear and actionable.
  3. Consider adding comments to explain the registration logic for better readability.
+ // Ensure that the oracle_info is correctly described in the meta_info.
if len(oracleInfo) != 5 {
  return nil, errors.New("register new asset fail, oracle_info must be described in meta_info")
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0369682 and d62f239.

Files selected for processing (4)
  • precompiles/assets/tx.go (3 hunks)
  • x/assets/types/expected_keepers.go (1 hunks)
  • x/oracle/keeper/params.go (2 hunks)
  • x/oracle/types/params.go (2 hunks)
Additional comments not posted (2)
x/oracle/keeper/params.go (1)

34-102: Review the logic in RegisterNewTokenAndSetTokenFeeder.

The function RegisterNewTokenAndSetTokenFeeder is well-structured, handling parameter retrieval, error checking, and token registration. However, ensure that:

  1. The error messages are consistent and informative.
  2. The logic for updating TokenFeeders is correct and aligns with the intended feeder configuration.
  3. Consider adding comments to explain complex logic blocks for better readability.
+ // Check if the assetID already exists to prevent duplicate registrations.
if p.GetTokenIDFromAssetID(assetID) > 0 {
  return fmt.Errorf("assetID exists:%s", assetID)
}
Verification successful

Function usage is correct and error handling is appropriate.

The function RegisterNewTokenAndSetTokenFeeder is used in precompiles/assets/tx.go with proper error handling and parameter validation. The code ensures that oracleInfo is correctly parsed and checked before calling the function, and any errors from the function are properly propagated. This aligns with the intended usage and error management.

  • precompiles/assets/tx.go: The function is called after parsing and validating oracleInfo, with errors being handled correctly.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correct behavior of RegisterNewTokenAndSetTokenFeeder.

# Test: Search for usages of RegisterNewTokenAndSetTokenFeeder to ensure correct error handling and parameter usage.
rg --type go 'RegisterNewTokenAndSetTokenFeeder'

Length of output: 549


Script:

#!/bin/bash
# Extract the context around the usage of RegisterNewTokenAndSetTokenFeeder in precompiles/assets/tx.go
rg --type go -A 10 -B 10 'RegisterNewTokenAndSetTokenFeeder' precompiles/assets/tx.go

Length of output: 875

precompiles/assets/tx.go (1)

28-28: Verify regex correctness.

The oracleInfoMatcher regex is designed to extract oracle information from metadata. Ensure that it correctly matches the expected format and consider edge cases that might not be covered.

Verification successful

Regex pattern correctly matches expected format.

The oracleInfoMatcher regex pattern successfully matches the expected format of oracle information metadata in the codebase. The pattern correctly handles both required and optional fields. No issues found with the regex.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the oracleInfoMatcher regex.

# Test: Search for all occurrences of oracle_info in the codebase to ensure they match the regex pattern.
rg --type go 'oracle_info:{chain:.+,token:.+,decimal:\d+(,interval:.+)?(,contract:.+)?}'

Length of output: 259


Script:

#!/bin/bash
# Corrected regex pattern to search for oracle_info occurrences in Go files.
rg --type go 'oracle_info:\{chain:[^,]+,token:[^,]+,decimal:\d+(,interval:[^,]+)?(,contract:[^,]+)?\}'

Length of output: 224

Comment on lines +488 to +492
assetIDs := strings.Split(token.AssetID, ",")
for _, aID := range assetIDs {
if aID == assetID {
return id
}
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 8, 2024

Choose a reason for hiding this comment

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

Consider returning a sentinel value or error for no match.

The current implementation returns 0 if no asset ID matches. This could be ambiguous if 0 is a valid token ID. Consider returning a sentinel value or an error to indicate no match found.

func (p Params) GetTokenIDFromAssetID(assetID string) (int, error) {
	for id, token := range p.Tokens {
		assetIDs := strings.Split(token.AssetID, ",")
		for _, aID := range assetIDs {
			if aID == assetID {
				return id, nil
			}
		}
	}
	return -1, errors.New("asset ID not found")
}

Optimize string splitting for performance.

If GetTokenIDFromAssetID is called frequently, consider optimizing the splitting operation to improve performance, such as caching the split results if the token data is static.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, since we're going to change the proto-definition, this will be updated to map

Copy link
Contributor

Choose a reason for hiding this comment

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

@leonz789, updating the proto-definition to use a map sounds like a great approach. This change should effectively address both the ambiguity issue and the performance concerns raised in the review. Let me know if there's anything else you'd like assistance with!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d62f239 and 5d3d625.

Files selected for processing (9)
  • precompiles/assets/IAssets.sol (1 hunks)
  • precompiles/assets/abi.json (1 hunks)
  • precompiles/assets/assets.go (1 hunks)
  • precompiles/assets/tx.go (2 hunks)
  • precompiles/assets/types.go (3 hunks)
  • precompiles/common/error.go (1 hunks)
  • x/assets/types/expected_keepers.go (1 hunks)
  • x/oracle/keeper/params.go (2 hunks)
  • x/oracle/types/types.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • precompiles/assets/assets.go
Files skipped from review as they are similar to previous changes (1)
  • precompiles/assets/tx.go
Additional comments not posted (29)
x/assets/types/expected_keepers.go (1)

10-10: Ensure consistent interface implementation.

The addition of RegisterNewTokenAndSetTokenFeeder enhances the OracleKeeper interface. Verify that all types implementing this interface are updated to include this new method.

x/oracle/types/types.go (1)

9-27: Review struct design for completeness and correctness.

The OracleInfo struct encapsulates detailed information about an oracle's token and feeder attributes. Ensure that:

  • Field types are appropriate for their intended use.
  • JSON tags are consistent with naming conventions and correctly reflect the field names.
  • Consider whether additional validation is needed for fields like Decimal and Interval.
Verification successful

OracleInfo struct validation is complete and correct.

The OracleInfo struct fields Decimal and Interval are appropriately validated in the codebase. The Decimal field is parsed and checked for negativity, while the Interval field is validated to ensure it is non-zero and logically consistent with other parameters. No additional validation is necessary.

  • x/oracle/keeper/params.go: Validates Decimal and Interval.
  • precompiles/assets/types.go: Checks for non-empty Decimal.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage and validation of OracleInfo struct fields.

# Test: Search for OracleInfo struct usage. Expect: Proper validation and usage of fields.
rg --type go 'OracleInfo' -A 10

Length of output: 3084


Script:

#!/bin/bash
# Description: Search for specific validation of OracleInfo fields, especially Decimal and Interval.

# Check for validation of Decimal field.
rg --type go 'Decimal' -A 5

# Check for validation of Interval field.
rg --type go 'Interval' -A 5

Length of output: 69043

precompiles/common/error.go (1)

19-19: Ensure error message clarity and alignment with validation logic.

The ErrInvalidOracleInfo constant provides a specific error message for oracle information validation. Verify that this error message is used consistently with the validation logic and that it clearly communicates the validation requirements.

Verification successful

Validation Logic Aligns with Error Message

The usage of ErrInvalidOracleInfo in the validation logic correctly aligns with the error message. The logic checks that token.Name, token.Chain.Name, and token.Decimal are not empty, consistent with the message requirements. No changes are needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of ErrInvalidOracleInfo in validation logic.

# Test: Search for ErrInvalidOracleInfo usage. Expect: Consistent use in validation logic.
rg --type go 'ErrInvalidOracleInfo'

Length of output: 271


Script:

#!/bin/bash
# Search for the validation logic related to ErrInvalidOracleInfo in precompiles/assets/types.go
rg --type go -A 10 'ErrInvalidOracleInfo' precompiles/assets/types.go

Length of output: 447


Script:

#!/bin/bash
# Search for function definitions and usages of ErrInvalidOracleInfo in precompiles/assets/types.go to understand the validation logic
rg --type go -A 15 'func ' precompiles/assets/types.go | rg -B 5 'ErrInvalidOracleInfo'

Length of output: 87


Script:

#!/bin/bash
# Search for the usage of ErrInvalidOracleInfo in precompiles/assets/types.go with more context to capture the validation logic
rg --type go -A 20 -B 10 'ErrInvalidOracleInfo' precompiles/assets/types.go

Length of output: 925

x/oracle/keeper/params.go (9)

12-15: Define constants for configuration.

The constants startAfterBlocks and defaultInterval are defined for configuration purposes. This is a good practice as it centralizes configuration values, making them easier to manage and change if needed.


34-38: Check for existing asset ID.

The function correctly checks if the asset ID already exists, preventing duplicate registrations. The error message is clear and informative.


39-53: Handle new chain addition.

The logic for adding a new chain if it doesn't exist is well-implemented. The use of a loop to check existing chains and append a new one if necessary is efficient.


54-60: Validate decimal value.

The code correctly parses and validates the decimal value, ensuring it is non-negative. The error handling is appropriate.


61-67: Default interval handling.

The interval is parsed and defaults to defaultInterval if zero. This ensures a valid interval is always set, which is a good practice.


80-88: Add a new token.

The function correctly adds a new token with all necessary information. The use of structured data ensures clarity and consistency.


90-96: Calculate start block for feeder.

The calculation of the start block for the token feeder is logical and ensures the feeder starts after a predefined number of blocks.


98-108: Set token feeder configuration.

The setup of the token feeder is well-structured, with clear parameters. The decision to not end feeders for version 1 is noted.


110-111: Finalize parameter updates.

The function concludes by setting the updated parameters, ensuring the state reflects all changes made. This is a crucial step for maintaining consistency.

precompiles/assets/IAssets.sol (1)

76-77: Enhance createAsset function with oracleInfo.

The addition of the oracleInfo parameter to the createAsset function allows for more comprehensive asset definitions, enhancing the interface's utility. Ensure that all calls to this function are updated to include the new parameter.

precompiles/assets/abi.json (1)

162-165: Update ABI to include oracleInfo.

The ABI now includes the oracleInfo parameter for the withdrawPrincipal function, aligning with the contract's updated signature. This ensures that interactions with the contract are correctly handled.

precompiles/assets/types.go (15)

114-118: Update function signature and error handling.

The function signature has been updated to return oracletypes.OracleInfo along with types.AssetInfo and an error. This change enhances the function's capability to provide additional oracle information.

The error handling pattern has been improved by using a consistent approach of assigning errors to a variable and returning initialized variables. This enhances clarity and consistency in the function's return structure.


138-139: Validate address length check.

The address length check ensures that the provided address is not shorter than expected. This validation is essential for preventing errors related to address handling.


163-164: Validate name length check.

The name length check ensures that the provided name is within acceptable limits. This validation is crucial for preventing errors related to name handling.


174-175: Validate metaInfo length check.

The metaInfo length check ensures that the provided metaInfo is within acceptable limits. This validation is crucial for preventing errors related to metaInfo handling.


188-192: Validate oracle information fields.

The checks for critical fields in oInfo ensure that the oracle information is complete. This validation is essential for preventing errors related to incomplete oracle data.


195-195: Consistent return structure.

The function returns a consistent structure, maintaining clarity and integrity in its return types.


128-128: Handle potential errors from GetClientChainInfoByIndex.

The function correctly handles errors from GetClientChainInfoByIndex. Ensure that this function is robust and handles all edge cases, as its failure could impact the TokenFromInputs function.


134-135: Ensure correct type assertion for assetAddr.

The error handling for type assertion of assetAddr is consistent with the new pattern. Ensure that args[1] is always a []byte in the calling code to prevent runtime errors.


152-153: Ensure correct type assertion for tvlLimit.

The error handling for type assertion of tvlLimit is consistent with the new pattern. Ensure that args[3] is always a *big.Int in the calling code to prevent runtime errors.


185-187: Validate JSON unmarshalling of oInfoStr.

The JSON unmarshalling of oInfoStr into oInfo is correctly handled. Ensure that oInfoStr is valid JSON in the calling code to prevent unmarshalling errors.


170-171: Ensure correct type assertion for metaInfo.

The error handling for type assertion of metaInfo is consistent with the new pattern. Ensure that args[5] is always a string in the calling code to prevent runtime errors.


159-160: Ensure correct type assertion for name.

The error handling for type assertion of name is consistent with the new pattern. Ensure that args[4] is always a string in the calling code to prevent runtime errors.


145-146: Ensure correct type assertion for decimal.

The error handling for type assertion of decimal is consistent with the new pattern. Ensure that args[2] is always a uint8 in the calling code to prevent runtime errors.


122-123: Ensure correct type assertion for clientChainID.

The error handling for type assertion of clientChainID is consistent with the new pattern. Ensure that args[0] is always a uint32 in the calling code to prevent runtime errors.


179-182: Ensure correct type assertion for oInfoStr.

The error handling for type assertion of oInfoStr is consistent with the new pattern. Ensure that args[6] is always a string in the calling code to prevent runtime errors.

Comment on lines +69 to +77
for _, t := range p.Tokens {
// token exists, bind assetID for this token
// it's possible for one price bonded with multiple assetID, like ETHUSDT from sepolia/mainnet
if t.Name == oInfo.Token.Name && t.ChainID == chainID {
t.AssetID = strings.Join([]string{t.AssetID, oInfo.AssetID}, ",")
k.SetParams(ctx, p)
// there should have been existing tokenFeeder running(currently we register tokens from assets-module and with infinite endBlock)
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Bind asset ID to existing token.

The logic for binding a new asset ID to an existing token is clear. The use of string concatenation to handle multiple asset IDs is straightforward, but consider using a more robust data structure if the list grows.

Consider using a slice or a set-like structure for managing multiple asset IDs to improve scalability and maintainability.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5d3d625 and ea61d79.

Files selected for processing (5)
  • precompiles/assets/tx.go (1 hunks)
  • precompiles/assets/types.go (2 hunks)
  • precompiles/common/error.go (1 hunks)
  • x/oracle/keeper/params.go (2 hunks)
  • x/oracle/types/types.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • precompiles/common/error.go
  • x/oracle/keeper/params.go
Additional context used
GitHub Check: build
precompiles/assets/types.go

[failure] 125-125:
undefined: types.OracleInfo

GitHub Check: test-unit-cover
precompiles/assets/types.go

[failure] 125-125:
undefined: types.OracleInfo


[failure] 125-125:
undefined: types.OracleInfo


[failure] 125-125:
undefined: types.OracleInfo

GitHub Check: Run golangci-lint
precompiles/assets/types.go

[failure] 125-125:
undefined: types.OracleInfo (typecheck)


[failure] 125-125:
undefined: types.OracleInfo) (typecheck)

Additional comments not posted (3)
x/oracle/types/types.go (1)

9-32: Ensure completeness and consistency of OracleInfo struct.

The OracleInfo struct is well-structured for encapsulating oracle-related data. However, consider the following:

  • Ensure that all necessary fields are included and initialized correctly.
  • Review the commented-out fields to determine if they are needed or should be removed for clarity.
  • Verify that the AssetID field is correctly used and updated throughout the codebase.
Verification successful

OracleInfo Struct is Complete and Consistent

The OracleInfo struct is appropriately utilized across the codebase. The AssetID field is used correctly in conditional checks and validations. The commented-out fields in the struct definition are not used elsewhere, indicating they might not be necessary. The current implementation appears consistent and complete.

  • x/oracle/keeper/params.go: AssetID is checked for existence.
  • precompiles/assets/types.go: Fields are initialized and validated.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `OracleInfo` and ensure all fields are utilized correctly.

# Test: Search for `OracleInfo` usage. Expect: Proper initialization and usage of all fields.
rg --type go 'OracleInfo'

Length of output: 2611


Script:

#!/bin/bash
# Extract lines where OracleInfo is initialized and used to verify field utilization.
rg --type go 'OracleInfo' -A 5 -B 2

Length of output: 6620

precompiles/assets/tx.go (1)

132-159: Review handling of OracleInfo in RegisterOrUpdateTokens.

The function now incorporates OracleInfo for enhanced asset management. Consider the following:

  • Ensure that oInfo is correctly populated and used throughout the function.
  • Verify error handling when registering new tokens and setting token feeders.
  • Confirm that the logic for updating stakingAsset is robust and handles all edge cases.
precompiles/assets/types.go (1)

119-208: Address undefined types.OracleInfo issue.

The static analysis tools have flagged an issue with types.OracleInfo being undefined. This needs to be resolved to ensure the code compiles and functions correctly.

- oracleInfo := types.OracleInfo{}
+ oracleInfo := oracletypes.OracleInfo{}

Enhance error handling in TokenFromInputs.

The function now checks for valid oracle information. Ensure that:

  • All necessary fields in oracleInfo are validated.
  • Error messages are clear and informative for debugging purposes.
  • Consider logging errors for better traceability.
Verification successful

Correct Usage of oracletypes.OracleInfo Confirmed

The review comment correctly identifies that types.OracleInfo should be replaced with oracletypes.OracleInfo. The OracleInfo struct is defined in the x/oracle/types package, confirming the validity of this change.

  • Ensure that the import statement for oracletypes is correctly added to the file if not already present.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization and usage of `oracleInfo` in `TokenFromInputs`.

# Test: Search for `TokenFromInputs` usage. Expect: Correct initialization and error handling.
rg --type go 'TokenFromInputs'

Length of output: 258


Script:

#!/bin/bash
# Search for the definition of `OracleInfo` in the codebase to verify its package and usage.
ast-grep --lang go --pattern 'type OracleInfo struct { $$$ }'

Length of output: 1287

Tools
GitHub Check: build

[failure] 125-125:
undefined: types.OracleInfo

GitHub Check: test-unit-cover

[failure] 125-125:
undefined: types.OracleInfo


[failure] 125-125:
undefined: types.OracleInfo


[failure] 125-125:
undefined: types.OracleInfo

GitHub Check: Run golangci-lint

[failure] 125-125:
undefined: types.OracleInfo (typecheck)


[failure] 125-125:
undefined: types.OracleInfo) (typecheck)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
precompiles/assets/types.go (1)

22-22: Address the formatting issue flagged by static analysis.

The file is not gofumpt-ed. Ensure the code is formatted according to gofumpt standards.

- var tokenDescMatcher = regexp.MustCompile(`TokenDesc:{(.+?)}`)
+var tokenDescMatcher = regexp.MustCompile(`TokenDesc:{(.+?)}`)
Tools
GitHub Check: Run golangci-lint

[failure] 22-22:
File is not gofumpt-ed (gofumpt)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ea61d79 and 0a30dd6.

Files selected for processing (1)
  • precompiles/assets/types.go (2 hunks)
Additional context used
GitHub Check: Run golangci-lint
precompiles/assets/types.go

[failure] 22-22:
File is not gofumpt-ed (gofumpt)

Comment on lines 177 to 206
oracleInfoStr, ok := args[6].(string)
if !ok {
return types.AssetInfo{}, oracletypes.OracleInfo{}, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "string", args[6])
}
parsed := strings.Split(oracleInfoStr, ",")
l := len(parsed)
switch {
case l > 5:
joined := strings.Join(parsed[5:], "")
tokenDesc := tokenDescMatcher.FindStringSubmatch(joined)
chainDesc := chainDescMatcher.FindStringSubmatch(joined)
if len(tokenDesc) == 2 {
oracleInfo.Token.Desc = tokenDesc[1]
}
if len(chainDesc) == 2 {
oracleInfo.Chain.Desc = chainDesc[1]
}
case l >= 5:
oracleInfo.Token.Contract = parsed[4]
fallthrough
case l >= 4:
oracleInfo.Feeder.Interval = parsed[3]
fallthrough
case l >= 3:
oracleInfo.Token.Name = parsed[0]
oracleInfo.Chain.Name = parsed[1]
oracleInfo.Token.Decimal = parsed[2]
default:
return types.AssetInfo{}, oracletypes.OracleInfo{}, errors.New(exocmn.ErrInvalidOracleInfo)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider simplifying the parsing logic for clarity.

The current switch-case structure for parsing oracleInfoStr can be simplified for better readability. Consider using a more straightforward approach to handle different lengths of parsed data.

parsed := strings.Split(oracleInfoStr, ",")
if len(parsed) < 3 {
    return types.AssetInfo{}, oracletypes.OracleInfo{}, errors.New(exocmn.ErrInvalidOracleInfo)
}

oracleInfo.Token.Name = parsed[0]
oracleInfo.Chain.Name = parsed[1]
oracleInfo.Token.Decimal = parsed[2]

if len(parsed) >= 4 {
    oracleInfo.Feeder.Interval = parsed[3]
}
if len(parsed) >= 5 {
    oracleInfo.Token.Contract = parsed[4]
}

if len(parsed) > 5 {
    joined := strings.Join(parsed[5:], "")
    tokenDesc := tokenDescMatcher.FindStringSubmatch(joined)
    chainDesc := chainDescMatcher.FindStringSubmatch(joined)
    if len(tokenDesc) == 2 {
        oracleInfo.Token.Desc = tokenDesc[1]
    }
    if len(chainDesc) == 2 {
        oracleInfo.Chain.Desc = chainDesc[1]
    }
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0a30dd6 and cb54e7c.

Files selected for processing (1)
  • precompiles/assets/types.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • precompiles/assets/types.go

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cb54e7c and 28fde00.

Files selected for processing (2)
  • precompiles/assets/types.go (2 hunks)
  • x/oracle/keeper/params.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • precompiles/assets/types.go
  • x/oracle/keeper/params.go

@cloud8little
Copy link
Contributor

Testing failed, oracle feed price fail.
exocore: PR #159 28fde00 + develop (09d1501 )

Steps:

  1. Start local_node.sh and open grpc
  2. Update oracle start_base_block for token ID 1.
  3. Start price feeder (ExocoreNetwork/price-feeder@da450eb)
exocored q tx 32e71b3fde7561c07102b746bee13920e08d9be29e6d436630abb6ea90cfe4a6
code: 11
codespace: sdk
data: ""
events: []
gas_used: "20721"
gas_wanted: "20000"
height: "51"
info: ""
logs: []
raw_log: 'out of gas in location: WritePerByte; gasWanted: 20000, gasUsed: 20721:
  out of gas'
timestamp: "2024-08-15T03:49:42Z"
tx:
  '@type': /cosmos.tx.v1beta1.Tx
  auth_info:
    fee:
      amount:
      - amount: "9223372036854775807"
        denom: aexo
      gas_limit: "20000"
      granter: ""
      payer: ""
    signer_infos:
    - mode_info:
        single:
          mode: SIGN_MODE_DIRECT
      public_key:
        '@type': /cosmos.crypto.ed25519.PubKey
        key: 8PaRnlIsW5fbLIJVv/dD+d/d162fw3ywwWcLSA0PmRQ=
      sequence: "0"
    tip: null
  body:
    extension_options: []
    memo: ""
    messages:
    - '@type': /exocore.oracle.v1.MsgCreatePrice
      based_block: "50"
      creator: exo18z3p42xn8pjk338upvzp794h02wh7p4tyandma
      feeder_id: "1"
      nonce: 1
      prices:
      - desc: ""
        prices:
        - decimal: 8
          det_id: "110680464442257331381"
          price: "265086000000"
          timestamp: "2024-08-15 03:49:42"
        source_id: "1"
    non_critical_extension_options: []
    timeout_height: "0"
  signatures:
  - JqlwCNSeXLCLPrHxxPWWDcRZ94gRGtEwAeJ16Y0ItlnTDlbHIRX529Puwn2iUv0CVjMTF5PWWC0gGHQffa5NBQ==
txhash: 32E71B3FDE7561C07102B746BEE13920E08D9BE29E6D436630ABB6EA90CFE4A6

@cloud8little
Copy link
Contributor

Testing failed, oracle feed price fail. exocore: PR #159 28fde00 + develop (09d1501 )

Steps:

  1. Start local_node.sh and open grpc
  2. Update oracle start_base_block for token ID 1.
  3. Start price feeder (ExocoreNetwork/price-feeder@da450eb)
exocored q tx 32e71b3fde7561c07102b746bee13920e08d9be29e6d436630abb6ea90cfe4a6
code: 11
codespace: sdk
data: ""
events: []
gas_used: "20721"
gas_wanted: "20000"
height: "51"
info: ""
logs: []
raw_log: 'out of gas in location: WritePerByte; gasWanted: 20000, gasUsed: 20721:
  out of gas'
timestamp: "2024-08-15T03:49:42Z"
tx:
  '@type': /cosmos.tx.v1beta1.Tx
  auth_info:
    fee:
      amount:
      - amount: "9223372036854775807"
        denom: aexo
      gas_limit: "20000"
      granter: ""
      payer: ""
    signer_infos:
    - mode_info:
        single:
          mode: SIGN_MODE_DIRECT
      public_key:
        '@type': /cosmos.crypto.ed25519.PubKey
        key: 8PaRnlIsW5fbLIJVv/dD+d/d162fw3ywwWcLSA0PmRQ=
      sequence: "0"
    tip: null
  body:
    extension_options: []
    memo: ""
    messages:
    - '@type': /exocore.oracle.v1.MsgCreatePrice
      based_block: "50"
      creator: exo18z3p42xn8pjk338upvzp794h02wh7p4tyandma
      feeder_id: "1"
      nonce: 1
      prices:
      - desc: ""
        prices:
        - decimal: 8
          det_id: "110680464442257331381"
          price: "265086000000"
          timestamp: "2024-08-15 03:49:42"
        source_id: "1"
    non_critical_extension_options: []
    timeout_height: "0"
  signatures:
  - JqlwCNSeXLCLPrHxxPWWDcRZ94gRGtEwAeJ16Y0ItlnTDlbHIRX529Puwn2iUv0CVjMTF5PWWC0gGHQffa5NBQ==
txhash: 32E71B3FDE7561C07102B746BEE13920E08D9BE29E6D436630ABB6EA90CFE4A6

This failure was due to the new commit of price feeder: ExocoreNetwork/price-feeder@da450eb

With https://github.com/ExocoreNetwork/price-feeder/releases/tag/v0.1.3 there is no such failure.

But the price update failed when register a new token.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (3)
x/oracle/keeper/params.go (3)

Line range hint 17-33:
Add validation logic in SetParams.

The SetParams function has a TODO comment for validation checks, which is crucial for ensuring data integrity when setting parameters.

Would you like me to help implement the validation logic or open a GitHub issue to track this task?


35-39: Enhance error message for existing asset ID.

The error message when an asset ID already exists could provide more context for debugging.

- return fmt.Errorf("assetID exists:%s", oInfo.AssetID)
+ return fmt.Errorf("assetID %s already exists in the system", oInfo.AssetID)

55-64: Improve error handling for parsing failures.

Error messages for parsing decimal and interval values could be more descriptive to aid debugging.

- return err
+ return fmt.Errorf("failed to parse decimal value for token %s: %w", oInfo.Token.Name, err)
- return err
+ return fmt.Errorf("failed to parse interval value for feeder %s: %w", oInfo.Feeder.Name, err)
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 28fde00 and eea41e6.

Files selected for processing (1)
  • x/oracle/keeper/params.go (2 hunks)
Additional comments not posted (3)
x/oracle/keeper/params.go (3)

13-16: Constants for feeder configuration are appropriate.

The constants startAfterBlocks and defaultInterval are well-defined and enhance readability by clarifying the purpose of these values in the feeder setup.


70-78: Consider using a more robust data structure for asset IDs.

The logic for binding asset IDs is clear, but consider using a slice or set-like structure for scalability and maintainability.


81-107: Token registration and feeder setup logic is clear.

The logic for adding new tokens and setting up feeders is well-implemented and aligns with the PR objectives.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between eea41e6 and 52db441.

Files selected for processing (6)
  • app/ante/cosmos/authz.go (2 hunks)
  • precompiles/avs/types.go (1 hunks)
  • testutil/abci.go (3 hunks)
  • x/dogfood/types/genesis.go (1 hunks)
  • x/oracle/keeper/aggregator/context.go (1 hunks)
  • x/oracle/types/params.go (3 hunks)
Files skipped from review due to trivial changes (2)
  • precompiles/avs/types.go
  • x/dogfood/types/genesis.go
Files skipped from review as they are similar to previous changes (1)
  • x/oracle/types/params.go
Additional comments not posted (5)
app/ante/cosmos/authz.go (1)

30-30: Simplify error handling with ErrUnauthorized.Wrap.

The change from errorsmod.Wrapf to errortypes.ErrUnauthorized.Wrap streamlines error handling by using a more specific error type. This improves clarity and consistency in error reporting.

testutil/abci.go (2)

193-193: Enhance error handling with ErrInvalidRequest.Wrap.

The change from errorsmod.Wrapf to errortypes.ErrInvalidRequest.Wrap in BroadcastTxBytes improves clarity by directly using a specific error type, aligning with the error handling conventions.


240-240: Enhance error handling with ErrInvalidRequest.Wrap.

Similarly, the change in checkTxBytes to use errortypes.ErrInvalidRequest.Wrap enhances clarity and consistency in error reporting.

x/oracle/keeper/aggregator/context.go (2)

93-93: Simplify validation logic by removing nil check.

The removal of the nil check for msg.Prices assumes that prior validation ensures non-nil values, simplifying the condition and improving efficiency.


98-98: Streamline validation by removing nil check for pSource.Prices.

By assuming pSource.Prices is not nil, the logic is simplified. Ensure that upstream validation guarantees this assumption to prevent runtime errors.

@leonz789
Copy link
Contributor Author

Testing failed, oracle feed price fail. exocore: PR #159 28fde00 + develop (09d1501 )
Steps:

  1. Start local_node.sh and open grpc
  2. Update oracle start_base_block for token ID 1.
  3. Start price feeder (ExocoreNetwork/price-feeder@da450eb)
exocored q tx 32e71b3fde7561c07102b746bee13920e08d9be29e6d436630abb6ea90cfe4a6
code: 11
codespace: sdk
data: ""
events: []
gas_used: "20721"
gas_wanted: "20000"
height: "51"
info: ""
logs: []
raw_log: 'out of gas in location: WritePerByte; gasWanted: 20000, gasUsed: 20721:
  out of gas'
timestamp: "2024-08-15T03:49:42Z"
tx:
  '@type': /cosmos.tx.v1beta1.Tx
  auth_info:
    fee:
      amount:
      - amount: "9223372036854775807"
        denom: aexo
      gas_limit: "20000"
      granter: ""
      payer: ""
    signer_infos:
    - mode_info:
        single:
          mode: SIGN_MODE_DIRECT
      public_key:
        '@type': /cosmos.crypto.ed25519.PubKey
        key: 8PaRnlIsW5fbLIJVv/dD+d/d162fw3ywwWcLSA0PmRQ=
      sequence: "0"
    tip: null
  body:
    extension_options: []
    memo: ""
    messages:
    - '@type': /exocore.oracle.v1.MsgCreatePrice
      based_block: "50"
      creator: exo18z3p42xn8pjk338upvzp794h02wh7p4tyandma
      feeder_id: "1"
      nonce: 1
      prices:
      - desc: ""
        prices:
        - decimal: 8
          det_id: "110680464442257331381"
          price: "265086000000"
          timestamp: "2024-08-15 03:49:42"
        source_id: "1"
    non_critical_extension_options: []
    timeout_height: "0"
  signatures:
  - JqlwCNSeXLCLPrHxxPWWDcRZ94gRGtEwAeJ16Y0ItlnTDlbHIRX529Puwn2iUv0CVjMTF5PWWC0gGHQffa5NBQ==
txhash: 32E71B3FDE7561C07102B746BEE13920E08D9BE29E6D436630ABB6EA90CFE4A6

This failure was due to the new commit of price feeder: ExocoreNetwork/price-feeder@da450eb

With https://github.com/ExocoreNetwork/price-feeder/releases/tag/v0.1.3 there is no such failure.

But the price update failed when register a new token.

fixed by #160

@cloud8little
Copy link
Contributor

Test passed. Input of oracleInfo field.

  1. ""ETH,Ethereum,8"
    new asset id is appended to oracle token ETH.
  2. "WSTETH,Sepolia,8
    new asset is added to assets module, and also WSTETH token is added in oracle token field, new token feeder with new token index is added, start base block is current height + 10.
  3. "WSTETH,Sepolia,8,10,0xB82381A3fBD3FaFA77B3a7bE693342618240067b"
    new asset is added to assets module, and also WSTETH token is added in oracle token field.

@MaxMustermann2
Copy link
Contributor

[⠒] Compiling...
[⠃] Compiling 62 files with Solc 0.8.24
[⠊] Solc 0.8.24 finished in 1.69s
Error: 
Compiler run failed:
Error: Compiler error (/solidity/libsolidity/codegen/LValue.cpp:51):Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, t
ry removing local variables.
CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.
   --> src/core/ExocoreGateway.sol:202:21:
    |
202 |                     clientChainId, abi.encodePacked(tokens[i]), decimals[i], tvlLimits[i], names[i], metaData[i], oracleInfos[i]
    |                     ^^^^^^^^^^^^^

Tried adding this to the contract in Solidity but it complains. Looking for a workaround in Solidity first; otherwise we might have to make some changes here.

@cloud8little cloud8little added this to the Testnet V5 milestone Aug 28, 2024
@cloud8little cloud8little self-requested a review August 29, 2024 07:51
MaxMustermann2 added a commit to MaxMustermann2/exocore-contracts that referenced this pull request Aug 31, 2024
ExocoreNetwork/exocore#159 adds a new `oracleInfo` parameter to the
`IAssets.sol` precompile when registering tokens. This PR follows that
change.

Previously, multiple tokens could be registered with a single call to
ExocoreGateway. However, that resulted in too many variables (and too
much gas) for Solidity to handle within a single function. To that end,
and keeping in mind that addition of new tokens isn't likely to be a
frequent occurrence, the function's capabilities have been tempered to
support only a single token within the transaction.

As a side effect, this fixes ExocoreNetwork#80
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (3)
precompiles/assets/tx.go (2)

Line range hint 120-160: Consider refactoring the function into smaller functions for better readability and maintainability.

The RegisterToken function is performing multiple operations:

  1. Input parsing
  2. Asset existence check
  3. Token registration
  4. Staking asset info update

Consider refactoring these operations into separate smaller functions. This will improve the readability and maintainability of the code.


162-200: Consider refactoring the function into smaller functions for better readability and maintainability.

The UpdateToken function is performing multiple operations:

  1. Input parsing
  2. Asset existence check
  3. Asset info update

Consider refactoring these operations into separate smaller functions. This will improve the readability and maintainability of the code.

precompiles/assets/types.go (1)

184-214: Consider simplifying the parsing logic for clarity.

The current switch-case structure for parsing oracleInfoStr can be simplified for better readability. Consider using a more straightforward approach to handle different lengths of parsed data.

parsed := strings.Split(oracleInfoStr, ",")
if len(parsed) < 3 {
    return types.AssetInfo{}, oracletypes.OracleInfo{}, errors.New(exocmn.ErrInvalidOracleInfo)
}

oracleInfo.Token.Name = parsed[0] 
oracleInfo.Chain.Name = parsed[1]
oracleInfo.Token.Decimal = parsed[2]

if len(parsed) >= 4 {
    oracleInfo.Feeder.Interval = parsed[3]
}
if len(parsed) >= 5 {
    oracleInfo.Token.Contract = parsed[4]
}

if len(parsed) > 5 {
    joined := strings.Join(parsed[5:], "")
    tokenDesc := tokenDescMatcher.FindStringSubmatch(joined)
    chainDesc := chainDescMatcher.FindStringSubmatch(joined)
    if len(tokenDesc) == 2 {
        oracleInfo.Token.Desc = tokenDesc[1]
    }
    if len(chainDesc) == 2 {
        oracleInfo.Chain.Desc = chainDesc[1]
    }
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 52db441 and ac83fd0.

Files selected for processing (6)
  • precompiles/assets/IAssets.sol (1 hunks)
  • precompiles/assets/abi.json (2 hunks)
  • precompiles/assets/assets.go (3 hunks)
  • precompiles/assets/tx.go (3 hunks)
  • precompiles/assets/types.go (2 hunks)
  • x/oracle/types/params.go (1 hunks)
Additional comments not posted (15)
precompiles/assets/IAssets.sol (2)

58-79: LGTM! The changes to the registerToken function improve clarity and functionality.

The key improvements include:

  • Separating the registration and update functionality into separate functions.
  • Adding the oracleInfo parameter to provide additional information about the token's oracle during registration.
  • Renaming clientChainID to clientChainId to maintain consistent casing.
  • Simplifying the return value to focus on the success status of token registration.

These changes enhance the clarity and functionality of the token registration process.


80-92: LGTM! The introduction of the updateToken function enhances the token management process.

The benefits of the new function include:

  • Improving clarity by separating the update functionality from the registration functionality.
  • Allowing for updating specific token parameters, such as the TVL limit and metadata, without affecting other token details.
  • Providing clear documentation on how to use the function effectively.

The updateToken function strengthens the flexibility and maintainability of the token management system.

precompiles/assets/abi.json (2)

129-129: Approve the changes to the registerToken function.

The following changes have been made:

  • The function has been renamed from registerOrUpdateTokens to registerToken, indicating a separation of concerns for token registration and updates.
  • The clientChainID parameter has been renamed to clientChainId, following a consistent naming convention.
  • A new oracleInfo parameter of type string has been added, allowing additional metadata related to oracle services to be provided during token registration.

These changes enhance clarity and functionality.

Also applies to: 132-132, 160-164, 172-175


Line range hint 177-209: Approve the addition of the updateToken function.

The updateToken function has been introduced to handle token updates separately from token registration. This change aligns with the separation of concerns and improves the clarity of the contract's functionality.

The function accepts the following parameters:

  • clientChainId: The ID of the client chain.
  • token: The token bytes.
  • tvlLimit: The TVL (Total Value Locked) limit for the token.
  • metaData: Additional metadata associated with the token.

The function returns a boolean value indicating the success of the token update operation.

This addition enhances the contract's ability to manage token updates independently and provides flexibility in modifying token details.

precompiles/assets/assets.go (6)

78-78: LGTM!

The comment change improves the accuracy of the description.


105-105: LGTM!

The error handling has been refined to consistently pack outputs with a single boolean value. The removal of the workaround comment suggests that the underlying issue may have been resolved.


107-112: LGTM!

The addition of MethodRegisterToken enhances the functionality of the Run method by introducing a new method for registering tokens. The error handling is consistent with the other methods.


113-118: LGTM!

The addition of MethodUpdateToken enhances the functionality of the Run method by introducing a new method for updating tokens. The error handling is consistent with the other methods.


122-125: LGTM!

The error handling for query methods has been refined to consistently pack outputs with a single boolean value indicating the success status, along with the query result. This improves the clarity and consistency of the error handling.

Also applies to: 128-131


153-153: LGTM!

The addition of MethodRegisterToken and MethodUpdateToken to the IsTransaction method ensures that these methods are correctly identified as transaction methods. This enhances the clarity and functionality of the transaction identification logic.

precompiles/assets/tx.go (2)

189-192: Good practice of selectively updating the metadata.

The function is updating the metadata only if it's provided in the input. This is a good practice to avoid overwriting existing metadata with empty values.


150-152: Verify the usage of RegisterNewTokenAndSetTokenFeeder.

Ensure that the RegisterNewTokenAndSetTokenFeeder function is defined and does the necessary operations.

Run the following script to verify the function usage:

Verification successful

Function RegisterNewTokenAndSetTokenFeeder is properly defined and used.

  • The function is defined in x/oracle/keeper/params.go.
  • It is used in precompiles/assets/tx.go.
  • It is part of an interface in x/assets/types/expected_keepers.go.

The function is integrated into the codebase as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `RegisterNewTokenAndSetTokenFeeder`.

# Test: Search for the function definition. Expect: The function definition.
rg --type go $'func \(.*\) RegisterNewTokenAndSetTokenFeeder\('

# Test: Search for the function usage. Expect: The usage in `RegisterToken`.
rg --type go -A 5 $'RegisterNewTokenAndSetTokenFeeder'

Length of output: 1194

precompiles/assets/types.go (2)

124-217: LGTM!

The code changes in the TokenFromInputs function are approved.


219-262: LGTM!

The new UpdateTokenFromInputs function looks good with proper validation and error handling.

x/oracle/types/params.go (1)

489-493: Enhancement: Support for multiple asset IDs per token.

The changes to the GetTokenIDFromAssetID function enable it to handle scenarios where a token's AssetID field contains multiple asset IDs separated by commas. This enhances flexibility and allows for more diverse token configurations.

The updated logic correctly splits the AssetID string by commas and iterates over the individual asset IDs to find a match with the provided assetID. If a match is found, the corresponding token ID is returned.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ac83fd0 and 3c2f9bb.

Files selected for processing (2)
  • app/ante/cosmos/txsize_gas.go (3 hunks)
  • precompiles/testutil/logs.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • precompiles/testutil/logs.go
Additional comments not posted (2)
app/ante/cosmos/txsize_gas.go (2)

42-43: LGTM!

The code changes are approved. The change in the size limit constant from utils.TxSizeLimit to anteutils.TxSizeLimit aligns with the reorganization of utility functions mentioned in the summary.


73-73: LGTM!

The code changes are approved. The added comment directive for gitleaks enhances the clarity of the code regarding security practices without altering the logic.

@cloud8little
Copy link
Contributor

Test object: 3c2f9bb
Test with four validator nodes, when exocoreGateway has no balance,but send a registerToken transaction, the node fails with following error message.

 3:57AM INF received complete proposal block hash=42320E32108E51506A6BC7A40511D930A7C02B851EFE7A015C4147AF65E09AFF height=6447002 module=consensus server=node
 3:57AM INF finalizing commit of block hash=42320E32108E51506A6BC7A40511D930A7C02B851EFE7A015C4147AF65E09AFF height=6447002 module=consensus num_txs=0 root=105AE2E16B626F6F26F758642F7EFD89D84E75D9C442F9CE3034649F40C0DA9C server=node
 3:57AM INF executed block height=6447002 module=state num_invalid_txs=0 num_valid_txs=0 server=node
 3:57AM INF commit synced commit=436F6D6D697449447B5B313139203134342032333520383120353220332031383920373620323032203839203232352032353120323338203138392030203130392031333620312032343820323232203233372031373320383520373620323136203430203939203632203732203536203138302033385D3A3632354639417D module=server
 3:57AM INF committed state app_hash=7790EB513403BD4CCA59E1FBEEBD006D8801F8DEEDAD554CD828633E4838B426 height=6447002 module=state num_txs=0 server=node
 3:57AM INF indexed block events height=6447002 module=txindex server=node
 2024/09/03 03:57:42 Triggered, height:6447002, feeder-parames:{feederID:2, startBlock:6446724, interval:30, roundID:1}:
 2024/09/03 03:57:42 Triggered, height:6447002, feeder-parames:{feederID:1, startBlock:6446724, interval:30, roundID:1}:
 3:57AM ERR failed to broadcast tx error="failed to check sender balance: sender balance < tx cost (0 < 3500000): insufficient funds: insufficient funds" module=backend
 3:57AM INF Served eth_sendRawTransaction conn=183.218.159.31:33734 duration=1.653269 err="failed to check sender balance: sender balance < tx cost (0 < 3500000): insufficient funds: insufficient funds" module=geth reqid=5
 3:57AM INF Timed out dur=2989.270907 height=6447003 module=consensus round=0 server=node step=RoundStepNewHeight
 3:57AM INF received proposal module=consensus proposal="Proposal{6447003/0 (0F90AAADD8CB19B0D8639F2A6E541DAC6F5E95B6967CCEE488E2ABE16E5ECDFD:1:B78CB1BE2651, -1) 64431CF9FD99 @ 2024-09-03T03:57:45.353196259Z}" proposer=2F703B396E582FB223561E445610EEFCFC0E594C server=node
 3:57AM INF received complete proposal block hash=0F90AAADD8CB19B0D8639F2A6E541DAC6F5E95B6967CCEE488E2ABE16E5ECDFD height=6447003 module=consensus server=node
 3:57AM ERR prevote step: consensus deems this block invalid; prevoting nil err="wrong Block.Header.AppHash.  Expected 7790EB513403BD4CCA59E1FBEEBD006D8801F8DEEDAD554CD828633E4838B426, got 9AC937F86D6E2A0C9C59CD6FAD8E8EA59DF693197EB27AAA046C2DECC7ECEE56" height=6447003 module=consensus round=0 server=node
 3:57AM ERR CONSENSUS FAILURE!!! err="precommit step; +2/3 prevoted for an invalid block: wrong Block.Header.AppHash.  Expected 7790EB513403BD4CCA59E1FBEEBD006D8801F8DEEDAD554CD828633E4838B426, got 9AC937F86D6E2A0C9C59CD6FAD8E8EA59DF693197EB27AAA046C2DECC7ECEE56" module=consensus server=node stack="goroutine 203 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/cometbft/cometbft/consensus.(*State).receiveRoutine.func2()\n\tgithub.com/cometbft/[email protected]/consensus/state.go:736 +0x46\npanic({0x2c8fa40?, 0xc005978cf0?})\n\truntime/panic.go:914 +0x21f\ngithub.com/cometbft/cometbft/consensus.(*State).enterPrecommit(0xc00181d180, 0x625f9b, 0x0)\n\tgithub.com/cometbft/[email protected]/consensus/state.go:1463 +0x15d9\ngithub.com/cometbft/cometbft/consensus.(*State).addVote(0xc00181d180, 0xc001701400, {0xc001ac4630, 0x28})\n\tgithub.com/cometbft/[email protected]/consensus/state.go:2195 +0x140f\ngithub.com/cometbft/cometbft/consensus.(*State).tryAddVote(0xc00181d180, 0xc001701400, {0xc001ac4630?, 0xc008807c08?})\n\tgithub.com/cometbft/[email protected]/consensus/state.go:2012 +0x26\ngithub.com/cometbft/cometbft/consensus.(*State).handleMsg(0xc00181d180, {{0x4192a40, 0xc005ec4380}, {0xc001ac4630, 0x28}})\n\tgithub.com/cometbft/[email protected]/consensus/state.go:865 +0x3ce\ngithub.com/cometbft/cometbft/consensus.(*State).receiveRoutine(0xc00181d180, 0x0)\n\tgithub.com/cometbft/[email protected]/consensus/state.go:772 +0x3d1\ncreated by github.com/cometbft/cometbft/consensus.(*State).OnStart in goroutine 164\n\tgithub.com/cometbft/[email protected]/consensus/state.go:383 +0x10c\n"
 3:57AM INF service stop impl=baseWAL module=consensus msg="Stopping baseWAL service" server=node wal=node1/data/cs.wal/wal
 3:57AM INF service stop impl=Group module=consensus msg="Stopping Group service" server=node wal=node1/data/cs.wal/wal
 3:57AM INF Timed out dur=1000 height=6447003 module=consensus round=0 server=node step=RoundStepPrevoteWait
 3:57AM INF New websocket connection module=rpc-server protocol=websocket remote=127.0.0.1:37824 server=node
 3:57AM INF service start impl=wsConnection module=rpc-server msg="Starting wsConnection service" protocol=websocket remote=127.0.0.1:37824 server=node

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3c2f9bb and 9cc32ee.

Files selected for processing (1)
  • x/oracle/keeper/params.go (2 hunks)
Additional comments not posted (1)
x/oracle/keeper/params.go (1)

35-111: Review of RegisterNewTokenAndSetTokenFeeder Function

This function is central to the PR's functionality, facilitating the registration of new tokens and setting up token feeders. Here are several observations and suggestions:

  1. Error Handling and Input Validation:

    • The function begins by retrieving existing parameters and checks if the asset ID already exists (lines 36-39). This is a good practice as it prevents duplicate entries.
    • Error messages should provide more context to aid debugging. For example, including the attempted asset ID in the error message at line 38 could be more informative.
  2. Handling of Chains and Tokens:

    • The logic to check if a chain exists and potentially add a new one (lines 40-54) is clear. However, consider encapsulating this logic into a separate method to improve readability and reusability.
    • When parsing the decimal and interval values (lines 55-68), the function defaults to predefined constants if necessary. This fallback mechanism is prudent, but it's essential to ensure that these defaults are documented clearly in the function's comments or external documentation.
  3. Token and Feeder Registration:

    • The loop from lines 70-78 handles the scenario where a token exists and needs to bind a new asset ID. The use of string concatenation for asset IDs (line 74) is straightforward but might not scale well with a large number of asset IDs. Consider using a more structured data format if scalability becomes an issue.
    • Adding a new token (lines 81-89) and setting up a new token feeder (lines 91-101) are well-handled. The use of constants and clear struct initialization makes these blocks easy to understand.
  4. Performance Considerations:

    • The function updates parameters and potentially modifies the cache based on the transaction context (lines 103-109). It's crucial to ensure that these operations are optimized for performance, especially given the issues reported with gas limits and transaction failures. Profiling and optimizing the database operations and cache interactions could help mitigate these problems.
  5. General Code Quality:

    • Overall, the function is structured logically. However, breaking down this large function into smaller, more focused sub-functions could enhance maintainability and testability.

Consider the following improvements:

  • Enhance error messages for better debugging.
  • Refactor chain and token handling into separate methods.
  • Optimize database operations and cache interactions to address performance issues.

Would you like assistance in implementing these suggestions or further testing to ensure compatibility with existing systems?

github-merge-queue bot pushed a commit to ExocoreNetwork/exocore-contracts that referenced this pull request Sep 5, 2024
* feat(exo-gateway): add oracleInfo

ExocoreNetwork/exocore#159 adds a new `oracleInfo` parameter to the
`IAssets.sol` precompile when registering tokens. This PR follows that
change.

Previously, multiple tokens could be registered with a single call to
ExocoreGateway. However, that resulted in too many variables (and too
much gas) for Solidity to handle within a single function. To that end,
and keeping in mind that addition of new tokens isn't likely to be a
frequent occurrence, the function's capabilities have been tempered to
support only a single token within the transaction.

As a side effect, this fixes #80

* chore(fmt): forge fmt with newer nightly

* doc: update comments

* fix(test): update test from merge

* forge fmt

* feat(assets): split precompile into add/update

Since only certain parameters can be updated (TVL limit and metadata),
it does not make sense to use the same function for token additions and
updates

* fix: accept empty metadata

* fix: remove superfluous check

* forge fmt

* doc: fix outdated comments
@cloud8little
Copy link
Contributor

Test passed on 9cc32ee.

@leonz789 leonz789 merged commit 3aee307 into ExocoreNetwork:develop Sep 5, 2024
21 checks passed
github-merge-queue bot pushed a commit to ExocoreNetwork/exocore-contracts that referenced this pull request Sep 5, 2024
* feat(exo-gateway): add oracleInfo

ExocoreNetwork/exocore#159 adds a new `oracleInfo` parameter to the
`IAssets.sol` precompile when registering tokens. This PR follows that
change.

Previously, multiple tokens could be registered with a single call to
ExocoreGateway. However, that resulted in too many variables (and too
much gas) for Solidity to handle within a single function. To that end,
and keeping in mind that addition of new tokens isn't likely to be a
frequent occurrence, the function's capabilities have been tempered to
support only a single token within the transaction.

As a side effect, this fixes #80

* chore(fmt): forge fmt with newer nightly

* doc: update comments

* fix(test): update test from merge

* forge fmt

* feat(assets): split precompile into add/update

Since only certain parameters can be updated (TVL limit and metadata),
it does not make sense to use the same function for token additions and
updates

* fix: accept empty metadata

* fix: remove superfluous check

* forge fmt

* doc: fix outdated comments
github-merge-queue bot pushed a commit to ExocoreNetwork/exocore-contracts that referenced this pull request Sep 11, 2024
* feat(exo-gateway): add oracleInfo

ExocoreNetwork/exocore#159 adds a new `oracleInfo` parameter to the
`IAssets.sol` precompile when registering tokens. This PR follows that
change.

Previously, multiple tokens could be registered with a single call to
ExocoreGateway. However, that resulted in too many variables (and too
much gas) for Solidity to handle within a single function. To that end,
and keeping in mind that addition of new tokens isn't likely to be a
frequent occurrence, the function's capabilities have been tempered to
support only a single token within the transaction.

As a side effect, this fixes #80

* chore(fmt): forge fmt with newer nightly

* doc: update comments

* fix(test): update test from merge

* forge fmt

* feat(assets): split precompile into add/update

Since only certain parameters can be updated (TVL limit and metadata),
it does not make sense to use the same function for token additions and
updates

* fix: accept empty metadata

* fix: remove superfluous check

* forge fmt

* doc: fix outdated comments

* feat(tvl-limit): impose tvl limit on client chain

We can consider the TVL limits to be of two types: one is the logical
TVL limit which disallows deposits from exceeding total supply and the
other is the operational TVL limit which is used for risk management
during the launch phase of the network.

The former is imposed by Exocore's precompiles while the latter is
imposed by the client chain's gateway contracts. Both fields are
editable by the contract owners: the total supply in response to minting
and burning and the deposit limits with time to larger values.

As a consequence of the introduction of a limit on the client chain, it
must now be provided at the time of token registration. It can be
updated or reduced unilaterally on the client chain.

While editing the `totalSupply` on Exocore, it is best to be fully
accurate. Reducing the `totalSupply` to lower than the TVL limit
configured on the client chain will result in failed deposits which may
produce a system halt. Even if the TVL limit is reduced on the client
chain after this, it can impact the messages that are already in-flight.

* fix(doc): update IAssets comment

* feat: prevent misconfig of supply and tvl limits

The objective of this change is to prevent deposit failures by ensuring
that the tvlLimit (as enforced on the client chain) <= totalSupply (as
enforced by Exocore). Note that, with time, the totalSupply stored on
Exocore may become outdated as well; however, it is a secondary check
which occurs only after tokens are transferred into the Vault on the
client chain.

Since the addition of tokens to the whitelist happens through Exocore,
it can be enforced easily that the tvlLimit of said token is less than
the total supply (as known to Exocore).

Whenever a transaction to update the tvlLimit on a client chain is
received, it is handled on a case-by-case basis.
- A decrease in tvl limit is always allowed.
- An increase in tvl limit is forwarded to Exocore for validation.

Exocore receives this validation request, and responds in the
affirmative if the new tvl limit <= supply of the token (again,
according to Exocore). It responds in the negative, otherwise.

Reciprocally, whenever an attempt is made to change the recorded value
of total supply corresponding to a token on Exocore, here's what
happens.
- An increase in the total supply is always allowed.
- A decrease in the total supply is forwarded to the client chain for
  validation.

when the client chain receives this validation request, it responds in
the affirmative if the tvl limit <= new total supply (which may be
totally different from the actual total supply due to changes in the
number when the message was in-flight). Otherwise, it responds in the
negative.

One caveat for both of these validations is that if a validation request
arising from the validating chain is already in-flight, the validation
is rejected. This is to ensure that in-flight messages cannot result in
a misconfiguration.

For example, if the TVL limit is increased from 400m to 500m and the
total supply is 600m, it will be approved. However, if, at the same
time, there is a validation request sent to the client chain by Exocore
to verify if the total supply can be reduced to 450m, it could cause
inconsistency. In this event, the TVL limit increase is rejected and the
total supply decrease will be approved.

* test: validate nonces once done

* feat(bootstrap): reject if tvl limit > supply

* fix: use a count of in-flight messages, not bool

* fix: native restake limit + non whitelist check

* fix: index requests by chainId and nonce

Mistakenly, only the nonce was used but that is not accurate

* fix: simplify TVL limit and total supply limit

Based on the discussion, it was decided to remove the total supply limit
enforced by Exocore. Instead, the TVL limit will be imposed on the
client chain, which will also enforce that any transfers more than the
total supply will fail.

It is possible to set a value of infinite TVL limit by using
`type(uin256).max`

* fix(script): print ProxyAdmin address to JSON

* feat(ci): fail compilation if code size is large

Within Foundry's configuration, the `deny_warnings` boolean may be set
to `true` to force it to report a compilation failure in the case of
warnings. With the `code-size` warning enabled, this will cause a build
failure and report to the developer.

* fix: remove unused variables

* fix: remove some more unused fields

* feat: use `uint128` for tvl limit on exo gateway
github-merge-queue bot pushed a commit to ExocoreNetwork/exocore-contracts that referenced this pull request Sep 14, 2024
* feat(exo-gateway): add oracleInfo

ExocoreNetwork/exocore#159 adds a new `oracleInfo` parameter to the
`IAssets.sol` precompile when registering tokens. This PR follows that
change.

Previously, multiple tokens could be registered with a single call to
ExocoreGateway. However, that resulted in too many variables (and too
much gas) for Solidity to handle within a single function. To that end,
and keeping in mind that addition of new tokens isn't likely to be a
frequent occurrence, the function's capabilities have been tempered to
support only a single token within the transaction.

As a side effect, this fixes #80

* chore(fmt): forge fmt with newer nightly

* doc: update comments

* fix(test): update test from merge

* forge fmt

* feat(assets): split precompile into add/update

Since only certain parameters can be updated (TVL limit and metadata),
it does not make sense to use the same function for token additions and
updates

* fix: accept empty metadata

* fix: remove superfluous check

* forge fmt

* doc: fix outdated comments

* feat(tvl-limit): impose tvl limit on client chain

We can consider the TVL limits to be of two types: one is the logical
TVL limit which disallows deposits from exceeding total supply and the
other is the operational TVL limit which is used for risk management
during the launch phase of the network.

The former is imposed by Exocore's precompiles while the latter is
imposed by the client chain's gateway contracts. Both fields are
editable by the contract owners: the total supply in response to minting
and burning and the deposit limits with time to larger values.

As a consequence of the introduction of a limit on the client chain, it
must now be provided at the time of token registration. It can be
updated or reduced unilaterally on the client chain.

While editing the `totalSupply` on Exocore, it is best to be fully
accurate. Reducing the `totalSupply` to lower than the TVL limit
configured on the client chain will result in failed deposits which may
produce a system halt. Even if the TVL limit is reduced on the client
chain after this, it can impact the messages that are already in-flight.

* fix(doc): update IAssets comment

* feat: prevent misconfig of supply and tvl limits

The objective of this change is to prevent deposit failures by ensuring
that the tvlLimit (as enforced on the client chain) <= totalSupply (as
enforced by Exocore). Note that, with time, the totalSupply stored on
Exocore may become outdated as well; however, it is a secondary check
which occurs only after tokens are transferred into the Vault on the
client chain.

Since the addition of tokens to the whitelist happens through Exocore,
it can be enforced easily that the tvlLimit of said token is less than
the total supply (as known to Exocore).

Whenever a transaction to update the tvlLimit on a client chain is
received, it is handled on a case-by-case basis.
- A decrease in tvl limit is always allowed.
- An increase in tvl limit is forwarded to Exocore for validation.

Exocore receives this validation request, and responds in the
affirmative if the new tvl limit <= supply of the token (again,
according to Exocore). It responds in the negative, otherwise.

Reciprocally, whenever an attempt is made to change the recorded value
of total supply corresponding to a token on Exocore, here's what
happens.
- An increase in the total supply is always allowed.
- A decrease in the total supply is forwarded to the client chain for
  validation.

when the client chain receives this validation request, it responds in
the affirmative if the tvl limit <= new total supply (which may be
totally different from the actual total supply due to changes in the
number when the message was in-flight). Otherwise, it responds in the
negative.

One caveat for both of these validations is that if a validation request
arising from the validating chain is already in-flight, the validation
is rejected. This is to ensure that in-flight messages cannot result in
a misconfiguration.

For example, if the TVL limit is increased from 400m to 500m and the
total supply is 600m, it will be approved. However, if, at the same
time, there is a validation request sent to the client chain by Exocore
to verify if the total supply can be reduced to 450m, it could cause
inconsistency. In this event, the TVL limit increase is rejected and the
total supply decrease will be approved.

* test: validate nonces once done

* feat(bootstrap): reject if tvl limit > supply

* fix: use a count of in-flight messages, not bool

* fix: native restake limit + non whitelist check

* fix: index requests by chainId and nonce

Mistakenly, only the nonce was used but that is not accurate

* fix: simplify TVL limit and total supply limit

Based on the discussion, it was decided to remove the total supply limit
enforced by Exocore. Instead, the TVL limit will be imposed on the
client chain, which will also enforce that any transfers more than the
total supply will fail.

It is possible to set a value of infinite TVL limit by using
`type(uin256).max`

* fix(script): print ProxyAdmin address to JSON

* feat(ci): fail compilation if code size is large

Within Foundry's configuration, the `deny_warnings` boolean may be set
to `true` to force it to report a compilation failure in the case of
warnings. With the `code-size` warning enabled, this will cause a build
failure and report to the developer.

* fix: remove unused variables

* fix: remove some more unused fields

* feat: use `uint128` for tvl limit on exo gateway
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.

4 participants