For montgomery squaring
const SAMPLES: usize = 10000;
for i in 1..(2 * N) {
r[2 * N - i] = (r[2 * N - i] << 1) | (r[2 * N - (i + 1)] >> 63);
}
mod miden_note_transport_client { | |
pub trait NoteTransportClient { | |
/// Send a serialized, encrypted note to the receiver `AccountId` | |
fn send_note(&self, note: Note, account_id: AccountId) -> Result<(), Error>; | |
/// Convenience method that constructs the tag from the account ID and fetches the notes by this tag. | |
/// Fetches all the notes addressed to a given account, decrypt them and import them into the client | |
/// Fails if the decryption key associated with `account_id` is missing from client's encryption store. | |
fn fetch_notes(&self, client: &mut Client, account_id: AccountId) -> Result<Vec<Note>, Error>; | |
/// Fetch all the notes with a given tag. Allows more customization than `fetch_notes`. | |
fn fetch_notes_by_tag(&self, client: &mut Client, tag: NoteTag, account_id: AccountId) -> Result<Vec<Note>, Error>; |
#!/bin/bash | |
diff=$(cargo fmt -- --check) | |
result=$? | |
if [[ ${result} -ne 0 ]] ; then | |
cat <<\EOF | |
There are some code style issues, run `cargo fmt` first. | |
EOF | |
exit 1 |
field_modulus = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787 | |
desired_curve_order = 52435875175126190479447740508185965837690552500527637822603658699938581184513 | |
x = -0xd201000000010000 | |
Fp = GF(field_modulus) | |
Fr = GF(desired_curve_order) | |
X = Fp(x) | |
PARAM_A4 = 0 |
# Finding the generators of G1 & G2 of a curve isogenous to BLS12-381, which has non-zero A, B coefficients in Short Weierstrass form. | |
# Script adapted from https://github.com/zkcrypto/bls12_381/blob/main/src/notes/design.rs | |
# Below are some links to the IETF draft where the isogeny is defined. | |
param = -0xd201000000010000 | |
def r(x): | |
return (x**4) - (x**2) + 1 | |
def q(x): | |
return (((x - 1) ** 2) * ((x**4) - (x**2) + 1) // 3) + x |
from web3 import Web3, HTTPProvider, Account | |
from zksync_sdk import ZkSyncProviderV01, HttpJsonRPCTransport, network, ZkSync, EthereumProvider, Wallet, ZkSyncSigner, EthereumSignerWeb3, ZkSyncLibrary | |
import asyncio | |
from zksync_sdk.types import ChainId | |
from dataclasses import dataclass | |
@dataclass | |
class Network: | |
zksync_url: str |
function [ output_args ] = saveFigure( handle, fileName ) | |
% saveFigure | |
% Saves figure specified by `handle` as `fileName` in fullscreen | |
% as to get around the stupid behavior. | |
screen_size = get(0, 'ScreenSize'); | |
origSize = get(handle, 'Position'); % grab original on screen size | |
set(handle, 'Position', [0 0 screen_size(3) screen_size(4) ] ); %set to scren size | |
set(handle,'PaperPositionMode','auto') %set paper pos for printing | |
saveas(handle, fileName) % save figure |