Skip to content

Instantly share code, notes, and snippets.

@jwasinger
jwasinger / gist:9e38c1c4d52ac0910bf5a0db64883f3d
Created May 21, 2020 10:20
evm384 f6m mul synth loop v2 evm bytecode
597fabaafffffffffeb9ffff53b1feffab1e24f6b0f6a0d23067bf1285f3844b776481527fd7ac4b43b6a71b4b9ae67f39ea11011a000000000000000000000000000000006020820152604081017f8f2990f3e598f5b1b8f480a3c388306bc023fac151c0104d13ec3aa18159940281527f72d1c8c528a1ce3bcaa280a8e735aa0d0000000000000000000000000000000060608301527f992d7a27906d4cd530b23a7e8c48c0778f8653fbc3332d63db24339d8bc65d7e60808301527fe83b6e91c6550f5aceab102e88e918090000000000000000000000000000000060a08301527f7299907146816f08c4c6a394e91374ed6ff3618a57358cfb124ee6ab4c560e5c60c08301527fac40700b41e2ee8674680728f0c5a6180000000000000000000000000000000060e08301527f0fd77f62b39eb952a0f8d21cec1f93b1d62dd7923aa86882ddf7dd4d3532b0b76101008301527fede8f3fc89fa4a79574067e2d9a9d200000000000000000000000000000000006101208301527f7a69de46b13d8cb4c4833224aaf9ef7ea6a48975ab35c6e123b8539ab84c381a6101408301527f2533401a73c4e79f47d714899d01ac130000000000000000000000000000000061016083015261018082017fa9fa0b0d8156c36a1a9ddacb73ef278f4d149b560e88789f2bfeb9f708b6cc2f81527f988927bfe0186d5bf9cb40cb
debug_printMemHex mem_pos: 288 284544
81f9ab902854e25b9885fd18eedded158d323cd1db63aac85667c846d7b32b2cd8f5fc6051a82f5ad57c039da951ed13d3b0186a84d65f84b496962eb845bf44b964a6dd009f7a9c7b5b31c8838bf7ad0c82c8568e5cba769a9865ef8ee6cc1393f29468d61bae4ee78df89e052fd93155a152b851f91c04e29820e971b2756faea7bb1d8cf88726fd98f26f1e55351464189369f3e2d094567d7159784b51602eaed4b93a96c7eaabdb17e21bc0f4b621ab0d9e6c704a29d07c16f10aa83b1829366951d266201e3461e4c8be6f97735790d8176b661ab62e24ca23a18989ad0b933264a916e4da9b1e8e3ceb7ddf13fc60e840573d9d79559e0c8d1f05e17459fe91066b901c99a515eb21ddfc359590d6ab7ebaec0e58a1d2fbaf0ff5a809
debug_memHex done
debug_printMemHex mem_pos: 288 284832
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008fc2328a6235e95c18abc18596f98a84839e593b9938c3e6ff7e206969e887754424c422d3bfc4dfa3a8f7bb06133119faf9234941983eb86272ccd6aaecab023b073792337fe67897873ade3ea4c5c54
@jwasinger
jwasinger / gist:5c0a292b94e29abb71dc6cadf24192e8
Created May 7, 2020 01:59
Yul stack check (possible) bug
code {
function memcpy_384(dst, src)
{
let hi := mload(src)
let lo := mload(add(src, 32))
mstore(dst, hi)
mstore(add(dst, 32), lo)
}
function f2m_add(x_0, x_1, y_0, y_1, r_0, r_1, modulus)
{
function f6m_mul(x_offset, y_offset, ret_offset, mod_offset, inv_offset) {
/*
f6m_mul pseudocode:
a = x_offset[0]
b = x_offset[1]
A = y_offset[0]
B = y_offset[1]
aA = a * A
bB = b * B
{
function addmod384(x_offset, y_offset, mod_offset) {
/* stub for future evm opcode */
}
function submod384(x_offset, y_offset, mod_offset) {
/* stub for future evm opcode */
}
function mulmodmont384(x_offset, y_offset, mod_offset, inv_offset) {
//
// 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 OR IN CONNECTION WITH THE SOFTW
FROM ubuntu:19.04
# System deps
RUN apt-get clean
RUN apt-get update
RUN apt-get install -y software-properties-common git sudo build-essential wget curl nano \
autoconf automake libtool make ninja-build unzip zlib1g-dev texinfo libssl-dev
RUN sudo apt-get clean autoclean
RUN sudo apt-get autoremove -y
template MiMCFeistel(nrounds) {
signal input xL_in;
signal input xR_in;
signal input k;
signal output xL_out;
signal output xR_out;
signal output t[nrounds];
// doesn't contain the first and last round constants, which are always zero
@jwasinger
jwasinger / instructions.md
Created May 3, 2019 23:31
Instructions to reproduce Solidity test failures when using truffle example with Geth
@jwasinger
jwasinger / instructions.md
Last active April 30, 2019 22:42
Instructions to Reproduce Truffle bug with Geth