Skip to content

Instantly share code, notes, and snippets.

View 0xNonCents's full-sized avatar

Non 0xNonCents

View GitHub Profile
@0xNonCents
0xNonCents / gist:68238374226ada243e92382bc47b93cc
Last active December 20, 2021 03:29
ClientConnectorCertificateError when trying to deploy a StarkNet contract

ClientConnectorCertificateError when trying to deploy a StarkNet contract

When deploying the contract with the command

starknet deploy --contract contract_compiled.json --network=alpha-goerli

and you run into the error

Error: ClientConnectorCertificateError: Cannot connect to host alpha4.starknet.io:443 ssl:True 
@0xNonCents
0xNonCents / .cairo
Last active February 18, 2022 08:19
Cairo vector
# @title The beginnings of Vector in Cairo
# @author 0xNonCents
# @notice Please let me know if this will save on gas compared to a @storage array
# MIT License
%builtins pedersen range_check
from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.hash import hash2
from starkware.cairo.common.cairo_builtins import HashBuiltin
@0xNonCents
0xNonCents / gist:063a0a4bd56083947e3a1b3689fc451f
Created April 3, 2022 14:47
Error when running make on pairing_benchmark() in alt_bn_example.cairo
(cairo_venv) (base) nonCents> make ~/dev/starknet/cairo-alt_bn128
Compiling..
Running..
prime 3618502788666131213697322783095070105623107215331596699973092056135872020481
prime 3618502788666131213697322783095070105623107215331596699973092056135872020481
prime 3618502788666131213697322783095070105623107215331596699973092056135872020481
/Users/dev/starknet/cairo-alt_bn128/bigint.cairo:60:5: Error at pc=0:19:
Value 3618502788666131213697322783095070105320111452007718569787670432089873896748, in range check builtin 12, is out of range [0, 340282366920938463463374607431768211456).
assert [range_check_ptr] = MAX_SUM - (res.d0 + res.d1 + res.d2)
^*************************************************************^
@0xNonCents
0xNonCents / run_cairo_wo_step_limit.py
Created June 1, 2022 21:38
Running Cairo Tests without step limit and allowing hints
import asyncio
import os
import pytest
from starkware.starknet.testing.starknet import Starknet
from starkware.starknet.compiler.compile import compile_starknet_files
from starkware.starknet.definitions.general_config import build_general_config, default_general_config
CONTRACT = os.path.join("contracts", "contract_name.cairo")
@pytest.fixture(scope="module")
for file in lib/*
do
cairo-migrate -i "$file"
done
for file in contracts/*
do
cairo-migrate -i "$file"
done
Error: nonce has already been used [ See: https://links.ethers.org/v5-errors-NONCE_EXPIRED ] (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":74946,\"error\":{\"code\":-32000,\"message\":\"nonce too low: address 0xCf5BF9F46FAb2F8EFC9e4118AAEDeBDF44092536, tx: 54 state: 55\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0x02f9037483066eed3684077359408407735940839896809457f7a8aa8291a04b325f3f0d2c4d03353d3ef25f80b903048beb33280000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f227873abf28cf0e50732cefd31f0d0a6f9d761c000000000000000000000000574ab6dc4b09ccbeb9445a095dac94007dbb781f000000000000000000000000cf5bf9f46fab2f8efc9e4118aaedebdf440925360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000009e9daa0c80000000000000000000000000000000000000000000000000
Error: nonce has already been used [ See: https://links.ethers.org/v5-errors-NONCE_EXPIRED ] (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":74946,\"error\":{\"code\":-32000,\"message\":\"nonce too low: address 0xCf5BF9F46FAb2F8EFC9e4118AAEDeBDF44092536, tx: 54 state: 55\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0x02f9037483066eed3684077359408407735940839896809457f7a8aa8291a04b325f3f0d2c4d03353d3ef25f80b903048beb33280000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f227873abf28cf0e50732cefd31f0d0a6f9d761c000000000000000000000000574ab6dc4b09ccbeb9445a095dac94007dbb781f000000000000000000000000cf5bf9f46fab2f8efc9e4118aaedebdf440925360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002900000000000000000000000000000000000000000000000000009e9daa0c80000000000000000000000000000000000000000000000000
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0xCf5BF9F46FAb2F8EFC9e4118AAEDeBDF44092536","to":"0x5b8bB80f2d72D0C85caB8fB169e8170A05C94bAF","data":"0x84efbaa10000000000000000000000000000000000000000000000000000000000000001","accessList":null}, error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":47,\"error\":{\"code\":3,\"message\":\"execution reverted\",\"data\":\"0x4e487b710000000000000000000000000000000000000000000000000000000000000011\"}}","error":{"code":3,"data":"0x4e487b710000000000000000000000000000000000000000000000000000000000000011"},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xcf5bf9f46fab2f8efc9e4118aaedebdf44092536\",\"to\":\"0x5b8bb80f2d72d0c85cab8fb169e8170a05c94baf\",\"data\":\"0x84efbaa1000000000000000000000000000000000000000000000000000000000
// Create your own language definition here
// You can safely look at other samples without losing modifications.
// Modifications are not saved on browser refresh/close though -- copy often!
return {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',
variables: [
`SelfX`,
"SelfY",
{
"0": 120,
"1": 1,
"2": 0,
"3": 0,
"4": 1,
"5": 0,
"6": 0,
"7": 4,
"8": 1,