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
06d548ff
Unverified
Commit
06d548ff
authored
Dec 13, 2021
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: tweaks from final SDK behavior review
parent
a46f5f2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
62 deletions
+29
-62
cross-chain-provider.ts
packages/sdk/src/interfaces/cross-chain-provider.ts
+4
-6
cross-chain-erc20-pair.spec.ts
packages/sdk/test/cross-chain-erc20-pair.spec.ts
+10
-46
cross-chain-messenger.spec.ts
packages/sdk/test/cross-chain-messenger.spec.ts
+0
-1
cross-chain-provider.spec.ts
packages/sdk/test/cross-chain-provider.spec.ts
+15
-9
No files found.
packages/sdk/src/interfaces/cross-chain-provider.ts
View file @
06d548ff
...
@@ -145,15 +145,13 @@ export interface ICrossChainProvider {
...
@@ -145,15 +145,13 @@ export interface ICrossChainProvider {
):
Promise
<
MessageReceipt
>
):
Promise
<
MessageReceipt
>
/**
/**
* Estimates the amount of gas required to fully execute a given message. Behavior of this
* Estimates the amount of gas required to fully execute a given message on L2. Only applies to
* function depends on the direction of the message. If the message is an L1 to L2 message,
* L1 => L2 messages. You would supply this gas limit when sending the message to L2.
* then this will estimate the amount of gas required to execute the message on L2. If the
* message is an L2 to L1 message, then this estimate will also include the amount of gas
* required to execute the Merkle Patricia Trie proof on L1.
*
*
* @param message Message get a gas estimate for.
* @param message Message get a gas estimate for.
* @returns Estimates L2 gas limit.
*/
*/
estimate
MessageExecutionGas
(
message
:
MessageLike
):
Promise
<
BigNumber
>
estimate
L2MessageGasLimit
(
message
:
MessageLike
):
Promise
<
BigNumber
>
/**
/**
* Returns the estimated amount of time before the message can be executed. When this is a
* Returns the estimated amount of time before the message can be executed. When this is a
...
...
packages/sdk/test/cross-chain-erc20-pair.spec.ts
View file @
06d548ff
...
@@ -5,56 +5,20 @@ describe('CrossChainERC20Pair', () => {
...
@@ -5,56 +5,20 @@ describe('CrossChainERC20Pair', () => {
describe
(
'
construction
'
,
()
=>
{
describe
(
'
construction
'
,
()
=>
{
it
(
'
should have a messenger
'
,
()
=>
{})
it
(
'
should have a messenger
'
,
()
=>
{})
describe
(
'
when only an L1 token is provided
'
,
()
=>
{
describe
(
'
when the token is a standard bridge token
'
,
()
=>
{
describe
(
'
when the token is a standard bridge token
'
,
()
=>
{
it
(
'
should resolve the correct bridge
'
,
()
=>
{})
it
(
'
should resolve an L2 token from the token list
'
,
()
=>
{})
})
describe
(
'
when the token is ETH
'
,
()
=>
{
it
(
'
should resolve the L2 ETH token address
'
,
()
=>
{})
})
describe
(
'
when the token is SNX
'
,
()
=>
{
it
(
'
should resolve the L2 SNX token address
'
,
()
=>
{})
})
describe
(
'
when the token is DAI
'
,
()
=>
{
it
(
'
should resolve the L2 DAI token address
'
,
()
=>
{})
})
describe
(
'
when the token is not a standard token or a special token
'
,
()
=>
{
it
(
'
should throw an error
'
,
()
=>
{})
})
})
})
describe
(
'
when only an L2 token is provided
'
,
()
=>
{
describe
(
'
when the token is SNX
'
,
()
=>
{
describe
(
'
when the token is a standard bridge token
'
,
()
=>
{
it
(
'
should resolve the correct bridge
'
,
()
=>
{})
it
(
'
should resolve an L1 token from the token list
'
,
()
=>
{})
})
describe
(
'
when the token is ETH
'
,
()
=>
{
it
(
'
should resolve the L1 ETH token address
'
,
()
=>
{})
})
describe
(
'
when the token is SNX
'
,
()
=>
{
it
(
'
should resolve the L1 SNX token address
'
,
()
=>
{})
})
describe
(
'
when the token is DAI
'
,
()
=>
{
it
(
'
should resolve the L1 DAI token address
'
,
()
=>
{})
})
describe
(
'
when the token is not a standard token or a special token
'
,
()
=>
{
it
(
'
should throw an error
'
,
()
=>
{})
})
})
})
describe
(
'
when
both an L1 token and an L2 token are provided
'
,
()
=>
{
describe
(
'
when
the token is DAI
'
,
()
=>
{
it
(
'
should
attach both instances
'
,
()
=>
{})
it
(
'
should
resolve the correct bridge
'
,
()
=>
{})
})
})
describe
(
'
when
neither an L1 token or an L2 token are
provided
'
,
()
=>
{
describe
(
'
when
a custom adapter is
provided
'
,
()
=>
{
it
(
'
should
throw an erro
r
'
,
()
=>
{})
it
(
'
should
use the custom adapte
r
'
,
()
=>
{})
})
})
})
})
...
@@ -121,11 +85,11 @@ describe('CrossChainERC20Pair', () => {
...
@@ -121,11 +85,11 @@ describe('CrossChainERC20Pair', () => {
})
})
describe
(
'
estimateGas
'
,
()
=>
{
describe
(
'
estimateGas
'
,
()
=>
{
describe
(
'
estimateGas
'
,
()
=>
{
describe
(
'
deposit
'
,
()
=>
{
it
(
'
should estimate gas required for the transaction
'
,
()
=>
{})
it
(
'
should estimate gas required for the transaction
'
,
()
=>
{})
})
})
describe
(
'
estimateGas
'
,
()
=>
{
describe
(
'
withdraw
'
,
()
=>
{
it
(
'
should estimate gas required for the transaction
'
,
()
=>
{})
it
(
'
should estimate gas required for the transaction
'
,
()
=>
{})
})
})
})
})
...
...
packages/sdk/test/cross-chain-messenger.spec.ts
View file @
06d548ff
...
@@ -32,7 +32,6 @@ describe('CrossChainMessenger', () => {
...
@@ -32,7 +32,6 @@ describe('CrossChainMessenger', () => {
it
(
'
should throw an error
'
,
()
=>
{})
it
(
'
should throw an error
'
,
()
=>
{})
})
})
// TODO: is this the behavior we want?
describe
(
'
when the message has already been finalized
'
,
()
=>
{
describe
(
'
when the message has already been finalized
'
,
()
=>
{
it
(
'
should throw an error
'
,
()
=>
{})
it
(
'
should throw an error
'
,
()
=>
{})
})
})
...
...
packages/sdk/test/cross-chain-provider.spec.ts
View file @
06d548ff
...
@@ -19,7 +19,7 @@ describe('CrossChainProvider', () => {
...
@@ -19,7 +19,7 @@ describe('CrossChainProvider', () => {
describe
(
'
getMessagesByTransaction
'
,
()
=>
{
describe
(
'
getMessagesByTransaction
'
,
()
=>
{
describe
(
'
when a direction is specified
'
,
()
=>
{
describe
(
'
when a direction is specified
'
,
()
=>
{
describe
(
'
when the transaction exists
'
,
()
=>
{
describe
(
'
when the transaction exists
'
,
()
=>
{
describe
(
'
when thetransaction has messages
'
,
()
=>
{
describe
(
'
when the
transaction has messages
'
,
()
=>
{
for
(
const
n
of
[
1
,
2
,
4
,
8
])
{
for
(
const
n
of
[
1
,
2
,
4
,
8
])
{
it
(
`should find
${
n
}
messages when the transaction emits
${
n
}
messages`
,
()
=>
{})
it
(
`should find
${
n
}
messages when the transaction emits
${
n
}
messages`
,
()
=>
{})
}
}
...
@@ -156,6 +156,10 @@ describe('CrossChainProvider', () => {
...
@@ -156,6 +156,10 @@ describe('CrossChainProvider', () => {
})
})
})
})
})
})
describe
(
'
when the message does not exist
'
,
()
=>
{
it
(
'
should throw an error
'
,
()
=>
{})
})
})
})
describe
(
'
getMessageReceipt
'
,
()
=>
{
describe
(
'
getMessageReceipt
'
,
()
=>
{
...
@@ -176,6 +180,10 @@ describe('CrossChainProvider', () => {
...
@@ -176,6 +180,10 @@ describe('CrossChainProvider', () => {
describe
(
'
when the message has not been relayed
'
,
()
=>
{
describe
(
'
when the message has not been relayed
'
,
()
=>
{
it
(
'
should return null
'
,
()
=>
{})
it
(
'
should return null
'
,
()
=>
{})
})
})
describe
(
'
when the message does not exist
'
,
()
=>
{
it
(
'
should throw an error
'
,
()
=>
{})
})
})
})
describe
(
'
waitForMessageReciept
'
,
()
=>
{
describe
(
'
waitForMessageReciept
'
,
()
=>
{
...
@@ -193,16 +201,14 @@ describe('CrossChainProvider', () => {
...
@@ -193,16 +201,14 @@ describe('CrossChainProvider', () => {
it
(
'
should throw an error if the timeout is reached
'
,
()
=>
{})
it
(
'
should throw an error if the timeout is reached
'
,
()
=>
{})
})
})
})
})
})
describe
(
'
estimateMessageExecutionGas
'
,
()
=>
{
describe
(
'
when the message does not exist
'
,
()
=>
{
describe
(
'
when the message is an L1 => L2 message
'
,
()
=>
{
it
(
'
should throw an error
'
,
()
=>
{})
it
(
'
should perform a gas estimation of the L2 action
'
,
()
=>
{})
})
})
})
describe
(
'
when the message is an L2 => L1 message
'
,
()
=>
{
describe
(
'
estimateL2MessageGasLimit
'
,
()
=>
{
it
(
'
should perform a gas estimation of the L1 action, including the cost of the proof
'
,
()
=>
{})
it
(
'
should perform a gas estimation of the L2 action
'
,
()
=>
{})
})
})
})
describe
(
'
estimateMessageWaitTimeBlocks
'
,
()
=>
{
describe
(
'
estimateMessageWaitTimeBlocks
'
,
()
=>
{
...
@@ -219,7 +225,7 @@ describe('CrossChainProvider', () => {
...
@@ -219,7 +225,7 @@ describe('CrossChainProvider', () => {
describe
(
'
when the message is an L2 => L1 message
'
,
()
=>
{
describe
(
'
when the message is an L2 => L1 message
'
,
()
=>
{
describe
(
'
when the state root has not been published
'
,
()
=>
{
describe
(
'
when the state root has not been published
'
,
()
=>
{
it
(
'
should return
null
'
,
()
=>
{})
it
(
'
should return
the estimated blocks until the state root will be published and pass the challenge period
'
,
()
=>
{})
})
})
describe
(
'
when the state root is within the challenge period
'
,
()
=>
{
describe
(
'
when the state root is within the challenge period
'
,
()
=>
{
...
...
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