Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Fix large string copies #269

Merged
merged 2 commits into from
Jul 31, 2020
Merged

Fix large string copies #269

merged 2 commits into from
Jul 31, 2020

Conversation

jochem-brouwer
Copy link
Member

When implementing Homestead in this PR I ran into an issue when trying to copy SHA3 large buffers which is caused by assertIsBuffer. This copies Buffers with sizes which node cannot handle even if there are no errors:

Error: Cannot create a string longer than 0x3fffffe7 characters
    at Buffer.toString (buffer.js:777:17)
    at Object.exports.assertIsBuffer (/Volumes/Ethereum/ethereumjs-vm/node_modules/ethereumjs-util/src/helpers.ts:19:15)
    at Object.exports.keccak (/Volumes/Ethereum/ethereumjs-vm/node_modules/ethereumjs-util/src/hash.ts:14:3)
    at Object.exports.keccak256 (/Volumes/Ethereum/ethereumjs-vm/node_modules/ethereumjs-util/src/hash.ts:39:10)

When you try to copy a Buffer into a string which is too large, it throws. Besides that, it does not make sense to create these messages if there are no errors (this is unnecessary copying).

@jochem-brouwer
Copy link
Member Author

Check won't pass because coverage doesn't upload?

alcuadrado
alcuadrado previously approved these changes Jul 31, 2020
Copy link
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

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

LGTM. Makes sense not to create the strings if they aren't needed.

I don't know what's going on with the CI. I tried re-running it and it failed in another way.

@jochem-brouwer
Copy link
Member Author

@evertonfraga could you take a look why Upload to Coveralls is not working in the CI? 😄

@evertonfraga
Copy link
Contributor

Sure, sir!

@github-actions
Copy link

Coverage Status

Coverage remained the same at 99.711% when pulling fbaf1b8 on fix-helper-memcopy into c6e8f3e on master.

@evertonfraga evertonfraga self-requested a review July 31, 2020 14:08
Copy link
Contributor

@evertonfraga evertonfraga left a comment

Choose a reason for hiding this comment

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

Done and fixed. Feel free to merge!

@evertonfraga
Copy link
Contributor

evertonfraga commented Jul 31, 2020

The main reason was a command trying to fetch a SHA reference from git, when it didn't exist. Checkout version 2 fixes that.

##[error]Error: Command failed: git cat-file -p 3130d061cb32a5063fafc16788945bd0cce0d55b

@jochem-brouwer
Copy link
Member Author

Thanks a lot @evertonfraga 😄

@jochem-brouwer jochem-brouwer merged commit ba3e344 into master Jul 31, 2020
@jochem-brouwer jochem-brouwer deleted the fix-helper-memcopy branch July 31, 2020 14:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants