L2 — Deep Dive into OVM

commit ca1fede6c8cb9e4eacd8205c1d53284d0c8debdc
Author: Mark Tyneway <mark.tyneway@gmail.com>
Date: Fri Oct 30 12:14:50 2020 -0700

deploy: use layer 2 chainid (#42)
function run(
Lib_OVMCodec.Transaction memory _transaction,
address _ovmStateManager
)
function isBytecodeSafe(
bytes memory _bytecode
)
override
external
pure
returns (bool)
{
function initializeFraudVerification(
bytes32 _preStateRoot,
Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,
Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,
Lib_OVMCodec.Transaction memory _transaction,
Lib_OVMCodec.TransactionChainElement memory _txChainElement,
Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader,
Lib_OVMCodec.ChainInclusionProof memory _transactionProof
)
require(
ovmStateCommitmentChain.verifyStateCommitment(
_preStateRoot,
_preStateRootBatchHeader,
_preStateRootProof
),
"Invalid pre-state root inclusion proof."
);
require(
ovmCanonicalTransactionChain.verifyTransaction(
_transaction,
_txChainElement,
_transactionBatchHeader,
_transactionProof
),
"Invalid transaction inclusion proof."
);
transitioners[_preStateRoot] = iOVM_StateTransitionerFactory(
resolve("OVM_StateTransitionerFactory")
).create(
address(libAddressManager),
_preStateRootProof.index,
_preStateRoot,
Lib_OVMCodec.hashTransaction(_transaction)
);
function finalizeFraudVerification(
bytes32 _preStateRoot,
Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,
Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,
bytes32 _postStateRoot,
Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,
Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof
)
require(
ovmStateCommitmentChain.verifyStateCommitment(
_preStateRoot,
_preStateRootBatchHeader,
_preStateRootProof
),
"Invalid pre-state root inclusion proof."
);
require(
ovmStateCommitmentChain.verifyStateCommitment(
_postStateRoot,
_postStateRootBatchHeader,
_postStateRootProof
),
"Invalid post-state root inclusion proof."
);
require(
_postStateRootProof.index == _preStateRootProof.index + 1,
"Invalid post-state root index."
);
require(
_postStateRoot != transitioner.getPostStateRoot(),
"State transition has not been proven fraudulent."
);
ovmStateCommitmentChain.deleteStateBatch(
_postStateRootBatchHeader
);
ovmBondManager.finalize(
_preStateRoot,
_postStateRootBatchHeader.batchIndex,
publisher,
timestamp
);
/// The dispute period
uint256 public constant disputePeriodSeconds = 7 days;

--

--

--

Founder of Trapdoor Tech (Blockchain & zk-SNARK solution provider) — www.trapdoortech.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ferrum Network bounty latest update

Keeping Customer Data Safe and Secure on the Shopify eCommerce Platform

The Future Is Now: Matt Karasiewicz of Sentivate On How Their Technological Innovation Will Shake…

{UPDATE} Clara and Hippo Hack Free Resources Generator

SIM Swap fraud can cost you millions and a damaged credit score

Playfair Cipher Decryption

Photo by iMattSmart on Unsplash

1 in 3 automotive cyber incidents result in car theft or break-ins

December DROP 💧 Hiring, Bounty, Telegram, 5 Live Pools

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Star LI

Star LI

Founder of Trapdoor Tech (Blockchain & zk-SNARK solution provider) — www.trapdoortech.com

More from Medium

Provable vs. Composable Computation or why Cairo will supersede Solidity

Ethereum wallets today and tomorrow — EIP-3074 vs ERC-4337

Sin7Y Tech Review (19): Design Concept and Applications of Custom Gate

Zero Knowledge Proof — Deep into zkEVM source code (State Circuit)