Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockprod: Ability to specify custom transactions #1270

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

iljakuklic
Copy link
Contributor

This gives the user the option to add a custom list of transactions when asking the node to generate a new block.

Based on the original work of @alfiedotwtf.

Related:

@iljakuklic iljakuklic added enhancement New feature or request mempool Mempool-related issues block-production Block-production related issues labels Oct 11, 2023
// TODO: Alternatively, we can construct the transaction sequence from
// scratch every time a different timestamp is attempted. That is more costly
// in terms of computational resources but will allow the node to include more
// transactions since the passing time may release some time locks.
Copy link
Contributor

Choose a reason for hiding this comment

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

Going through the above code and then this change, I'm thinking that the minimum here should be MIN(last_timestamp_seconds_used, min_constructed_block_timestamp) given that transactions may be earlier than min_constructed_block_timestamp.

min_contstructed_block_timestamp should probably by locally scoped to the construction of max_constructed_block_timestamp as it's only used to calculate that value.

// Set of transactions already placed into the accumulator
let mut emitted: BTreeSet<_> = accum_ids.iter().collect();
// Set of already processed transactions, for de-duplication
let mut processed = emitted.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess for here too.

@alfiedotwtf
Copy link
Contributor

Race condition fix in 22940c6 looks good

@iljakuklic iljakuklic marked this pull request as draft October 12, 2023 17:13
@iljakuklic
Copy link
Contributor Author

Apparently, the mempool sync issue resurfaced also in functional tests, need to fix it up.

Comment on lines +196 to +198
accumulator
.add_tx(transaction, Amount::ZERO.into())
.map_err(|err| BlockProductionError::FailedToAddTransaction(transaction_id, err))?
Copy link
Collaborator

Choose a reason for hiding this comment

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

How are we making sure that these raw transactions are valid against what's coming from the mempool? I do hope we're not depending on the temporary solution we deployed that we wanted to solve later, where we include a transaction verifier inside the accumulator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no guarantee currently. Even transaction verifier is not sufficient because mempool deps are used to figure out the parent/child relationships. So it only properly works for transactions that are "independent" of transactions in the mempool. Could be removed since the guarantees are much weaker than for transactions specified by IDs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we agreed to just remove it...

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 thought we agreed to just remove it...

Ok will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm there are many existing functional tests that rely on this functionality, and some are not easy to adapt so the transactions can be pushed through mempool.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's just keep it, and write in the documentation that adding transactions there relies on the user ensuring the validity, and is done only in testing.

@TheQuantumPhysicist
Copy link
Collaborator

I took a round and it looks fine. I just don't understand the consistency guarantees we're having on transactions. Besides that and the comments, looking good.

@iljakuklic iljakuklic force-pushed the blockprod-custom-txs branch 2 times, most recently from 3426273 to 2080d38 Compare October 13, 2023 11:29
This gives the user the option to add a custom list of transactions when
asking the node to generate a new block.

Based on the original work of @alfiedotwtf.
@iljakuklic iljakuklic marked this pull request as ready for review October 13, 2023 19:57
@iljakuklic iljakuklic merged commit 923f4be into master Oct 16, 2023
31 checks passed
@iljakuklic iljakuklic deleted the blockprod-custom-txs branch October 16, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block-production Block-production related issues enhancement New feature or request mempool Mempool-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants