Skip to content

EvmStack native endian#8037

Closed
Scooletz wants to merge 20 commits intomasterfrom
evm-stack-native-endian
Closed

EvmStack native endian#8037
Scooletz wants to merge 20 commits intomasterfrom
evm-stack-native-endian

Conversation

@Scooletz
Copy link
Contributor

@Scooletz Scooletz commented Jan 9, 2025

This PR changes the endianness of the EvmStack to be aligned with the platform it runs on. It means that no endianness conversions should be done when retrieving storing UInt256. The penalty though is related to pushing/poping bytes that now require reversing. According to the profiling this should happen much less frequent than regular operations.

Beside the endiannes, this PR add one method that allows to peek a ref UInt256 to the top of the stack. This allows for any Instruction that has push/pop behavior to get a ref to the last parameter and directly set the value on the stack, without performing calculations for pop and push. Instead it will calculated the offset once for getting the ref and use it for pop.

Changes

  • EvmStack uses now native platform endianess
  • EvmStack allows peeking a ref to the top

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

@Scooletz Scooletz force-pushed the evm-stack-native-endian branch 2 times, most recently from 4e48a4c to 4b804ef Compare January 16, 2025 12:16
@Scooletz Scooletz force-pushed the evm-stack-native-endian branch from 4b804ef to 8f8c479 Compare January 16, 2025 13:49
@Scooletz
Copy link
Contributor Author

Benchmarks showed no more than 2% gain, which was much less than the standard deviation for the MGas/s. Closing in its current form.

@Scooletz Scooletz closed this Jan 22, 2025
@benaadams benaadams deleted the evm-stack-native-endian branch March 29, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant