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
892b1d16
Commit
892b1d16
authored
Apr 13, 2023
by
Will Cory
Committed by
Mark Tyneway
Apr 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Add failing test to sdk.proveMessage
parent
efa4013e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2329 additions
and
22 deletions
+2329
-22
config.yml
.circleci/config.yml
+34
-0
package.json
packages/sdk/package.json
+3
-2
cross-chain-messenger.ts
packages/sdk/src/cross-chain-messenger.ts
+3
-0
cross-chain-messenger.with-logs.ts
packages/sdk/src/cross-chain-messenger.with-logs.ts
+2254
-0
proveMessage.spec.ts
packages/sdk/test-next/proveMessage.spec.ts
+35
-20
No files found.
.circleci/config.yml
View file @
892b1d16
...
...
@@ -535,6 +535,40 @@ jobs:
name
:
Upload coverage
command
:
codecov --verbose --clean --flags <<parameters.coverage_flag>>
sdk-next-tests
:
docker
:
-
image
:
ethereumoptimism/ci-builder:latest
resource_class
:
large
steps
:
-
checkout
-
attach_workspace
:
{
at
:
'
.'
}
-
check-changed
:
patterns
:
sdk,contracts-bedrock,contracts
-
run
:
name
:
anvil-l1
background
:
true
command
:
anvil --fork-url $ANVIL_L1_FORK_URL
-
run
:
name
:
anvil-l2
background
:
true
command
:
anvil --fork-url $ANVIL_L2_FORK_URL --port
9545
-
run
:
name
:
make sure anvil l1 is up
command
:
cast block-number --rpc-url http://localhost:8545
-
run
:
name
:
make sure anvil l2 is up
command
:
cast block-number --rpc-url http://localhost:9545
-
run
:
name
:
test:next
command
:
yarn test:next
no_output_timeout
:
5m
working_directory
:
packages/sdk
environment
:
# anvil[0] test private key
VITE_E2E_PRIVATE_KEY
:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
VITE_E2E_RPC_URLS_L1
:
http://localhost:8545
VITE_E2E_RPC_URLS_L2
:
http://localhost:9545
bedrock-markdown
:
machine
:
image
:
ubuntu-2204:2022.07.1
...
...
packages/sdk/package.json
View file @
892b1d16
...
...
@@ -46,7 +46,8 @@
"hardhat-deploy"
:
"^0.11.4"
,
"nyc"
:
"^15.1.0"
,
"typedoc"
:
"^0.22.13"
,
"mocha"
:
"^10.0.0"
"mocha"
:
"^10.0.0"
,
"vitest"
:
"^0.28.3"
},
"dependencies"
:
{
"@eth-optimism/contracts"
:
"0.5.40"
,
...
...
@@ -55,7 +56,7 @@
"lodash"
:
"^4.17.21"
,
"merkletreejs"
:
"^0.2.27"
,
"rlp"
:
"^2.2.7"
,
"
vitest"
:
"^0.28.3
"
"
zod"
:
"^3.11.6
"
},
"peerDependencies"
:
{
"ethers"
:
"^5"
...
...
packages/sdk/src/cross-chain-messenger.ts
View file @
892b1d16
...
...
@@ -572,6 +572,9 @@ export class CrossChainMessenger {
public
async
toCrossChainMessage
(
message
:
MessageLike
):
Promise
<
CrossChainMessage
>
{
if
(
!
message
)
{
throw
new
Error
(
'
message is undefined
'
)
}
// TODO: Convert these checks into proper type checks.
if
((
message
as
CrossChainMessage
).
message
)
{
return
message
as
CrossChainMessage
...
...
packages/sdk/src/cross-chain-messenger.with-logs.ts
0 → 100644
View file @
892b1d16
This diff is collapsed.
Click to expand it.
packages/sdk/test-next/proveMessage.spec.ts
View file @
892b1d16
import
ethers
from
'
ethers
'
import
{
describe
,
expect
,
it
}
from
'
vitest
'
import
{
z
}
from
'
zod
'
import
{
CrossChainMessenger
}
from
'
../src
'
/**
* This test repros the bug where legacy withdrawals are not provable
*/
/**
/**
*****
Cast results from runnning cast tx and cast receipt on the l2 tx hash
cast tx 0xd66fda632b51a8b25a9d260d70da8be57b9930c4616370861526335c3e8eef81 --rpc-url https://goerli.optimism.io
...
...
@@ -42,25 +48,33 @@ transactionHash 0xd66fda632b51a8b25a9d260d70da8be57b9930c461637086152633
transactionIndex 0
type
*/
import
{
CrossChainMessenger
}
from
'
../src
'
import
ethers
from
'
ethers
'
import
{
describe
,
expect
,
it
}
from
'
vitest
'
import
{
z
}
from
'
zod
'
const
E2E_RPC_URL_L1
=
z
.
string
().
url
().
describe
(
'
L1 ethereum rpc Url
'
).
parse
(
import
.
meta
.
env
.
VITE_E2E_RPC_URL_L1
)
const
E2E_RPC_URL_L2
=
z
.
string
().
url
().
describe
(
'
L1 ethereum rpc Url
'
).
parse
(
import
.
meta
.
env
.
VITE_E2E_RPC_URL_L2
)
const
E2E_PRIVATE_KEY
=
z
.
string
().
describe
(
'
Private key
'
).
parse
(
import
.
meta
.
env
.
VITE_E2E_PRIVATE_KEY
)
const
E2E_RPC_URL_L1
=
z
.
string
()
.
url
()
.
describe
(
'
L1 ethereum rpc Url
'
)
.
parse
(
import
.
meta
.
env
.
VITE_E2E_RPC_URL_L1
)
const
E2E_RPC_URL_L2
=
z
.
string
()
.
url
()
.
describe
(
'
L1 ethereum rpc Url
'
)
.
parse
(
import
.
meta
.
env
.
VITE_E2E_RPC_URL_L2
)
const
E2E_PRIVATE_KEY
=
z
.
string
()
.
describe
(
'
Private key
'
)
.
parse
(
import
.
meta
.
env
.
VITE_E2E_PRIVATE_KEY
)
const
jsonRpcHeaders
=
{
'
User-Agent
'
:
'
eth-optimism/@gateway/backend
'
}
/**
* Initialize the signer, prover, and cross chain messenger
*/
const
l2Provider
=
new
ethers
.
providers
.
JsonRpcProvider
(
E2E_RPC_URL_L1
)
const
l1Provider
=
new
ethers
.
providers
.
JsonRpcProvider
(
E2E_RPC_URL_L2
)
const
l1Provider
=
new
ethers
.
providers
.
JsonRpcProvider
({
url
:
E2E_RPC_URL_L1
,
headers
:
jsonRpcHeaders
,
})
const
l2Provider
=
new
ethers
.
providers
.
JsonRpcProvider
({
url
:
E2E_RPC_URL_L2
,
headers
:
jsonRpcHeaders
,
})
const
l1Wallet
=
new
ethers
.
Wallet
(
E2E_PRIVATE_KEY
,
l1Provider
)
const
crossChainMessenger
=
new
CrossChainMessenger
({
l1SignerOrProvider
:
l1Wallet
,
...
...
@@ -83,9 +97,10 @@ describe('prove message', () => {
const
txReceipt
=
await
l2Provider
.
getTransactionReceipt
(
txWithdrawalHash
)
expect
(
txReceipt
).
toBeDefined
()
expect
(
await
crossChainMessenger
.
proveMessage
(
txReceipt
)
).
toMatchInlineSnapshot
(
)
await
crossChainMessenger
.
proveMessage
(
txWithdrawalHash
)
).
toMatchInlineSnapshot
()
},
20
_000
)
})
\ No newline at end of file
})
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