Skip to content

Instantly share code, notes, and snippets.

Rust Compiler/Systems Engineer @ powdr labs

powdr is a language and compiler framework designed to aid development of zkVMs and ZK proof generation. It consists of a modular stack with an architecture that is agnostic to both frontend languages and backend ZK proof systems. powdr is fully FOSS and built in the open.

For more information, see the docs and source code.

Application

Please email CV, Github, or any relevant info to [email protected].

ZK/Cryptography Engineer @ powdr labs

powdr is a language and compiler framework designed to aid development of zkVMs and ZK proof generation. It consists of a modular stack with an architecture that is agnostic to both frontend languages and backend ZK proof systems. powdr is fully FOSS and built in the open.

For more information, see the docs and source code.

Application

Please email CV, Github, or any relevant info to [email protected].

use std::binary::Binary;
use std::shift::Shift;
machine Main {
Binary binary;
Shift shift;
degree 1048576;
reg pc[@pc];
reg X[<=];
struct State {
field pc;
field A;
}
struct Witness {
field X;
field reg_write_X_A;
field instr_ASSERT_IS_ZERO_A;
field X_const;
// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
(set-logic HORN)
(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int))))))
(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int)))))
(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.difficulty| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int)))))
(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int)))))
(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int))))))
(declare-datatypes ((|uint_array_tuple| 0)) (((|uint_array_tuple| (|u
{
/// @src 0:0:261 "contract Token {..."
mstore(64, memoryguard(128))
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0xa9059cbb
function factorial_Yul_For(uint256 x) public pure returns(uint256){
assembly{
let result := 1
for {} iszero(iszero(x)) { x := sub(x, 1)} {
result := mul(result, x)
}
mstore(0,result)
return(0,0x20)
}
}
def main(_0, _9) -> (1):
# _1, _2, _3, _4, _5, _6, _7, _8 = Bits(8)((1 * ~one) * (1 * _0))
(1 * _1) * (1 * _1) == 1 * _1
(1 * _2) * (1 * _2) == 1 * _2
(1 * _3) * (1 * _3) == 1 * _3
(1 * _4) * (1 * _4) == 1 * _4
(1 * _5) * (1 * _5) == 1 * _5
(1 * _6) * (1 * _6) == 1 * _6
(1 * _7) * (1 * _7) == 1 * _7
(1 * _8) * (1 * _8) == 1 * _8
(declare-const |~prime| Int)
(declare-const |~one| Int)
(declare-const x Int)
(declare-const b1 Int)
(declare-const b2 Int)
(declare-const b3 Int)
(declare-const b4 Int)
(declare-const b5 Int)