Skip to content

Crescendo updates for Rosetta#63

Merged
franklywatson merged 62 commits intoonflow:mainfrom
The-K-R-O-K:jeromep/52-updates-for-crescendo
Jul 18, 2024
Merged

Crescendo updates for Rosetta#63
franklywatson merged 62 commits intoonflow:mainfrom
The-K-R-O-K:jeromep/52-updates-for-crescendo

Conversation

@franklywatson
Copy link

@franklywatson franklywatson commented Jun 25, 2024

  • Golang compatibility updates
  • Config and automation updates
  • Cadence 1.0 upgrades

Summary by CodeRabbit

  • New Features

    • Introduced previewnet network configuration for enhanced network options.
    • Added previewnet-integration-test target in build scripts.
  • Improvements

    • Updated network configuration options in multiple scripts and configuration files from "canary" to "previewnet".
    • Enhanced transaction and script handling with improved Cadence type conversions for better accuracy and efficiency.
    • Improved error handling in blockchain scripts to ensure greater reliability.
  • Refactor

    • Removed deprecated relic targets and tags from build and linting processes.

UlyanaAndrukhiv and others added 26 commits May 1, 2024 13:25
@coderabbitai
Copy link

coderabbitai bot commented Jun 25, 2024

Warning

Rate limit exceeded

@franklywatson has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 13 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 1a5e072 and 918220f.

Walkthrough

This update involves several enhancements and adjustments across the codebase. The Makefile has seen orchestration changes, while the README and various Go and Cadence files have been updated to support the new previewnet network. Critical API methods have transitioned to using Cadence types for improved type safety. Additionally, new configuration files and adjustments to blockchain transaction handling scripts have been introduced to streamline integration with previewnet.

Changes

Files Change Summary
Makefile Removed relic target; modified go-build and lint targets; added previewnet-integration-test; updated build-flow target.
README.md Updated network configuration options; adjusted syntax for borrowing capabilities in transactions.
access/access.go Rearranged imports; updated import paths.
api/account_service.go Changed type assertion from int64 to cadence.Int64 in getSequenceNumber method.
api/call_service.go Updated type assertions and data conversions to use Cadence types.
api/construction_service.go Replaced conversions to native types with Cadence types across multiple methods.
cmd/corecontracts/corecontracts.go Replaced flow.Canary with flow.Previewnet in network loop.
cmd/tipheight/tipheight.go Updated network configuration from "canary" to "previewnet".
cmd/txinfo/txinfo.go Replaced "canary" with "previewnet" in network configurations and usage.
script/flow.json Added network configuration for "previewnet".
previewnet.json Introduced configuration JSON object for PreviewNet network.
script/cadence/transactions/proxy-...cdc Adjusted borrowing syntax; updated access control for blockchain operations.
script/cadence/scripts/get-public-...cdc Changed function access from pub to access(all); added error handling for key retrieval.
script/cadence/scripts/get-revoke-...cdc Changed function access from pub to access(all); added error handling for key status retrieval.

Poem

In the realm of code so bright,
Previewnet takes its flight,
With Cadence types so clear and pure,
Our blockchain journey feels secure.
From vaults and keys to new configs,
On Flow, our codebase now performs big!
🚀🐇✨


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@franklywatson franklywatson changed the title Cadence 1.0 updates on top of previous work branch covering remaining contract/scripts/transactions Cadence 1.0 updates on top of working KROK branch to upgrade remaining contract/scripts/transactions Jun 25, 2024
Copy link

@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 f764ae5 and 3dfe10f.

Files selected for processing (1)
  • script/script.go (12 hunks)
Files skipped from review as they are similar to previous changes (1)
  • script/script.go

Copy link

@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 3dfe10f and 573951b.

