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

Remove contract hex encoding #480

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

Conversation

nozim
Copy link
Contributor

@nozim nozim commented Sep 26, 2023

Closes: #467

Description


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (79491cf) 61.23% compared to head (de79a68) 61.11%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
- Coverage   61.23%   61.11%   -0.13%     
==========================================
  Files          26       26              
  Lines        3312     3312              
==========================================
- Hits         2028     2024       -4     
- Misses       1112     1116       +4     
  Partials      172      172              
Flag Coverage Δ
unittests 61.11% <33.33%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
templates/accounts.go 16.41% <33.33%> (-2.06%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@janezpodhostnik janezpodhostnik left a comment

Choose a reason for hiding this comment

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

The code lgtm, but what is the release strategy here? This will break a lot of code right?

@nozim
Copy link
Contributor Author

nozim commented Sep 26, 2023

I could add alternative methods with usage of string instead to make a smooth transition?
Obviously marking existing methods as deprecated instead?

@bluesign
Copy link
Contributor

I think we can make this non-breaking change: onflow/sdks#18 (comment)

Comment on lines 51 to 54
require.Less(t, argumentsSize, len(testContractBody)*2+500,
"The create account argument size should not grow over "+
"2 times the contract code (converted to hex) + 500 bytes of extra data.")
})
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here should be fixed for non-hex case.

Copy link
Contributor Author

@nozim nozim Sep 26, 2023

Choose a reason for hiding this comment

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

it already checks utf8 contract length to be below the limit.

@turbolent
Copy link
Member

Nice!

@janezpodhostnik Why would this be a breaking change?

@nozim
Copy link
Contributor Author

nozim commented Sep 28, 2023

@janezpodhostnik the only potential breaking point I see for existing contracts already deployed in hex format. Kindly help me to understand if I miss anything here.

@janezpodhostnik
Copy link
Contributor

Looking at this again... yeah sorry I thought this was a breaking change, but I see that we are only using fields already on the Contract object.

chasefleming
chasefleming previously approved these changes Oct 12, 2023
@chasefleming chasefleming dismissed their stale review October 12, 2023 16:36

I think the sdks dependency actually needs to be bumped for this

Copy link
Member

@chasefleming chasefleming left a comment

Choose a reason for hiding this comment

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

I think onflow/sdks needs a dependency bump

@@ -50,7 +48,7 @@ func TestCreateAccount(t *testing.T) {
argumentsSize += len(argument)
}
require.Less(t, txSize, 1000, "The create account script should not grow over 1kB.")
require.Less(t, argumentsSize, contractLen*2+500,
require.Less(t, argumentsSize, len(testContractBody)+500,
"The create account argument size should not grow over "+
"2 times the contract code (converted to hex) + 500 bytes of extra data.")
Copy link
Member

Choose a reason for hiding this comment

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

This message needs updating as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated :)

@nozim
Copy link
Contributor Author

nozim commented Oct 22, 2023

I think onflow/sdks needs a dependency bump

updated, kindly check latest commits.

@nozim nozim requested review from nvdtf and chasefleming October 22, 2023 17:32
@chasefleming
Copy link
Member

I think this PR needs to be merged and release first before updating: onflow/sdks#18

@turbolent can you confirm?

@nozim
Copy link
Contributor Author

nozim commented Oct 30, 2023

@chasefleming @turbolent updated from master. Kindly check 🙏

@chasefleming
Copy link
Member

@nozim That PR I linked was not merged or released yet so updating from master would not actually address the issue.

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.

[FEATURE] Use .utf8 instead of hex-encoding/decoding
7 participants