-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test hardcoded Paratime withdraw gas limit
- Loading branch information
Showing
10 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test hardcoded Paratime withdraw gas limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { paraTimesConfig } from '../../src/config' | ||
|
||
for (const net of ['mainnet', 'testnet']) { | ||
for (const paratime of ['sapphire', 'emerald', 'cipher']) { | ||
test(`Check if hardcoded Paratime withdraw gas limit needs to be updated: ${net} ${paratime}`, async ({ | ||
page, | ||
}) => { | ||
await page.goto('/e2e') | ||
|
||
const estimatedGas = await page.evaluate( | ||
async ([net, paratime, paraTimesConfig]) => { | ||
const oasis: typeof import('@oasisprotocol/client') = (window as any).oasis | ||
const oasisRT: typeof import('@oasisprotocol/client-rt') = (window as any).oasisRT | ||
|
||
const nic = | ||
net === 'mainnet' | ||
? new oasis.client.NodeInternal('https://grpc.oasis.io') | ||
: new oasis.client.NodeInternal('https://testnet.grpc.oasis.io') | ||
|
||
const txWrapper = new oasisRT.consensusAccounts.Wrapper( | ||
oasis.misc.fromHex(paraTimesConfig[paratime][net].runtimeId!), | ||
) | ||
.callDeposit() | ||
.setBody({ | ||
amount: [ | ||
oasis.quantity.fromBigInt(10n ** 18n * 1000000000n), | ||
oasisRT.token.NATIVE_DENOMINATION, | ||
], | ||
to: oasis.staking.addressFromBech32( | ||
// await getEvmBech32Address('0x0000000000000000000000000000000000000000') | ||
'oasis1qq2v39p9fqk997vk6742axrzqyu9v2ncyuqt8uek', | ||
), | ||
}) | ||
.setFeeAmount([oasis.quantity.fromBigInt(10n ** 18n), oasisRT.token.NATIVE_DENOMINATION]) | ||
.setFeeGas(10n ** 18n) | ||
.setFeeConsensusMessages(1) | ||
.setSignerInfo([ | ||
{ | ||
address_spec: { | ||
signature: { | ||
ed25519: oasis.signature.NaclSigner.fromRandom('this key is not important').public(), | ||
}, | ||
}, | ||
nonce: 10000n, | ||
}, | ||
]) | ||
|
||
const estimatedGas = await new oasisRT.core.Wrapper( | ||
oasis.misc.fromHex(paraTimesConfig[paratime][net].runtimeId!), | ||
) | ||
.queryEstimateGas() | ||
.setArgs({ tx: txWrapper.transaction }) | ||
.query(nic) | ||
|
||
return estimatedGas | ||
}, | ||
[net, paratime, paraTimesConfig] as const, | ||
) | ||
|
||
expect(estimatedGas.toString()).toMatchSnapshot() | ||
expect(estimatedGas).toBeLessThan(paraTimesConfig[paratime].feeGas) | ||
}) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...hardcoded-Paratime-withdraw-gas-limit-needs-to-be-updated-mainnet-cipher-1-main-linux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4106320 |
1 change: 1 addition & 0 deletions
1
...ardcoded-Paratime-withdraw-gas-limit-needs-to-be-updated-mainnet-emerald-1-main-linux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
61316 |
1 change: 1 addition & 0 deletions
1
...rdcoded-Paratime-withdraw-gas-limit-needs-to-be-updated-mainnet-sapphire-1-main-linux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
61316 |
1 change: 1 addition & 0 deletions
1
...hardcoded-Paratime-withdraw-gas-limit-needs-to-be-updated-testnet-cipher-1-main-linux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4106320 |
1 change: 1 addition & 0 deletions
1
...ardcoded-Paratime-withdraw-gas-limit-needs-to-be-updated-testnet-emerald-1-main-linux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
61316 |
1 change: 1 addition & 0 deletions
1
...rdcoded-Paratime-withdraw-gas-limit-needs-to-be-updated-testnet-sapphire-1-main-linux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
61316 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters