Skip to content

Instantly share code, notes, and snippets.

View ben-chain's full-sized avatar

Ben Jones ben-chain

View GitHub Profile
Name Effect Description Difficulty
Snap sync, partial syncing 30% reduction in hardware requirements Improve sync time by snap syncing and partially syncing. 2
Basket of EVM improvements 50% reduction in hardware requirements - https://github.com/ledgerwatch/erigon/wiki/TEVM---Transpiled-EVM:-accelerate-EVM-improvement-R&D,-but-learning-from-eWASM - https://github.com/ethereum/evmone - https://eips.ethereum.org/EIPS/eip-2929 5
16 core, 32 vthread EVM parallelism 32x reduction in hardware requirements Require all transactions in a block to have non-intersecting access lists. Scale gas_limit * n where n is the number of cores available to a verifier. 3
Name Effect Difficulty
eth2 phase 1 initial rollout 95% L1 gas cost reduction 15
Later phases...... Who knows! Who knows!
Name Effect Difficulty
Zero byte transaction compression 10% L1 gas cost reduction and 2% L2 gas cost increase 1
Lookup table compression 15% L1 gas cost reduction and 2% L1 gas cost increase 2
Aggregate Transactions 20% L1 gas cost reduction and 1% L1 gas cost increase 2
@ben-chain
ben-chain / example-smock.js
Created December 19, 2020 03:11
Example usage of the smock Hardhat plugin
import { ethers } from 'hardhat'
import { smockit } from '@eth-optimism/smock'
const MyContractFactory = await ethers.getContractFactory('MyContract')
// Smockit!
const MyMockContract = await smockit(MyContractFactory)
MyMockContract.myFunction.will.return.with('Some return value!')
console.log(await MyMockContract.myFunction()) // 'Some return value!'
pragma solidity >=0.4.22 <0.6.0;
contract SimpleConstants {
bytes32 public constant A = 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
bytes public constant B = hex"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
bytes public constant C = hex"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC";
function getA() public pure returns(bytes32) {
return(A);
}
@ben-chain
ben-chain / ownership-predicate.py
Last active March 22, 2019 19:51
Basic Ownership Predicate for Python Simulation
class OwnershipDeprecationWitness:
def __init__(self, next_state_update, signature, inclusion_witness):
self.next_state_update = next_state_update
self.signature = signature
self.inclusion_witness = inclusion_witness
class OwnershipPredicate:
def __init__(self, parent_plasma_contract):
self.parent = parent_plasma_contract
@ben-chain
ben-chain / ownership-predicate.py
Last active March 20, 2019 21:21
Python Reference Ownership Predicate
class OwnershipRevocationWitness:
def __init__(self, next_state_commitment, signature, inclusion_witness):
self.next_state_commitment = next_state_commitment
self.signature = signature
self.inclusion_witness = inclusion_witness
class OwnershipPredicate:
dispute_duration = 10
def __init__(self, parent_settlement_contract):
public function canClaim(commitment: commitment, claimabilityWitness: bytes):
return tx.sender == commitment.state.parameters.owner
public function claimRedeemed(redeemedClaim: claim):
#length of sequential stateIDs claimed = start - end
redeemedAmount: uint = redeemedClaim.end - redeemedClaim.start
ERC20.transferFrom(self.address, redeemedClaim.state.owner, redeemedAmount)
public isRevoked(stateID: uint, commitment: commitment, revocationWitness: bytes):
assert wasCommitted(
... revocationWitness.newCommitment, revocationWitness.newCommitmentWitness)
assert verifySignature(
... revocationWitness.newCommitment) = commitment.state.owner