Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Conversation

@dvush
Copy link
Contributor

@dvush dvush commented Aug 10, 2023

📝 Summary

Sanity check that all bundles that were included in the block are included preserving promised invariant.


return nil
}

func extractBundleTxDataFromBundles(bundles []types.SimulatedBundle, result map[common.Hash][]bundleTxData) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion: I'd expect result as an outparam to be a pointer to the map because I never know if the map is a reference under the copied value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but pointer to map does not support m[key] operation so you would still need to do (*m)[key] below.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine


// we allow gaps between txs in the bundle,
// but txs must be in the right order
if txInclusion.index < currentBlockTx {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

return nil, nil, err
}

err = VerifyBundlesAtomicity(work, blockBundles, allBundles, usedSbundles, mempoolTxHashes)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider putting this behind a flag maybe? I think we always want to run with this check, but who knows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a micro benchmark and it claims to run in 0.25ms on my machine. So it looks like it could be safely be here without flag.

Copy link
Contributor

@Wazzymandias Wazzymandias Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your 64-core machine? 😅

With efficient revert and other performance optimizations block build time will go lower. We also want to resubmit more often because it enables more transactions to be included

I updated benchmark for worst-case n=1000 because I sometimes saw 300+ bundles. I could add flag to this branch maybe.

BenchmarkVerifyBundlesAtomicity-12          1272            904799 ns/op
PASS
ok      github.com/ethereum/go-ethereum/miner   17.514s

Copy link
Contributor Author

@dvush dvush Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its non parallel

and in your case its still 1 ms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw you don't need to add 1000 committed bundles. even 100 is way to big for committed stuff.

but for used bundles its more correct

@Wazzymandias Wazzymandias force-pushed the sanity_check_bundles branch 2 times, most recently from 804defb to 17d7dbc Compare August 10, 2023 15:02
@dvush dvush force-pushed the sanity_check_bundles branch from 0f91091 to 28d9029 Compare August 11, 2023 05:58
@dvush dvush merged commit 5740880 into main Aug 11, 2023
@dvush dvush deleted the sanity_check_bundles branch August 11, 2023 06:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants