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

Update BLS12-381 and EIP-4844 precompiles #5857

Merged
merged 6 commits into from
Jun 23, 2023

Conversation

flcl42
Copy link
Contributor

@flcl42 flcl42 commented Jun 23, 2023

Update BLS12-381 and EIP-4844 precompiles' addresses according to:

Changes

|                    Method |     Mean |     Error |    StdDev | Ratio |
|-------------------------- |---------:|----------:|----------:|------:|
|         WithMemoryMarshal | 2.926 ns | 0.0313 ns | 0.0277 ns |  0.59 |
|  WithMemoryMarshalOrdered | 2.650 ns | 0.0220 ns | 0.0195 ns |  0.53 |
| WithMemoryMarshalOrderedU | 2.441 ns | 0.0399 ns | 0.0373 ns |  0.49 | # x2-3
|         WithBytesAreEqual | 4.966 ns | 0.0209 ns | 0.0195 ns |  1.00 |

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

@flcl42 flcl42 force-pushed the feature/eip-4844-and-2537-update-addresses branch from a540d46 to 7e4d348 Compare June 23, 2023 08:49
@flcl42 flcl42 force-pushed the feature/eip-4844-and-2537-update-addresses branch from cb47b98 to 3632e5d Compare June 23, 2023 09:14
@flcl42 flcl42 marked this pull request as ready for review June 23, 2023 10:28
Comment on lines +15 to +17
Span<uint> data = MemoryMarshal.Cast<byte, uint>(address.Bytes.AsSpan());
return (data[4] & 0x00ffffff) == 0
&& data[3] == 0 && data[2] == 0 && data[1] == 0 && data[0] == 0
Copy link
Member

Choose a reason for hiding this comment

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

Loading to a Vector256 wouldn't be even faster?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anything but 4B integers does seem to work well with 20B address. May be we could cast it additionally to 8B int / Vector128(?) and have less comparisons, but it'd become too complicated

@flcl42 flcl42 merged commit dcc2d20 into master Jun 23, 2023
61 checks passed
@flcl42 flcl42 deleted the feature/eip-4844-and-2537-update-addresses branch June 23, 2023 14:52
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