Commit 06d548ff authored by Kelvin Fichter's avatar Kelvin Fichter

feat: tweaks from final SDK behavior review

parent a46f5f2d
......@@ -145,15 +145,13 @@ export interface ICrossChainProvider {
): Promise<MessageReceipt>
/**
* Estimates the amount of gas required to fully execute a given message. Behavior of this
* function depends on the direction of the message. If the message is an L1 to L2 message,
* 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.
* Estimates the amount of gas required to fully execute a given message on L2. Only applies to
* L1 => L2 messages. You would supply this gas limit when sending the message to L2.
*
* @param message Message get a gas estimate for.
* @returns Estimates L2 gas limit.
*/
estimateMessageExecutionGas(message: MessageLike): Promise<BigNumber>
estimateL2MessageGasLimit(message: MessageLike): Promise<BigNumber>
/**
* Returns the estimated amount of time before the message can be executed. When this is a
......
......@@ -5,56 +5,20 @@ describe('CrossChainERC20Pair', () => {
describe('construction', () => {
it('should have a messenger', () => {})
describe('when only an L1 token is provided', () => {
describe('when the token is a standard bridge token', () => {
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 a standard bridge token', () => {
it('should resolve an L1 token from the token list', () => {})
})
describe('when the token is ETH', () => {
it('should resolve the L1 ETH token address', () => {})
it('should resolve the correct bridge', () => {})
})
describe('when the token is SNX', () => {
it('should resolve the L1 SNX token address', () => {})
it('should resolve the correct bridge', () => {})
})
describe('when the token is DAI', () => {
it('should resolve the L1 DAI token address', () => {})
it('should resolve the correct bridge', () => {})
})
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', () => {
it('should attach both instances', () => {})
})
describe('when neither an L1 token or an L2 token are provided', () => {
it('should throw an error', () => {})
describe('when a custom adapter is provided', () => {
it('should use the custom adapter', () => {})
})
})
......@@ -121,11 +85,11 @@ describe('CrossChainERC20Pair', () => {
})
describe('estimateGas', () => {
describe('estimateGas', () => {
describe('deposit', () => {
it('should estimate gas required for the transaction', () => {})
})
describe('estimateGas', () => {
describe('withdraw', () => {
it('should estimate gas required for the transaction', () => {})
})
})
......
......@@ -32,7 +32,6 @@ describe('CrossChainMessenger', () => {
it('should throw an error', () => {})
})
// TODO: is this the behavior we want?
describe('when the message has already been finalized', () => {
it('should throw an error', () => {})
})
......
......@@ -19,7 +19,7 @@ describe('CrossChainProvider', () => {
describe('getMessagesByTransaction', () => {
describe('when a direction is specified', () => {
describe('when the transaction exists', () => {
describe('when thetransaction has messages', () => {
describe('when the transaction has messages', () => {
for (const n of [1, 2, 4, 8]) {
it(`should find ${n} messages when the transaction emits ${n} messages`, () => {})
}
......@@ -156,6 +156,10 @@ describe('CrossChainProvider', () => {
})
})
})
describe('when the message does not exist', () => {
it('should throw an error', () => {})
})
})
describe('getMessageReceipt', () => {
......@@ -176,6 +180,10 @@ describe('CrossChainProvider', () => {
describe('when the message has not been relayed', () => {
it('should return null', () => {})
})
describe('when the message does not exist', () => {
it('should throw an error', () => {})
})
})
describe('waitForMessageReciept', () => {
......@@ -193,16 +201,14 @@ describe('CrossChainProvider', () => {
it('should throw an error if the timeout is reached', () => {})
})
})
})
describe('estimateMessageExecutionGas', () => {
describe('when the message is an L1 => L2 message', () => {
it('should perform a gas estimation of the L2 action', () => {})
describe('when the message does not exist', () => {
it('should throw an error', () => {})
})
describe('when the message is an L2 => L1 message', () => {
it('should perform a gas estimation of the L1 action, including the cost of the proof', () => {})
})
describe('estimateL2MessageGasLimit', () => {
it('should perform a gas estimation of the L2 action', () => {})
})
describe('estimateMessageWaitTimeBlocks', () => {
......@@ -219,7 +225,7 @@ describe('CrossChainProvider', () => {
describe('when the message is an L2 => L1 message', () => {
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', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment