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

NewHint#4 shouldn't appear in issue #1031 #1062

Closed
pefontana opened this issue Apr 26, 2023 · 0 comments · Fixed by #1090
Closed

NewHint#4 shouldn't appear in issue #1031 #1062

pefontana opened this issue Apr 26, 2023 · 0 comments · Fixed by #1090
Assignees
Labels
whitelisted-hint Implementation of hint on whitelist directory

Comments

@pefontana
Copy link
Collaborator

NewHint#4 shouldn't appear in issue #1031

%{
def split(num: int, num_bits_shift: int, length: int):
    a = []
    for _ in range(length):
        a.append( num & ((1 << num_bits_shift) - 1) )
        num = num >> num_bits_shift
    return tuple(a)

def pack(z, num_bits_shift: int) -> int:
    limbs = (z.d0, z.d1, z.d2)
    return sum(limb << (num_bits_shift * i) for i, limb in enumerate(limbs))

a = pack(ids.a, num_bits_shift = 128)
b = pack(ids.b, num_bits_shift = 128)
p = pack(ids.p, num_bits_shift = 128)

res = (a - b) % p


res_split = split(res, num_bits_shift=128, length=3)

ids.res.d0 = res_split[0]
ids.res.d1 = res_split[1]
ids.res.d2 = res_split[2]
%}

This can happen because:

  • The hint is duplicated with minor string differences in the whitelisted hint list. If this is the case, handle this string match in the cairo-rs HintProcessor.
  • We use a different string from the one in the whitelisted hint list. If this is the case, fix the string match.
@pefontana pefontana moved this to Todo in Starknet Apr 26, 2023
@pefontana pefontana added the whitelisted-hint Implementation of hint on whitelist directory label Apr 26, 2023
@fmoletta fmoletta self-assigned this Apr 27, 2023
@fmoletta fmoletta linked a pull request Apr 27, 2023 that will close this issue
6 tasks
@pefontana pefontana moved this from Todo to In Progress in Starknet Apr 28, 2023
@pefontana pefontana moved this from In Progress to In Review in Starknet Apr 28, 2023
@github-project-automation github-project-automation bot moved this from In Review to Done in Starknet Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whitelisted-hint Implementation of hint on whitelist directory
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants