Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new LinearCodeAddressGenerator contract #467

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

turbolent
Copy link
Member

Port the linear code address generator from https://github.com/onflow/flow-go/blob/master/model/flow/address.go to Cadence.

We'll likely need this for the migration code of onflow/cadence#3584, which will be implemented as a Cadence contract.

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.

Left a couple clarifying questions. My main question is whether index needs to be tracked in contract or some struct's state or if that's relegated to some lower-level state.

contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
contracts/LinearCodeAddressGenerator.cdc Show resolved Hide resolved
contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
@sisyphusSmiling
Copy link
Contributor

Approved but CI failing. Looks like the go assets need to be updated as well.

@tarakby
Copy link
Contributor

tarakby commented Nov 28, 2024

I'm back from time off and looking at this today

Copy link
Contributor

@tarakby tarakby left a comment

Choose a reason for hiding this comment

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

Nice!

contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
tests/LinearCodeAddressGenerator_test.cdc Show resolved Hide resolved
@turbolent turbolent requested a review from tarakby November 29, 2024 18:19
contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
@bluesign
Copy link
Contributor

bluesign commented Nov 30, 2024

Nit: I think address(index: 0) should fail

@tarakby
Copy link
Contributor

tarakby commented Dec 2, 2024

Nit: I think address(index: 0) should fail

right thanks @bluesign.
Actually, address(index) should only work for index in the range [1 .. 2^45 - 1], and should fail otherwise.

@turbolent
Copy link
Member Author

@tarakby Added a check for the index in 7fb76ed

@turbolent turbolent requested a review from tarakby December 2, 2024 18:03
Copy link
Contributor

@tarakby tarakby left a comment

Choose a reason for hiding this comment

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

Sweet! Thank you @turbolent, feel free to merge

contracts/LinearCodeAddressGenerator.cdc Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants