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

The generated cache is different from that generated in go-ethereum #223

Closed
alicebobscorpio opened this issue Aug 4, 2022 · 2 comments
Closed

Comments

@alicebobscorpio
Copy link

In build_light_cache() function, the address of variable `cache' changes in each loop
for (int i = 0; i < num_items; ++i)
{
const uint32_t index_limit = static_cast<uint32_t>(num_items);

        // Fist index: 4 first bytes of the item as little-endian integer.
        const uint32_t t = le::uint32(cache[i].word32s[0]);
        const uint32_t v = t % index_limit;

        // Second index.
        const uint32_t w = static_cast<uint32_t>(num_items + (i - 1)) % index_limit;

        cache[i] = keccak512(bitwise_xor(cache[v], cache[w]));
    }

In particular, for i=0, cache[0] is the first element of array cache (as expected). However, for i=1, cache[0] is the second element of array cache, and for i=2, cache[0] is the third element of array cache, ...
By observing the address of cache, I found that the address of cache changes each time when arriving at
" const uint32_t t = le::uint32(cache[i].word32s[0]);".

As a result, the generated cache is different from that generated in go-ethereum.

@alicebobscorpio
Copy link
Author

The codes seem good. I am wondering why this happens.

@alicebobscorpio alicebobscorpio closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2022
@alicebobscorpio
Copy link
Author

It seems due to the CLion debug tool.

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

No branches or pull requests

1 participant