Files selected for processing (1)
  • script/cadence/contracts/FlowColdStorageProxy.cdc (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • script/cadence/contracts/FlowColdStorageProxy.cdc

Copy link

@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 573951b and fd8038a.

Files selected for processing (1)
  • script/cadence/contracts/FlowColdStorageProxy.cdc (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • script/cadence/contracts/FlowColdStorageProxy.cdc

Copy link

@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 fd8038a and 9bbb9b3.

Files selected for processing (4)
  • script/cadence/contracts/FlowColdStorageProxy.cdc (8 hunks)
  • script/cadence/scripts/get-balances-basic.cdc (2 hunks)
  • script/cadence/scripts/get-balances.cdc (2 hunks)
  • script/cadence/transactions/basic-transfer.cdc (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • script/cadence/contracts/FlowColdStorageProxy.cdc
  • script/cadence/transactions/basic-transfer.cdc
Additional comments not posted (6)
script/cadence/scripts/get-balances-basic.cdc (3)

4-7: Confirm the intended restriction of access.

Changing the access control from pub to access(all) restricts the visibility of the AccountBalances struct to the current module. Ensure this is the intended behavior.


16-16: Confirm the intended restriction of access.

Changing the access control from pub to access(all) restricts the visibility of the main function to the current module. Ensure this is the intended behavior.


18-21: LGTM! Improved reliability by checking balanceRef existence.

The new code correctly checks for the existence of balanceRef before accessing its balance, preventing potential runtime errors.

script/cadence/scripts/get-balances.cdc (3)

5-5: Confirm the intended restriction of access.

Changing the access control from pub to access(all) restricts the visibility of the AccountBalances struct to the current module. Ensure this is the intended behavior.


17-17: Confirm the intended restriction of access.

Changing the access control from pub to access(all) restricts the visibility of the main function to the current module. Ensure this is the intended behavior.


19-22: LGTM! Improved reliability by checking balanceRef and ref existence.

The new code correctly checks for the existence of balanceRef and ref before accessing their balances, preventing potential runtime errors.

Copy link

@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 9bbb9b3 and 4bd9d99.

Files selected for processing (3)
  • access/access.go (19 hunks)
  • config/config.go (4 hunks)
  • script/flow.json (1 hunks)
Additional comments not posted (18)
script/flow.json (1)

13-13: LGTM!

The new network configuration for "previewnet" is correctly added.

config/config.go (4)

192-192: LGTM!

The added log message for reading the config file is useful for debugging and monitoring.


211-211: LGTM!

The network validation logic correctly includes "previewnet" as a valid network.


388-389: LGTM!

The added log message for accessing nodes config is useful for debugging and monitoring.


399-399: LGTM!

The version validation range is correctly adjusted to accommodate version 7.

access/access.go (13)

15-17: LGTM!

The added imports for OpenTelemetry attributes and metrics are necessary for the added logging and tracing functionality.


23-23: LGTM!

The updated import paths for crypto packages are necessary to align with the new package structure.


92-92: LGTM!

The added logging statement in Client.Account is useful for debugging and monitoring.


119-119: LGTM!

The added logging statement in Client.AccountAtHeight is useful for debugging and monitoring.


140-140: LGTM!

The added logging statement in Client.BlockByHeight is useful for debugging and monitoring.


161-161: LGTM!

The added logging statement in Client.BlockByID is useful for debugging and monitoring.


188-188: LGTM!

The added logging statement in Client.BlockEvents is useful for debugging and monitoring.


209-209: LGTM!

The added logging statement in Client.BlockHeaderByHeight is useful for debugging and monitoring.


229-229: LGTM!

The added logging statement in Client.BlockHeaderByID is useful for debugging and monitoring.


250-250: LGTM!

The added logging statement in Client.CollectionByID is useful for debugging and monitoring.


294-294: LGTM!

The added logging statement in Client.Execute is useful for debugging and monitoring.


314-314: LGTM!

The added logging statement in Client.ExecutionResultForBlockID is useful for debugging and monitoring.


336-336: LGTM!

The added logging statement in Client.LatestBlockHeader is useful for debugging and monitoring.

Copy link

@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 (1)
previewnet.json (1)

22-22: Inconsistency in spork_seal_tolerance values across environments

The spork_seal_tolerance value is set to 10000 in previewnet.json and localnet.json, while it is set to 600 in testnet.json, testnet-clone.json, and mainnet.json. This discrepancy needs to be addressed to ensure consistency and appropriateness for the use case.

  • previewnet.json: 10000
  • localnet.json: 10000
  • testnet.json: 600
  • testnet-clone.json: 600
  • mainnet.json: 600

Please verify the tolerance value and ensure it is consistent and appropriate across all environments.

Analysis chain

LGTM! Spork seal tolerance correctly specified.

The spork_seal_tolerance setting is correctly specified as 10000.

However, ensure that the tolerance value is appropriate for the use case.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the spork seal tolerance value.

# Test: Ensure the spork seal tolerance value is appropriate for the use case.
rg --type json -A 5 $'spork_seal_tolerance'

Length of output: 1355

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4bd9d99 and 22a865b.

Files selected for processing (1)
  • previewnet.json (1 hunks)
Additional comments not posted (12)
previewnet.json (12)

2-2: LGTM! Cache setting enabled.

The cache setting is enabled, which is beneficial for performance.


3-7: LGTM! Construction access nodes correctly specified.

The construction_access_nodes setting contains the correct access node address for the PreviewNet network.


15-15: LGTM! Data directory correctly specified.

The data_dir setting is set to ./data, which is appropriate for storing data.


16-16: LGTM! Consensus follower disabled.

The disable_consensus_follower setting is enabled, which is appropriate if consensus following is not required.


17-17: LGTM! Network name correctly specified.

The network setting is correctly specified as previewnet.


26-30: LGTM! Access nodes within sporks correctly specified.

The access_nodes setting within sporks contains the correct access node address for the PreviewNet network.


31-33: LGTM! Root block and version within sporks correctly specified.

The root_block and version settings within sporks are correctly specified.

However, ensure that the root block number and version are accurate and up-to-date.

Verification successful

Verified: Root block and version within sporks are correctly specified.

The root_block and version settings for the PreviewNet network in previewnet.json are accurate and up-to-date.

  • root_block: 14700328
  • version: 7
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the root block number and version for the PreviewNet network.

# Test: Ensure the root block number and version are accurate and up-to-date.
rg --type json -A 5 $'root_block'

Length of output: 1026


8-14: LGTM! Contracts correctly specified.

The contracts setting contains the correct contract addresses for the PreviewNet network.

However, ensure that the contract addresses are accurate and up-to-date.


18-20: LGTM! Originators correctly specified.

The originators setting contains the correct originator address.

However, ensure that the originator address is accurate and up-to-date.


24-34: LGTM! Sporks correctly specified.

The sporks setting contains the correct spork configurations for the PreviewNet network.

However, ensure that the spork configurations are accurate and up-to-date.


23-23: LGTM! Spork synced tolerance correctly specified.

The spork_synced_tolerance setting is correctly specified as 10.

However, ensure that the tolerance value is appropriate for the use case.


21-21: LGTM! Port number correctly specified.

The port setting is correctly specified as 8080, which is a common choice for web services.

However, ensure that the port number does not conflict with other services.

Copy link

@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 22a865b and 054e00a.

Files selected for processing (1)
  • script/cadence/transactions/proxy-to-flow-transfer.cdc (2 hunks)
Additional context used
Learnings (1)
script/cadence/transactions/proxy-to-flow-transfer.cdc (1)
Learnt from: franklywatson
PR: onflow/rosetta#63
File: script/script.go:23-23
Timestamp: 2024-07-16T15:22:29.703Z
Learning: The syntax `let xfer: @{FungibleToken.Vault}` is considered correct in the context of Cadence 1.0 as per user franklywatson.
Additional comments not posted (4)
script/cadence/transactions/proxy-to-flow-transfer.cdc (4)

8-8: LGTM! Correct syntax for Cadence 1.0.

The change to use curly braces around FungibleToken.Vault is correct.


10-10: LGTM! Correct syntax for Cadence 1.0.

The change to use auth(BorrowValue) &Account is correct.


12-12: LGTM! Correct syntax for Cadence 1.0.

The change to include auth(FungibleToken.Withdraw) is correct.

However, ensure that all function calls to sender.storage.borrow match the new syntax.

Verification successful

Verification Successful: All occurrences of sender.storage.borrow match the new syntax.

The change to include auth(FungibleToken.Withdraw) is consistently applied across the codebase.

  • script/script.go
  • script/cadence/transactions/proxy-to-flow-transfer.cdc
  • script/cadence/transactions/basic-transfer.cdc
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `sender.storage.borrow` match the new syntax.

# Test: Search for the function usage. Expect: Only occurrences of the new syntax.
rg --type cadence -A 5 $'sender.storage.borrow<auth(FungibleToken.Withdraw)'

Length of output: 109


Script:

#!/bin/bash
# Description: Verify all function calls to `sender.storage.borrow` match the new syntax.

# Test: Search for the function usage. Expect: Only occurrences of the new syntax.
rg -A 5 $'sender.storage.borrow<auth(FungibleToken.Withdraw)'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify all function calls to `sender.storage.borrow` match the new syntax.

# Test: Search for all occurrences of `sender.storage.borrow` in the codebase.
rg 'sender.storage.borrow'

Length of output: 505


22-22: LGTM! Correct syntax for Cadence 1.0.

The change to use capabilities instead of getCapability is correct.

However, ensure that all function calls to getAccount(receiver).capabilities.borrow match the new syntax.

Verification successful

Verification Successful: The new syntax is consistently used.

The change to use capabilities instead of getCapability is correctly implemented across the codebase.

  • README.md
  • script/script.go
  • script/cadence/transactions/proxy-to-flow-transfer.cdc
  • script/cadence/transactions/basic-transfer.cdc
  • script/cadence/contracts/FlowColdStorageProxy.cdc
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `getAccount(receiver).capabilities.borrow` match the new syntax.

# Test: Search for the function usage. Expect: Only occurrences of the new syntax.
rg --type cadence -A 5 $'getAccount(receiver).capabilities.borrow'

Length of output: 99


Script:

#!/bin/bash
# Description: Verify all function calls to `getAccount(receiver).capabilities.borrow` match the new syntax.

# Test: Search for the function usage. Expect: Only occurrences of the new syntax.
rg -A 5 'getAccount(receiver).capabilities.borrow'

Length of output: 52


Script:

#!/bin/bash
# Description: Verify all function calls to `getAccount(receiver)` and `borrow` match the new syntax.

# Test: Search for the function usage. Expect: Only occurrences of the new syntax.
rg -A 5 'getAccount(receiver)'
rg -A 5 'borrow<&{FungibleToken.Receiver}>'

Length of output: 203


Script:

#!/bin/bash
# Description: Verify all function calls to `getAccount(receiver)` and `borrow` match the new syntax.

# Test: Search for the function usage. Expect: Only occurrences of the new syntax.
rg -A 5 'getAccount(receiver)'
rg -A 5 'borrow<&\{FungibleToken\.Receiver\}>'

Length of output: 2501

Copy link
Contributor

@sisyphusSmiling sisyphusSmiling left a comment

Choose a reason for hiding this comment

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

Great work! Left some small suggestions and comments

j pimmel and others added 3 commits July 18, 2024 13:58
Co-authored-by: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com>
Co-authored-by: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com>
Copy link

@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 054e00a and 1a5e072.

Files selected for processing (2)
  • script/cadence/scripts/get-public-key.cdc (1 hunks)
  • script/cadence/scripts/get-revoke-status.cdc (1 hunks)
Additional comments not posted (4)
script/cadence/scripts/get-revoke-status.cdc (2)

1-1: Access control change looks good.

Changing pub to access(all) is appropriate for this context.


4-4: Error handling improvement looks good.

The added error handling ensures that the function panics with a descriptive message if the key is not found.

script/cadence/scripts/get-public-key.cdc (2)

1-1: Access control change looks good.

Changing pub to access(all) is appropriate for this context.


4-4: Error handling improvement looks good.

The added error handling ensures that the function panics with a descriptive message if the key is not found.

@franklywatson franklywatson merged commit f3bbacc into onflow:main Jul 18, 2024
@franklywatson franklywatson deleted the jeromep/52-updates-for-crescendo branch July 18, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments