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

Getting rid of unbounded shift #241

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

martun
Copy link
Contributor

@martun martun commented Jan 5, 2025

Getting rid of unbounded shift. It looked nice, but introduced memory access bugs. We should not shift over the size of values and hide it with this class.

@martun martun changed the title Getting rid of unbounded shift. It looked nice, but introduced memory… Getting rid of unbounded shift Jan 5, 2025
@martun martun self-assigned this Jan 6, 2025
@martun martun requested a review from vo-nil January 6, 2025 14:23
@martun martun marked this pull request as draft January 6, 2025 21:48
@martun martun force-pushed the get_rid_of_unbounded_shift branch from fec1077 to b90241c Compare January 7, 2025 21:11
Copy link

github-actions bot commented Jan 7, 2025

Gcc Test Results

  162 files   - 1    162 suites   - 1   16m 25s ⏱️ +8s
7 284 tests +3  7 267 ✅  - 8  6 💤 ±0  11 ❌ +11 
7 358 runs  +3  7 341 ✅  - 8  6 💤 ±0  11 ❌ +11 

For more details on these failures, see this check.

Results for commit b90241c. ± Comparison against base commit 1fed3a7.

This pull request removes 5 and adds 8 tests. Note that renamed tests count towards both.
blueprint_plonk_test_suite ‑ calldatacopy_contract
blueprint_plonk_test_suite ‑ meminit_contract
blueprint_plonk_test_suite ‑ minimal_math_contract
blueprint_plonk_test_suite ‑ mstore8_contract
blueprint_plonk_test_suite ‑ small_storage_contract
sha3_stream_processor_test_suite ‑ sha3_224_shortmsg_bit1
sha3_stream_processor_test_suite ‑ sha3_224_shortmsg_bit2
sha3_stream_processor_test_suite ‑ sha3_256_shortmsg_bit1
sha3_stream_processor_test_suite ‑ sha3_256_shortmsg_bit2
sha3_stream_processor_test_suite ‑ sha3_384_shortmsg_bit1
sha3_stream_processor_test_suite ‑ sha3_384_shortmsg_bit2
sha3_stream_processor_test_suite ‑ sha3_512_shortmsg_bit1
sha3_stream_processor_test_suite ‑ sha3_512_shortmsg_bit2

@martun martun force-pushed the get_rid_of_unbounded_shift branch 2 times, most recently from d09d2bf to 79d8a26 Compare January 8, 2025 10:30
@martun martun marked this pull request as ready for review January 8, 2025 10:30
has_encode<T>::value && has_decode<T>::value;
typedef T type;
};
//template<typename T>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional? Should we remove the total block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted this code.

k = k + data[i] * (shft % L);
shft *= 0x10000000000000000_big_uint512;
k = k + data[i] * shft;
shft = wrapping_mul(shft, 0x10000000000000000_big_uint512) % L;
Copy link
Contributor

@vo-nil vo-nil Jan 8, 2025

Choose a reason for hiding this comment

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

I think we can keep original code, just skip *= on the last step.
Why don't we use shift <<= 64; here in first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want modulo L here, not modulo 0x10000000000000000_big_uint512, no?

@martun martun force-pushed the get_rid_of_unbounded_shift branch from fc050e2 to b25cd40 Compare January 8, 2025 18:27
@martun martun force-pushed the get_rid_of_unbounded_shift branch from b25cd40 to 321188a Compare January 8, 2025 18:35
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.

2 participants