Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
6250cb02
Commit
6250cb02
authored
Mar 19, 2021
by
C
Committed by
GitHub
Mar 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced NULL_BYTES32 (#340)
Co-authored-by:
smartcontracts
<
kelvinfichter@gmail.com
>
parent
adb16d5f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
106 additions
and
98 deletions
+106
-98
OVM_L1CrossDomainMessenger.spec.ts
...tracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
+2
-3
OVM_StateCommitmentChain.spec.ts
...test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts
+1
-2
ovmCREATE.spec.ts
...acts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts
+17
-14
ovmSLOAD.spec.ts
...racts/OVM/execution/OVM_ExecutionManager/ovmSLOAD.spec.ts
+5
-3
ovmSTATICCALL.spec.ts
.../OVM/execution/OVM_ExecutionManager/ovmSTATICCALL.spec.ts
+11
-9
OVM_FraudVerifier.spec.ts
...test/contracts/OVM/verification/OVM_FraudVerifier.spec.ts
+28
-27
OVM_StateTransitioner.spec.ts
.../contracts/OVM/verification/OVM_StateTransitioner.spec.ts
+9
-10
OVM_StateTransitionerFactory.spec.ts
...cts/OVM/verification/OVM_StateTransitionerFactory.spec.ts
+2
-3
Lib_MerkleTree.spec.ts
...cts/test/contracts/libraries/utils/Lib_MerkleTree.spec.ts
+13
-7
constants.ts
packages/contracts/test/helpers/constants.ts
+0
-2
batches.ts
packages/contracts/test/helpers/dummy/batches.ts
+7
-7
transactions.ts
packages/contracts/test/helpers/dummy/transactions.ts
+1
-2
test-runner.ts
packages/contracts/test/helpers/test-runner/test-runner.ts
+1
-2
trie-test-generator.ts
packages/contracts/test/helpers/trie/trie-test-generator.ts
+9
-7
No files found.
packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
View file @
6250cb02
...
@@ -12,7 +12,6 @@ import {
...
@@ -12,7 +12,6 @@ import {
setProxyTarget
,
setProxyTarget
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
NON_ZERO_ADDRESS
,
NON_ZERO_ADDRESS
,
NULL_BYTES32
,
DUMMY_BATCH_HEADERS
,
DUMMY_BATCH_HEADERS
,
DUMMY_BATCH_PROOFS
,
DUMMY_BATCH_PROOFS
,
TrieTestGenerator
,
TrieTestGenerator
,
...
@@ -231,7 +230,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
...
@@ -231,7 +230,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
)
)
const
proof1
=
{
const
proof1
=
{
stateRoot
:
NULL_BYTES32
,
stateRoot
:
ethers
.
constants
.
HashZero
,
stateRootBatchHeader
:
DUMMY_BATCH_HEADERS
[
0
],
stateRootBatchHeader
:
DUMMY_BATCH_HEADERS
[
0
],
stateRootProof
:
DUMMY_BATCH_PROOFS
[
0
],
stateRootProof
:
DUMMY_BATCH_PROOFS
[
0
],
stateTrieWitness
:
'
0x
'
,
stateTrieWitness
:
'
0x
'
,
...
@@ -255,7 +254,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
...
@@ -255,7 +254,7 @@ describe('OVM_L1CrossDomainMessenger', () => {
)
)
const
proof1
=
{
const
proof1
=
{
stateRoot
:
NULL_BYTES32
,
stateRoot
:
ethers
.
constants
.
HashZero
,
stateRootBatchHeader
:
DUMMY_BATCH_HEADERS
[
0
],
stateRootBatchHeader
:
DUMMY_BATCH_HEADERS
[
0
],
stateRootProof
:
DUMMY_BATCH_PROOFS
[
0
],
stateRootProof
:
DUMMY_BATCH_PROOFS
[
0
],
stateTrieWitness
:
'
0x
'
,
stateTrieWitness
:
'
0x
'
,
...
...
packages/contracts/test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts
View file @
6250cb02
...
@@ -11,7 +11,6 @@ import {
...
@@ -11,7 +11,6 @@ import {
setProxyTarget
,
setProxyTarget
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
getEthTime
,
getEthTime
,
NULL_BYTES32
,
increaseEthTime
,
increaseEthTime
,
}
from
'
../../../helpers
'
}
from
'
../../../helpers
'
...
@@ -195,7 +194,7 @@ describe('OVM_StateCommitmentChain', () => {
...
@@ -195,7 +194,7 @@ describe('OVM_StateCommitmentChain', () => {
batchRoot
:
NON_NULL_BYTES32
,
batchRoot
:
NON_NULL_BYTES32
,
batchSize
:
1
,
batchSize
:
1
,
prevTotalElements
:
0
,
prevTotalElements
:
0
,
extraData
:
NULL_BYTES32
,
extraData
:
ethers
.
constants
.
HashZero
,
}
}
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts
View file @
6250cb02
/* Internal Imports */
/* Internal Imports */
import
{
constants
}
from
'
ethers
'
import
{
constants
,
ethers
}
from
'
ethers
'
import
{
import
{
ExecutionManagerTestRunner
,
ExecutionManagerTestRunner
,
TestDefinition
,
TestDefinition
,
OVM_TX_GAS_LIMIT
,
OVM_TX_GAS_LIMIT
,
NULL_BYTES32
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
REVERT_FLAGS
,
REVERT_FLAGS
,
DUMMY_BYTECODE
,
DUMMY_BYTECODE
,
...
@@ -80,8 +79,8 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -80,8 +79,8 @@ const test_ovmCREATE: TestDefinition = {
},
},
contractStorage
:
{
contractStorage
:
{
$DUMMY_OVM_ADDRESS_2
:
{
$DUMMY_OVM_ADDRESS_2
:
{
[
NULL_BYTES32
]:
getStorageXOR
(
NULL_BYTES32
),
[
ethers
.
constants
.
HashZero
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
[
NON_NULL_BYTES32
]:
getStorageXOR
(
NULL_BYTES32
),
[
NON_NULL_BYTES32
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
},
},
},
},
verifiedContractStorage
:
{
verifiedContractStorage
:
{
...
@@ -89,7 +88,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -89,7 +88,7 @@ const test_ovmCREATE: TestDefinition = {
[
NON_NULL_BYTES32
]:
true
,
[
NON_NULL_BYTES32
]:
true
,
},
},
$DUMMY_OVM_ADDRESS_2
:
{
$DUMMY_OVM_ADDRESS_2
:
{
[
NULL_BYTES32
]:
true
,
[
ethers
.
constants
.
HashZero
]:
true
,
[
NON_NULL_BYTES32
]:
true
,
[
NON_NULL_BYTES32
]:
true
,
},
},
},
},
...
@@ -251,7 +250,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -251,7 +250,7 @@ const test_ovmCREATE: TestDefinition = {
address
:
CREATED_CONTRACT_1
,
address
:
CREATED_CONTRACT_1
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
@@ -322,7 +321,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -322,7 +321,7 @@ const test_ovmCREATE: TestDefinition = {
key
:
NON_NULL_BYTES32
,
key
:
NON_NULL_BYTES32
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
@@ -350,7 +349,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -350,7 +349,7 @@ const test_ovmCREATE: TestDefinition = {
key
:
NON_NULL_BYTES32
,
key
:
NON_NULL_BYTES32
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
@@ -431,10 +430,10 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -431,10 +430,10 @@ const test_ovmCREATE: TestDefinition = {
{
{
functionName
:
'
ovmSLOAD
'
,
functionName
:
'
ovmSLOAD
'
,
functionParams
:
{
functionParams
:
{
key
:
NULL_BYTES32
,
key
:
ethers
.
constants
.
HashZero
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
@@ -773,10 +772,12 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -773,10 +772,12 @@ const test_ovmCREATE: TestDefinition = {
),
),
// allowArbitraryDeployment? false
// allowArbitraryDeployment? false
'
0x0000000000000000000000000000000000000000000000000000000000000012
'
:
getStorageXOR
(
'
0x0000000000000000000000000000000000000000000000000000000000000012
'
:
getStorageXOR
(
NULL_BYTES32
ethers
.
constants
.
HashZero
),
),
// non-whitelisted deployer is whitelisted? false
// non-whitelisted deployer is whitelisted? false
[
NON_WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
NULL_BYTES32
),
[
NON_WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
// whitelisted deployer is whitelisted? true
// whitelisted deployer is whitelisted? true
[
WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
[
WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
'
0x
'
+
'
00
'
.
repeat
(
31
)
+
'
01
'
'
0x
'
+
'
00
'
.
repeat
(
31
)
+
'
01
'
...
@@ -859,7 +860,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -859,7 +860,7 @@ const test_ovmCREATE: TestDefinition = {
{
{
functionName
:
'
ovmCREATE2
'
,
functionName
:
'
ovmCREATE2
'
,
functionParams
:
{
functionParams
:
{
salt
:
NULL_BYTES32
,
salt
:
ethers
.
constants
.
HashZero
,
bytecode
:
'
0x
'
,
bytecode
:
'
0x
'
,
},
},
expectedReturnStatus
:
false
,
expectedReturnStatus
:
false
,
...
@@ -909,7 +910,9 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -909,7 +910,9 @@ const test_ovmCREATE: TestDefinition = {
'
0x
'
+
'
00
'
.
repeat
(
31
)
+
'
01
'
'
0x
'
+
'
00
'
.
repeat
(
31
)
+
'
01
'
),
),
// non-whitelisted deployer is whitelisted? false
// non-whitelisted deployer is whitelisted? false
[
NON_WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
NULL_BYTES32
),
[
NON_WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
// whitelisted deployer is whitelisted? true
// whitelisted deployer is whitelisted? true
[
WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
[
WHITELISTED_DEPLOYER_KEY
]:
getStorageXOR
(
'
0x
'
+
'
00
'
.
repeat
(
31
)
+
'
01
'
'
0x
'
+
'
00
'
.
repeat
(
31
)
+
'
01
'
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmSLOAD.spec.ts
View file @
6250cb02
/* External Imports */
import
{
ethers
}
from
'
ethers
'
/* Internal Imports */
/* Internal Imports */
import
{
import
{
ExecutionManagerTestRunner
,
ExecutionManagerTestRunner
,
TestDefinition
,
TestDefinition
,
OVM_TX_GAS_LIMIT
,
OVM_TX_GAS_LIMIT
,
NULL_BYTES32
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
getStorageXOR
,
getStorageXOR
,
}
from
'
../../../../helpers
'
}
from
'
../../../../helpers
'
...
@@ -32,7 +34,7 @@ const test_ovmSLOAD: TestDefinition = {
...
@@ -32,7 +34,7 @@ const test_ovmSLOAD: TestDefinition = {
},
},
contractStorage
:
{
contractStorage
:
{
$DUMMY_OVM_ADDRESS_1
:
{
$DUMMY_OVM_ADDRESS_1
:
{
[
NON_NULL_BYTES32
]:
getStorageXOR
(
NULL_BYTES32
),
[
NON_NULL_BYTES32
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
},
},
},
},
verifiedContractStorage
:
{
verifiedContractStorage
:
{
...
@@ -58,7 +60,7 @@ const test_ovmSLOAD: TestDefinition = {
...
@@ -58,7 +60,7 @@ const test_ovmSLOAD: TestDefinition = {
key
:
NON_NULL_BYTES32
,
key
:
NON_NULL_BYTES32
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmSTATICCALL.spec.ts
View file @
6250cb02
/* External Imports */
import
{
ethers
}
from
'
ethers
'
/* Internal Imports */
/* Internal Imports */
import
{
import
{
ExecutionManagerTestRunner
,
ExecutionManagerTestRunner
,
TestDefinition
,
TestDefinition
,
OVM_TX_GAS_LIMIT
,
OVM_TX_GAS_LIMIT
,
NULL_BYTES32
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
REVERT_FLAGS
,
REVERT_FLAGS
,
DUMMY_BYTECODE
,
DUMMY_BYTECODE
,
...
@@ -38,10 +40,10 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -38,10 +40,10 @@ const test_ovmSTATICCALL: TestDefinition = {
},
},
contractStorage
:
{
contractStorage
:
{
$DUMMY_OVM_ADDRESS_1
:
{
$DUMMY_OVM_ADDRESS_1
:
{
[
NON_NULL_BYTES32
]:
getStorageXOR
(
NULL_BYTES32
),
[
NON_NULL_BYTES32
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
},
},
$DUMMY_OVM_ADDRESS_3
:
{
$DUMMY_OVM_ADDRESS_3
:
{
[
NON_NULL_BYTES32
]:
getStorageXOR
(
NULL_BYTES32
),
[
NON_NULL_BYTES32
]:
getStorageXOR
(
ethers
.
constants
.
HashZero
),
},
},
},
},
verifiedContractStorage
:
{
verifiedContractStorage
:
{
...
@@ -67,8 +69,8 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -67,8 +69,8 @@ const test_ovmSTATICCALL: TestDefinition = {
{
{
functionName
:
'
ovmSSTORE
'
,
functionName
:
'
ovmSSTORE
'
,
functionParams
:
{
functionParams
:
{
key
:
NULL_BYTES32
,
key
:
ethers
.
constants
.
HashZero
,
value
:
NULL_BYTES32
,
value
:
ethers
.
constants
.
HashZero
,
},
},
expectedReturnStatus
:
false
,
expectedReturnStatus
:
false
,
expectedReturnValue
:
{
expectedReturnValue
:
{
...
@@ -97,7 +99,7 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -97,7 +99,7 @@ const test_ovmSTATICCALL: TestDefinition = {
key
:
NON_NULL_BYTES32
,
key
:
NON_NULL_BYTES32
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
@@ -214,8 +216,8 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -214,8 +216,8 @@ const test_ovmSTATICCALL: TestDefinition = {
{
{
functionName
:
'
ovmSSTORE
'
,
functionName
:
'
ovmSSTORE
'
,
functionParams
:
{
functionParams
:
{
key
:
NULL_BYTES32
,
key
:
ethers
.
constants
.
HashZero
,
value
:
NULL_BYTES32
,
value
:
ethers
.
constants
.
HashZero
,
},
},
expectedReturnStatus
:
false
,
expectedReturnStatus
:
false
,
expectedReturnValue
:
{
expectedReturnValue
:
{
...
@@ -265,7 +267,7 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -265,7 +267,7 @@ const test_ovmSTATICCALL: TestDefinition = {
key
:
NON_NULL_BYTES32
,
key
:
NON_NULL_BYTES32
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
NULL_BYTES32
,
expectedReturnValue
:
ethers
.
constants
.
HashZero
,
},
},
],
],
},
},
...
...
packages/contracts/test/contracts/OVM/verification/OVM_FraudVerifier.spec.ts
View file @
6250cb02
...
@@ -13,7 +13,6 @@ import {
...
@@ -13,7 +13,6 @@ import {
DUMMY_BATCH_PROOFS
,
DUMMY_BATCH_PROOFS
,
DUMMY_OVM_TRANSACTIONS
,
DUMMY_OVM_TRANSACTIONS
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
NULL_BYTES32
,
hashTransaction
,
hashTransaction
,
}
from
'
../../../helpers
'
}
from
'
../../../helpers
'
...
@@ -23,7 +22,7 @@ const DUMMY_TX_CHAIN_ELEMENTS = [...Array(10).keys()].map((i) => {
...
@@ -23,7 +22,7 @@ const DUMMY_TX_CHAIN_ELEMENTS = [...Array(10).keys()].map((i) => {
queueIndex
:
BigNumber
.
from
(
0
),
queueIndex
:
BigNumber
.
from
(
0
),
timestamp
:
BigNumber
.
from
(
i
),
timestamp
:
BigNumber
.
from
(
i
),
blockNumber
:
BigNumber
.
from
(
0
),
blockNumber
:
BigNumber
.
from
(
0
),
txData
:
NULL_BYTES32
,
txData
:
ethers
.
constants
.
HashZero
,
}
}
})
})
...
@@ -32,7 +31,7 @@ const DUMMY_HASH = hashTransaction(DUMMY_OVM_TRANSACTIONS[0])
...
@@ -32,7 +31,7 @@ const DUMMY_HASH = hashTransaction(DUMMY_OVM_TRANSACTIONS[0])
const
DUMMY_BATCH_PROOFS_WITH_INDEX
=
[
const
DUMMY_BATCH_PROOFS_WITH_INDEX
=
[
{
{
index
:
11
,
index
:
11
,
siblings
:
[
NULL_BYTES32
],
siblings
:
[
ethers
.
constants
.
HashZero
],
},
},
]
]
...
@@ -122,7 +121,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -122,7 +121,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
initializeFraudVerification
(
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
...
@@ -151,7 +150,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -151,7 +150,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
initializeFraudVerification
(
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
...
@@ -173,7 +172,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -173,7 +172,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should deploy a new state transitioner
'
,
async
()
=>
{
it
(
'
should deploy a new state transitioner
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
initializeFraudVerification
(
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
...
@@ -188,7 +187,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -188,7 +187,7 @@ describe('OVM_FraudVerifier', () => {
expect
(
expect
(
await
OVM_FraudVerifier
.
getStateTransitioner
(
await
OVM_FraudVerifier
.
getStateTransitioner
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_HASH
DUMMY_HASH
)
)
).
to
.
equal
(
Mock__OVM_StateTransitioner
.
address
)
).
to
.
equal
(
Mock__OVM_StateTransitioner
.
address
)
...
@@ -197,7 +196,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -197,7 +196,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert when provided with a incorrect transaction root global index
'
,
async
()
=>
{
it
(
'
should revert when provided with a incorrect transaction root global index
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
initializeFraudVerification
(
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
...
@@ -223,7 +222,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -223,7 +222,7 @@ describe('OVM_FraudVerifier', () => {
)
)
await
OVM_FraudVerifier
.
initializeFraudVerification
(
await
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
0
],
...
@@ -244,7 +243,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -244,7 +243,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -272,7 +271,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -272,7 +271,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -302,7 +301,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -302,7 +301,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -333,7 +332,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -333,7 +332,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -362,7 +361,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -362,7 +361,7 @@ describe('OVM_FraudVerifier', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -379,13 +378,13 @@ describe('OVM_FraudVerifier', () => {
...
@@ -379,13 +378,13 @@ describe('OVM_FraudVerifier', () => {
describe
(
'
when the provided post-state root differs from the computed one
'
,
()
=>
{
describe
(
'
when the provided post-state root differs from the computed one
'
,
()
=>
{
before
(()
=>
{
before
(()
=>
{
Mock__OVM_StateTransitioner
.
smocked
.
getPostStateRoot
.
will
.
return
.
with
(
Mock__OVM_StateTransitioner
.
smocked
.
getPostStateRoot
.
will
.
return
.
with
(
NULL_BYTES32
ethers
.
constants
.
HashZero
)
)
})
})
it
(
'
should succeed and attempt to delete a state batch
'
,
async
()
=>
{
it
(
'
should succeed and attempt to delete a state batch
'
,
async
()
=>
{
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -423,16 +422,18 @@ describe('OVM_FraudVerifier', () => {
...
@@ -423,16 +422,18 @@ describe('OVM_FraudVerifier', () => {
)
)
Mock__OVM_StateTransitioner
.
smocked
.
getPostStateRoot
.
will
.
return
.
with
(
Mock__OVM_StateTransitioner
.
smocked
.
getPostStateRoot
.
will
.
return
.
with
(
NULL_BYTES32
ethers
.
constants
.
HashZero
)
)
state2
.
smocked
.
getPostStateRoot
.
will
.
return
.
with
(
NULL_BYTES32
)
state2
.
smocked
.
getPostStateRoot
.
will
.
return
.
with
(
ethers
.
constants
.
HashZero
)
})
})
it
(
'
creates multiple state transitioners per tx hash
'
,
async
()
=>
{
it
(
'
creates multiple state transitioners per tx hash
'
,
async
()
=>
{
await
expect
(
await
expect
(
OVM_FraudVerifier
.
initializeFraudVerification
(
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
1
],
DUMMY_OVM_TRANSACTIONS
[
1
],
...
@@ -447,13 +448,13 @@ describe('OVM_FraudVerifier', () => {
...
@@ -447,13 +448,13 @@ describe('OVM_FraudVerifier', () => {
expect
(
expect
(
await
OVM_FraudVerifier
.
getStateTransitioner
(
await
OVM_FraudVerifier
.
getStateTransitioner
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_HASH
DUMMY_HASH
)
)
).
to
.
equal
(
Mock__OVM_StateTransitioner
.
address
)
).
to
.
equal
(
Mock__OVM_StateTransitioner
.
address
)
expect
(
expect
(
await
OVM_FraudVerifier
.
getStateTransitioner
(
await
OVM_FraudVerifier
.
getStateTransitioner
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_HASH_2
DUMMY_HASH_2
)
)
).
to
.
equal
(
state2
.
address
)
).
to
.
equal
(
state2
.
address
)
...
@@ -468,7 +469,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -468,7 +469,7 @@ describe('OVM_FraudVerifier', () => {
it
.
skip
(
'
Case 1: allows proving fraud on the same pre-state root twice
'
,
async
()
=>
{
it
.
skip
(
'
Case 1: allows proving fraud on the same pre-state root twice
'
,
async
()
=>
{
// finalize previous fraud
// finalize previous fraud
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
@@ -479,7 +480,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -479,7 +480,7 @@ describe('OVM_FraudVerifier', () => {
// start new fraud
// start new fraud
await
OVM_FraudVerifier
.
initializeFraudVerification
(
await
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
1
],
DUMMY_OVM_TRANSACTIONS
[
1
],
...
@@ -493,7 +494,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -493,7 +494,7 @@ describe('OVM_FraudVerifier', () => {
// finalize it as well
// finalize it as well
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH_2
,
DUMMY_HASH_2
,
...
@@ -516,7 +517,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -516,7 +517,7 @@ describe('OVM_FraudVerifier', () => {
it
.
skip
(
'
Case 2: does not get blocked by the first transitioner
'
,
async
()
=>
{
it
.
skip
(
'
Case 2: does not get blocked by the first transitioner
'
,
async
()
=>
{
// start new fraud
// start new fraud
await
OVM_FraudVerifier
.
initializeFraudVerification
(
await
OVM_FraudVerifier
.
initializeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_OVM_TRANSACTIONS
[
1
],
DUMMY_OVM_TRANSACTIONS
[
1
],
...
@@ -530,7 +531,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -530,7 +531,7 @@ describe('OVM_FraudVerifier', () => {
// finalize the new fraud first
// finalize the new fraud first
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH_2
,
DUMMY_HASH_2
,
...
@@ -550,7 +551,7 @@ describe('OVM_FraudVerifier', () => {
...
@@ -550,7 +551,7 @@ describe('OVM_FraudVerifier', () => {
// finalize previous fraud
// finalize previous fraud
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
await
OVM_FraudVerifier
.
finalizeFraudVerification
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_BATCH_PROOFS
[
0
],
DUMMY_HASH
,
DUMMY_HASH
,
...
...
packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts
View file @
6250cb02
...
@@ -11,7 +11,6 @@ import {
...
@@ -11,7 +11,6 @@ import {
makeAddressManager
,
makeAddressManager
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
NON_ZERO_ADDRESS
,
NON_ZERO_ADDRESS
,
NULL_BYTES32
,
setProxyTarget
,
setProxyTarget
,
TrieTestGenerator
,
TrieTestGenerator
,
}
from
'
../../../helpers
'
}
from
'
../../../helpers
'
...
@@ -84,8 +83,8 @@ describe('OVM_StateTransitioner', () => {
...
@@ -84,8 +83,8 @@ describe('OVM_StateTransitioner', () => {
OVM_StateTransitioner
=
await
Factory__OVM_StateTransitioner
.
deploy
(
OVM_StateTransitioner
=
await
Factory__OVM_StateTransitioner
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
0
,
0
,
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
NULL_BYTES32
ethers
.
constants
.
HashZero
)
)
})
})
...
@@ -99,8 +98,8 @@ describe('OVM_StateTransitioner', () => {
...
@@ -99,8 +98,8 @@ describe('OVM_StateTransitioner', () => {
account
=
{
account
=
{
nonce
:
0
,
nonce
:
0
,
balance
:
0
,
balance
:
0
,
storageRoot
:
NULL_BYTES32
,
storageRoot
:
ethers
.
constants
.
HashZero
,
codeHash
:
NULL_BYTES32
,
codeHash
:
ethers
.
constants
.
HashZero
,
}
}
})
})
...
@@ -147,7 +146,7 @@ describe('OVM_StateTransitioner', () => {
...
@@ -147,7 +146,7 @@ describe('OVM_StateTransitioner', () => {
AddressManager
.
address
,
AddressManager
.
address
,
0
,
0
,
test
.
accountTrieRoot
,
test
.
accountTrieRoot
,
NULL_BYTES32
ethers
.
constants
.
HashZero
)
)
})
})
...
@@ -341,8 +340,8 @@ describe('OVM_StateTransitioner', () => {
...
@@ -341,8 +340,8 @@ describe('OVM_StateTransitioner', () => {
account
=
{
account
=
{
nonce
:
0
,
nonce
:
0
,
balance
:
0
,
balance
:
0
,
storageRoot
:
NULL_BYTES32
,
storageRoot
:
ethers
.
constants
.
HashZero
,
codeHash
:
NULL_BYTES32
,
codeHash
:
ethers
.
constants
.
HashZero
,
ethAddress
:
constants
.
AddressZero
,
ethAddress
:
constants
.
AddressZero
,
isFresh
:
false
,
isFresh
:
false
,
}
}
...
@@ -429,8 +428,8 @@ describe('OVM_StateTransitioner', () => {
...
@@ -429,8 +428,8 @@ describe('OVM_StateTransitioner', () => {
account
=
{
account
=
{
nonce
:
0
,
nonce
:
0
,
balance
:
0
,
balance
:
0
,
storageRoot
:
NULL_BYTES32
,
storageRoot
:
ethers
.
constants
.
HashZero
,
codeHash
:
NULL_BYTES32
,
codeHash
:
ethers
.
constants
.
HashZero
,
}
}
Mock__OVM_StateManager
.
smocked
.
getAccount
.
will
.
return
.
with
({
Mock__OVM_StateManager
.
smocked
.
getAccount
.
will
.
return
.
with
({
...
...
packages/contracts/test/contracts/OVM/verification/OVM_StateTransitionerFactory.spec.ts
View file @
6250cb02
...
@@ -8,7 +8,6 @@ import { ContractFactory, Contract, constants } from 'ethers'
...
@@ -8,7 +8,6 @@ import { ContractFactory, Contract, constants } from 'ethers'
import
{
import
{
makeAddressManager
,
makeAddressManager
,
DUMMY_OVM_TRANSACTIONS
,
DUMMY_OVM_TRANSACTIONS
,
NULL_BYTES32
,
hashTransaction
,
hashTransaction
,
}
from
'
../../../helpers
'
}
from
'
../../../helpers
'
...
@@ -47,8 +46,8 @@ describe('OVM_StateTransitionerFactory', () => {
...
@@ -47,8 +46,8 @@ describe('OVM_StateTransitionerFactory', () => {
await
expect
(
await
expect
(
OVM_StateTransitionerFactory
.
create
(
OVM_StateTransitionerFactory
.
create
(
AddressManager
.
address
,
AddressManager
.
address
,
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
DUMMY_HASH
DUMMY_HASH
)
)
).
to
.
be
.
revertedWith
(
).
to
.
be
.
revertedWith
(
...
...
packages/contracts/test/contracts/libraries/utils/Lib_MerkleTree.spec.ts
View file @
6250cb02
...
@@ -7,7 +7,7 @@ import { MerkleTree } from 'merkletreejs'
...
@@ -7,7 +7,7 @@ import { MerkleTree } from 'merkletreejs'
import
{
fromHexString
,
toHexString
}
from
'
@eth-optimism/core-utils
'
import
{
fromHexString
,
toHexString
}
from
'
@eth-optimism/core-utils
'
/* Internal Imports */
/* Internal Imports */
import
{
NON_NULL_BYTES32
,
NULL_BYTES32
}
from
'
../../../helpers
'
import
{
NON_NULL_BYTES32
}
from
'
../../../helpers
'
const
NODE_COUNTS
=
[
const
NODE_COUNTS
=
[
2
,
2
,
...
@@ -100,7 +100,13 @@ describe('Lib_MerkleTree', () => {
...
@@ -100,7 +100,13 @@ describe('Lib_MerkleTree', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
Lib_MerkleTree
.
verify
(
NULL_BYTES32
,
NULL_BYTES32
,
0
,
[],
totalLeaves
)
Lib_MerkleTree
.
verify
(
ethers
.
constants
.
HashZero
,
ethers
.
constants
.
HashZero
,
0
,
[],
totalLeaves
)
).
to
.
be
.
revertedWith
(
).
to
.
be
.
revertedWith
(
'
Lib_MerkleTree: Total leaves must be greater than zero.
'
'
Lib_MerkleTree: Total leaves must be greater than zero.
'
)
)
...
@@ -114,8 +120,8 @@ describe('Lib_MerkleTree', () => {
...
@@ -114,8 +120,8 @@ describe('Lib_MerkleTree', () => {
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
Lib_MerkleTree
.
verify
(
Lib_MerkleTree
.
verify
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
index
,
index
,
[],
[],
totalLeaves
totalLeaves
...
@@ -126,13 +132,13 @@ describe('Lib_MerkleTree', () => {
...
@@ -126,13 +132,13 @@ describe('Lib_MerkleTree', () => {
describe
(
'
when total siblings does not match provided total leaves
'
,
()
=>
{
describe
(
'
when total siblings does not match provided total leaves
'
,
()
=>
{
const
totalLeaves
=
8
const
totalLeaves
=
8
const
siblings
=
[
NULL_BYTES32
,
NULL_BYTES32
]
const
siblings
=
[
ethers
.
constants
.
HashZero
,
ethers
.
constants
.
HashZero
]
it
(
'
should revert
'
,
async
()
=>
{
it
(
'
should revert
'
,
async
()
=>
{
await
expect
(
await
expect
(
Lib_MerkleTree
.
verify
(
Lib_MerkleTree
.
verify
(
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
NULL_BYTES32
,
ethers
.
constants
.
HashZero
,
0
,
0
,
siblings
,
siblings
,
totalLeaves
totalLeaves
...
...
packages/contracts/test/helpers/constants.ts
View file @
6250cb02
...
@@ -17,8 +17,6 @@ export const RUN_OVM_TEST_GAS = 20_000_000
...
@@ -17,8 +17,6 @@ export const RUN_OVM_TEST_GAS = 20_000_000
export
const
FORCE_INCLUSION_PERIOD_SECONDS
=
600
export
const
FORCE_INCLUSION_PERIOD_SECONDS
=
600
export
const
FORCE_INCLUSION_PERIOD_BLOCKS
=
600
/
12
export
const
FORCE_INCLUSION_PERIOD_BLOCKS
=
600
/
12
export
const
NULL_BYTES32
=
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
export
const
NON_NULL_BYTES32
=
export
const
NON_NULL_BYTES32
=
'
0x1111111111111111111111111111111111111111111111111111111111111111
'
'
0x1111111111111111111111111111111111111111111111111111111111111111
'
export
const
NON_ZERO_ADDRESS
=
'
0x1111111111111111111111111111111111111111
'
export
const
NON_ZERO_ADDRESS
=
'
0x1111111111111111111111111111111111111111
'
...
...
packages/contracts/test/helpers/dummy/batches.ts
View file @
6250cb02
import
{
N
ULL_BYTES32
,
N
ON_ZERO_ADDRESS
}
from
'
../constants
'
import
{
NON_ZERO_ADDRESS
}
from
'
../constants
'
import
{
ethers
}
from
'
hardhat
'
import
{
ethers
}
from
'
hardhat
'
export
const
DUMMY_BATCH_HEADERS
=
[
export
const
DUMMY_BATCH_HEADERS
=
[
{
{
batchIndex
:
0
,
batchIndex
:
0
,
batchRoot
:
NULL_BYTES32
,
batchRoot
:
ethers
.
constants
.
HashZero
,
batchSize
:
0
,
batchSize
:
0
,
prevTotalElements
:
0
,
prevTotalElements
:
0
,
extraData
:
ethers
.
utils
.
defaultAbiCoder
.
encode
(
extraData
:
ethers
.
utils
.
defaultAbiCoder
.
encode
(
[
'
uint256
'
,
'
address
'
],
[
'
uint256
'
,
'
address
'
],
[
NULL_BYTES32
,
NON_ZERO_ADDRESS
]
[
ethers
.
constants
.
HashZero
,
NON_ZERO_ADDRESS
]
),
),
},
},
{
{
batchIndex
:
1
,
batchIndex
:
1
,
batchRoot
:
NULL_BYTES32
,
batchRoot
:
ethers
.
constants
.
HashZero
,
batchSize
:
0
,
batchSize
:
0
,
prevTotalElements
:
0
,
prevTotalElements
:
0
,
extraData
:
ethers
.
utils
.
defaultAbiCoder
.
encode
(
extraData
:
ethers
.
utils
.
defaultAbiCoder
.
encode
(
[
'
uint256
'
,
'
address
'
],
[
'
uint256
'
,
'
address
'
],
[
NULL_BYTES32
,
NON_ZERO_ADDRESS
]
[
ethers
.
constants
.
HashZero
,
NON_ZERO_ADDRESS
]
),
),
},
},
]
]
...
@@ -27,10 +27,10 @@ export const DUMMY_BATCH_HEADERS = [
...
@@ -27,10 +27,10 @@ export const DUMMY_BATCH_HEADERS = [
export
const
DUMMY_BATCH_PROOFS
=
[
export
const
DUMMY_BATCH_PROOFS
=
[
{
{
index
:
0
,
index
:
0
,
siblings
:
[
NULL_BYTES32
],
siblings
:
[
ethers
.
constants
.
HashZero
],
},
},
{
{
index
:
1
,
index
:
1
,
siblings
:
[
NULL_BYTES32
],
siblings
:
[
ethers
.
constants
.
HashZero
],
},
},
]
]
packages/contracts/test/helpers/dummy/transactions.ts
View file @
6250cb02
import
{
NULL_BYTES32
}
from
'
../constants
'
import
{
constants
,
ethers
}
from
'
ethers
'
import
{
constants
,
ethers
}
from
'
ethers
'
export
interface
Transaction
{
export
interface
Transaction
{
...
@@ -21,7 +20,7 @@ export const DUMMY_OVM_TRANSACTIONS: Array<Transaction> = [
...
@@ -21,7 +20,7 @@ export const DUMMY_OVM_TRANSACTIONS: Array<Transaction> = [
l1TxOrigin
:
constants
.
AddressZero
,
l1TxOrigin
:
constants
.
AddressZero
,
entrypoint
:
constants
.
AddressZero
,
entrypoint
:
constants
.
AddressZero
,
gasLimit
:
0
,
gasLimit
:
0
,
data
:
NULL_BYTES32
,
data
:
ethers
.
constants
.
HashZero
,
}
}
})
})
...
...
packages/contracts/test/helpers/test-runner/test-runner.ts
View file @
6250cb02
...
@@ -35,7 +35,6 @@ import {
...
@@ -35,7 +35,6 @@ import {
OVM_TX_GAS_LIMIT
,
OVM_TX_GAS_LIMIT
,
RUN_OVM_TEST_GAS
,
RUN_OVM_TEST_GAS
,
NON_NULL_BYTES32
,
NON_NULL_BYTES32
,
NULL_BYTES32
,
}
from
'
../constants
'
}
from
'
../constants
'
import
{
getStorageXOR
}
from
'
../
'
import
{
getStorageXOR
}
from
'
../
'
import
{
UNSAFE_BYTECODE
}
from
'
../dummy
'
import
{
UNSAFE_BYTECODE
}
from
'
../dummy
'
...
@@ -71,7 +70,7 @@ export class ExecutionManagerTestRunner {
...
@@ -71,7 +70,7 @@ export class ExecutionManagerTestRunner {
contractStorage
:
{
contractStorage
:
{
[
'
0x4200000000000000000000000000000000000002
'
]:
{
[
'
0x4200000000000000000000000000000000000002
'
]:
{
'
0x0000000000000000000000000000000000000000000000000000000000000010
'
:
getStorageXOR
(
'
0x0000000000000000000000000000000000000000000000000000000000000010
'
:
getStorageXOR
(
NULL_BYTES32
ethers
.
constants
.
HashZero
),
),
},
},
},
},
...
...
packages/contracts/test/helpers/trie/trie-test-generator.ts
View file @
6250cb02
...
@@ -3,9 +3,7 @@ import * as rlp from 'rlp'
...
@@ -3,9 +3,7 @@ import * as rlp from 'rlp'
import
{
default
as
seedbytes
}
from
'
random-bytes-seed
'
import
{
default
as
seedbytes
}
from
'
random-bytes-seed
'
import
{
SecureTrie
,
BaseTrie
}
from
'
merkle-patricia-tree
'
import
{
SecureTrie
,
BaseTrie
}
from
'
merkle-patricia-tree
'
import
{
fromHexString
,
toHexString
}
from
'
@eth-optimism/core-utils
'
import
{
fromHexString
,
toHexString
}
from
'
@eth-optimism/core-utils
'
import
{
ethers
}
from
'
ethers
'
/* Internal Imports */
import
{
NULL_BYTES32
}
from
'
../constants
'
export
interface
TrieNode
{
export
interface
TrieNode
{
key
:
string
key
:
string
...
@@ -48,8 +46,8 @@ const rlpEncodeAccount = (account: EthereumAccount): string => {
...
@@ -48,8 +46,8 @@ const rlpEncodeAccount = (account: EthereumAccount): string => {
rlp
.
encode
([
rlp
.
encode
([
account
.
nonce
,
account
.
nonce
,
account
.
balance
,
account
.
balance
,
account
.
storageRoot
||
NULL_BYTES32
,
account
.
storageRoot
||
ethers
.
constants
.
HashZero
,
account
.
codeHash
||
NULL_BYTES32
,
account
.
codeHash
||
ethers
.
constants
.
HashZero
,
])
])
)
)
}
}
...
@@ -59,8 +57,12 @@ const rlpDecodeAccount = (encoded: string): EthereumAccount => {
...
@@ -59,8 +57,12 @@ const rlpDecodeAccount = (encoded: string): EthereumAccount => {
return
{
return
{
nonce
:
decoded
[
0
].
length
?
parseInt
(
decoded
[
0
],
16
)
:
0
,
nonce
:
decoded
[
0
].
length
?
parseInt
(
decoded
[
0
],
16
)
:
0
,
balance
:
decoded
[
1
].
length
?
parseInt
(
decoded
[
1
],
16
)
:
0
,
balance
:
decoded
[
1
].
length
?
parseInt
(
decoded
[
1
],
16
)
:
0
,
storageRoot
:
decoded
[
2
].
length
?
toHexString
(
decoded
[
2
])
:
NULL_BYTES32
,
storageRoot
:
decoded
[
2
].
length
codeHash
:
decoded
[
3
].
length
?
toHexString
(
decoded
[
3
])
:
NULL_BYTES32
,
?
toHexString
(
decoded
[
2
])
:
ethers
.
constants
.
HashZero
,
codeHash
:
decoded
[
3
].
length
?
toHexString
(
decoded
[
3
])
:
ethers
.
constants
.
HashZero
,
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment