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

Inconsistent offset calculation #1986

Open
petscheit opened this issue Mar 6, 2025 · 0 comments
Open

Inconsistent offset calculation #1986

petscheit opened this issue Mar 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@petscheit
Copy link

petscheit commented Mar 6, 2025

Describe the bug
Consider the following example:

func hash_full_transcript_and_get_Z_4_LIMBS{poseidon_ptr: PoseidonBuiltin*}(
    limbs_ptr: felt*, n: felt
) -> (_s0: felt, _s1: felt, _s2: felt) {
    alloc_locals;
    local BASE = 2 ** 96;

    // n = 768 & N_LIMBS = 4
    local offset = n * N_LIMBS;
    let elements_end_correct = &limbs_ptr[offset];
    let elements_end = &limbs_ptr[n * N_LIMBS];


//...more code here
}

Both references should point to the same relocatable offset. However, when I print these relocatables I get different values:

elements_end: Relocatable { segment_index: 6, offset: 31300 }
elements_end_correct: Relocatable { segment_index: 6, offset: 33604 }

The starting offset in this case is 30532

so: 30532 + (4 * 768) = 33604

and 30532 + 768 = 31300

For some reason the * 4 is not applied

To Reproduce
Hard to reproduce, as this is running deep in the extension field circuit in garaga

Expected behavior
A clear and concise description of what you expected to happen.

What version/commit are you on?
Upgraded to the latest version: v2.0.0

Additional context
this seems related to #1918

@petscheit petscheit added the bug Something isn't working label Mar 6, 2025
@petscheit petscheit changed the title Inconsistant offset calculation Inconsistent offset calculation Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant