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 limitation info about dynamic sized variable types #177

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

sukanyaparashar
Copy link

This PR adds the point for mentioning the limitation of using dynamic sized variable types strings and bytes.

@dariaag
Copy link

dariaag commented Aug 26, 2024

@sukanyaparashar Looks good to me, I would just rephrase it a bit to make this long sentence clearer:

In Solidity versions before 0.8.15, there is a limitation when using dynamic-sized variable types, such as strings and bytes, as mapping values in functions invoked multiple times. This issue arises because reusing the same parameters of these types in transactions leads to increased consumption of Solana accounts.

@@ -83,6 +83,36 @@ Every Solana transaction which corresponds to a particular Neon EVM transaction,

If the data emitted by an event is more than 128K bytes, the transaction won't get reverted, but some of the event data won't be stored on-chain, causing some inconsistencies in the data stored.

### Usage of dynamic sized variable types

There is a limitation in Solidity versions prior to `0.8.15` when using dynamic-sized variable types, such as `strings` and `bytes`, as mapping values in functions that are invoked multiple times. This issue arises because reusing the same parameters of these types in transactions leads to an increased consumption of Solana accounts.
Copy link

Choose a reason for hiding this comment

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

Looks good to me, I would just rephrase it a bit to make this long sentence clearer:

In Solidity versions before 0.8.15, there is a limitation when using dynamic-sized variable types, such as strings and bytes, as mapping values in functions invoked multiple times. This issue arises because reusing the same parameters of these types in transactions leads to increased consumption of Solana accounts.

Copy link

@ephemerno ephemerno left a comment

Choose a reason for hiding this comment

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

Looks very nice!
Have just one question:
in 101: for (uint256 i = 0; i < 45; ++i) {
why do you use here i until 45?

@sukanyaparashar
Copy link
Author

Looks very nice! Have just one question: in 101: for (uint256 i = 0; i < 45; ++i) { why do you use here i until 45?

It is just an example of an iteration

Looks very nice! Have just one question: in 101: for (uint256 i = 0; i < 45; ++i) { why do you use here i until 45?

This is a really good question! In Solana, each mapping entry corresponds to usage of one Solana account and there is a limit of using 64 Solana accounts in a single transaction. We have used the value 45 so that the usage of Solana accounts exceeds the 64 accounts limit in this case and it fails.

That means if there are 45 iterations, then because of double spending issue described in this case, the total accounts used in this transaction will be >64, i.e, 45 * 2 = 90 + 9 = 99 accounts (extra 9 accounts are added by default).

@sukanyaparashar sukanyaparashar force-pushed the update/code-compatibility-checklist branch from 9ea99aa to bc07cfd Compare August 29, 2024 15:01
Copy link

@ephemerno ephemerno left a comment

Choose a reason for hiding this comment

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

Everything is clear, thank you!

@sukanyaparashar sukanyaparashar merged commit a2db5b7 into develop Aug 29, 2024
1 check failed
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