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
b80fc6e6
Commit
b80fc6e6
authored
Jun 28, 2023
by
Will Cory
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
messageIndex
parent
28ad99fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
60 deletions
+60
-60
cross-chain-messenger.ts
packages/sdk/src/cross-chain-messenger.ts
+60
-60
No files found.
packages/sdk/src/cross-chain-messenger.ts
View file @
b80fc6e6
...
@@ -333,11 +333,11 @@ export class CrossChainMessenger {
...
@@ -333,11 +333,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
CrossChainMessage
>
{
):
Promise
<
CrossChainMessage
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
// Bedrock messages are already in the correct format.
// Bedrock messages are already in the correct format.
...
@@ -405,11 +405,11 @@ export class CrossChainMessenger {
...
@@ -405,11 +405,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
LowLevelMessage
>
{
):
Promise
<
LowLevelMessage
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
throw
new
Error
(
`can only convert L2 to L1 messages to low level`
)
throw
new
Error
(
`can only convert L2 to L1 messages to low level`
)
...
@@ -421,7 +421,7 @@ export class CrossChainMessenger {
...
@@ -421,7 +421,7 @@ export class CrossChainMessenger {
if
(
version
.
eq
(
0
))
{
if
(
version
.
eq
(
0
))
{
updated
=
await
this
.
toBedrockCrossChainMessage
(
updated
=
await
this
.
toBedrockCrossChainMessage
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
}
else
{
}
else
{
updated
=
resolved
updated
=
resolved
...
@@ -454,10 +454,10 @@ export class CrossChainMessenger {
...
@@ -454,10 +454,10 @@ export class CrossChainMessenger {
throw
new
Error
(
`no withdrawals found in receipt`
)
throw
new
Error
(
`no withdrawals found in receipt`
)
}
}
const
withdrawal
=
withdrawals
[
m
ultiWithdrawal
Index
]
const
withdrawal
=
withdrawals
[
m
essage
Index
]
if
(
!
withdrawal
)
{
if
(
!
withdrawal
)
{
throw
new
Error
(
throw
new
Error
(
`withdrawal index
${
m
ultiWithdrawal
Index
}
out of bounds there are
${
withdrawals
.
length
}
withdrawals`
`withdrawal index
${
m
essage
Index
}
out of bounds there are
${
withdrawals
.
length
}
withdrawals`
)
)
}
}
messageNonce
=
withdrawal
.
nonce
messageNonce
=
withdrawal
.
nonce
...
@@ -604,7 +604,7 @@ export class CrossChainMessenger {
...
@@ -604,7 +604,7 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
CrossChainMessage
>
{
):
Promise
<
CrossChainMessage
>
{
if
(
!
message
)
{
if
(
!
message
)
{
throw
new
Error
(
'
message is undefined
'
)
throw
new
Error
(
'
message is undefined
'
)
...
@@ -648,10 +648,10 @@ export class CrossChainMessenger {
...
@@ -648,10 +648,10 @@ export class CrossChainMessenger {
message
as
TransactionLike
message
as
TransactionLike
)
)
const
out
=
messages
[
m
ultiWithdrawal
Index
]
const
out
=
messages
[
m
essage
Index
]
if
(
!
out
)
{
if
(
!
out
)
{
throw
new
Error
(
throw
new
Error
(
`withdrawal index
${
m
ultiWithdrawal
Index
}
out of bounds. There are
${
messages
.
length
}
withdrawals`
`withdrawal index
${
m
essage
Index
}
out of bounds. There are
${
messages
.
length
}
withdrawals`
)
)
}
}
return
out
return
out
...
@@ -670,13 +670,13 @@ export class CrossChainMessenger {
...
@@ -670,13 +670,13 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
MessageStatus
>
{
):
Promise
<
MessageStatus
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
const
receipt
=
await
this
.
getMessageReceipt
(
resolved
,
m
ultiWithdrawal
Index
)
const
receipt
=
await
this
.
getMessageReceipt
(
resolved
,
m
essage
Index
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
receipt
===
null
)
{
if
(
receipt
===
null
)
{
...
@@ -694,7 +694,7 @@ export class CrossChainMessenger {
...
@@ -694,7 +694,7 @@ export class CrossChainMessenger {
if
(
this
.
bedrock
)
{
if
(
this
.
bedrock
)
{
const
output
=
await
this
.
getMessageBedrockOutput
(
const
output
=
await
this
.
getMessageBedrockOutput
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
output
===
null
)
{
if
(
output
===
null
)
{
return
MessageStatus
.
STATE_ROOT_NOT_PUBLISHED
return
MessageStatus
.
STATE_ROOT_NOT_PUBLISHED
...
@@ -703,7 +703,7 @@ export class CrossChainMessenger {
...
@@ -703,7 +703,7 @@ export class CrossChainMessenger {
// Convert the message to the low level message that was proven.
// Convert the message to the low level message that was proven.
const
withdrawal
=
await
this
.
toLowLevelMessage
(
const
withdrawal
=
await
this
.
toLowLevelMessage
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
// Attempt to fetch the proven withdrawal.
// Attempt to fetch the proven withdrawal.
...
@@ -723,7 +723,7 @@ export class CrossChainMessenger {
...
@@ -723,7 +723,7 @@ export class CrossChainMessenger {
}
else
{
}
else
{
const
stateRoot
=
await
this
.
getMessageStateRoot
(
const
stateRoot
=
await
this
.
getMessageStateRoot
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
stateRoot
===
null
)
{
if
(
stateRoot
===
null
)
{
return
MessageStatus
.
STATE_ROOT_NOT_PUBLISHED
return
MessageStatus
.
STATE_ROOT_NOT_PUBLISHED
...
@@ -765,11 +765,11 @@ export class CrossChainMessenger {
...
@@ -765,11 +765,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
MessageReceipt
>
{
):
Promise
<
MessageReceipt
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
// legacy withdrawals relayed prebedrock are v1
// legacy withdrawals relayed prebedrock are v1
const
messageHashV0
=
hashCrossDomainMessagev0
(
const
messageHashV0
=
hashCrossDomainMessagev0
(
...
@@ -877,12 +877,12 @@ export class CrossChainMessenger {
...
@@ -877,12 +877,12 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
MessageReceipt
>
{
):
Promise
<
MessageReceipt
>
{
// Resolving once up-front is slightly more efficient.
// Resolving once up-front is slightly more efficient.
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
let
totalTimeMs
=
0
let
totalTimeMs
=
0
...
@@ -890,7 +890,7 @@ export class CrossChainMessenger {
...
@@ -890,7 +890,7 @@ export class CrossChainMessenger {
const
tick
=
Date
.
now
()
const
tick
=
Date
.
now
()
const
receipt
=
await
this
.
getMessageReceipt
(
const
receipt
=
await
this
.
getMessageReceipt
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
receipt
!==
null
)
{
if
(
receipt
!==
null
)
{
return
receipt
return
receipt
...
@@ -926,12 +926,12 @@ export class CrossChainMessenger {
...
@@ -926,12 +926,12 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
void
>
{
):
Promise
<
void
>
{
// Resolving once up-front is slightly more efficient.
// Resolving once up-front is slightly more efficient.
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
let
totalTimeMs
=
0
let
totalTimeMs
=
0
...
@@ -939,7 +939,7 @@ export class CrossChainMessenger {
...
@@ -939,7 +939,7 @@ export class CrossChainMessenger {
const
tick
=
Date
.
now
()
const
tick
=
Date
.
now
()
const
currentStatus
=
await
this
.
getMessageStatus
(
const
currentStatus
=
await
this
.
getMessageStatus
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
// Handle special cases for L1 to L2 messages.
// Handle special cases for L1 to L2 messages.
...
@@ -1009,7 +1009,7 @@ export class CrossChainMessenger {
...
@@ -1009,7 +1009,7 @@ export class CrossChainMessenger {
bufferPercent
?:
number
bufferPercent
?:
number
from
?:
string
from
?:
string
},
},
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
BigNumber
>
{
):
Promise
<
BigNumber
>
{
let
resolved
:
CrossChainMessage
|
CrossChainMessageRequest
let
resolved
:
CrossChainMessage
|
CrossChainMessageRequest
let
from
:
string
let
from
:
string
...
@@ -1019,7 +1019,7 @@ export class CrossChainMessenger {
...
@@ -1019,7 +1019,7 @@ export class CrossChainMessenger {
}
else
{
}
else
{
resolved
=
await
this
.
toCrossChainMessage
(
resolved
=
await
this
.
toCrossChainMessage
(
message
as
MessageLike
,
message
as
MessageLike
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
from
=
opts
?.
from
||
(
resolved
as
CrossChainMessage
).
sender
from
=
opts
?.
from
||
(
resolved
as
CrossChainMessage
).
sender
}
}
...
@@ -1055,13 +1055,13 @@ export class CrossChainMessenger {
...
@@ -1055,13 +1055,13 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
number
>
{
):
Promise
<
number
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
const
status
=
await
this
.
getMessageStatus
(
resolved
,
m
ultiWithdrawal
Index
)
const
status
=
await
this
.
getMessageStatus
(
resolved
,
m
essage
Index
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
if
(
status
===
MessageStatus
.
RELAYED
||
status
===
MessageStatus
.
RELAYED
||
...
@@ -1101,7 +1101,7 @@ export class CrossChainMessenger {
...
@@ -1101,7 +1101,7 @@ export class CrossChainMessenger {
// when the state root is published.
// when the state root is published.
const
stateRoot
=
await
this
.
getMessageStateRoot
(
const
stateRoot
=
await
this
.
getMessageStateRoot
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
const
challengePeriod
=
await
this
.
getChallengePeriodSeconds
()
const
challengePeriod
=
await
this
.
getChallengePeriodSeconds
()
const
targetBlock
=
await
this
.
l1Provider
.
getBlock
(
const
targetBlock
=
await
this
.
l1Provider
.
getBlock
(
...
@@ -1135,13 +1135,13 @@ export class CrossChainMessenger {
...
@@ -1135,13 +1135,13 @@ export class CrossChainMessenger {
const
challengePeriod
=
const
challengePeriod
=
oracleVersion
===
'
1.0.0
'
oracleVersion
===
'
1.0.0
'
?
// The ABI in the SDK does not contain FINALIZATION_PERIOD_SECONDS
?
// The ABI in the SDK does not contain FINALIZATION_PERIOD_SECONDS
// in OptimismPortal, so making an explicit call instead.
// in OptimismPortal, so making an explicit call instead.
BigNumber
.
from
(
BigNumber
.
from
(
await
this
.
contracts
.
l1
.
OptimismPortal
.
provider
.
call
({
await
this
.
contracts
.
l1
.
OptimismPortal
.
provider
.
call
({
to
:
this
.
contracts
.
l1
.
OptimismPortal
.
address
,
to
:
this
.
contracts
.
l1
.
OptimismPortal
.
address
,
data
:
'
0xf4daa291
'
,
// FINALIZATION_PERIOD_SECONDS
data
:
'
0xf4daa291
'
,
// FINALIZATION_PERIOD_SECONDS
})
})
)
)
:
await
this
.
contracts
.
l1
.
L2OutputOracle
.
FINALIZATION_PERIOD_SECONDS
()
:
await
this
.
contracts
.
l1
.
L2OutputOracle
.
FINALIZATION_PERIOD_SECONDS
()
return
challengePeriod
.
toNumber
()
return
challengePeriod
.
toNumber
()
}
}
...
@@ -1177,11 +1177,11 @@ export class CrossChainMessenger {
...
@@ -1177,11 +1177,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
BedrockOutputData
|
null
>
{
):
Promise
<
BedrockOutputData
|
null
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
// Outputs are only a thing for L2 to L1 messages.
// Outputs are only a thing for L2 to L1 messages.
...
@@ -1236,11 +1236,11 @@ export class CrossChainMessenger {
...
@@ -1236,11 +1236,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
StateRoot
|
null
>
{
):
Promise
<
StateRoot
|
null
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
// State roots are only a thing for L2 to L1 messages.
// State roots are only a thing for L2 to L1 messages.
...
@@ -1429,11 +1429,11 @@ export class CrossChainMessenger {
...
@@ -1429,11 +1429,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
CrossChainMessageProof
>
{
):
Promise
<
CrossChainMessageProof
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
throw
new
Error
(
`can only generate proofs for L2 to L1 messages`
)
throw
new
Error
(
`can only generate proofs for L2 to L1 messages`
)
...
@@ -1441,7 +1441,7 @@ export class CrossChainMessenger {
...
@@ -1441,7 +1441,7 @@ export class CrossChainMessenger {
const
stateRoot
=
await
this
.
getMessageStateRoot
(
const
stateRoot
=
await
this
.
getMessageStateRoot
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
stateRoot
===
null
)
{
if
(
stateRoot
===
null
)
{
throw
new
Error
(
`state root for message not yet published`
)
throw
new
Error
(
`state root for message not yet published`
)
...
@@ -1498,11 +1498,11 @@ export class CrossChainMessenger {
...
@@ -1498,11 +1498,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
BedrockCrossChainMessageProof
>
{
):
Promise
<
BedrockCrossChainMessageProof
>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
throw
new
Error
(
`can only generate proofs for L2 to L1 messages`
)
throw
new
Error
(
`can only generate proofs for L2 to L1 messages`
)
...
@@ -1510,7 +1510,7 @@ export class CrossChainMessenger {
...
@@ -1510,7 +1510,7 @@ export class CrossChainMessenger {
const
output
=
await
this
.
getMessageBedrockOutput
(
const
output
=
await
this
.
getMessageBedrockOutput
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
output
===
null
)
{
if
(
output
===
null
)
{
throw
new
Error
(
`state root for message not yet published`
)
throw
new
Error
(
`state root for message not yet published`
)
...
@@ -1518,7 +1518,7 @@ export class CrossChainMessenger {
...
@@ -1518,7 +1518,7 @@ export class CrossChainMessenger {
const
withdrawal
=
await
this
.
toLowLevelMessage
(
const
withdrawal
=
await
this
.
toLowLevelMessage
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
const
hash
=
hashLowLevelMessage
(
withdrawal
)
const
hash
=
hashLowLevelMessage
(
withdrawal
)
const
messageSlot
=
hashMessageHash
(
hash
)
const
messageSlot
=
hashMessageHash
(
hash
)
...
@@ -1870,11 +1870,11 @@ export class CrossChainMessenger {
...
@@ -1870,11 +1870,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
TransactionRequest
>
=>
{
):
Promise
<
TransactionRequest
>
=>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
resolved
.
direction
===
MessageDirection
.
L2_TO_L1
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L2_TO_L1
)
{
throw
new
Error
(
`cannot resend L2 to L1 message`
)
throw
new
Error
(
`cannot resend L2 to L1 message`
)
...
@@ -1924,11 +1924,11 @@ export class CrossChainMessenger {
...
@@ -1924,11 +1924,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
TransactionRequest
>
=>
{
):
Promise
<
TransactionRequest
>
=>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
throw
new
Error
(
'
cannot finalize L1 to L2 message
'
)
throw
new
Error
(
'
cannot finalize L1 to L2 message
'
)
...
@@ -1942,11 +1942,11 @@ export class CrossChainMessenger {
...
@@ -1942,11 +1942,11 @@ export class CrossChainMessenger {
const
withdrawal
=
await
this
.
toLowLevelMessage
(
const
withdrawal
=
await
this
.
toLowLevelMessage
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
const
proof
=
await
this
.
getBedrockMessageProof
(
const
proof
=
await
this
.
getBedrockMessageProof
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
const
args
=
[
const
args
=
[
...
@@ -1993,11 +1993,11 @@ export class CrossChainMessenger {
...
@@ -1993,11 +1993,11 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
TransactionRequest
>
=>
{
):
Promise
<
TransactionRequest
>
=>
{
const
resolved
=
await
this
.
toCrossChainMessage
(
const
resolved
=
await
this
.
toCrossChainMessage
(
message
,
message
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
if
(
resolved
.
direction
===
MessageDirection
.
L1_TO_L2
)
{
throw
new
Error
(
`cannot finalize L1 to L2 message`
)
throw
new
Error
(
`cannot finalize L1 to L2 message`
)
...
@@ -2006,7 +2006,7 @@ export class CrossChainMessenger {
...
@@ -2006,7 +2006,7 @@ export class CrossChainMessenger {
if
(
this
.
bedrock
)
{
if
(
this
.
bedrock
)
{
const
withdrawal
=
await
this
.
toLowLevelMessage
(
const
withdrawal
=
await
this
.
toLowLevelMessage
(
resolved
,
resolved
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
return
this
.
contracts
.
l1
.
OptimismPortal
.
populateTransaction
.
finalizeWithdrawalTransaction
(
return
this
.
contracts
.
l1
.
OptimismPortal
.
populateTransaction
.
finalizeWithdrawalTransaction
(
[
[
...
@@ -2023,7 +2023,7 @@ export class CrossChainMessenger {
...
@@ -2023,7 +2023,7 @@ export class CrossChainMessenger {
// L1CrossDomainMessenger relayMessage is the only method that isn't fully backwards
// L1CrossDomainMessenger relayMessage is the only method that isn't fully backwards
// compatible, so we need to use the legacy interface. When we fully upgrade to Bedrock we
// compatible, so we need to use the legacy interface. When we fully upgrade to Bedrock we
// should be able to remove this code.
// should be able to remove this code.
const
proof
=
await
this
.
getMessageProof
(
resolved
,
m
ultiWithdrawal
Index
)
const
proof
=
await
this
.
getMessageProof
(
resolved
,
m
essage
Index
)
const
legacyL1XDM
=
new
ethers
.
Contract
(
const
legacyL1XDM
=
new
ethers
.
Contract
(
this
.
contracts
.
l1
.
L1CrossDomainMessenger
.
address
,
this
.
contracts
.
l1
.
L1CrossDomainMessenger
.
address
,
getContractInterface
(
'
L1CrossDomainMessenger
'
),
getContractInterface
(
'
L1CrossDomainMessenger
'
),
...
@@ -2284,13 +2284,13 @@ export class CrossChainMessenger {
...
@@ -2284,13 +2284,13 @@ export class CrossChainMessenger {
/**
/**
* The index of the withdrawal if multiple are made with multicall
* The index of the withdrawal if multiple are made with multicall
*/
*/
m
ultiWithdrawal
Index
=
0
m
essage
Index
=
0
):
Promise
<
BigNumber
>
=>
{
):
Promise
<
BigNumber
>
=>
{
return
this
.
l1Provider
.
estimateGas
(
return
this
.
l1Provider
.
estimateGas
(
await
this
.
populateTransaction
.
proveMessage
(
await
this
.
populateTransaction
.
proveMessage
(
message
,
message
,
opts
,
opts
,
m
ultiWithdrawal
Index
m
essage
Index
)
)
)
)
},
},
...
...
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