Skip to content

Commit

Permalink
Merge pull request #535 from lidofinance/533-changing-gateseal-address
Browse files Browse the repository at this point in the history
feat: Changing GateSeal address
  • Loading branch information
sergeyWh1te authored Apr 26, 2024
2 parents f8c5346 + ea0f778 commit 6af771d
Show file tree
Hide file tree
Showing 28 changed files with 491 additions and 726 deletions.
1 change: 0 additions & 1 deletion ethereum-steth/.nvmrc

This file was deleted.

12 changes: 2 additions & 10 deletions ethereum-steth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
2. 🚨🚨🚨 Withdrawal Vault balance mismatch. [within oracle report]
3. 🚨🚨🚨 EL Vault balance mismatch. [without oracle report]
4. 🚨🚨🚨 EL Vault balance mismatch. [within oracle report]
5. 💵 Withdrawal Vault Balance significant change (checks every on 100-th block)
6. 💵 EL Vault Balance significant change
5. ℹ️ Withdrawal Vault Balance significant change (checks every on 100-th block)
6. ℹ️ EL Vault Balance significant change
2. HandleTransaction
1. 🚨 Burner shares transfer

Expand All @@ -97,11 +97,3 @@ Running in a live mode:
```
yarn start:dev
```

Testing on a specific block/range/transaction:

```
yarn block 13626668
yarn range '13626667..13626668'
yarn tx 0x2d2774c04e3faf9f17cd26e0978bb812081b9d0b5cc6fd8bf04cc441f92c0a8c
```
21 changes: 16 additions & 5 deletions ethereum-steth/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { TransactionEvent } from 'forta-agent/dist/sdk/transaction.event'
import { Metadata } from './entity/metadata'
import Version from './utils/version'
import { ETH_DECIMALS } from './utils/constants'
import { BlockDto } from './entity/events'
import { BlockDto, TransactionDto } from './entity/events'
import BigNumber from 'bignumber.js'

export function initialize(): Initialize {
const metadata: Metadata = {
Expand Down Expand Up @@ -172,10 +173,20 @@ export const handleTransaction = (): HandleTransaction => {
const app = await App.getInstance()
const out: Finding[] = []

const stethOperationFindings = await app.StethOperationSrv.handleTransaction(txEvent, txEvent.block.number)
const withdrawalsFindings = await app.WithdrawalsSrv.handleTransaction(txEvent)
const gateSealFindings = app.GateSealSrv.handleTransaction(txEvent)
const vaultFindings = app.VaultSrv.handleTransaction(txEvent)
const txDto: TransactionDto = {
logs: txEvent.logs,
to: txEvent.to,
timestamp: txEvent.timestamp,
block: {
timestamp: txEvent.block.timestamp,
number: new BigNumber(txEvent.block.number, 10).toNumber(),
},
}

const withdrawalsFindings = await app.WithdrawalsSrv.handleTransaction(txDto)
const stethOperationFindings = await app.StethOperationSrv.handleTransaction(txDto)
const gateSealFindings = app.GateSealSrv.handleTransaction(txDto)
const vaultFindings = app.VaultSrv.handleTransaction(txDto)

out.push(...stethOperationFindings, ...withdrawalsFindings, ...gateSealFindings, ...vaultFindings)

Expand Down
27 changes: 12 additions & 15 deletions ethereum-steth/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,12 @@ export class App {

const address: Address = Address

const lidoContact = Lido__factory.connect(address.LIDO_STETH_ADDRESS, ethersProvider)
const lidoRunner = Lido__factory.connect(address.LIDO_STETH_ADDRESS, ethersProvider)

const wdQueueContact = WithdrawalQueueERC721__factory.connect(address.WITHDRAWALS_QUEUE_ADDRESS, drpcProvider)
const wdQueueRunner = WithdrawalQueueERC721__factory.connect(address.WITHDRAWALS_QUEUE_ADDRESS, drpcProvider)

const gateSealContact = GateSeal__factory.connect(address.GATE_SEAL_DEFAULT_ADDRESS, ethersProvider)
const exitBusOracleContract = ValidatorsExitBusOracle__factory.connect(
address.EXIT_BUS_ORACLE_ADDRESS,
ethersProvider,
)
const gateSealRunner = GateSeal__factory.connect(address.GATE_SEAL_DEFAULT_ADDRESS, ethersProvider)
const veboRunner = ValidatorsExitBusOracle__factory.connect(address.EXIT_BUS_ORACLE_ADDRESS, ethersProvider)

const logger: Winston.Logger = Winston.createLogger({
format: Winston.format.simple(),
Expand All @@ -120,10 +117,10 @@ export class App {
logger,
ethersProvider,
etherscanProvider,
lidoContact,
wdQueueContact,
gateSealContact,
exitBusOracleContract,
lidoRunner,
wdQueueRunner,
gateSealRunner,
veboRunner,
)

const stethOperationCache = new StethOperationCache()
Expand Down Expand Up @@ -162,10 +159,10 @@ export class App {
logger,
drpcProvider,
etherscanProvider,
lidoContact,
wdQueueContact,
gateSealContact,
exitBusOracleContract,
lidoRunner,
wdQueueRunner,
gateSealRunner,
veboRunner,
)

const vaultSrv = new VaultSrv(
Expand Down
16 changes: 0 additions & 16 deletions ethereum-steth/src/clients/contracts.ts

This file was deleted.

4 changes: 2 additions & 2 deletions ethereum-steth/src/clients/eth_provider.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App } from '../app'
import * as E from 'fp-ts/Either'
import { Address, ETH_DECIMALS } from '../utils/constants'
import { Address, ETH_DECIMALS, GATE_SEAL_DEFAULT_ADDRESS_BEFORE_26_APR_2024 } from '../utils/constants'
import { GateSeal } from '../entity/gate_seal'
import { JsonRpcProvider } from '@ethersproject/providers'
import { ethers } from 'forta-agent'
Expand Down Expand Up @@ -37,7 +37,7 @@ describe('eth provider tests', () => {

const blockNumber = 19140476

const resp = await app.ethClient.checkGateSeal(blockNumber, Address.GATE_SEAL_DEFAULT_ADDRESS)
const resp = await app.ethClient.checkGateSeal(blockNumber, GATE_SEAL_DEFAULT_ADDRESS_BEFORE_26_APR_2024)
if (E.isLeft(resp)) {
throw resp.left.message
}
Expand Down
Loading

0 comments on commit 6af771d

Please sign in to comment.