-
Notifications
You must be signed in to change notification settings - Fork 294
Open
Description
I'm trying to send a flashbot Bundle with several transactions. I use the following code to sign and send a bundle:
const signedTransactions = await flashbotsProvider.signBundle([
{
signer: MyWallet,
transaction: firstTx
},
{
signer: MyWallet,
transaction: secondTx
},
{
signer: MyWallet,
transaction: thirdTx
}]);
const targetBlockNumber = block.number;
const simulation = await flashbotsProvider.simulate(
signedTransactions,
targetBlockNumber + 1
)
console.log(simulation);
console.log("bundleHash: ", simulation.bundleHash);
for (var i = 1; i <= 10; i++) {
console.log(">>>>>> ", i);
const bundleSubmission = await flashbotsProvider.sendRawBundle(
signedTransactions,
targetBlockNumber + i
)
console.log('bundle submitted, waiting', bundleSubmission.bundleHash)
const waitResponse = await bundleSubmission.wait()
console.log(`Wait Response: ${FlashbotsBundleResolution[waitResponse]}`)
if (
waitResponse === FlashbotsBundleResolution.BundleIncluded ||
waitResponse === FlashbotsBundleResolution.AccountNonceTooHigh
) {
console.log('Bundle included!')
process.exit(0)
} else {
console.log(">>>", simulation.bundleHash);
console.log({
bundleStats: await flashbotsProvider.getBundleStats(
simulation.bundleHash,
targetBlockNumber + 1,
),
userStats: await flashbotsProvider.getUserStats(),
})
}
}
The simulation is successful. However, In order to ensure that the bundle can be included, I for loop 10 times to send a new bundle in case the previous bundle fails. It seems that the bundles are not included because they are not sent to the miners(isSentToMiners is false). Why does this happen?
bundleHash: 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
>>>>>> 1
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 2
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 3
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 4
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 5
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 6
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 7
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
>>>>>> 8
bundle submitted, waiting 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
Wait Response: BlockPassedWithoutInclusion
>>> 0x012ca7ac493afc4bf288bb9cde4b49d521d1c12c01d66705d8fbd3bdfb1c6112
{
bundleStats: {
isHighPriority: true,
isSentToMiners: false,
isSimulated: true,
simulatedAt: '2023-02-12T08:03:16.241Z',
submittedAt: '2023-02-12T08:03:16.233Z'
},
userStats: {
all_time_gas_simulated: '',
all_time_miner_payments: '',
is_high_priority: false,
last_1d_gas_simulated: '',
last_1d_miner_payments: '',
last_7d_gas_simulated: '',
last_7d_miner_payments: ''
}
}
Metadata
Metadata
Assignees
Labels
No labels