Skip to content

Commit

Permalink
fix: historical frontrun test
Browse files Browse the repository at this point in the history
  • Loading branch information
Amuhar committed Jan 6, 2025
1 parent 5f019b0 commit bc39114
Show file tree
Hide file tree
Showing 4 changed files with 940 additions and 1,075 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/app-root-path": "^1.2.4",
"@types/cache-manager": "^3.4.3",
"@types/glob": "^8.1.0",
"@types/jest": "^27.0.1",
"@types/jest": "^29.5.14",
"@types/kafkajs": "^1.9.0",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
Expand All @@ -86,11 +86,11 @@
"eslint-plugin-prettier": "^3.4.0",
"ganache": "7.9.0",
"hardhat": "^2.22.14",
"jest": "^27.0.6",
"jest": "^29.7.0",
"pg": "^8.13.0",
"prettier": "^2.3.2",
"supertest": "^6.1.3",
"ts-jest": "^27.0.3",
"ts-jest": "^29.2.5",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "^3.10.1",
Expand Down
19 changes: 0 additions & 19 deletions test/helpers/docker-containers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,25 +169,6 @@ async function pullAndCreateKapiContainer(docker: Docker) {
const exposedHosts =
process.platform === 'linux' ? {} : { ExposedPorts: { '3000/tcp': {} } };

console.log({
Image: KAPI_IMAGE,
name: KAPI_CONTAINER,
Env: [
'NODE_ENV=production',
'DB_NAME=node_operator_keys_service_db',
'DB_PORT=5432',
`DB_HOST=${DB_HOST}`,
'DB_USER=postgres',
'DB_PASSWORD=postgres',
`PROVIDERS_URLS=${HARDHAT_URL}`,
'VALIDATOR_REGISTRY_ENABLE=false',
`CHAIN_ID=${CHAIN_ID}`,
'CL_API_URLS=',
],
...exposedHosts,
HostConfig: hostConfig,
});

// Create and configure the PostgreSQL container
const container = await docker.createContainer({
Image: KAPI_IMAGE,
Expand Down
13 changes: 8 additions & 5 deletions test/helpers/dsm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getLocator } from './sr.contract';
import { Contract } from '@ethersproject/contracts';
import { wqAbi } from './wq.abi';
import { VOTING } from './voting';
import { BigNumber } from 'ethers';

Check warning on line 9 in test/helpers/dsm.ts

View workflow job for this annotation

GitHub Actions / Unit Tests

'BigNumber' is defined but never used

function createWallet(provider: ethers.providers.JsonRpcProvider) {
if (!process.env.WALLET_PRIVATE_KEY) throw new Error(NO_PRIVKEY_MESSAGE);
Expand Down Expand Up @@ -94,11 +95,6 @@ export async function deposit(moduleId: number) {

const lidoVotingSigner = LidoAbi__factory.connect(lidoAddress, votingSigner);

await lidoVotingSigner.setStakingLimit(
ethers.utils.parseEther('150000'), // _maxStakeLimit
ethers.utils.parseEther('23.4375'), // _stakeLimitIncreasePerBlock
);

const unfinalizedStETHWei = await withdrawalQueue.unfinalizedStETH();
const depositableEtherWei = await lido.getBufferedEther();

Expand All @@ -110,6 +106,13 @@ export async function deposit(moduleId: number) {
.add(ethers.utils.parseEther('100000'));
const amountForDepositsInEth = ethers.utils.formatEther(amountForDeposits);

await lidoVotingSigner.setStakingLimit(
ethers.utils.parseEther(amountForDepositsInEth), // _maxStakeLimit
ethers.utils.parseEther(amountForDepositsInEth), // _stakeLimitIncreasePerBlock
);

await new Promise((res) => setTimeout(res, 12000));

await transferEther(lidoAddress, amountForDepositsInEth);

await new Promise((res) => setTimeout(res, 12000));
Expand Down
Loading

0 comments on commit bc39114

Please sign in to comment.