Commit a4340e51 authored by Kelvin Fichter's avatar Kelvin Fichter Committed by GitHub

Added fix for error in StateTransitioner (#13)

* Added fix for error in StateTransitioner

* Added tests for some precompiles (#14)

* Added tests for some precompiles

* Cleanup build process (#15)

* Cleaned build and added typechain

* Linted files
parent e7196c18
......@@ -7,6 +7,7 @@ import {
usePlugin('@nomiclabs/buidler-ethers')
usePlugin('@nomiclabs/buidler-waffle')
usePlugin('buidler-typechain')
import '@eth-optimism/smock/build/src/buidler-plugins/compiler-storage-layout'
......@@ -24,6 +25,10 @@ const config: BuidlerConfig = {
version: '0.7.0',
optimizer: { enabled: true, runs: 200 },
},
typechain: {
outDir: 'build/types',
target: 'ethers-v5',
},
}
export default config
......@@ -143,6 +143,7 @@ contract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, OVM_BaseCros
L2MessageInclusionProof memory _proof
)
internal
view
returns (
bool
)
......@@ -162,6 +163,7 @@ contract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, OVM_BaseCros
L2MessageInclusionProof memory _proof
)
internal
view
returns (
bool
)
......@@ -187,6 +189,7 @@ contract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, OVM_BaseCros
L2MessageInclusionProof memory _proof
)
internal
pure
returns (
bool
)
......
......@@ -204,7 +204,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
"Must append more than zero transactions."
);
(uint40 totalElements, uint32 nextQueueIndex) = _getLatestBatchContext();
(, uint32 nextQueueIndex) = _getLatestBatchContext();
bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);
for (uint i = 0; i < _numQueuedTransactions; i++) {
......@@ -424,7 +424,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
uint32 _nextQueueIndex
)
internal
view
pure
returns (
bytes28 _context
)
......@@ -512,6 +512,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, OVM_Ba
uint32 _nextQueueIndex
)
internal
view
{
if (queue.getLength() == 0) {
return;
......
......@@ -1319,6 +1319,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
bytes memory _data
)
internal
view
returns (
bytes memory _revertdata
)
......@@ -1362,6 +1363,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
bytes memory _revertdata
)
internal
pure
returns (
RevertFlag _flag,
uint256 _nuisanceGasLeft,
......
......@@ -22,7 +22,7 @@ contract OVM_SafetyChecker is iOVM_SafetyChecker {
)
override
external
view
pure
returns (bool)
{
// autogenerated by gen_safety_checker_constants.py
......
......@@ -20,6 +20,7 @@ contract OVM_L1MessageSender is iOVM_L1MessageSender {
function getL1MessageSender()
override
public
view
returns (
address _l1MessageSender
)
......
......@@ -332,12 +332,10 @@ contract OVM_StateTransitioner is iOVM_StateTransitioner, Lib_AddressResolver {
/**
* Allows a user to commit the final state of a contract.
* @param _ovmContractAddress Address of the contract on the OVM.
* @param _account Claimed account state.
* @param _stateTrieWitness Proof of the account state.
*/
function commitContractState(
address _ovmContractAddress,
Lib_OVMCodec.EVMAccount memory _account,
bytes memory _stateTrieWitness
)
override
......@@ -349,9 +347,13 @@ contract OVM_StateTransitioner is iOVM_StateTransitioner, Lib_AddressResolver {
"Account was not changed or has already been committed."
);
Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);
postStateRoot = Lib_SecureMerkleTrie.update(
abi.encodePacked(_ovmContractAddress),
Lib_OVMCodec.encodeEVMAccount(_account),
Lib_OVMCodec.encodeEVMAccount(
Lib_OVMCodec.toEVMAccount(account)
),
_stateTrieWitness,
postStateRoot
);
......@@ -361,14 +363,12 @@ contract OVM_StateTransitioner is iOVM_StateTransitioner, Lib_AddressResolver {
* Allows a user to commit the final state of a contract storage slot.
* @param _ovmContractAddress Address of the contract on the OVM.
* @param _key Claimed account slot key.
* @param _value Claimed account slot value.
* @param _stateTrieWitness Proof of the account state.
* @param _storageTrieWitness Proof of the storage slot.
*/
function commitStorageSlot(
address _ovmContractAddress,
bytes32 _key,
bytes32 _value,
bytes memory _stateTrieWitness,
bytes memory _storageTrieWitness
)
......@@ -381,23 +381,26 @@ contract OVM_StateTransitioner is iOVM_StateTransitioner, Lib_AddressResolver {
"Storage slot was not changed or has already been committed."
);
Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.toEVMAccount(
ovmStateManager.getAccount(_ovmContractAddress)
);
Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);
bytes32 value = ovmStateManager.getContractStorage(_ovmContractAddress, _key);
account.storageRoot = Lib_SecureMerkleTrie.update(
abi.encodePacked(_key),
abi.encodePacked(_value),
abi.encodePacked(value),
_storageTrieWitness,
account.storageRoot
);
postStateRoot = Lib_SecureMerkleTrie.update(
abi.encodePacked(_ovmContractAddress),
Lib_OVMCodec.encodeEVMAccount(account),
Lib_OVMCodec.encodeEVMAccount(
Lib_OVMCodec.toEVMAccount(account)
),
_stateTrieWitness,
postStateRoot
);
ovmStateManager.putAccount(_ovmContractAddress, account);
}
......
......@@ -58,14 +58,12 @@ interface iOVM_StateTransitioner {
function commitContractState(
address _ovmContractAddress,
Lib_OVMCodec.EVMAccount calldata _account,
bytes calldata _stateTrieWitness
) external;
function commitStorageSlot(
address _ovmContractAddress,
bytes32 _key,
bytes32 _value,
bytes calldata _stateTrieWitness,
bytes calldata _storageTrieWitness
) external;
......
......@@ -25,9 +25,7 @@ contract Lib_AddressResolver {
*/
constructor(
address _libAddressManager
)
public
{
) {
libAddressManager = Lib_AddressManager(_libAddressManager);
}
......
......@@ -28,9 +28,7 @@ abstract contract Ownable {
* Constructor *
***************/
constructor()
internal
{
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
......
......@@ -79,7 +79,7 @@ library Lib_RLPReader {
{
(
uint256 listOffset,
uint256 listLength,
,
RLPItemType itemType
) = _decodeLength(_in);
......
......@@ -77,7 +77,7 @@ library Lib_MerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bool _verified
)
......@@ -108,7 +108,7 @@ library Lib_MerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bool _verified
)
......@@ -138,7 +138,7 @@ library Lib_MerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bytes32 _updatedRoot
)
......@@ -171,7 +171,7 @@ library Lib_MerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bool _exists,
bytes memory _value
......@@ -206,7 +206,7 @@ library Lib_MerkleTrie {
bytes memory _value
)
internal
view
pure
returns (
bytes32 _updatedRoot
)
......@@ -237,7 +237,7 @@ library Lib_MerkleTrie {
bytes32 _root
)
private
view
pure
returns (
uint256 _pathLength,
bytes memory _keyRemainder,
......@@ -358,7 +358,7 @@ library Lib_MerkleTrie {
bytes memory _value
)
private
view
pure
returns (
TrieNode[] memory _newPath
)
......@@ -484,7 +484,7 @@ library Lib_MerkleTrie {
bytes memory _key
)
private
view
pure
returns (
bytes32 _updatedRoot
)
......@@ -547,7 +547,7 @@ library Lib_MerkleTrie {
bytes memory _proof
)
private
view
pure
returns (
TrieNode[] memory _parsed
)
......@@ -577,7 +577,7 @@ library Lib_MerkleTrie {
Lib_RLPReader.RLPItem memory _node
)
private
view
pure
returns (
bytes32 _nodeID
)
......@@ -604,7 +604,7 @@ library Lib_MerkleTrie {
TrieNode memory _node
)
private
view
pure
returns (
bytes memory _path
)
......@@ -622,7 +622,7 @@ library Lib_MerkleTrie {
TrieNode memory _node
)
private
view
pure
returns (
bytes memory _key
)
......@@ -639,7 +639,7 @@ library Lib_MerkleTrie {
TrieNode memory _node
)
private
view
pure
returns (
bytes memory _value
)
......@@ -678,7 +678,7 @@ library Lib_MerkleTrie {
TrieNode memory _node
)
private
view
pure
returns (
NodeType _type
)
......@@ -711,7 +711,7 @@ library Lib_MerkleTrie {
bytes memory _b
)
private
view
pure
returns (
uint256 _shared
)
......@@ -732,7 +732,7 @@ library Lib_MerkleTrie {
bytes[] memory _raw
)
private
view
pure
returns (
TrieNode memory _node
)
......@@ -754,7 +754,7 @@ library Lib_MerkleTrie {
Lib_RLPReader.RLPItem[] memory _items
)
private
view
pure
returns (
TrieNode memory _node
)
......@@ -777,7 +777,7 @@ library Lib_MerkleTrie {
bytes memory _value
)
private
view
pure
returns (
TrieNode memory _node
)
......@@ -803,7 +803,7 @@ library Lib_MerkleTrie {
bytes memory _value
)
private
view
pure
returns (
TrieNode memory _node
)
......@@ -821,7 +821,7 @@ library Lib_MerkleTrie {
*/
function _makeEmptyBranchNode()
private
view
pure
returns (
TrieNode memory _node
)
......@@ -844,7 +844,7 @@ library Lib_MerkleTrie {
bytes memory _value
)
private
view
pure
returns (
TrieNode memory _updatedNode
)
......@@ -867,7 +867,7 @@ library Lib_MerkleTrie {
bytes memory _value
)
private
view
pure
returns (
TrieNode memory _updatedNode
)
......@@ -888,7 +888,7 @@ library Lib_MerkleTrie {
bool _isLeaf
)
private
view
pure
returns (
bytes memory _prefixedKey
)
......@@ -909,7 +909,7 @@ library Lib_MerkleTrie {
bytes memory _path
)
private
view
pure
returns (
bytes memory _unprefixedKey
)
......
......@@ -33,7 +33,7 @@ library Lib_SecureMerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bool _verified
)
......@@ -58,7 +58,7 @@ library Lib_SecureMerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bool _verified
)
......@@ -85,7 +85,7 @@ library Lib_SecureMerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bytes32 _updatedRoot
)
......@@ -108,7 +108,7 @@ library Lib_SecureMerkleTrie {
bytes32 _root
)
internal
view
pure
returns (
bool _exists,
bytes memory _value
......@@ -129,7 +129,7 @@ library Lib_SecureMerkleTrie {
bytes memory _value
)
internal
view
pure
returns (
bytes32 _updatedRoot
)
......
......@@ -145,7 +145,7 @@ library Lib_EthUtils {
uint256 _nonce
)
internal
view
pure
returns (
address _address
)
......@@ -171,7 +171,7 @@ library Lib_EthUtils {
bytes32 _salt
)
internal
view
pure
returns (address _address)
{
bytes32 hashedData = keccak256(abi.encodePacked(
......
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.0;
// author: cobaltedge
......
......@@ -10,7 +10,7 @@ library Lib_MerkleUtils {
bytes32[] memory _hashes
)
internal
view
pure
returns (
bytes32 _root
)
......
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.0;
import { Helper_SimpleProxy } from "./Helper_SimpleProxy.sol";
contract Helper_PrecompileCaller is Helper_SimpleProxy {
function callPrecompile(
address _precompile,
bytes memory _data
)
public
{
if (msg.sender == owner) {
makeExternalCall(_precompile, _data);
} else {
makeExternalCall(target, msg.data);
}
}
function getL1MessageSender(
address _precompile,
bytes memory _data
)
public
returns (
address
)
{
callPrecompile(_precompile, _data);
}
}
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.0;
import { console } from "@nomiclabs/buidler/console.sol";
contract Helper_SimpleProxy {
address private owner;
address private target;
address internal owner;
address internal target;
constructor() {
owner = msg.sender;
......@@ -31,7 +33,7 @@ contract Helper_SimpleProxy {
address _target,
bytes memory _calldata
)
private
internal
{
(bool success, bytes memory returndata) = _target.call(_calldata);
......
......@@ -137,6 +137,7 @@ contract Helper_TestRunner {
bytes memory _revertdata
)
internal
pure
returns (
uint256 _flag,
uint256 _nuisanceGasLeft,
......
......@@ -14,7 +14,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
bytes[] memory
)
......@@ -31,7 +31,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
string memory
)
......@@ -43,7 +43,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
bytes memory
)
......@@ -55,7 +55,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
bytes32
)
......@@ -67,7 +67,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
uint256
)
......@@ -79,7 +79,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
bool
)
......@@ -91,7 +91,7 @@ contract TestLib_RLPReader {
bytes memory _in
)
public
view
pure
returns (
address
)
......
......@@ -16,7 +16,7 @@ contract TestLib_MerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bool
)
......@@ -35,7 +35,7 @@ contract TestLib_MerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bool
)
......@@ -54,7 +54,7 @@ contract TestLib_MerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bytes32
)
......@@ -73,7 +73,7 @@ contract TestLib_MerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bool,
bytes memory
......@@ -91,7 +91,7 @@ contract TestLib_MerkleTrie {
bytes memory _value
)
public
view
pure
returns (
bytes32
)
......
......@@ -17,7 +17,7 @@ contract TestLib_SecureMerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bool
)
......@@ -36,7 +36,7 @@ contract TestLib_SecureMerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bool
)
......@@ -55,7 +55,7 @@ contract TestLib_SecureMerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bytes32
)
......@@ -74,7 +74,7 @@ contract TestLib_SecureMerkleTrie {
bytes32 _root
)
public
view
pure
returns (
bool,
bytes memory
......@@ -92,7 +92,7 @@ contract TestLib_SecureMerkleTrie {
bytes memory _value
)
public
view
pure
returns (
bytes32
)
......
......@@ -88,7 +88,7 @@ contract TestLib_EthUtils {
uint256 _nonce
)
public
view
pure
returns (
address _address
)
......@@ -105,7 +105,7 @@ contract TestLib_EthUtils {
bytes32 _salt
)
public
view
pure
returns (address _address)
{
return Lib_EthUtils.getAddressForCREATE2(
......
......@@ -17,9 +17,7 @@ contract TestLib_TimeboundRingBuffer {
uint32 _startingSize,
uint32 _maxSizeIncrementAmount,
uint _timeout
)
public
{
) {
list.init(_startingSize, _maxSizeIncrementAmount, _timeout);
}
......
......@@ -10,11 +10,12 @@
],
"license": "MIT",
"scripts": {
"build": "yarn run build:contracts && yarn run build:typescript && yarn run build:copy && yarn run build:dump",
"build:typescript": "tsc -p .",
"build": "yarn run build:contracts && yarn run build:typescript && yarn run build:copy && yarn run build:dump && yarn run build:typechain",
"build:typescript": "tsc -p tsconfig.prod.json",
"build:contracts": "buidler compile",
"build:dump": "ts-node \"bin/take-dump.ts\"",
"build:copy": "copyfiles -u 2 \"contracts/optimistic-ethereum/**/*.sol\" \"build/contracts\"",
"build:typechain": "buidler typechain",
"test": "yarn run test:contracts",
"test:contracts": "buidler test --show-stack-traces",
"lint": "yarn run lint:typescript",
......@@ -31,12 +32,14 @@
"@nomiclabs/buidler": "^1.4.4",
"@nomiclabs/buidler-ethers": "^2.0.0",
"@nomiclabs/buidler-waffle": "^2.0.0",
"@typechain/ethers-v5": "1.0.0",
"@types/chai": "^4.2.12",
"@types/lodash": "^4.14.161",
"@types/mocha": "^8.0.3",
"@types/node": "^14.6.0",
"assert": "^2.0.0",
"buffer-xor": "^2.0.2",
"buidler-typechain": "^0.2.1",
"chai": "^4.2.0",
"copyfiles": "^2.3.0",
"ethereum-waffle": "3.0.0",
......@@ -50,11 +53,13 @@
"random-bytes-seed": "^1.0.3",
"rlp": "^2.2.6",
"seedrandom": "^3.0.5",
"ts-generator": "0.0.8",
"ts-node": "^9.0.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-no-focused-test": "^0.5.0",
"tslint-plugin-prettier": "^2.3.0",
"typechain": "2.0.0",
"typescript": "^4.0.2"
}
}
......@@ -6,7 +6,7 @@ import { keccak256 } from 'ethers/lib/utils'
/* Internal Imports */
import { deploy, RollupDeployConfig } from './contract-deployment'
import { fromHexString, toHexString, remove0x } from '../test/helpers/utils'
import { fromHexString, toHexString, remove0x } from './utils'
import { getContractDefinition } from './contract-defs'
interface StorageDump {
......
export * from './buffer-utils'
export * from './byte-utils'
import { expect } from '../../../setup'
/* External Imports */
import { ethers } from '@nomiclabs/buidler'
import { ContractFactory, Contract } from 'ethers'
import { MockContract, smockit } from '@eth-optimism/smock'
import { NON_ZERO_ADDRESS } from '../../../helpers/constants'
const callPrecompileStatic = async (
Helper_PrecompileCaller: Contract,
precompile: Contract,
functionName: string,
functionParams?: any[]
): Promise<any> => {
return Helper_PrecompileCaller.callStatic[functionName](
precompile.address,
precompile.interface.encodeFunctionData(functionName, functionParams || [])
)
}
describe('OVM_L1MessageSender', () => {
let Mock__OVM_ExecutionManager: MockContract
before(async () => {
Mock__OVM_ExecutionManager = smockit(
await ethers.getContractFactory('OVM_ExecutionManager')
)
})
let Helper_PrecompileCaller: Contract
before(async () => {
Helper_PrecompileCaller = await (
await ethers.getContractFactory('Helper_PrecompileCaller')
).deploy()
Helper_PrecompileCaller.setTarget(Mock__OVM_ExecutionManager.address)
})
let Factory__OVM_L1MessageSender: ContractFactory
before(async () => {
Factory__OVM_L1MessageSender = await ethers.getContractFactory(
'OVM_L1MessageSender'
)
})
let OVM_L1MessageSender: Contract
beforeEach(async () => {
OVM_L1MessageSender = await Factory__OVM_L1MessageSender.deploy()
})
describe('getL1MessageSender', () => {
before(async () => {
Mock__OVM_ExecutionManager.smocked.ovmL1TXORIGIN.will.return.with(
NON_ZERO_ADDRESS
)
})
it('should return the L1 message sender', async () => {
expect(
await callPrecompileStatic(
Helper_PrecompileCaller,
OVM_L1MessageSender,
'getL1MessageSender'
)
).to.equal(NON_ZERO_ADDRESS)
})
})
})
import { expect } from '../../../setup'
/* External Imports */
import { ethers } from '@nomiclabs/buidler'
import { ContractFactory, Contract } from 'ethers'
import { MockContract, smockit } from '@eth-optimism/smock'
import { NON_ZERO_ADDRESS } from '../../../helpers/constants'
const ELEMENT_TEST_SIZES = [1, 2, 4, 8, 16]
const callPrecompile = async (
Helper_PrecompileCaller: Contract,
precompile: Contract,
functionName: string,
functionParams?: any[]
): Promise<any> => {
return Helper_PrecompileCaller.callPrecompile(
precompile.address,
precompile.interface.encodeFunctionData(functionName, functionParams || [])
)
}
describe('OVM_L2ToL1MessagePasser', () => {
let Mock__OVM_ExecutionManager: MockContract
before(async () => {
Mock__OVM_ExecutionManager = smockit(
await ethers.getContractFactory('OVM_ExecutionManager')
)
})
let Helper_PrecompileCaller: Contract
before(async () => {
Helper_PrecompileCaller = await (
await ethers.getContractFactory('Helper_PrecompileCaller')
).deploy()
Helper_PrecompileCaller.setTarget(Mock__OVM_ExecutionManager.address)
})
let Factory__OVM_L2ToL1MessagePasser: ContractFactory
before(async () => {
Factory__OVM_L2ToL1MessagePasser = await ethers.getContractFactory(
'OVM_L2ToL1MessagePasser'
)
})
let OVM_L2ToL1MessagePasser: Contract
beforeEach(async () => {
OVM_L2ToL1MessagePasser = await Factory__OVM_L2ToL1MessagePasser.deploy()
})
describe('passMessageToL1', () => {
before(async () => {
Mock__OVM_ExecutionManager.smocked.ovmCALLER.will.return.with(
NON_ZERO_ADDRESS
)
})
for (const size of ELEMENT_TEST_SIZES) {
it(`should be able to pass ${size} messages`, async () => {
for (let i = 0; i < size; i++) {
const message = '0x' + '12' + '34'.repeat(i)
await expect(
callPrecompile(
Helper_PrecompileCaller,
OVM_L2ToL1MessagePasser,
'passMessageToL1',
[message]
)
)
.to.emit(OVM_L2ToL1MessagePasser, 'L2ToL1Message')
.withArgs(i, NON_ZERO_ADDRESS, message)
}
})
}
})
})
......@@ -303,13 +303,16 @@ describe('OVM_StateTransitioner', () => {
let ovmContractAddress = NON_ZERO_ADDRESS
let account: any
beforeEach(() => {
Mock__OVM_StateManager.smocked.hasAccount.will.return.with(false)
account = {
nonce: 0,
balance: 0,
storageRoot: NULL_BYTES32,
codeHash: NULL_BYTES32,
ethAddress: ZERO_ADDRESS,
isFresh: false,
}
Mock__OVM_StateManager.smocked.hasAccount.will.return.with(false)
Mock__OVM_StateManager.smocked.getAccount.will.return.with(account)
})
describe('when the account was not changed or has already been committed', () => {
......@@ -319,11 +322,7 @@ describe('OVM_StateTransitioner', () => {
it('should revert', async () => {
await expect(
OVM_StateTransitioner.commitContractState(
ovmContractAddress,
account,
'0x'
)
OVM_StateTransitioner.commitContractState(ovmContractAddress, '0x')
).to.be.revertedWith(
'Account was not changed or has already been committed.'
)
......@@ -365,11 +364,7 @@ describe('OVM_StateTransitioner', () => {
it('should update the post state root', async () => {
await expect(
OVM_StateTransitioner.commitContractState(
ovmContractAddress,
account,
proof
)
OVM_StateTransitioner.commitContractState(ovmContractAddress, proof)
).to.not.be.reverted
expect(await OVM_StateTransitioner.getPostStateRoot()).to.equal(
......@@ -405,6 +400,8 @@ describe('OVM_StateTransitioner', () => {
ethAddress: ZERO_ADDRESS,
isFresh: false,
})
Mock__OVM_StateManager.smocked.getContractStorage.will.return.with(val)
})
describe('when the slot was not changed or was already committed', () => {
......@@ -419,7 +416,6 @@ describe('OVM_StateTransitioner', () => {
OVM_StateTransitioner.commitStorageSlot(
ovmContractAddress,
key,
val,
'0x',
'0x'
)
......@@ -497,7 +493,6 @@ describe('OVM_StateTransitioner', () => {
OVM_StateTransitioner.commitStorageSlot(
ovmContractAddress,
key,
newVal,
accountTrieProof,
storageTrieProof
)
......
export * from './buffer-utils'
export * from './byte-utils'
export * from '../../../src/utils'
export * from './eth-time'
......@@ -20,11 +20,13 @@
"node_modules/@types"
]
},
"include": ["src/**/*.ts", "artifacts/*.json"],
"files": [
"include": [
"src/**/*.ts",
"artifacts/*.json",
"./buidler.config.ts",
"./buidler-env.d.ts",
"./node_modules/@nomiclabs/buidler-ethers/src/type-extensions.d.ts",
"./node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts"
"./node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts",
"./node_modules/buidler-typechain/src/type-extensions.d.ts"
]
}
\ No newline at end of file
{
"extends": "./tsconfig",
"exclude": [
"./buidler.config.ts",
"./buidler-env.d.ts",
"./node_modules/@nomiclabs/buidler-ethers/src/type-extensions.d.ts",
"./node_modules/@nomiclabs/buidler-waffle/src/type-extensions.d.ts",
"./node_modules/buidler-typechain/src/type-extensions.d.ts"
]
}
......@@ -656,6 +656,13 @@
dependencies:
defer-to-connect "^1.0.1"
"@typechain/ethers-v5@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-1.0.0.tgz#9156c9a2b078f9bb00a339631221e42c26b218df"
integrity sha512-CWxLmlmfM7NMT6OSq8UXZM7mSkHU1xrbNi40Hvj26S97jKnwERmNbiERgy4fXXOdVqb+zCshnZQ9X+P5WndLMA==
dependencies:
ethers "^5.0.2"
"@types/abstract-leveldown@*":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@types/abstract-leveldown/-/abstract-leveldown-5.0.1.tgz#3c7750d0186b954c7f2d2f6acc8c3c7ba0c3412e"
......@@ -728,6 +735,18 @@
dependencies:
"@types/node" "*"
"@types/prettier@^1.13.2":
version "1.19.1"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.19.1.tgz#33509849f8e679e4add158959fdb086440e9553f"
integrity sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==
"@types/resolve@^0.0.8":
version "0.0.8"
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194"
integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==
dependencies:
"@types/node" "*"
"@types/secp256k1@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.1.tgz#fb3aa61a1848ad97d7425ff9dcba784549fca5a4"
......@@ -963,6 +982,20 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=
array-back@^1.0.3, array-back@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/array-back/-/array-back-1.0.4.tgz#644ba7f095f7ffcf7c43b5f0dc39d3c1f03c063b"
integrity sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=
dependencies:
typical "^2.6.0"
array-back@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/array-back/-/array-back-2.0.0.tgz#6877471d51ecc9c9bfa6136fb6c7d5fe69748022"
integrity sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==
dependencies:
typical "^2.6.1"
array-filter@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83"
......@@ -1910,6 +1943,11 @@ bufferutil@^4.0.1:
dependencies:
node-gyp-build "~3.7.0"
buidler-typechain@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/buidler-typechain/-/buidler-typechain-0.2.1.tgz#0ed5e8f982444be4d2fff7d6544fb40d7b18b60e"
integrity sha512-U/2xAPP0dVRwFcMZzdE6ckVXOhwXpagnEAdn/0auPZDW4eGI0CTjmC+/OXdo83aqVSkofQ/10QuHblN/Fcsz9A==
builtin-modules@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
......@@ -2037,7 +2075,7 @@ chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"
chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.2:
chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
......@@ -2228,6 +2266,15 @@ command-exists@^1.2.8:
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69"
integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==
command-line-args@^4.0.7:
version "4.0.7"
resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-4.0.7.tgz#f8d1916ecb90e9e121eda6428e41300bfb64cc46"
integrity sha512-aUdPvQRAyBvQd2n7jXcsMDz68ckBJELXNzBybCHOibUWEg0mWTnaYCSRU8h9R+aNRSvDihJtssSRCiDRpLaezA==
dependencies:
array-back "^2.0.0"
find-replace "^1.0.3"
typical "^2.6.1"
commander@3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e"
......@@ -3382,7 +3429,7 @@ ethers@5.0.0:
"@ethersproject/web" "^5.0.0"
"@ethersproject/wordlists" "^5.0.0"
ethers@^5, ethers@^5.0.0, ethers@^5.0.1:
ethers@^5, ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.2:
version "5.0.17"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.0.17.tgz#35dea41f1d09d31f80e0bb4c03cb633cd6673756"
integrity sha512-E0MrwCttHgdD6Irfa0B9cNdX0VoWVWLusaj51+EQalkl3pqhV2zGMPncfhYbc9+4nD2u81dbX8Pk9UN5kh/jew==
......@@ -3677,6 +3724,14 @@ finalhandler@~1.1.2:
statuses "~1.5.0"
unpipe "~1.0.0"
find-replace@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-1.0.3.tgz#b88e7364d2d9c959559f388c66670d6130441fa0"
integrity sha1-uI5zZNLZyVlVnziMZmcNYTBEH6A=
dependencies:
array-back "^1.0.4"
test-value "^2.1.0"
find-up@3.0.0, find-up@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73"
......@@ -3835,7 +3890,7 @@ fs-extra@^4.0.2, fs-extra@^4.0.3:
jsonfile "^4.0.0"
universalify "^0.1.0"
fs-extra@^7.0.1:
fs-extra@^7.0.0, fs-extra@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
......@@ -3998,7 +4053,7 @@ glob@7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@7.1.6, glob@^7.0.5, glob@^7.1.1, glob@^7.1.3, glob@~7.1.6:
glob@7.1.6, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@~7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
......@@ -6211,6 +6266,11 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
prettier@^1.14.2:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5"
......@@ -6637,7 +6697,7 @@ resolve-url@^0.2.1:
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
resolve@^1.10.0, resolve@^1.3.2, resolve@~1.17.0:
resolve@^1.10.0, resolve@^1.3.2, resolve@^1.8.1, resolve@~1.17.0:
version "1.17.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444"
integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==
......@@ -7367,6 +7427,14 @@ tar@^4.0.2:
safe-buffer "^5.1.2"
yallist "^3.0.3"
test-value@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/test-value/-/test-value-2.1.0.tgz#11da6ff670f3471a73b625ca4f3fdcf7bb748291"
integrity sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=
dependencies:
array-back "^1.0.3"
typical "^2.6.0"
testrpc@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/testrpc/-/testrpc-0.0.1.tgz#83e2195b1f5873aec7be1af8cbe6dcf39edb7aed"
......@@ -7476,11 +7544,36 @@ trim-right@^1.0.1:
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=
ts-essentials@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-1.0.4.tgz#ce3b5dade5f5d97cf69889c11bf7d2da8555b15a"
integrity sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ==
ts-essentials@^2.0.7:
version "2.0.12"
resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-2.0.12.tgz#c9303f3d74f75fa7528c3d49b80e089ab09d8745"
integrity sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w==
ts-essentials@^6.0.3:
version "6.0.7"
resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-6.0.7.tgz#5f4880911b7581a873783740ce8b94da163d18a6"
integrity sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==
ts-generator@0.0.8, ts-generator@^0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/ts-generator/-/ts-generator-0.0.8.tgz#7bd48ca064db026d9520bcb682b69efc20971d6a"
integrity sha512-Gi+aZCELpVL7Mqb+GuMgM+n8JZ/arZZib1iD/R9Ok8JDjOCOCrqS9b1lr72ku7J45WeDCFZxyJoRsiQvhokCnw==
dependencies:
"@types/mkdirp" "^0.5.2"
"@types/prettier" "^1.13.2"
"@types/resolve" "^0.0.8"
chalk "^2.4.1"
glob "^7.1.2"
mkdirp "^0.5.1"
prettier "^1.14.2"
resolve "^1.8.1"
ts-essentials "^1.0.0"
ts-node@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.0.0.tgz#e7699d2a110cc8c0d3b831715e417688683460b3"
......@@ -7597,6 +7690,19 @@ type@^2.0.0:
resolved "https://registry.yarnpkg.com/type/-/type-2.1.0.tgz#9bdc22c648cf8cf86dd23d32336a41cfb6475e3f"
integrity sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==
typechain@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/typechain/-/typechain-2.0.0.tgz#62143b48cdf8f95a777f1b76617af077b2d44eee"
integrity sha512-O+hsAUwtBpqCfoq46Grm52OEdm0GBEu78LxrEzkkGdwUdCoCZpNb2HPzPoNB1MXiRnNhEOGMFyf05UbT2/bUEw==
dependencies:
command-line-args "^4.0.7"
debug "^4.1.1"
fs-extra "^7.0.0"
js-sha3 "^0.8.0"
lodash "^4.17.15"
ts-essentials "^6.0.3"
ts-generator "^0.0.8"
typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
......@@ -7631,6 +7737,11 @@ typewiselite@~1.0.0:
resolved "https://registry.yarnpkg.com/typewiselite/-/typewiselite-1.0.0.tgz#c8882fa1bb1092c06005a97f34ef5c8508e3664e"
integrity sha1-yIgvobsQksBgBal/NO9chQjjZk4=
typical@^2.6.0, typical@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/typical/-/typical-2.6.1.tgz#5c080e5d661cbbe38259d2e70a3c7253e873881d"
integrity sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=
ultron@~1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment