Compare commits
5 Commits
3.4.0
...
fake-mev-e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af6848f39c | ||
|
|
72e1242544 | ||
|
|
13be1a4b6a | ||
|
|
9586b78e10 | ||
|
|
3e84b01f3b |
@@ -57,5 +57,8 @@ services:
|
|||||||
ORACLE_MEV_FOREIGN_FLASHBOTS_AUTH_SIGNING_KEY: 82db7175932f4e6c8e45283b78b54fd5f195149378ec90d95b8fd0ec8bdadf1d
|
ORACLE_MEV_FOREIGN_FLASHBOTS_AUTH_SIGNING_KEY: 82db7175932f4e6c8e45283b78b54fd5f195149378ec90d95b8fd0ec8bdadf1d
|
||||||
ORACLE_MEV_FOREIGN_BUNDLES_BLOCK_RANGE: '5'
|
ORACLE_MEV_FOREIGN_BUNDLES_BLOCK_RANGE: '5'
|
||||||
ORACLE_FOREIGN_RPC_POLLING_INTERVAL: '70000' # time between sending different batches of MEV bundles (~= 5 blocks * 14 seconds)
|
ORACLE_FOREIGN_RPC_POLLING_INTERVAL: '70000' # time between sending different batches of MEV bundles (~= 5 blocks * 14 seconds)
|
||||||
|
FAKE_MEV_RELAY_TX_SENDING: 'true'
|
||||||
|
FAKE_MEV_RELAY_NO_EIP1559: 'true'
|
||||||
|
COMMON_FOREIGN_GAS_PRICE_FALLBACK: 100000000000 # will essentially replace block base fee
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
entrypoint: yarn mev:sender:foreign
|
entrypoint: yarn mev:sender:foreign
|
||||||
|
|||||||
@@ -15,9 +15,13 @@ if (process.argv.length < 3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const config = require(path.join('../config/', process.argv[2]))
|
const config = require(path.join('../config/', process.argv[2]))
|
||||||
|
const GasPrice = require('./services/gasPrice')
|
||||||
|
|
||||||
const { web3, mevForeign, validatorAddress } = config
|
const { web3, mevForeign, validatorAddress } = config
|
||||||
|
|
||||||
|
const FAKE_MEV_RELAY_TX_SENDING = process.env.FAKE_MEV_RELAY_TX_SENDING === 'true'
|
||||||
|
const FAKE_MEV_RELAY_NO_EIP1559 = process.env.FAKE_MEV_RELAY_NO_EIP1559 === 'true'
|
||||||
|
|
||||||
let chainId = 0
|
let chainId = 0
|
||||||
let flashbotsProvider
|
let flashbotsProvider
|
||||||
|
|
||||||
@@ -28,7 +32,9 @@ async function initialize() {
|
|||||||
web3.currentProvider.urls.forEach(checkHttps(config.id))
|
web3.currentProvider.urls.forEach(checkHttps(config.id))
|
||||||
|
|
||||||
chainId = await getChainId(web3)
|
chainId = await getChainId(web3)
|
||||||
flashbotsProvider = await mevForeign.getFlashbotsProvider(chainId)
|
if (!FAKE_MEV_RELAY_TX_SENDING) {
|
||||||
|
flashbotsProvider = await mevForeign.getFlashbotsProvider(chainId)
|
||||||
|
}
|
||||||
return runMain()
|
return runMain()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(e.message)
|
logger.error(e.message)
|
||||||
@@ -65,7 +71,13 @@ async function main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { baseFeePerGas: pendingBaseFee, number: pendingBlockNumber } = await getBlock(web3, 'pending')
|
const { baseFeePerGas, number: pendingBlockNumber } = await getBlock(web3, 'pending')
|
||||||
|
let pendingBaseFee = baseFeePerGas
|
||||||
|
if (FAKE_MEV_RELAY_TX_SENDING && FAKE_MEV_RELAY_NO_EIP1559) {
|
||||||
|
// emulate baseFee with the current gasPrice
|
||||||
|
await GasPrice.start('foreign', web3, true)
|
||||||
|
pendingBaseFee = GasPrice.gasPriceOptions().gasPrice
|
||||||
|
}
|
||||||
const bestJob = pickBestJob(jobs, pendingBaseFee)
|
const bestJob = pickBestJob(jobs, pendingBaseFee)
|
||||||
|
|
||||||
if (!bestJob) {
|
if (!bestJob) {
|
||||||
@@ -115,7 +127,7 @@ async function main() {
|
|||||||
{ nonce, fromBlock: pendingBlockNumber, toBlock: pendingBlockNumber + mevForeign.bundlesPerIteration - 1 },
|
{ nonce, fromBlock: pendingBlockNumber, toBlock: pendingBlockNumber + mevForeign.bundlesPerIteration - 1 },
|
||||||
'Sending MEV bundles'
|
'Sending MEV bundles'
|
||||||
)
|
)
|
||||||
const txHash = await sendTx({
|
const opts = {
|
||||||
data: bestJob.data,
|
data: bestJob.data,
|
||||||
nonce,
|
nonce,
|
||||||
value: bestJob.value,
|
value: bestJob.value,
|
||||||
@@ -134,7 +146,14 @@ async function main() {
|
|||||||
toBlock: pendingBlockNumber + mevForeign.bundlesPerIteration - 1,
|
toBlock: pendingBlockNumber + mevForeign.bundlesPerIteration - 1,
|
||||||
logger
|
logger
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
if (FAKE_MEV_RELAY_TX_SENDING) {
|
||||||
|
if (FAKE_MEV_RELAY_NO_EIP1559) {
|
||||||
|
opts.gasPriceOptions = { gasPrice: pendingBaseFee }
|
||||||
|
}
|
||||||
|
delete opts.mevOptions
|
||||||
|
}
|
||||||
|
const txHash = await sendTx(opts)
|
||||||
|
|
||||||
jobLogger.info({ txHash }, `Tx generated ${txHash} for event Tx ${bestJob.transactionReference}`)
|
jobLogger.info({ txHash }, `Tx generated ${txHash} for event Tx ${bestJob.transactionReference}`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user