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
305fff21
Commit
305fff21
authored
Jun 28, 2021
by
Liam Horne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: run lint:fix on all code
parent
35c846a5
Changes
43
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
474 additions
and
613 deletions
+474
-613
1-sync-verifier.spec.ts
integration-tests/sync-tests/1-sync-verifier.spec.ts
+2
-1
basic-l1-l2-communication.spec.ts
integration-tests/test/basic-l1-l2-communication.spec.ts
+4
-3
fee-payment.spec.ts
integration-tests/test/fee-payment.spec.ts
+4
-2
native-eth-ovm-calls.spec.ts
integration-tests/test/native-eth-ovm-calls.spec.ts
+85
-97
native-eth.spec.ts
integration-tests/test/native-eth.spec.ts
+2
-6
ovmcontext.spec.ts
integration-tests/test/ovmcontext.spec.ts
+2
-3
rpc.spec.ts
integration-tests/test/rpc.spec.ts
+2
-4
batch-submitter.spec.ts
...ch-submitter/test/batch-submitter/batch-submitter.spec.ts
+11
-9
deploy.ts
packages/contracts/bin/deploy.ts
+26
-14
take-dump.ts
packages/contracts/bin/take-dump.ts
+3
-2
008-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
...ts/deploy/008-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
+2
-1
015-Proxy__OVM_L1StandardBridge.deploy.ts
...ontracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts
+4
-2
make-dump.ts
packages/contracts/src/state-dump/make-dump.ts
+4
-2
OVM_L2StandardBridge.spec.ts
.../contracts/OVM/bridge/assets/OVM_L2StandardBridge.spec.ts
+3
-1
OVM_L1CrossDomainMessenger.spec.ts
...tracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
+11
-10
OVM_L2CrossDomainMessenger.spec.ts
...tracts/OVM/bridge/base/OVM_L2CrossDomainMessenger.spec.ts
+10
-8
OVM_CanonicalTransactionChain.gas.spec.ts
...racts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts
+9
-9
OVM_CanonicalTransactionChain.spec.ts
...contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
+19
-16
OVM_StateCommitmentChain.spec.ts
...test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts
+2
-1
OVM_ExecutionManager.gas-spec.ts
.../contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts
+3
-3
nuisance-gas.spec.ts
...s/OVM/execution/OVM_ExecutionManager/nuisance-gas.spec.ts
+4
-8
ovmCALL.spec.ts
...tracts/OVM/execution/OVM_ExecutionManager/ovmCALL.spec.ts
+2
-4
ovmCREATE.spec.ts
...acts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts
+13
-13
ovmCREATEEOA.spec.ts
...s/OVM/execution/OVM_ExecutionManager/ovmCREATEEOA.spec.ts
+2
-4
ovmDELEGATECALL.spec.ts
...VM/execution/OVM_ExecutionManager/ovmDELEGATECALL.spec.ts
+5
-10
ovmSTATICCALL.spec.ts
.../OVM/execution/OVM_ExecutionManager/ovmSTATICCALL.spec.ts
+3
-6
OVM_BondManager.spec.ts
...s/test/contracts/OVM/verification/OVM_BondManager.spec.ts
+3
-4
OVM_StateTransitionerFactory.spec.ts
...cts/OVM/verification/OVM_StateTransitionerFactory.spec.ts
+2
-3
Lib_RLPWriter.spec.ts
...tracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts
+4
-3
Lib_MerkleTree.spec.ts
...cts/test/contracts/libraries/utils/Lib_MerkleTree.spec.ts
+1
-14
bridge.ts
packages/contracts/test/helpers/codec/bridge.ts
+4
-3
gas.ts
packages/contracts/test/helpers/gas/gas.ts
+5
-4
test-runner.ts
packages/contracts/test/helpers/test-runner/test-runner.ts
+9
-8
watcher.ts
packages/core-utils/src/watcher.ts
+2
-2
service.ts
...data-transport-layer/src/services/l1-ingestion/service.ts
+19
-10
service.ts
packages/data-transport-layer/src/services/server/service.ts
+14
-11
l2-data.ts
.../data-transport-layer/test/unit-tests/examples/l2-data.ts
+123
-246
state-batch-appended.spec.ts
...rvices/l1-ingestion/handlers/state-batch-appended.spec.ts
+2
-4
relay-tx.ts
packages/message-relayer/src/relay-tx.ts
+17
-23
service.ts
packages/message-relayer/src/service.ts
+17
-18
binding.ts
packages/smock/src/smockit/binding.ts
+8
-13
smockit.ts
packages/smock/src/smockit/smockit.ts
+1
-3
transaction-indexer.md
specs/l2geth/transaction-indexer.md
+6
-5
No files found.
integration-tests/sync-tests/1-sync-verifier.spec.ts
View file @
305fff21
...
@@ -64,7 +64,8 @@ describe('Syncing a verifier', () => {
...
@@ -64,7 +64,8 @@ describe('Syncing a verifier', () => {
})
})
it
(
'
should sync dummy transaction
'
,
async
()
=>
{
it
(
'
should sync dummy transaction
'
,
async
()
=>
{
const
totalElementsBefore
=
(
await
env
.
ctc
.
getTotalElements
())
as
BigNumber
const
totalElementsBefore
=
(
await
env
.
ctc
.
getTotalElements
())
as
BigNumber
const
tx
=
{
const
tx
=
{
to
:
'
0x
'
+
'
1234
'
.
repeat
(
10
),
to
:
'
0x
'
+
'
1234
'
.
repeat
(
10
),
...
...
integration-tests/test/basic-l1-l2-communication.spec.ts
View file @
305fff21
...
@@ -133,9 +133,10 @@ describe('Basic L1<>L2 Communication', async () => {
...
@@ -133,9 +133,10 @@ describe('Basic L1<>L2 Communication', async () => {
// This call is fine but will give a status of 0.
// This call is fine but will give a status of 0.
const
transaction
=
await
env
.
l1Messenger
.
sendMessage
(
const
transaction
=
await
env
.
l1Messenger
.
sendMessage
(
predeploys
.
Lib_AddressManager
,
predeploys
.
Lib_AddressManager
,
getContractInterface
(
getContractInterface
(
'
Lib_AddressManager
'
).
encodeFunctionData
(
'
Lib_AddressManager
'
'
getAddress
'
,
).
encodeFunctionData
(
'
getAddress
'
,
[
'
whatever
'
]),
[
'
whatever
'
]
),
5000000
5000000
)
)
...
...
integration-tests/test/fee-payment.spec.ts
View file @
305fff21
...
@@ -42,8 +42,10 @@ describe('Fee Payment Integration Tests', async () => {
...
@@ -42,8 +42,10 @@ describe('Fee Payment Integration Tests', async () => {
other
,
other
,
utils
.
parseEther
(
'
0.5
'
)
utils
.
parseEther
(
'
0.5
'
)
)
)
const
executionGas
=
await
(
env
.
ovmEth
const
executionGas
=
await
(
env
.
ovmEth
.
provider
as
any
).
send
(
.
provider
as
any
).
send
(
'
eth_estimateExecutionGas
'
,
[
tx
,
true
])
'
eth_estimateExecutionGas
'
,
[
tx
,
true
]
)
const
decoded
=
TxGasLimit
.
decode
(
gas
)
const
decoded
=
TxGasLimit
.
decode
(
gas
)
expect
(
BigNumber
.
from
(
executionGas
)).
deep
.
eq
(
decoded
)
expect
(
BigNumber
.
from
(
executionGas
)).
deep
.
eq
(
decoded
)
})
})
...
...
integration-tests/test/native-eth-ovm-calls.spec.ts
View file @
305fff21
...
@@ -118,8 +118,10 @@ describe('Native ETH value integration tests', () => {
...
@@ -118,8 +118,10 @@ describe('Native ETH value integration tests', () => {
'
geth RPC does not match OVM_ETH.balanceOf
'
'
geth RPC does not match OVM_ETH.balanceOf
'
)
)
// query address(this).balance solidity via eth_call as final check
// query address(this).balance solidity via eth_call as final check
const
ovmAddressThisBalance0
=
await
ValueCalls0
.
callStatic
.
getAddressThisBalance
()
const
ovmAddressThisBalance0
=
const
ovmAddressThisBalance01
=
await
ValueCalls1
.
callStatic
.
getAddressThisBalance
()
await
ValueCalls0
.
callStatic
.
getAddressThisBalance
()
const
ovmAddressThisBalance01
=
await
ValueCalls1
.
callStatic
.
getAddressThisBalance
()
expect
(
ovmAddressThisBalance0
).
to
.
deep
.
eq
(
expect
(
ovmAddressThisBalance0
).
to
.
deep
.
eq
(
BigNumber
.
from
(
expectedBalances
[
0
]),
BigNumber
.
from
(
expectedBalances
[
0
]),
'
geth RPC does not match address(this).balance
'
'
geth RPC does not match address(this).balance
'
...
@@ -251,20 +253,16 @@ describe('Native ETH value integration tests', () => {
...
@@ -251,20 +253,16 @@ describe('Native ETH value integration tests', () => {
const
sendAmount
=
10
const
sendAmount
=
10
const
[
const
[
outerSuccess
,
outerReturndata
]
=
outerSuccess
,
await
ValueCalls0
.
callStatic
.
sendWithData
(
outerReturndata
,
]
=
await
ValueCalls0
.
callStatic
.
sendWithData
(
ValueCalls1
.
address
,
ValueCalls1
.
address
,
sendAmount
,
sendAmount
,
ValueCalls1
.
interface
.
encodeFunctionData
(
'
delegateCallToCallValue
'
,
[
ValueCalls1
.
interface
.
encodeFunctionData
(
'
delegateCallToCallValue
'
,
[
ValueContext
.
address
,
ValueContext
.
address
,
])
])
)
)
const
[
const
[
innerSuccess
,
innerReturndata
]
=
innerSuccess
,
ValueCalls1
.
interface
.
decodeFunctionResult
(
innerReturndata
,
]
=
ValueCalls1
.
interface
.
decodeFunctionResult
(
'
delegateCallToCallValue
'
,
'
delegateCallToCallValue
'
,
outerReturndata
outerReturndata
)
)
...
@@ -286,10 +284,8 @@ describe('Native ETH value integration tests', () => {
...
@@ -286,10 +284,8 @@ describe('Native ETH value integration tests', () => {
const
ValueContext
=
await
Factory__ValueContext
.
deploy
()
const
ValueContext
=
await
Factory__ValueContext
.
deploy
()
await
ValueContext
.
deployTransaction
.
wait
()
await
ValueContext
.
deployTransaction
.
wait
()
const
[
const
[
delegatedSuccess
,
delegatedReturndata
]
=
delegatedSuccess
,
await
ValueCalls0
.
callStatic
.
delegateCallToAddressThisBalance
(
delegatedReturndata
,
]
=
await
ValueCalls0
.
callStatic
.
delegateCallToAddressThisBalance
(
ValueContext
.
address
ValueContext
.
address
)
)
...
@@ -298,10 +294,8 @@ describe('Native ETH value integration tests', () => {
...
@@ -298,10 +294,8 @@ describe('Native ETH value integration tests', () => {
})
})
it
(
'
should have correct address(this).balance through ovmDELEGATECALLs to same account
'
,
async
()
=>
{
it
(
'
should have correct address(this).balance through ovmDELEGATECALLs to same account
'
,
async
()
=>
{
const
[
const
[
delegatedSuccess
,
delegatedReturndata
]
=
delegatedSuccess
,
await
ValueCalls0
.
callStatic
.
delegateCallToAddressThisBalance
(
delegatedReturndata
,
]
=
await
ValueCalls0
.
callStatic
.
delegateCallToAddressThisBalance
(
ValueCalls0
.
address
ValueCalls0
.
address
)
)
...
@@ -310,18 +304,15 @@ describe('Native ETH value integration tests', () => {
...
@@ -310,18 +304,15 @@ describe('Native ETH value integration tests', () => {
})
})
it
(
'
should allow delegate calls which preserve msg.value even with no balance going into the inner call
'
,
async
()
=>
{
it
(
'
should allow delegate calls which preserve msg.value even with no balance going into the inner call
'
,
async
()
=>
{
const
Factory__SendETHAwayAndDelegateCall
:
ContractFactory
=
await
ethers
.
getContractFactory
(
const
Factory__SendETHAwayAndDelegateCall
:
ContractFactory
=
'
SendETHAwayAndDelegateCall
'
,
await
ethers
.
getContractFactory
(
'
SendETHAwayAndDelegateCall
'
,
wallet
)
wallet
const
SendETHAwayAndDelegateCall
:
Contract
=
)
await
Factory__SendETHAwayAndDelegateCall
.
deploy
()
const
SendETHAwayAndDelegateCall
:
Contract
=
await
Factory__SendETHAwayAndDelegateCall
.
deploy
()
await
SendETHAwayAndDelegateCall
.
deployTransaction
.
wait
()
await
SendETHAwayAndDelegateCall
.
deployTransaction
.
wait
()
const
value
=
17
const
value
=
17
const
[
const
[
delegatedSuccess
,
delegatedReturndata
]
=
delegatedSuccess
,
await
SendETHAwayAndDelegateCall
.
callStatic
.
emptySelfAndDelegateCall
(
delegatedReturndata
,
]
=
await
SendETHAwayAndDelegateCall
.
callStatic
.
emptySelfAndDelegateCall
(
ValueCalls0
.
address
,
ValueCalls0
.
address
,
ValueCalls0
.
interface
.
encodeFunctionData
(
'
getCallValue
'
),
ValueCalls0
.
interface
.
encodeFunctionData
(
'
getCallValue
'
),
{
{
...
@@ -343,8 +334,10 @@ describe('Native ETH value integration tests', () => {
...
@@ -343,8 +334,10 @@ describe('Native ETH value integration tests', () => {
getContractInterface
(
'
OVM_ExecutionManager
'
,
false
),
getContractInterface
(
'
OVM_ExecutionManager
'
,
false
),
env
.
l1Wallet
.
provider
env
.
l1Wallet
.
provider
)
)
const
CALL_WITH_VALUE_INTRINSIC_GAS_BIGNUM
=
await
OVM_ExecutionManager
.
CALL_WITH_VALUE_INTRINSIC_GAS
()
const
CALL_WITH_VALUE_INTRINSIC_GAS_BIGNUM
=
CALL_WITH_VALUE_INTRINSIC_GAS
=
CALL_WITH_VALUE_INTRINSIC_GAS_BIGNUM
.
toNumber
()
await
OVM_ExecutionManager
.
CALL_WITH_VALUE_INTRINSIC_GAS
()
CALL_WITH_VALUE_INTRINSIC_GAS
=
CALL_WITH_VALUE_INTRINSIC_GAS_BIGNUM
.
toNumber
()
const
Factory__ValueGasMeasurer
=
await
ethers
.
getContractFactory
(
const
Factory__ValueGasMeasurer
=
await
ethers
.
getContractFactory
(
'
ValueGasMeasurer
'
,
'
ValueGasMeasurer
'
,
...
@@ -357,7 +350,8 @@ describe('Native ETH value integration tests', () => {
...
@@ -357,7 +350,8 @@ describe('Native ETH value integration tests', () => {
it
(
'
a call with value to an empty account consumes <= the intrinsic gas including a buffer
'
,
async
()
=>
{
it
(
'
a call with value to an empty account consumes <= the intrinsic gas including a buffer
'
,
async
()
=>
{
const
value
=
1
const
value
=
1
const
gasLimit
=
1
_000_000
const
gasLimit
=
1
_000_000
const
minimalSendGas
=
await
ValueGasMeasurer
.
callStatic
.
measureGasOfTransferingEthViaCall
(
const
minimalSendGas
=
await
ValueGasMeasurer
.
callStatic
.
measureGasOfTransferingEthViaCall
(
ethers
.
constants
.
AddressZero
,
ethers
.
constants
.
AddressZero
,
value
,
value
,
gasLimit
,
gasLimit
,
...
@@ -384,7 +378,8 @@ describe('Native ETH value integration tests', () => {
...
@@ -384,7 +378,8 @@ describe('Native ETH value integration tests', () => {
const
value
=
1
const
value
=
1
const
gasLimit
=
1
_000_000
const
gasLimit
=
1
_000_000
// A revert, causing the ETH to be sent back, should consume the minimal possible gas for a nonzero ETH send
// A revert, causing the ETH to be sent back, should consume the minimal possible gas for a nonzero ETH send
const
minimalSendGas
=
await
ValueGasMeasurer
.
callStatic
.
measureGasOfTransferingEthViaCall
(
const
minimalSendGas
=
await
ValueGasMeasurer
.
callStatic
.
measureGasOfTransferingEthViaCall
(
AutoRevert
.
address
,
AutoRevert
.
address
,
value
,
value
,
gasLimit
,
gasLimit
,
...
@@ -398,18 +393,15 @@ describe('Native ETH value integration tests', () => {
...
@@ -398,18 +393,15 @@ describe('Native ETH value integration tests', () => {
})
})
it
(
'
a value call passing less than the intrinsic gas should appear to revert
'
,
async
()
=>
{
it
(
'
a value call passing less than the intrinsic gas should appear to revert
'
,
async
()
=>
{
const
Factory__PayableConstant
:
ContractFactory
=
await
ethers
.
getContractFactory
(
const
Factory__PayableConstant
:
ContractFactory
=
'
PayableConstant
'
,
await
ethers
.
getContractFactory
(
'
PayableConstant
'
,
wallet
)
wallet
const
PayableConstant
:
Contract
=
)
await
Factory__PayableConstant
.
deploy
()
const
PayableConstant
:
Contract
=
await
Factory__PayableConstant
.
deploy
()
await
PayableConstant
.
deployTransaction
.
wait
()
await
PayableConstant
.
deployTransaction
.
wait
()
const
sendAmount
=
15
const
sendAmount
=
15
const
[
const
[
success
,
returndata
]
=
success
,
await
ValueCalls0
.
callStatic
.
sendWithDataAndGas
(
returndata
,
]
=
await
ValueCalls0
.
callStatic
.
sendWithDataAndGas
(
PayableConstant
.
address
,
PayableConstant
.
address
,
sendAmount
,
sendAmount
,
PayableConstant
.
interface
.
encodeFunctionData
(
'
returnValue
'
),
PayableConstant
.
interface
.
encodeFunctionData
(
'
returnValue
'
),
...
@@ -424,19 +416,15 @@ describe('Native ETH value integration tests', () => {
...
@@ -424,19 +416,15 @@ describe('Native ETH value integration tests', () => {
})
})
it
(
'
a value call which runs out of gas does not out-of-gas the parent
'
,
async
()
=>
{
it
(
'
a value call which runs out of gas does not out-of-gas the parent
'
,
async
()
=>
{
const
Factory__TestOOG
:
ContractFactory
=
await
ethers
.
getContractFactory
(
const
Factory__TestOOG
:
ContractFactory
=
'
TestOOG
'
,
await
ethers
.
getContractFactory
(
'
TestOOG
'
,
wallet
)
wallet
)
const
TestOOG
:
Contract
=
await
Factory__TestOOG
.
deploy
()
const
TestOOG
:
Contract
=
await
Factory__TestOOG
.
deploy
()
await
TestOOG
.
deployTransaction
.
wait
()
await
TestOOG
.
deployTransaction
.
wait
()
const
sendAmount
=
15
const
sendAmount
=
15
// Implicitly test that this call is not rejected
// Implicitly test that this call is not rejected
const
[
const
[
success
,
returndata
]
=
success
,
await
ValueCalls0
.
callStatic
.
sendWithDataAndGas
(
returndata
,
]
=
await
ValueCalls0
.
callStatic
.
sendWithDataAndGas
(
TestOOG
.
address
,
TestOOG
.
address
,
sendAmount
,
sendAmount
,
TestOOG
.
interface
.
encodeFunctionData
(
'
runOutOfGas
'
),
TestOOG
.
interface
.
encodeFunctionData
(
'
runOutOfGas
'
),
...
...
integration-tests/test/native-eth.spec.ts
View file @
305fff21
...
@@ -325,12 +325,8 @@ describe('Native ETH Integration Tests', async () => {
...
@@ -325,12 +325,8 @@ describe('Native ETH Integration Tests', async () => {
expect
(
receipt
.
events
.
length
).
to
.
equal
(
4
)
expect
(
receipt
.
events
.
length
).
to
.
equal
(
4
)
// The first transfer event is fee payment
// The first transfer event is fee payment
const
[
const
[,
firstTransferEvent
,
secondTransferEvent
,
depositEvent
]
=
,
receipt
.
events
firstTransferEvent
,
secondTransferEvent
,
depositEvent
,
]
=
receipt
.
events
expect
(
firstTransferEvent
.
event
).
to
.
equal
(
'
Transfer
'
)
expect
(
firstTransferEvent
.
event
).
to
.
equal
(
'
Transfer
'
)
expect
(
firstTransferEvent
.
args
.
from
).
to
.
equal
(
env
.
l2Wallet
.
address
)
expect
(
firstTransferEvent
.
args
.
from
).
to
.
equal
(
env
.
l2Wallet
.
address
)
...
...
integration-tests/test/ovmcontext.spec.ts
View file @
305fff21
...
@@ -49,9 +49,8 @@ describe('OVM Context: Layer 2 EVM Context', () => {
...
@@ -49,9 +49,8 @@ describe('OVM Context: Layer 2 EVM Context', () => {
'
OVM_CanonicalTransactionChain
'
'
OVM_CanonicalTransactionChain
'
)
)
CanonicalTransactionChain
=
CanonicalTransactionChainFactory
.
connect
(
CanonicalTransactionChain
=
l1Wallet
CanonicalTransactionChainFactory
.
connect
(
l1Wallet
).
attach
(
ctcAddress
)
).
attach
(
ctcAddress
)
const
OVMMulticallFactory
=
await
ethers
.
getContractFactory
(
const
OVMMulticallFactory
=
await
ethers
.
getContractFactory
(
'
OVMMulticall
'
,
'
OVMMulticall
'
,
...
...
integration-tests/test/rpc.spec.ts
View file @
305fff21
...
@@ -208,10 +208,8 @@ describe('Basic RPC tests', () => {
...
@@ -208,10 +208,8 @@ describe('Basic RPC tests', () => {
it
(
'
should allow eth_calls with nonzero value
'
,
async
()
=>
{
it
(
'
should allow eth_calls with nonzero value
'
,
async
()
=>
{
// Deploy a contract to check msg.value of the call
// Deploy a contract to check msg.value of the call
const
Factory__ValueContext
:
ContractFactory
=
await
ethers
.
getContractFactory
(
const
Factory__ValueContext
:
ContractFactory
=
'
ValueContext
'
,
await
ethers
.
getContractFactory
(
'
ValueContext
'
,
wallet
)
wallet
)
const
ValueContext
:
Contract
=
await
Factory__ValueContext
.
deploy
()
const
ValueContext
:
Contract
=
await
Factory__ValueContext
.
deploy
()
await
ValueContext
.
deployTransaction
.
wait
()
await
ValueContext
.
deployTransaction
.
wait
()
...
...
packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts
View file @
305fff21
...
@@ -152,7 +152,8 @@ describe('BatchSubmitter', () => {
...
@@ -152,7 +152,8 @@ describe('BatchSubmitter', () => {
let
OVM_StateCommitmentChain
:
Contract
let
OVM_StateCommitmentChain
:
Contract
let
l2Provider
:
MockchainProvider
let
l2Provider
:
MockchainProvider
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
const
unwrapped_OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
const
unwrapped_OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
FORCE_INCLUSION_PERIOD_SECONDS
FORCE_INCLUSION_PERIOD_SECONDS
)
)
...
@@ -169,7 +170,8 @@ describe('BatchSubmitter', () => {
...
@@ -169,7 +170,8 @@ describe('BatchSubmitter', () => {
sequencer
sequencer
)
)
const
unwrapped_OVM_StateCommitmentChain
=
await
Factory__OVM_StateCommitmentChain
.
deploy
(
const
unwrapped_OVM_StateCommitmentChain
=
await
Factory__OVM_StateCommitmentChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
0
,
// fraudProofWindowSeconds
0
,
// fraudProofWindowSeconds
0
// sequencerPublishWindowSeconds
0
// sequencerPublishWindowSeconds
...
...
packages/contracts/bin/deploy.ts
View file @
305fff21
...
@@ -31,7 +31,10 @@ const parseEnv = () => {
...
@@ -31,7 +31,10 @@ const parseEnv = () => {
return
{
return
{
l1BlockTimeSeconds
:
ensure
(
'
BLOCK_TIME_SECONDS
'
,
'
number
'
),
l1BlockTimeSeconds
:
ensure
(
'
BLOCK_TIME_SECONDS
'
,
'
number
'
),
ctcForceInclusionPeriodSeconds
:
ensure
(
'
FORCE_INCLUSION_PERIOD_SECONDS
'
,
'
number
'
),
ctcForceInclusionPeriodSeconds
:
ensure
(
'
FORCE_INCLUSION_PERIOD_SECONDS
'
,
'
number
'
),
ctcMaxTransactionGasLimit
:
ensure
(
'
MAX_TRANSACTION_GAS_LIMIT
'
,
'
number
'
),
ctcMaxTransactionGasLimit
:
ensure
(
'
MAX_TRANSACTION_GAS_LIMIT
'
,
'
number
'
),
emMinTransactionGasLimit
:
ensure
(
'
MIN_TRANSACTION_GAS_LIMIT
'
,
'
number
'
),
emMinTransactionGasLimit
:
ensure
(
'
MIN_TRANSACTION_GAS_LIMIT
'
,
'
number
'
),
emMaxtransactionGasLimit
:
ensure
(
'
MAX_TRANSACTION_GAS_LIMIT
'
,
'
number
'
),
emMaxtransactionGasLimit
:
ensure
(
'
MAX_TRANSACTION_GAS_LIMIT
'
,
'
number
'
),
...
@@ -39,7 +42,10 @@ const parseEnv = () => {
...
@@ -39,7 +42,10 @@ const parseEnv = () => {
emSecondsPerEpoch
:
ensure
(
'
ECONDS_PER_EPOCH
'
,
'
number
'
),
emSecondsPerEpoch
:
ensure
(
'
ECONDS_PER_EPOCH
'
,
'
number
'
),
emOvmChainId
:
ensure
(
'
CHAIN_ID
'
,
'
number
'
),
emOvmChainId
:
ensure
(
'
CHAIN_ID
'
,
'
number
'
),
sccFraudProofWindow
:
ensure
(
'
FRAUD_PROOF_WINDOW_SECONDS
'
,
'
number
'
),
sccFraudProofWindow
:
ensure
(
'
FRAUD_PROOF_WINDOW_SECONDS
'
,
'
number
'
),
sccSequencerPublishWindow
:
ensure
(
'
SEQUENCER_PUBLISH_WINDOW_SECONDS
'
,
'
number
'
),
sccSequencerPublishWindow
:
ensure
(
'
SEQUENCER_PUBLISH_WINDOW_SECONDS
'
,
'
number
'
),
}
}
}
}
...
@@ -68,19 +74,25 @@ const main = async () => {
...
@@ -68,19 +74,25 @@ const main = async () => {
// update our CI so this is no longer necessary. But I'm adding it for backwards compat so we can
// update our CI so this is no longer necessary. But I'm adding it for backwards compat so we can
// get the hardhat-deploy stuff merged. Woot.
// get the hardhat-deploy stuff merged. Woot.
const
nicknames
=
{
const
nicknames
=
{
'
Lib_AddressManager
'
:
'
AddressManager
'
,
Lib_AddressManager
:
'
AddressManager
'
,
'
mockOVM_BondManager
'
:
'
OVM_BondManager
'
mockOVM_BondManager
:
'
OVM_BondManager
'
,
}
}
const
contracts
:
any
=
dirtree
(
const
contracts
:
any
=
dirtree
(
path
.
resolve
(
__dirname
,
`../deployments/custom`
)
path
.
resolve
(
__dirname
,
`../deployments/custom`
)
).
children
.
filter
((
child
)
=>
{
)
.
children
.
filter
((
child
)
=>
{
return
child
.
extension
===
'
.json
'
return
child
.
extension
===
'
.json
'
}).
reduce
((
contractsAccumulator
,
child
)
=>
{
})
.
reduce
((
contractsAccumulator
,
child
)
=>
{
const
contractName
=
child
.
name
.
replace
(
'
.json
'
,
''
)
const
contractName
=
child
.
name
.
replace
(
'
.json
'
,
''
)
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires
const
artifact
=
require
(
path
.
resolve
(
__dirname
,
`../deployments/custom/
${
child
.
name
}
`
))
const
artifact
=
require
(
path
.
resolve
(
contractsAccumulator
[
nicknames
[
contractName
]
||
contractName
]
=
artifact
.
address
__dirname
,
`../deployments/custom/
${
child
.
name
}
`
))
contractsAccumulator
[
nicknames
[
contractName
]
||
contractName
]
=
artifact
.
address
return
contractsAccumulator
return
contractsAccumulator
},
{})
},
{})
...
@@ -88,7 +100,7 @@ const main = async () => {
...
@@ -88,7 +100,7 @@ const main = async () => {
contracts
.
Deployer
=
await
deployer
.
getAddress
()
contracts
.
Deployer
=
await
deployer
.
getAddress
()
const
addresses
=
JSON
.
stringify
(
contracts
,
null
,
2
)
const
addresses
=
JSON
.
stringify
(
contracts
,
null
,
2
)
const
dumpsPath
=
path
.
resolve
(
__dirname
,
"
../dist/dumps
"
)
const
dumpsPath
=
path
.
resolve
(
__dirname
,
'
../dist/dumps
'
)
if
(
!
fs
.
existsSync
(
dumpsPath
))
{
if
(
!
fs
.
existsSync
(
dumpsPath
))
{
fs
.
mkdirSync
(
dumpsPath
)
fs
.
mkdirSync
(
dumpsPath
)
}
}
...
...
packages/contracts/bin/take-dump.ts
View file @
305fff21
...
@@ -5,7 +5,8 @@ import * as mkdirp from 'mkdirp'
...
@@ -5,7 +5,8 @@ import * as mkdirp from 'mkdirp'
const
env
=
process
.
env
const
env
=
process
.
env
const
CHAIN_ID
=
env
.
CHAIN_ID
||
'
420
'
const
CHAIN_ID
=
env
.
CHAIN_ID
||
'
420
'
const
GAS_PRICE_ORACLE_OWNER
=
env
.
GAS_PRICE_ORACLE_OWNER
||
'
0x
'
+
'
FF
'
.
repeat
(
20
)
const
GAS_PRICE_ORACLE_OWNER
=
env
.
GAS_PRICE_ORACLE_OWNER
||
'
0x
'
+
'
FF
'
.
repeat
(
20
)
/* Internal Imports */
/* Internal Imports */
import
{
makeStateDump
}
from
'
../src/state-dump/make-dump
'
import
{
makeStateDump
}
from
'
../src/state-dump/make-dump
'
...
@@ -22,7 +23,7 @@ import { RollupDeployConfig } from '../src/contract-deployment'
...
@@ -22,7 +23,7 @@ import { RollupDeployConfig } from '../src/contract-deployment'
gasPriceOracleConfig
:
{
gasPriceOracleConfig
:
{
owner
:
GAS_PRICE_ORACLE_OWNER
,
owner
:
GAS_PRICE_ORACLE_OWNER
,
initialGasPrice
:
0
,
initialGasPrice
:
0
,
}
}
,
}
}
const
dump
=
await
makeStateDump
(
config
as
RollupDeployConfig
)
const
dump
=
await
makeStateDump
(
config
as
RollupDeployConfig
)
...
...
packages/contracts/deploy/008-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
View file @
305fff21
...
@@ -38,7 +38,8 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -38,7 +38,8 @@ const deployFn: DeployFunction = async (hre) => {
await
Proxy__OVM_L1CrossDomainMessenger
.
initialize
(
Lib_AddressManager
.
address
)
await
Proxy__OVM_L1CrossDomainMessenger
.
initialize
(
Lib_AddressManager
.
address
)
const
libAddressManager
=
await
Proxy__OVM_L1CrossDomainMessenger
.
libAddressManager
()
const
libAddressManager
=
await
Proxy__OVM_L1CrossDomainMessenger
.
libAddressManager
()
if
(
libAddressManager
!==
Lib_AddressManager
.
address
)
{
if
(
libAddressManager
!==
Lib_AddressManager
.
address
)
{
throw
new
Error
(
throw
new
Error
(
`\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n`
+
`\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n`
+
...
...
packages/contracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts
View file @
305fff21
...
@@ -65,7 +65,8 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -65,7 +65,8 @@ const deployFn: DeployFunction = async (hre) => {
hre
.
ethers
.
utils
.
hexZeroPad
(
l1MessengerAddress
,
32
)
hre
.
ethers
.
utils
.
hexZeroPad
(
l1MessengerAddress
,
32
)
)
)
// Verify that the slot was set correctly
// Verify that the slot was set correctly
const
l1MessengerStored
=
await
Proxy__WithBridgeInterface
.
callStatic
.
messenger
()
const
l1MessengerStored
=
await
Proxy__WithBridgeInterface
.
callStatic
.
messenger
()
console
.
log
(
'
l1MessengerStored:
'
,
l1MessengerStored
)
console
.
log
(
'
l1MessengerStored:
'
,
l1MessengerStored
)
if
(
l1MessengerStored
!==
l1MessengerAddress
)
{
if
(
l1MessengerStored
!==
l1MessengerAddress
)
{
throw
new
Error
(
throw
new
Error
(
...
@@ -79,7 +80,8 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -79,7 +80,8 @@ const deployFn: DeployFunction = async (hre) => {
hre
.
ethers
.
utils
.
hexZeroPad
(
predeploys
.
OVM_L2StandardBridge
,
32
)
hre
.
ethers
.
utils
.
hexZeroPad
(
predeploys
.
OVM_L2StandardBridge
,
32
)
)
)
// Verify that the slot was set correctly
// Verify that the slot was set correctly
const
l2TokenBridgeStored
=
await
Proxy__WithBridgeInterface
.
callStatic
.
l2TokenBridge
()
const
l2TokenBridgeStored
=
await
Proxy__WithBridgeInterface
.
callStatic
.
l2TokenBridge
()
console
.
log
(
'
l2TokenBridgeStored:
'
,
l2TokenBridgeStored
)
console
.
log
(
'
l2TokenBridgeStored:
'
,
l2TokenBridgeStored
)
if
(
l2TokenBridgeStored
!==
predeploys
.
OVM_L2StandardBridge
)
{
if
(
l2TokenBridgeStored
!==
predeploys
.
OVM_L2StandardBridge
)
{
throw
new
Error
(
throw
new
Error
(
...
...
packages/contracts/src/state-dump/make-dump.ts
View file @
305fff21
...
@@ -189,8 +189,10 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
...
@@ -189,8 +189,10 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
const
contract
=
deploymentResult
.
contracts
[
name
]
const
contract
=
deploymentResult
.
contracts
[
name
]
let
code
:
string
let
code
:
string
if
(
ovmCompiled
.
includes
(
name
))
{
if
(
ovmCompiled
.
includes
(
name
))
{
const
ovmDeployedBytecode
=
getContractDefinition
(
name
,
true
)
const
ovmDeployedBytecode
=
getContractDefinition
(
.
deployedBytecode
name
,
true
).
deployedBytecode
// TODO remove: deployedBytecode is missing the find and replace in solidity
// TODO remove: deployedBytecode is missing the find and replace in solidity
code
=
ovmDeployedBytecode
code
=
ovmDeployedBytecode
.
split
(
.
split
(
...
...
packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2StandardBridge.spec.ts
View file @
305fff21
...
@@ -197,7 +197,9 @@ describe('OVM_L2StandardBridge', () => {
...
@@ -197,7 +197,9 @@ describe('OVM_L2StandardBridge', () => {
let
SmoddedL2Token
:
ModifiableContract
let
SmoddedL2Token
:
ModifiableContract
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
// Deploy a smodded gateway so we can give some balances to withdraw
// Deploy a smodded gateway so we can give some balances to withdraw
SmoddedL2Token
=
await
(
await
smoddit
(
'
L2StandardERC20
'
,
alice
)).
deploy
(
SmoddedL2Token
=
await
(
await
smoddit
(
'
L2StandardERC20
'
,
alice
)
).
deploy
(
OVM_L2StandardBridge
.
address
,
OVM_L2StandardBridge
.
address
,
DUMMY_L1TOKEN_ADDRESS
,
DUMMY_L1TOKEN_ADDRESS
,
'
L2Token
'
,
'
L2Token
'
,
...
...
packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
View file @
305fff21
...
@@ -93,7 +93,8 @@ describe('OVM_L1CrossDomainMessenger', () => {
...
@@ -93,7 +93,8 @@ describe('OVM_L1CrossDomainMessenger', () => {
Factory__OVM_L1CrossDomainMessenger
=
await
ethers
.
getContractFactory
(
Factory__OVM_L1CrossDomainMessenger
=
await
ethers
.
getContractFactory
(
'
OVM_L1CrossDomainMessenger
'
'
OVM_L1CrossDomainMessenger
'
)
)
OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
FORCE_INCLUSION_PERIOD_SECONDS
,
FORCE_INCLUSION_PERIOD_SECONDS
,
FORCE_INCLUSION_PERIOD_BLOCKS
,
FORCE_INCLUSION_PERIOD_BLOCKS
,
...
@@ -127,7 +128,8 @@ describe('OVM_L1CrossDomainMessenger', () => {
...
@@ -127,7 +128,8 @@ describe('OVM_L1CrossDomainMessenger', () => {
let
OVM_L1CrossDomainMessenger
:
Contract
let
OVM_L1CrossDomainMessenger
:
Contract
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
const
xDomainMessengerImpl
=
await
Factory__OVM_L1CrossDomainMessenger
.
deploy
()
const
xDomainMessengerImpl
=
await
Factory__OVM_L1CrossDomainMessenger
.
deploy
()
// We use an upgradable proxy for the XDomainMessenger--deploy & set up the proxy.
// We use an upgradable proxy for the XDomainMessenger--deploy & set up the proxy.
OVM_L1CrossDomainMessenger
=
await
deployProxyXDomainMessenger
(
OVM_L1CrossDomainMessenger
=
await
deployProxyXDomainMessenger
(
AddressManager
,
AddressManager
,
...
@@ -469,9 +471,8 @@ describe('OVM_L1CrossDomainMessenger', () => {
...
@@ -469,9 +471,8 @@ describe('OVM_L1CrossDomainMessenger', () => {
describe
(
'
blockMessage and allowMessage
'
,
()
=>
{
describe
(
'
blockMessage and allowMessage
'
,
()
=>
{
it
(
'
should revert if called by an account other than the owner
'
,
async
()
=>
{
it
(
'
should revert if called by an account other than the owner
'
,
async
()
=>
{
const
OVM_L1CrossDomainMessenger2
=
OVM_L1CrossDomainMessenger
.
connect
(
const
OVM_L1CrossDomainMessenger2
=
signer2
OVM_L1CrossDomainMessenger
.
connect
(
signer2
)
)
await
expect
(
await
expect
(
OVM_L1CrossDomainMessenger2
.
blockMessage
(
keccak256
(
calldata
))
OVM_L1CrossDomainMessenger2
.
blockMessage
(
keccak256
(
calldata
))
).
to
.
be
.
revertedWith
(
'
Ownable: caller is not the owner
'
)
).
to
.
be
.
revertedWith
(
'
Ownable: caller is not the owner
'
)
...
...
packages/contracts/test/contracts/OVM/bridge/base/OVM_L2CrossDomainMessenger.spec.ts
View file @
305fff21
...
@@ -71,9 +71,8 @@ describe('OVM_L2CrossDomainMessenger', () => {
...
@@ -71,9 +71,8 @@ describe('OVM_L2CrossDomainMessenger', () => {
let
OVM_L2CrossDomainMessenger
:
Contract
let
OVM_L2CrossDomainMessenger
:
Contract
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
OVM_L2CrossDomainMessenger
=
await
Factory__OVM_L2CrossDomainMessenger
.
deploy
(
OVM_L2CrossDomainMessenger
=
AddressManager
.
address
await
Factory__OVM_L2CrossDomainMessenger
.
deploy
(
AddressManager
.
address
)
)
})
})
describe
(
'
sendMessage
'
,
()
=>
{
describe
(
'
sendMessage
'
,
()
=>
{
...
@@ -183,7 +182,9 @@ describe('OVM_L2CrossDomainMessenger', () => {
...
@@ -183,7 +182,9 @@ describe('OVM_L2CrossDomainMessenger', () => {
// There should be no 'relayedMessage' event logged in the receipt.
// There should be no 'relayedMessage' event logged in the receipt.
const
logs
=
(
const
logs
=
(
await
Mock__OVM_L2ToL1MessagePasser
.
provider
.
getTransactionReceipt
(
await
Mock__OVM_L2ToL1MessagePasser
.
provider
.
getTransactionReceipt
(
(
await
resProm
).
hash
(
await
resProm
).
hash
)
)
).
logs
).
logs
expect
(
logs
).
to
.
deep
.
equal
([])
expect
(
logs
).
to
.
deep
.
equal
([])
...
@@ -204,7 +205,8 @@ describe('OVM_L2CrossDomainMessenger', () => {
...
@@ -204,7 +205,8 @@ describe('OVM_L2CrossDomainMessenger', () => {
Mock__OVM_L1CrossDomainMessenger
.
address
Mock__OVM_L1CrossDomainMessenger
.
address
)
)
const
reentrantMessage
=
OVM_L2CrossDomainMessenger
.
interface
.
encodeFunctionData
(
const
reentrantMessage
=
OVM_L2CrossDomainMessenger
.
interface
.
encodeFunctionData
(
'
relayMessage
'
,
'
relayMessage
'
,
[
target
,
sender
,
message
,
1
]
[
target
,
sender
,
message
,
1
]
)
)
...
...
packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts
View file @
305fff21
...
@@ -98,7 +98,8 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
...
@@ -98,7 +98,8 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
let
OVM_CanonicalTransactionChain
:
Contract
let
OVM_CanonicalTransactionChain
:
Contract
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
FORCE_INCLUSION_PERIOD_SECONDS
,
FORCE_INCLUSION_PERIOD_SECONDS
,
FORCE_INCLUSION_PERIOD_BLOCKS
,
FORCE_INCLUSION_PERIOD_BLOCKS
,
...
@@ -132,9 +133,8 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
...
@@ -132,9 +133,8 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
describe
(
'
appendSequencerBatch [ @skip-on-coverage ]
'
,
()
=>
{
describe
(
'
appendSequencerBatch [ @skip-on-coverage ]
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
OVM_CanonicalTransactionChain
=
OVM_CanonicalTransactionChain
.
connect
(
OVM_CanonicalTransactionChain
=
sequencer
OVM_CanonicalTransactionChain
.
connect
(
sequencer
)
)
})
})
it
(
'
200 transactions in a single context
'
,
async
()
=>
{
it
(
'
200 transactions in a single context
'
,
async
()
=>
{
...
...
packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts
View file @
305fff21
...
@@ -147,7 +147,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -147,7 +147,8 @@ describe('OVM_CanonicalTransactionChain', () => {
let
OVM_CanonicalTransactionChain
:
Contract
let
OVM_CanonicalTransactionChain
:
Contract
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
OVM_CanonicalTransactionChain
=
await
Factory__OVM_CanonicalTransactionChain
.
deploy
(
AddressManager
.
address
,
AddressManager
.
address
,
FORCE_INCLUSION_PERIOD_SECONDS
,
FORCE_INCLUSION_PERIOD_SECONDS
,
FORCE_INCLUSION_PERIOD_BLOCKS
,
FORCE_INCLUSION_PERIOD_BLOCKS
,
...
@@ -184,7 +185,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -184,7 +185,8 @@ describe('OVM_CanonicalTransactionChain', () => {
const
gasLimit
=
500
_000
const
gasLimit
=
500
_000
it
(
'
should revert when trying to input more data than the max data size
'
,
async
()
=>
{
it
(
'
should revert when trying to input more data than the max data size
'
,
async
()
=>
{
const
MAX_ROLLUP_TX_SIZE
=
await
OVM_CanonicalTransactionChain
.
MAX_ROLLUP_TX_SIZE
()
const
MAX_ROLLUP_TX_SIZE
=
await
OVM_CanonicalTransactionChain
.
MAX_ROLLUP_TX_SIZE
()
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
MAX_ROLLUP_TX_SIZE
+
1
)
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
MAX_ROLLUP_TX_SIZE
+
1
)
await
expect
(
await
expect
(
...
@@ -207,7 +209,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -207,7 +209,8 @@ describe('OVM_CanonicalTransactionChain', () => {
})
})
it
(
'
should revert if gas limit parameter is not at least MIN_ROLLUP_TX_GAS
'
,
async
()
=>
{
it
(
'
should revert if gas limit parameter is not at least MIN_ROLLUP_TX_GAS
'
,
async
()
=>
{
const
MIN_ROLLUP_TX_GAS
=
await
OVM_CanonicalTransactionChain
.
MIN_ROLLUP_TX_GAS
()
const
MIN_ROLLUP_TX_GAS
=
await
OVM_CanonicalTransactionChain
.
MIN_ROLLUP_TX_GAS
()
const
customGasLimit
=
MIN_ROLLUP_TX_GAS
/
2
const
customGasLimit
=
MIN_ROLLUP_TX_GAS
/
2
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
1234
)
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
1234
)
...
@@ -217,7 +220,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -217,7 +220,8 @@ describe('OVM_CanonicalTransactionChain', () => {
})
})
it
(
'
should revert if transaction gas limit does not cover rollup burn
'
,
async
()
=>
{
it
(
'
should revert if transaction gas limit does not cover rollup burn
'
,
async
()
=>
{
const
L2_GAS_DISCOUNT_DIVISOR
=
await
OVM_CanonicalTransactionChain
.
L2_GAS_DISCOUNT_DIVISOR
()
const
L2_GAS_DISCOUNT_DIVISOR
=
await
OVM_CanonicalTransactionChain
.
L2_GAS_DISCOUNT_DIVISOR
()
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
1234
)
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
1234
)
await
expect
(
await
expect
(
...
@@ -663,9 +667,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -663,9 +667,8 @@ describe('OVM_CanonicalTransactionChain', () => {
describe
(
'
appendSequencerBatch
'
,
()
=>
{
describe
(
'
appendSequencerBatch
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
OVM_CanonicalTransactionChain
=
OVM_CanonicalTransactionChain
.
connect
(
OVM_CanonicalTransactionChain
=
sequencer
OVM_CanonicalTransactionChain
.
connect
(
sequencer
)
)
})
})
it
(
'
should revert if expected start does not match current total batches
'
,
async
()
=>
{
it
(
'
should revert if expected start does not match current total batches
'
,
async
()
=>
{
...
@@ -757,7 +760,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -757,7 +760,8 @@ describe('OVM_CanonicalTransactionChain', () => {
})
})
it
(
'
should revert when trying to input more data than the max data size
'
,
async
()
=>
{
it
(
'
should revert when trying to input more data than the max data size
'
,
async
()
=>
{
const
MAX_ROLLUP_TX_SIZE
=
await
OVM_CanonicalTransactionChain
.
MAX_ROLLUP_TX_SIZE
()
const
MAX_ROLLUP_TX_SIZE
=
await
OVM_CanonicalTransactionChain
.
MAX_ROLLUP_TX_SIZE
()
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
MAX_ROLLUP_TX_SIZE
+
1
)
const
data
=
'
0x
'
+
'
12
'
.
repeat
(
MAX_ROLLUP_TX_SIZE
+
1
)
const
timestamp
=
await
getEthTime
(
ethers
.
provider
)
const
timestamp
=
await
getEthTime
(
ethers
.
provider
)
...
@@ -965,9 +969,8 @@ describe('OVM_CanonicalTransactionChain', () => {
...
@@ -965,9 +969,8 @@ describe('OVM_CanonicalTransactionChain', () => {
gasLimit
,
gasLimit
,
data
data
)
)
queueElements
[
queueElements
[
i
]
=
i
await
OVM_CanonicalTransactionChain
.
getQueueElement
(
i
)
]
=
await
OVM_CanonicalTransactionChain
.
getQueueElement
(
i
)
// this is a valid context for this TX
// this is a valid context for this TX
validContexts
[
i
]
=
{
validContexts
[
i
]
=
{
numSequencedTransactions
:
1
,
numSequencedTransactions
:
1
,
...
...
packages/contracts/test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts
View file @
305fff21
...
@@ -170,7 +170,8 @@ describe('OVM_StateCommitmentChain', () => {
...
@@ -170,7 +170,8 @@ describe('OVM_StateCommitmentChain', () => {
describe
(
'
when outside sequencer publish window
'
,
()
=>
{
describe
(
'
when outside sequencer publish window
'
,
()
=>
{
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
const
SEQUENCER_PUBLISH_WINDOW
=
await
OVM_StateCommitmentChain
.
SEQUENCER_PUBLISH_WINDOW
()
const
SEQUENCER_PUBLISH_WINDOW
=
await
OVM_StateCommitmentChain
.
SEQUENCER_PUBLISH_WINDOW
()
await
increaseEthTime
(
await
increaseEthTime
(
ethers
.
provider
,
ethers
.
provider
,
SEQUENCER_PUBLISH_WINDOW
.
toNumber
()
+
1
SEQUENCER_PUBLISH_WINDOW
.
toNumber
()
+
1
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts
View file @
305fff21
...
@@ -68,9 +68,9 @@ describe('OVM_ExecutionManager gas consumption', () => {
...
@@ -68,9 +68,9 @@ describe('OVM_ExecutionManager gas consumption', () => {
// deploy the state manager and mock it for the state transitioner
// deploy the state manager and mock it for the state transitioner
MOCK__STATE_MANAGER
=
await
smockit
(
MOCK__STATE_MANAGER
=
await
smockit
(
await
(
await
ethers
.
getContractFactory
(
'
OVM_StateManager
'
)).
deploy
(
await
(
NON_ZERO_ADDRESS
await
ethers
.
getContractFactory
(
'
OVM_StateManager
'
)
)
)
.
deploy
(
NON_ZERO_ADDRESS
)
)
)
// Setup the SM to satisfy all the checks executed during EM.run()
// Setup the SM to satisfy all the checks executed during EM.run()
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/nuisance-gas.spec.ts
View file @
305fff21
...
@@ -51,8 +51,7 @@ const test_nuisanceGas: TestDefinition = {
...
@@ -51,8 +51,7 @@ const test_nuisanceGas: TestDefinition = {
},
},
subTests
:
[
subTests
:
[
{
{
name
:
name
:
'
ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE
'
,
'
ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE
'
,
postState
:
{
postState
:
{
ExecutionManager
:
{
ExecutionManager
:
{
messageRecord
:
{
messageRecord
:
{
...
@@ -88,8 +87,7 @@ const test_nuisanceGas: TestDefinition = {
...
@@ -88,8 +87,7 @@ const test_nuisanceGas: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE twice for two unique ovmCALLS
'
,
'
ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE twice for two unique ovmCALLS
'
,
postState
:
{
postState
:
{
ExecutionManager
:
{
ExecutionManager
:
{
messageRecord
:
{
messageRecord
:
{
...
@@ -140,8 +138,7 @@ const test_nuisanceGas: TestDefinition = {
...
@@ -140,8 +138,7 @@ const test_nuisanceGas: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL consumes all allotted nuisance gas if code contract throws unknown exception
'
,
'
ovmCALL consumes all allotted nuisance gas if code contract throws unknown exception
'
,
postState
:
{
postState
:
{
ExecutionManager
:
{
ExecutionManager
:
{
messageRecord
:
{
messageRecord
:
{
...
@@ -178,8 +175,7 @@ const test_nuisanceGas: TestDefinition = {
...
@@ -178,8 +175,7 @@ const test_nuisanceGas: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCREATE consumes all allotted nuisance gas if creation code throws data-less exception
'
,
'
ovmCREATE consumes all allotted nuisance gas if creation code throws data-less exception
'
,
parameters
:
[
parameters
:
[
{
{
name
:
'
give 1/2 gas to ovmCALL => ovmCREATE, evmINVALID
'
,
name
:
'
give 1/2 gas to ovmCALL => ovmCREATE, evmINVALID
'
,
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCALL.spec.ts
View file @
305fff21
...
@@ -90,8 +90,7 @@ const test_ovmCALL: TestDefinition = {
...
@@ -90,8 +90,7 @@ const test_ovmCALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmSSTORE + ovmSLOAD, ovmCALL(ADDRESS_1) => ovmSLOAD
'
,
'
ovmCALL(ADDRESS_1) => ovmSSTORE + ovmSLOAD, ovmCALL(ADDRESS_1) => ovmSLOAD
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -140,8 +139,7 @@ const test_ovmCALL: TestDefinition = {
...
@@ -140,8 +139,7 @@ const test_ovmCALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmADDRESS + ovmCALLER
'
,
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmADDRESS + ovmCALLER
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts
View file @
305fff21
...
@@ -401,8 +401,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -401,8 +401,7 @@ const test_ovmCREATE: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCREATE => ovmSSTORE, ovmCALL(CREATED) => ovmSLOAD(EXIST) + ovmSLOAD(NONEXIST)
'
,
'
ovmCREATE => ovmSSTORE, ovmCALL(CREATED) => ovmSLOAD(EXIST) + ovmSLOAD(NONEXIST)
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCREATE
'
,
functionName
:
'
ovmCREATE
'
,
...
@@ -450,8 +449,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -450,8 +449,7 @@ const test_ovmCREATE: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCREATE => ovmCALL(ADDRESS_1) => ovmSSTORE, ovmCALL(ADDRESS_1) => ovmSLOAD
'
,
'
ovmCREATE => ovmCALL(ADDRESS_1) => ovmSSTORE, ovmCALL(ADDRESS_1) => ovmSLOAD
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCREATE
'
,
functionName
:
'
ovmCREATE
'
,
...
@@ -503,8 +501,7 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -503,8 +501,7 @@ const test_ovmCREATE: TestDefinition = {
{
{
// TODO: appears to be failing due to a smoddit issue
// TODO: appears to be failing due to a smoddit issue
skip
:
true
,
skip
:
true
,
name
:
name
:
'
ovmCREATE => (ovmCALL(ADDRESS_2) => ovmSSTORE) + ovmREVERT, ovmCALL(ADDRESS_2) => ovmSLOAD
'
,
'
ovmCREATE => (ovmCALL(ADDRESS_2) => ovmSSTORE) + ovmREVERT, ovmCALL(ADDRESS_2) => ovmSLOAD
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCREATE
'
,
functionName
:
'
ovmCREATE
'
,
...
@@ -775,7 +772,8 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -775,7 +772,8 @@ const test_ovmCREATE: TestDefinition = {
contractStorage
:
{
contractStorage
:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
// initialized? true, allowArbitraryDeployment? false
// initialized? true, allowArbitraryDeployment? false
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
getStorageXOR
(
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
getStorageXOR
(
'
0x0000000000000000000000000000000000000000000000000000000000000001
'
'
0x0000000000000000000000000000000000000000000000000000000000000001
'
),
),
// non-whitelisted deployer is whitelisted? false
// non-whitelisted deployer is whitelisted? false
...
@@ -905,7 +903,8 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -905,7 +903,8 @@ const test_ovmCREATE: TestDefinition = {
contractStorage
:
{
contractStorage
:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
// initialized? true, allowArbitraryDeployment? true
// initialized? true, allowArbitraryDeployment? true
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
getStorageXOR
(
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
getStorageXOR
(
'
0x0000000000000000000000000000000000000000000000000000000000000101
'
'
0x0000000000000000000000000000000000000000000000000000000000000101
'
),
),
// non-whitelisted deployer is whitelisted? false
// non-whitelisted deployer is whitelisted? false
...
@@ -946,7 +945,8 @@ const test_ovmCREATE: TestDefinition = {
...
@@ -946,7 +945,8 @@ const test_ovmCREATE: TestDefinition = {
subSteps
:
[],
subSteps
:
[],
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
CREATED_BY_NON_WHITELISTED_DEPLOYER
,
expectedReturnValue
:
CREATED_BY_NON_WHITELISTED_DEPLOYER
,
},
},
],
],
},
},
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATEEOA.spec.ts
View file @
305fff21
...
@@ -54,10 +54,8 @@ const test_ovmCREATEEOA: TestDefinition = {
...
@@ -54,10 +54,8 @@ const test_ovmCREATEEOA: TestDefinition = {
_messageHash
:
_messageHash
:
'
0x92d658d25f963af824e9d4bd533c165773d4a694a67d88135d119d5bca97c001
'
,
'
0x92d658d25f963af824e9d4bd533c165773d4a694a67d88135d119d5bca97c001
'
,
_v
:
1
,
_v
:
1
,
_r
:
_r
:
'
0x73757c671fae2c3fb6825766c724b7715720bda4b309d3612f2c623364556967
'
,
'
0x73757c671fae2c3fb6825766c724b7715720bda4b309d3612f2c623364556967
'
,
_s
:
'
0x2fc9b7222783390b9f10e22e92a52871beaff2613193d6e2dbf18d0e2d2eb8ff
'
,
_s
:
'
0x2fc9b7222783390b9f10e22e92a52871beaff2613193d6e2dbf18d0e2d2eb8ff
'
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
undefined
,
expectedReturnValue
:
undefined
,
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmDELEGATECALL.spec.ts
View file @
305fff21
...
@@ -87,8 +87,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
...
@@ -87,8 +87,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmCALLER
'
,
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmCALLER
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -127,8 +126,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
...
@@ -127,8 +126,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => (ovmDELEGATECALL(ADDRESS_2) => ovmSSTORE) + ovmSLOAD
'
,
'
ovmCALL(ADDRESS_1) => (ovmDELEGATECALL(ADDRESS_2) => ovmSSTORE) + ovmSLOAD
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -202,8 +200,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
...
@@ -202,8 +200,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmDELEGATECALL(ADDRESS_4) => ovmCALLER
'
,
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmDELEGATECALL(ADDRESS_4) => ovmCALLER
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -252,8 +249,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
...
@@ -252,8 +249,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmDELEGATECALL(ADDRESS_4) => ovmADDRESS
'
,
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmDELEGATECALL(ADDRESS_4) => ovmADDRESS
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -302,8 +298,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
...
@@ -302,8 +298,7 @@ const test_ovmDELEGATECALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmDELEGATECALL(ADDRESS_4) => ovmCREATE
'
,
'
ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2) => ovmDELEGATECALL(ADDRESS_3) => ovmDELEGATECALL(ADDRESS_4) => ovmCREATE
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmSTATICCALL.spec.ts
View file @
305fff21
...
@@ -192,8 +192,7 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -192,8 +192,7 @@ const test_ovmSTATICCALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmSTATICCALL(ADDRESS_2) => ovmCALL(ADDRESS_3) => ovmSSTORE
'
,
'
ovmCALL(ADDRESS_1) => ovmSTATICCALL(ADDRESS_2) => ovmCALL(ADDRESS_3) => ovmSSTORE
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -240,8 +239,7 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -240,8 +239,7 @@ const test_ovmSTATICCALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmSTATICCALL(ADDRESS_2) => ovmCALL(ADDRESS_3) => ovmSLOAD
'
,
'
ovmCALL(ADDRESS_1) => ovmSTATICCALL(ADDRESS_2) => ovmCALL(ADDRESS_3) => ovmSLOAD
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
@@ -284,8 +282,7 @@ const test_ovmSTATICCALL: TestDefinition = {
...
@@ -284,8 +282,7 @@ const test_ovmSTATICCALL: TestDefinition = {
],
],
},
},
{
{
name
:
name
:
'
ovmCALL(ADDRESS_1) => ovmSTATICCALL(ADDRESS_2) => ovmCALL(ADDRESS_3) => ovmCREATE
'
,
'
ovmCALL(ADDRESS_1) => ovmSTATICCALL(ADDRESS_2) => ovmCALL(ADDRESS_3) => ovmCREATE
'
,
steps
:
[
steps
:
[
{
{
functionName
:
'
ovmCALL
'
,
functionName
:
'
ovmCALL
'
,
...
...
packages/contracts/test/contracts/OVM/verification/OVM_BondManager.spec.ts
View file @
305fff21
...
@@ -67,10 +67,9 @@ describe('OVM_BondManager', () => {
...
@@ -67,10 +67,9 @@ describe('OVM_BondManager', () => {
token
=
await
(
await
deployer
.
getContractFactory
(
'
TestERC20
'
)).
deploy
()
token
=
await
(
await
deployer
.
getContractFactory
(
'
TestERC20
'
)).
deploy
()
await
token
.
mint
(
sender
,
ethers
.
utils
.
parseEther
(
'
100
'
))
await
token
.
mint
(
sender
,
ethers
.
utils
.
parseEther
(
'
100
'
))
bondManager
=
await
(
await
smoddit
(
'
OVM_BondManager
'
)).
deploy
(
bondManager
=
await
(
token
.
address
,
await
smoddit
(
'
OVM_BondManager
'
)
manager
.
address
).
deploy
(
token
.
address
,
manager
.
address
)
)
await
manager
.
setAddress
(
'
OVM_BondManager
'
,
bondManager
.
address
)
await
manager
.
setAddress
(
'
OVM_BondManager
'
,
bondManager
.
address
)
await
fraudVerifier
.
setBondManager
(
bondManager
.
address
)
await
fraudVerifier
.
setBondManager
(
bondManager
.
address
)
})
})
...
...
packages/contracts/test/contracts/OVM/verification/OVM_StateTransitionerFactory.spec.ts
View file @
305fff21
...
@@ -35,9 +35,8 @@ describe('OVM_StateTransitionerFactory', () => {
...
@@ -35,9 +35,8 @@ describe('OVM_StateTransitionerFactory', () => {
let
OVM_StateTransitionerFactory
:
Contract
let
OVM_StateTransitionerFactory
:
Contract
let
Mock__OVM_StateManagerFactory
:
MockContract
let
Mock__OVM_StateManagerFactory
:
MockContract
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
OVM_StateTransitionerFactory
=
await
Factory__OVM_StateTransitionerFactory
.
deploy
(
OVM_StateTransitionerFactory
=
AddressManager
.
address
await
Factory__OVM_StateTransitionerFactory
.
deploy
(
AddressManager
.
address
)
)
Mock__OVM_StateManagerFactory
=
await
smockit
(
'
OVM_StateManagerFactory
'
)
Mock__OVM_StateManagerFactory
=
await
smockit
(
'
OVM_StateManagerFactory
'
)
Mock__OVM_StateManagerFactory
.
smocked
.
create
.
will
.
return
.
with
(
Mock__OVM_StateManagerFactory
.
smocked
.
create
.
will
.
return
.
with
(
...
...
packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts
View file @
305fff21
...
@@ -44,7 +44,8 @@ describe('Lib_RLPWriter', () => {
...
@@ -44,7 +44,8 @@ describe('Lib_RLPWriter', () => {
const
randomAddress
=
'
0x1234123412341234123412341234123412341234
'
const
randomAddress
=
'
0x1234123412341234123412341234123412341234
'
const
rlpEncodedRandomAddress
=
const
rlpEncodedRandomAddress
=
'
0x941234123412341234123412341234123412341234
'
'
0x941234123412341234123412341234123412341234
'
const
encoded
=
await
Lib_RLPWriter
.
callStatic
.
writeAddressWithTaintedMemory
(
const
encoded
=
await
Lib_RLPWriter
.
callStatic
.
writeAddressWithTaintedMemory
(
randomAddress
randomAddress
)
)
expect
(
encoded
).
to
.
eq
(
rlpEncodedRandomAddress
)
expect
(
encoded
).
to
.
eq
(
rlpEncodedRandomAddress
)
...
...
packages/contracts/test/contracts/libraries/utils/Lib_MerkleTree.spec.ts
View file @
305fff21
...
@@ -10,20 +10,7 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils'
...
@@ -10,20 +10,7 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils'
import
{
NON_NULL_BYTES32
}
from
'
../../../helpers
'
import
{
NON_NULL_BYTES32
}
from
'
../../../helpers
'
const
NODE_COUNTS
=
[
const
NODE_COUNTS
=
[
2
,
2
,
3
,
7
,
9
,
13
,
63
,
64
,
123
,
128
,
129
,
255
,
1021
,
1023
,
1024
,
3
,
7
,
9
,
13
,
63
,
64
,
123
,
128
,
129
,
255
,
1021
,
1023
,
1024
,
]
]
const
hash
=
(
el
:
Buffer
|
string
):
Buffer
=>
{
const
hash
=
(
el
:
Buffer
|
string
):
Buffer
=>
{
...
...
packages/contracts/test/helpers/codec/bridge.ts
View file @
305fff21
...
@@ -6,7 +6,8 @@ export const encodeXDomainCalldata = (
...
@@ -6,7 +6,8 @@ export const encodeXDomainCalldata = (
message
:
string
,
message
:
string
,
messageNonce
:
number
messageNonce
:
number
):
string
=>
{
):
string
=>
{
return
getContractInterface
(
return
getContractInterface
(
'
OVM_L2CrossDomainMessenger
'
).
encodeFunctionData
(
'
OVM_L2CrossDomainMessenger
'
'
relayMessage
'
,
).
encodeFunctionData
(
'
relayMessage
'
,
[
target
,
sender
,
message
,
messageNonce
])
[
target
,
sender
,
message
,
messageNonce
]
)
}
}
packages/contracts/test/helpers/gas/gas.ts
View file @
305fff21
...
@@ -16,7 +16,8 @@ export class GasMeasurement {
...
@@ -16,7 +16,8 @@ export class GasMeasurement {
methodName
:
string
,
methodName
:
string
,
methodArgs
:
Array
<
any
>
=
[]
methodArgs
:
Array
<
any
>
=
[]
):
Promise
<
number
>
{
):
Promise
<
number
>
{
const
gasCost
:
number
=
await
this
.
GasMeasurementContract
.
callStatic
.
measureCallGas
(
const
gasCost
:
number
=
await
this
.
GasMeasurementContract
.
callStatic
.
measureCallGas
(
targetContract
.
address
,
targetContract
.
address
,
targetContract
.
interface
.
encodeFunctionData
(
methodName
,
methodArgs
)
targetContract
.
interface
.
encodeFunctionData
(
methodName
,
methodArgs
)
)
)
...
...
packages/contracts/test/helpers/test-runner/test-runner.ts
View file @
305fff21
...
@@ -83,7 +83,8 @@ export class ExecutionManagerTestRunner {
...
@@ -83,7 +83,8 @@ export class ExecutionManagerTestRunner {
},
},
contractStorage
:
{
contractStorage
:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
{
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
{
getStorageXOR
:
true
,
getStorageXOR
:
true
,
value
:
ethers
.
constants
.
HashZero
,
value
:
ethers
.
constants
.
HashZero
,
},
},
...
@@ -91,7 +92,8 @@ export class ExecutionManagerTestRunner {
...
@@ -91,7 +92,8 @@ export class ExecutionManagerTestRunner {
},
},
verifiedContractStorage
:
{
verifiedContractStorage
:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
[
predeploys
.
OVM_DeployerWhitelist
]:
{
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
true
,
'
0x0000000000000000000000000000000000000000000000000000000000000000
'
:
true
,
},
},
},
},
},
},
...
@@ -275,9 +277,8 @@ export class ExecutionManagerTestRunner {
...
@@ -275,9 +277,8 @@ export class ExecutionManagerTestRunner {
await
ethers
.
getContractFactory
(
'
Helper_TestRunner
'
)
await
ethers
.
getContractFactory
(
'
Helper_TestRunner
'
)
).
deploy
()
).
deploy
()
this
.
contracts
.
Factory__Helper_TestRunner_CREATE
=
await
ethers
.
getContractFactory
(
this
.
contracts
.
Factory__Helper_TestRunner_CREATE
=
'
Helper_TestRunner_CREATE
'
await
ethers
.
getContractFactory
(
'
Helper_TestRunner_CREATE
'
)
)
this
.
snapshot
=
await
ethers
.
provider
.
send
(
'
evm_snapshot
'
,
[])
this
.
snapshot
=
await
ethers
.
provider
.
send
(
'
evm_snapshot
'
,
[])
}
}
...
...
packages/core-utils/src/watcher.ts
View file @
305fff21
...
@@ -22,7 +22,7 @@ export class Watcher {
...
@@ -22,7 +22,7 @@ export class Watcher {
constructor
(
opts
:
WatcherOptions
)
{
constructor
(
opts
:
WatcherOptions
)
{
this
.
l1
=
opts
.
l1
this
.
l1
=
opts
.
l1
this
.
l2
=
opts
.
l2
this
.
l2
=
opts
.
l2
if
(
opts
.
pollInterval
)
{
if
(
opts
.
pollInterval
)
{
this
.
pollInterval
=
opts
.
pollInterval
this
.
pollInterval
=
opts
.
pollInterval
}
}
}
}
...
@@ -105,7 +105,7 @@ export class Watcher {
...
@@ -105,7 +105,7 @@ export class Watcher {
}
}
// pause awhile before trying again
// pause awhile before trying again
await
new
Promise
(
r
=>
setTimeout
(
r
,
this
.
pollInterval
))
await
new
Promise
(
(
r
)
=>
setTimeout
(
r
,
this
.
pollInterval
))
}
}
// Message was relayed in the past
// Message was relayed in the past
...
...
packages/data-transport-layer/src/services/l1-ingestion/service.ts
View file @
305fff21
...
@@ -46,7 +46,7 @@ const registerMetrics = ({
...
@@ -46,7 +46,7 @@ const registerMetrics = ({
name
:
'
data_transport_layer_l1_unhandled_error_count
'
,
name
:
'
data_transport_layer_l1_unhandled_error_count
'
,
help
:
'
Number of times recovered from unhandled errors
'
,
help
:
'
Number of times recovered from unhandled errors
'
,
registers
:
[
registry
],
registers
:
[
registry
],
})
})
,
})
})
export
interface
L1IngestionServiceOptions
export
interface
L1IngestionServiceOptions
...
@@ -168,7 +168,8 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
...
@@ -168,7 +168,8 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
// Store the total number of submitted transactions so the server can tell clients if we're
// Store the total number of submitted transactions so the server can tell clients if we're
// done syncing or not
// done syncing or not
const
totalElements
=
await
this
.
state
.
contracts
.
OVM_CanonicalTransactionChain
.
getTotalElements
()
const
totalElements
=
await
this
.
state
.
contracts
.
OVM_CanonicalTransactionChain
.
getTotalElements
()
if
(
totalElements
>
0
)
{
if
(
totalElements
>
0
)
{
await
this
.
state
.
db
.
putHighestL2BlockNumber
(
totalElements
-
1
)
await
this
.
state
.
db
.
putHighestL2BlockNumber
(
totalElements
-
1
)
}
}
...
@@ -246,9 +247,14 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
...
@@ -246,9 +247,14 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
// Different functions for getting the last good element depending on the event type.
// Different functions for getting the last good element depending on the event type.
const
handlers
=
{
const
handlers
=
{
SequencerBatchAppended
:
this
.
state
.
db
.
getLatestTransactionBatch
.
bind
(
this
.
state
.
db
),
SequencerBatchAppended
:
StateBatchAppended
:
this
.
state
.
db
.
getLatestStateRootBatch
.
bind
(
this
.
state
.
db
),
this
.
state
.
db
.
getLatestTransactionBatch
.
bind
(
this
.
state
.
db
),
TransactionEnqueued
:
this
.
state
.
db
.
getLatestEnqueue
.
bind
(
this
.
state
.
db
),
StateBatchAppended
:
this
.
state
.
db
.
getLatestStateRootBatch
.
bind
(
this
.
state
.
db
),
TransactionEnqueued
:
this
.
state
.
db
.
getLatestEnqueue
.
bind
(
this
.
state
.
db
),
}
}
// Find the last good element and reset the highest synced L1 block to go back to the
// Find the last good element and reset the highest synced L1 block to go back to the
...
@@ -325,8 +331,11 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
...
@@ -325,8 +331,11 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
// We need to figure out how to make this work without Infura. Mark and I think that infura is
// We need to figure out how to make this work without Infura. Mark and I think that infura is
// doing some indexing of events beyond Geth's native capabilities, meaning some event logic
// doing some indexing of events beyond Geth's native capabilities, meaning some event logic
// will only work on Infura and not on a local geth instance. Not great.
// will only work on Infura and not on a local geth instance. Not great.
const
addressSetEvents
=
await
this
.
state
.
contracts
.
Lib_AddressManager
.
queryFilter
(
const
addressSetEvents
=
this
.
state
.
contracts
.
Lib_AddressManager
.
filters
.
AddressSet
(
contractName
),
await
this
.
state
.
contracts
.
Lib_AddressManager
.
queryFilter
(
this
.
state
.
contracts
.
Lib_AddressManager
.
filters
.
AddressSet
(
contractName
),
fromL1Block
,
fromL1Block
,
toL1Block
toL1Block
)
)
...
...
packages/data-transport-layer/src/services/server/service.ts
View file @
305fff21
...
@@ -229,7 +229,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
...
@@ -229,7 +229,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
highestL2BlockNumber
=
await
this
.
state
.
db
.
getHighestL2BlockNumber
()
highestL2BlockNumber
=
await
this
.
state
.
db
.
getHighestL2BlockNumber
()
break
break
case
'
l2
'
:
case
'
l2
'
:
currentL2Block
=
await
this
.
state
.
db
.
getLatestUnconfirmedTransaction
()
currentL2Block
=
await
this
.
state
.
db
.
getLatestUnconfirmedTransaction
()
highestL2BlockNumber
=
highestL2BlockNumber
=
(
await
this
.
state
.
db
.
getHighestSyncedUnconfirmedBlock
())
-
1
(
await
this
.
state
.
db
.
getHighestSyncedUnconfirmedBlock
())
-
1
break
break
...
@@ -472,7 +473,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
...
@@ -472,7 +473,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
}
}
}
}
const
transactions
=
await
this
.
state
.
db
.
getFullTransactionsByIndexRange
(
const
transactions
=
await
this
.
state
.
db
.
getFullTransactionsByIndexRange
(
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
(),
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
(),
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
()
+
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
()
+
BigNumber
.
from
(
batch
.
size
).
toNumber
()
BigNumber
.
from
(
batch
.
size
).
toNumber
()
...
@@ -500,7 +502,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
...
@@ -500,7 +502,8 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
}
}
}
}
const
transactions
=
await
this
.
state
.
db
.
getFullTransactionsByIndexRange
(
const
transactions
=
await
this
.
state
.
db
.
getFullTransactionsByIndexRange
(
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
(),
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
(),
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
()
+
BigNumber
.
from
(
batch
.
prevTotalElements
).
toNumber
()
+
BigNumber
.
from
(
batch
.
size
).
toNumber
()
BigNumber
.
from
(
batch
.
size
).
toNumber
()
...
...
packages/data-transport-layer/test/unit-tests/examples/l2-data.ts
View file @
305fff21
This diff is collapsed.
Click to expand it.
packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/state-batch-appended.spec.ts
View file @
305fff21
...
@@ -14,8 +14,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.StateBatchAppended', ()
...
@@ -14,8 +14,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.StateBatchAppended', ()
it
(
'
should return event block and transaction
'
,
async
()
=>
{
it
(
'
should return event block and transaction
'
,
async
()
=>
{
// Source: https://etherscan.io/tx/0x4ca72484e93cdb50fe1089984db152258c2bbffc2534dcafbfe032b596bd5b49
// Source: https://etherscan.io/tx/0x4ca72484e93cdb50fe1089984db152258c2bbffc2534dcafbfe032b596bd5b49
const
l1Transaction
=
{
const
l1Transaction
=
{
hash
:
hash
:
'
0x4ca72484e93cdb50fe1089984db152258c2bbffc2534dcafbfe032b596bd5b49
'
,
'
0x4ca72484e93cdb50fe1089984db152258c2bbffc2534dcafbfe032b596bd5b49
'
,
from
:
'
0xfd7d4de366850c08ee2cba32d851385a3071ec8d
'
,
from
:
'
0xfd7d4de366850c08ee2cba32d851385a3071ec8d
'
,
data
:
l1StateBatchData
,
data
:
l1StateBatchData
,
}
}
...
@@ -23,8 +22,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.StateBatchAppended', ()
...
@@ -23,8 +22,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.StateBatchAppended', ()
const
eventBlock
:
Block
=
{
const
eventBlock
:
Block
=
{
timestamp
:
1616680530
,
timestamp
:
1616680530
,
number
:
12106615
,
number
:
12106615
,
hash
:
hash
:
'
0x9c40310e19e943ad38e170329465c4489f6aba5895e9cacdac236be181aea31f
'
,
'
0x9c40310e19e943ad38e170329465c4489f6aba5895e9cacdac236be181aea31f
'
,
parentHash
:
parentHash
:
'
0xc7707a04c287a22ff4e43e5d9316e45ab342dcd405e7e0284eb51ce71a3a29ac
'
,
'
0xc7707a04c287a22ff4e43e5d9316e45ab342dcd405e7e0284eb51ce71a3a29ac
'
,
miner
:
'
0xea674fdde714fd979de3edf0f56aa9716b898ec8
'
,
miner
:
'
0xea674fdde714fd979de3edf0f56aa9716b898ec8
'
,
...
...
packages/message-relayer/src/relay-tx.ts
View file @
305fff21
...
@@ -116,14 +116,10 @@ export const getMessagesByTransactionHash = async (
...
@@ -116,14 +116,10 @@ export const getMessagesByTransactionHash = async (
* @returns Encoded message.
* @returns Encoded message.
*/
*/
const
encodeCrossDomainMessage
=
(
message
:
CrossDomainMessage
):
string
=>
{
const
encodeCrossDomainMessage
=
(
message
:
CrossDomainMessage
):
string
=>
{
return
getContractInterface
(
return
getContractInterface
(
'
OVM_L2CrossDomainMessenger
'
).
encodeFunctionData
(
'
OVM_L2CrossDomainMessenger
'
'
relayMessage
'
,
).
encodeFunctionData
(
'
relayMessage
'
,
[
[
message
.
target
,
message
.
sender
,
message
.
message
,
message
.
messageNonce
]
message
.
target
,
)
message
.
sender
,
message
.
message
,
message
.
messageNonce
,
])
}
}
/**
/**
...
@@ -169,16 +165,16 @@ export const getStateBatchAppendedEventByTransactionIndex = async (
...
@@ -169,16 +165,16 @@ export const getStateBatchAppendedEventByTransactionIndex = async (
return
index
>=
prevTotalElements
+
batchSize
return
index
>=
prevTotalElements
+
batchSize
}
}
const
totalBatches
:
ethers
.
BigNumber
=
await
l1StateCommitmentChain
.
getTotalBatches
()
const
totalBatches
:
ethers
.
BigNumber
=
await
l1StateCommitmentChain
.
getTotalBatches
()
if
(
totalBatches
.
eq
(
0
))
{
if
(
totalBatches
.
eq
(
0
))
{
return
null
return
null
}
}
let
lowerBound
=
0
let
lowerBound
=
0
let
upperBound
=
totalBatches
.
toNumber
()
-
1
let
upperBound
=
totalBatches
.
toNumber
()
-
1
let
batchEvent
:
ethers
.
Event
|
null
=
await
getStateBatchAppendedEventByBatchIndex
(
let
batchEvent
:
ethers
.
Event
|
null
=
upperBound
await
getStateBatchAppendedEventByBatchIndex
(
upperBound
)
)
if
(
isEventLo
(
batchEvent
,
l2TransactionIndex
))
{
if
(
isEventLo
(
batchEvent
,
l2TransactionIndex
))
{
// Upper bound is too low, means this transaction doesn't have a corresponding state batch yet.
// Upper bound is too low, means this transaction doesn't have a corresponding state batch yet.
...
@@ -227,7 +223,8 @@ export const getStateRootBatchByTransactionIndex = async (
...
@@ -227,7 +223,8 @@ export const getStateRootBatchByTransactionIndex = async (
l1RpcProvider
l1RpcProvider
)
)
const
stateBatchAppendedEvent
=
await
getStateBatchAppendedEventByTransactionIndex
(
const
stateBatchAppendedEvent
=
await
getStateBatchAppendedEventByTransactionIndex
(
l1RpcProvider
,
l1RpcProvider
,
l1StateCommitmentChainAddress
,
l1StateCommitmentChainAddress
,
l2TransactionIndex
l2TransactionIndex
...
@@ -277,12 +274,9 @@ const getMerkleTreeProof = (leaves: string[], index: number): string[] => {
...
@@ -277,12 +274,9 @@ const getMerkleTreeProof = (leaves: string[], index: number): string[] => {
// merkletreejs prefers things to be Buffers.
// merkletreejs prefers things to be Buffers.
const
bufLeaves
=
parsedLeaves
.
map
(
fromHexString
)
const
bufLeaves
=
parsedLeaves
.
map
(
fromHexString
)
const
tree
=
new
MerkleTree
(
const
tree
=
new
MerkleTree
(
bufLeaves
,
(
el
:
Buffer
|
string
):
Buffer
=>
{
bufLeaves
,
(
el
:
Buffer
|
string
):
Buffer
=>
{
return
fromHexString
(
ethers
.
utils
.
keccak256
(
el
))
return
fromHexString
(
ethers
.
utils
.
keccak256
(
el
))
}
})
)
const
proof
=
tree
.
getProof
(
bufLeaves
[
index
],
index
).
map
((
element
:
any
)
=>
{
const
proof
=
tree
.
getProof
(
bufLeaves
[
index
],
index
).
map
((
element
:
any
)
=>
{
return
toHexString
(
element
.
data
)
return
toHexString
(
element
.
data
)
...
...
packages/message-relayer/src/service.ts
View file @
305fff21
...
@@ -274,9 +274,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
...
@@ -274,9 +274,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
}
}
}
}
private
async
_getStateBatchHeader
(
private
async
_getStateBatchHeader
(
height
:
number
):
Promise
<
height
:
number
):
Promise
<
|
{
|
{
batch
:
StateRootBatchHeader
batch
:
StateRootBatchHeader
stateRoots
:
string
[]
stateRoots
:
string
[]
...
@@ -308,7 +306,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
...
@@ -308,7 +306,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
endBlock
:
startingBlock
+
this
.
options
.
getLogsInterval
,
endBlock
:
startingBlock
+
this
.
options
.
getLogsInterval
,
})
})
const
events
:
ethers
.
Event
[]
=
await
this
.
state
.
OVM_StateCommitmentChain
.
queryFilter
(
const
events
:
ethers
.
Event
[]
=
await
this
.
state
.
OVM_StateCommitmentChain
.
queryFilter
(
this
.
state
.
OVM_StateCommitmentChain
.
filters
.
StateBatchAppended
(),
this
.
state
.
OVM_StateCommitmentChain
.
filters
.
StateBatchAppended
(),
startingBlock
,
startingBlock
,
startingBlock
+
this
.
options
.
getLogsInterval
startingBlock
+
this
.
options
.
getLogsInterval
...
@@ -333,9 +332,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
...
@@ -333,9 +332,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
event
.
transactionHash
event
.
transactionHash
)
)
const
[
const
[
stateRoots
]
=
stateRoots
,
this
.
state
.
OVM_StateCommitmentChain
.
interface
.
decodeFunctionData
(
]
=
this
.
state
.
OVM_StateCommitmentChain
.
interface
.
decodeFunctionData
(
'
appendStateBatch
'
,
'
appendStateBatch
'
,
transaction
.
data
transaction
.
data
)
)
...
@@ -390,7 +388,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
...
@@ -390,7 +388,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
const
messages
=
events
.
map
((
event
)
=>
{
const
messages
=
events
.
map
((
event
)
=>
{
const
message
=
event
.
args
.
message
const
message
=
event
.
args
.
message
const
decoded
=
this
.
state
.
OVM_L2CrossDomainMessenger
.
interface
.
decodeFunctionData
(
const
decoded
=
this
.
state
.
OVM_L2CrossDomainMessenger
.
interface
.
decodeFunctionData
(
'
relayMessage
'
,
'
relayMessage
'
,
message
message
)
)
...
...
packages/smock/src/smockit/binding.ts
View file @
305fff21
...
@@ -7,8 +7,8 @@ import BN from 'bn.js'
...
@@ -7,8 +7,8 @@ import BN from 'bn.js'
// Handle hardhat ^2.4.0
// Handle hardhat ^2.4.0
let
decodeRevertReason
:
(
value
:
Buffer
)
=>
string
let
decodeRevertReason
:
(
value
:
Buffer
)
=>
string
try
{
try
{
decodeRevertReason
=
require
(
'
hardhat/internal/hardhat-network/stack-traces/revert-reasons
'
)
decodeRevertReason
=
.
decodeRevertReason
require
(
'
hardhat/internal/hardhat-network/stack-traces/revert-reasons
'
)
.
decodeRevertReason
}
catch
(
err
)
{
}
catch
(
err
)
{
const
{
const
{
ReturnData
,
ReturnData
,
...
@@ -20,11 +20,11 @@ try {
...
@@ -20,11 +20,11 @@ try {
// Handle hardhat ^2.2.0
// Handle hardhat ^2.2.0
let
TransactionExecutionError
:
any
let
TransactionExecutionError
:
any
try
{
try
{
TransactionExecutionError
=
require
(
'
hardhat/internal/hardhat-network/provider/errors
'
)
TransactionExecutionError
=
.
TransactionExecutionError
require
(
'
hardhat/internal/hardhat-network/provider/errors
'
)
.
TransactionExecutionError
}
catch
(
err
)
{
}
catch
(
err
)
{
TransactionExecutionError
=
require
(
'
hardhat/internal/core/providers/errors
'
)
TransactionExecutionError
=
.
TransactionExecutionError
require
(
'
hardhat/internal/core/providers/errors
'
)
.
TransactionExecutionError
}
}
/* eslint-enable @typescript-eslint/no-var-requires */
/* eslint-enable @typescript-eslint/no-var-requires */
...
@@ -137,13 +137,8 @@ const initializeSmock = (provider: HardhatNetworkProvider): void => {
...
@@ -137,13 +137,8 @@ const initializeSmock = (provider: HardhatNetworkProvider): void => {
// Compute the mock return data.
// Compute the mock return data.
const
mock
:
MockContract
=
vm
.
_smockState
.
mocks
[
target
]
const
mock
:
MockContract
=
vm
.
_smockState
.
mocks
[
target
]
const
{
const
{
resolve
,
functionName
,
rawReturnValue
,
returnValue
,
gasUsed
}
=
resolve
,
await
mock
.
_smockit
(
message
.
data
)
functionName
,
rawReturnValue
,
returnValue
,
gasUsed
,
}
=
await
mock
.
_smockit
(
message
.
data
)
// Set the mock return data, potentially set the `exceptionError` field if the user requested
// Set the mock return data, potentially set the `exceptionError` field if the user requested
// a revert.
// a revert.
...
...
packages/smock/src/smockit/smockit.ts
View file @
305fff21
...
@@ -200,9 +200,7 @@ export const smockit = async (
...
@@ -200,9 +200,7 @@ export const smockit = async (
}
}
// TODO: Make this less of a hack.
// TODO: Make this less of a hack.
;(
contract
as
any
).
_smockit
=
async
function
(
;(
contract
as
any
).
_smockit
=
async
function
(
data
:
Buffer
):
Promise
<
{
data
:
Buffer
):
Promise
<
{
resolve
:
'
return
'
|
'
revert
'
resolve
:
'
return
'
|
'
revert
'
functionName
:
string
functionName
:
string
rawReturnValue
:
any
rawReturnValue
:
any
...
...
specs/l2geth/transaction-indexer.md
View file @
305fff21
...
@@ -328,7 +328,7 @@ function parseSequencerBatchAppendedEvent(
...
@@ -328,7 +328,7 @@ function parseSequencerBatchAppendedEvent(
l1TxOrigin
:
0x0000000000000000000000000000000000000000
,
l1TxOrigin
:
0x0000000000000000000000000000000000000000
,
entrypoint
:
0x4200000000000000000000000000000000000005
,
entrypoint
:
0x4200000000000000000000000000000000000005
,
gasLimit
:
OVM_ExecutionManager
.
getMaxTransactionGasLimit
(),
gasLimit
:
OVM_ExecutionManager
.
getMaxTransactionGasLimit
(),
data
:
params
.
transactions
[
sequencerTransactionCount
]
data
:
params
.
transactions
[
sequencerTransactionCount
]
,
});
});
sequencerTransactionCount
=
sequencerTransactionCount
+
1
;
sequencerTransactionCount
=
sequencerTransactionCount
+
1
;
...
@@ -338,7 +338,8 @@ function parseSequencerBatchAppendedEvent(
...
@@ -338,7 +338,8 @@ function parseSequencerBatchAppendedEvent(
// Note that this places an assumption on how events are parsed. This
// Note that this places an assumption on how events are parsed. This
// only works if enqueued transactions are parsed before
// only works if enqueued transactions are parsed before
// `appendQueueBatch` events.
// `appendQueueBatch` events.
const
enqueuedTransaction
:
EnqueuedTransaction
=
getEnqueuedTransactionByIndex
(
const
enqueuedTransaction
:
EnqueuedTransaction
=
getEnqueuedTransactionByIndex
(
event
.
startingQueueIndex
+
queueTransactionCount
event
.
startingQueueIndex
+
queueTransactionCount
);
);
...
@@ -349,7 +350,7 @@ function parseSequencerBatchAppendedEvent(
...
@@ -349,7 +350,7 @@ function parseSequencerBatchAppendedEvent(
l1TxOrigin
:
enqueuedTransaction
.
l1TxOrigin
,
l1TxOrigin
:
enqueuedTransaction
.
l1TxOrigin
,
entrypoint
:
enqueuedTransaction
.
entrypoint
,
entrypoint
:
enqueuedTransaction
.
entrypoint
,
gasLimit
:
enqueuedTransaction
.
gasLimit
,
gasLimit
:
enqueuedTransaction
.
gasLimit
,
data
:
enqueuedTransaction
.
data
data
:
enqueuedTransaction
.
data
,
});
});
queueTransactionCount
=
queueTransactionCount
+
1
;
queueTransactionCount
=
queueTransactionCount
+
1
;
...
...
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