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

Export contract's storage to json #3129

Closed
wants to merge 3 commits into from
Closed

Conversation

shargon
Copy link
Member

@shargon shargon commented Feb 8, 2024

Description

Related to #3127

Type of change

  • New feature (non-breaking change which adds functionality)

@shargon shargon requested a review from Jim8y February 8, 2024 17:44
@shargon shargon changed the title Export storage Export contract's storage to a json Feb 8, 2024
@shargon shargon mentioned this pull request Feb 8, 2024
2 tasks
@shargon shargon changed the title Export contract's storage to a json Export contract's storage to json Feb 8, 2024
var jsonData = new JObject();
foreach (var entry in snapshot.Find(prefix, Persistence.SeekDirection.Forward))
{
jsonData[Convert.ToBase64String(entry.Key.Key.ToArray())] = Convert.ToBase64String(entry.Value.Value.ToArray());
Copy link
Member

Choose a reason for hiding this comment

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

I believe there is a limit in json that doesn't allow super long properties.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have extremely big data because of gas

Copy link
Member

Choose a reason for hiding this comment

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

I am talking about keys for the property names.

Copy link
Member Author

Choose a reason for hiding this comment

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

in ASP.Net, there's "MaxJsonLength". The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.

I think that it's enough, and in our json version, we don't have this limit.

Copy link
Member

@cschuchardt88 cschuchardt88 Feb 9, 2024

Choose a reason for hiding this comment

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

I think its 3 characters per one byte of base64 encode. Isn't it? Maybe add a check? for that length?

Copy link
Contributor

Choose a reason for hiding this comment

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

4 bytes long for 3 bytes charadters.

@shargon
Copy link
Member Author

shargon commented Feb 10, 2024

It will me moved to a testing plugin

@shargon shargon closed this Feb 10, 2024
@shargon shargon deleted the core-export-storage branch February 10, 2024 14:19
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