- mock lifetimes mess, implicit casting everywhere
- Fn is somewhat limited, no unsafes
- Common fn for all fn arg counts - fn {} to fn casting is only implicit or fully explicit with all arg types - ergonomics killer, also it breaks if fn is not explicitly requested (but trait is or something). Can't impl anything for fn{}
- Blanket impls - impl MockUnsafe for Mock conflicts with any impl Mock
- https://www.drips.network/app/drip-lists/30178668158349445547603108732480118476541651095408979232800331391215?ethereum_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d&optimism_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d&filecoin_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d&zksync_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38dðereum_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d&optimism_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d&filecoin_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d&zksync_owned_by=0x341a08926dCa7fa7D135F96E4d76b696e5f6d38d
- https://bb.com
- https://cc.com
- https://dd.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function length(elem) | |
return pandoc.text.len(pandoc.utils.stringify(elem)) | |
end | |
function insert(doc, inserted, idx, before) | |
idx = idx or -1 | |
local total_length = length(doc) | |
if(idx < 0) then | |
idx = idx + 1 + total_length | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @notice Creates a contract under a deterministic addresses | |
/// derived only from the deployer's address and the salt. | |
/// The deployment is a two-step process, first, a proxy is deployed using CREATE2 with | |
/// the given salt, and then it's called with the bytecode of the deployed contract, | |
/// the proxy uses it to deploy the contract using regular CREATE. | |
/// If the deployed contract's constructor reverts, the proxy also reverts and bubbles the error. | |
/// If the proxy call has a non-zero value, it's passed to the deployed contract's constructor. | |
/// A deployment can be made either by a contract or an EOA, and over multiple transactions, | |
/// because the proxy only accepts being called by its deployer, so there's no risk of frontrunning. | |
/// Each proxy can be used only once, so it's guaranteed to only deploy the contract using nonce 1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.7.6; | |
contract Bench { | |
uint256 public data; | |
function increment() public { | |
uint256 gasUsed = gasleft(); | |
uint256 dataLocal = data; | |
gasUsed -= gasleft(); | |
dataLocal += gasUsed; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
unsafe { | |
mock_0(main, Safe); | |
mock_unsafe_0(main, Safe); | |
mock_1(foo, SafeB); | |
mock_unsafe_1(foo, SafeB); | |
mock_1(foo, || {static RES: bool = true; MockResult::Return(&RES)}); | |
mock_unsafe_1(foo, || {static RES: bool = true; MockResult::Return(&RES)}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
unsafe { | |
Bar.mock_unsafe(foo); | |
// Bar.mock_unsafe(foo_no); // MUST FAIL | |
BarNo.mock_unsafe(foo); | |
BarNo.mock_unsafe(foo_no); | |
} | |
// Bar.mock(foo); // MUST FAIL | |
// Bar.mock_unsafe(foo_no); // MUST FAIL | |
BarNo.mock(foo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: "3.0.2" | |
info: | |
title: Generic blockchain node REST API | |
version: 0.0.1 | |
paths: | |
/v0/tip: | |
description: Get block ID of the chain tip | |
get: | |
responses: | |
200: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![cfg_attr(test, feature(proc_macro, proc_macro_mod))] | |
#[cfg(test)] | |
extern crate mocktopus; | |
#[cfg(test)] | |
use mocktopus::macros::*; | |
#[cfg(test)] | |
use mocktopus::mocking::*; | |
pub struct Node<'a>(Option<&'a Node<'a>>); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![cfg_attr(test, feature(proc_macro, proc_macro_mod))] | |
#[cfg(test)] // It's needed only for test runs | |
extern crate mocktopus; | |
#[cfg(test)] | |
mod tests { | |
use mocktopus::macros::*; // Lack of that line was crashing your code :) | |
use mocktopus::mocking::*; | |
// annotating a struct does nothing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUSTFLAGS='--pretty expanded -Z unstable-options' cargo build |
NewerOlder