Skip to content

Instantly share code, notes, and snippets.

@jobez
Created August 25, 2023 01:39
Show Gist options
  • Save jobez/b21a84a35e7c97eb0de98424506cd4ef to your computer and use it in GitHub Desktop.
Save jobez/b21a84a35e7c97eb0de98424506cd4ef to your computer and use it in GitHub Desktop.
the sha diaries
pragma solidity ^0.8.0;
contract HashAndStore {
bytes32 public storedHash;
function hashAndStore() public {
// Perform the keccak256 operation on an empty bytes array
bytes32 result = keccak256(abi.encodePacked());
// Store the result at storage slot 0
storedHash = result;
}
}
res = await plain_opcodes.hashAndStore(caller_address=owner.starknet_address)
The currently activated Python version 3.10.10 is not supported by the project (>=3.9,<3.10).
Trying to find and use a compatible version.
Using python3.9 (3.9.17)
Error in the called contract (0x04e2460d0debdacdde372cb598b4e4403939ca112c8720e1c2aca13f6ac09b9a):
/Users/jmsb/Library/Caches/pypoetry/virtualenvs/kakarot-wte-U8dZ-py3.9/lib/python3.9/site-packages/starkware/cairo/common/hash.cairo:16:18: Error at pc=0:7:
let result = hash_ptr.result;
^*************^
Got an exception while executing a hint.
Cairo traceback (most recent call last):
/Users/jmsb/Library/Caches/pypoetry/virtualenvs/kakarot-wte-U8dZ-py3.9/lib/python3.9/site-packages/starkware/cairo/common/math.cairo:130:15
let low = [range_check_ptr];
^***************^
Unknown location (pc=0:149)
Error in the called contract (0x04e2460d0debdacdde372cb598b4e4403939ca112c8720e1c2aca13f6ac09b9a):
Error at pc=0:31:
Got an exception while executing a hint.
Cairo traceback (most recent call last):
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/execution_context.cairo:613:34
create_addresses_len=self.create_addresses_len,
^***********************^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/execution_context.cairo:545:35
revert_contract_state=self.revert_contract_state,
^************************^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/execution_context.cairo:364:52
let revert_contract_state_dict_start = self.revert_contract_state.dict_start;
^***********************************^
/Users/jmsb/Library/Caches/pypoetry/virtualenvs/kakarot-wte-U8dZ-py3.9/lib/python3.9/site-packages/starkware/cairo/common/math_cmp.cairo:43:18
return is_nn(b - a);
^***^
Error in the called contract (0x049c085e55e5ab05ea46e16706720852421e86c1f8aeeab2be257313c4e290f4):
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/utils/utils.cairo:352:26: Error at pc=0:2671:
tempvar loaded = [ptr - 1];
^*******^
Couldn't compute operand op1. Unknown value for memory cell 39:1
Cairo traceback (most recent call last):
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:647:16
return run(ctx=ctx);
^**********^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions.cairo:640:31
let ctx = CallHelper.finalize_calling_context(ctx);
^**************************************^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/instructions/system_operations.cairo:593:22
let memory = Memory.store_n(
^*************^
/Users/jmsb/exps/internet-computers/starknet/kakarot-rpc/lib/kakarot/src/kakarot/memory.cairo:189:19
let x_i = Helpers.load_word(16 - offset_in_chunk_i, element);
import json
from scripts.utils.starknet import get_artifact
from starkware.cairo.lang.compiler.program import Program
from starkware.cairo.lang.vm.reconstruct_traceback import reconstruct_traceback
kakarot_program = Program.load(
data=json.loads(get_artifact("kakarot").read_text())["program"]
)
# Just copy/paste the whole stack, just shorten in the snippet for clarity
error_message = """
Error in the called contract (0x04e2460d0debdacdde372cb598b4e4403939ca112c8720e1c2aca13f6ac09b9a):
Error at pc=0:7:
Got an exception while executing a hint.
Cairo traceback (most recent call last):
Unknown location (pc=0:163)
Unknown location (pc=0:149)
Error in the called contract (0x04e2460d0debdacdde372cb598b4e4403939ca112c8720e1c2aca13f6ac09b9a):
Error at pc=0:31:
Got an exception while executing a hint.
Cairo traceback (most recent call last):
Unknown location (pc=0:4606)
Unknown location (pc=0:4545)
Unknown location (pc=0:4374)
Unknown location (pc=0:376)
Error in the called contract (0x049c085e55e5ab05ea46e16706720852421e86c1f8aeeab2be257313c4e290f4):
Error at pc=0:2671:
Couldn't compute operand op1. Unknown value for memory cell 39:1
Cairo traceback (most recent call last):
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18120)
Unknown location (pc=0:18091)
Unknown location (pc=0:16584)
Unknown location (pc=0:3321)
"""
print(reconstruct_traceback(kakarot_program, error_message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment