Skip to content

Interval Sealing support for engine_createBlock #1745

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

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

wilwade
Copy link
Collaborator

@wilwade wilwade commented Oct 30, 2023

Goal

The goal of this PR is enable engine_createBlock for Interval Sealing mode.

Effectively it uses the should make empty block coming down the command instead of making a special exception for interval sealing.

Note: This does reduce the logs in other modes when engine_createBlock is called with not making an empty block and no transactions are in the pool.

Test

  • make start-interval (or the new 1 second make command make start-interval-1)
  • Wait for it to start
  • make local-block now works (it will would before this PR)

@wilwade wilwade requested a review from rlaferla October 30, 2023 14:47
Comment on lines 254 to 251
if sealing_mode != SealingMode::Interval ||
sealing_create_empty_blocks ||
pool.ready().count() > 0
// To keep the logs quieter, don't even attempt to create empty blocks unless there are transactions in the pool
if create_empty || pool.ready().count() > 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the important logic change!

Copy link
Contributor

Choose a reason for hiding this comment

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

How is this different from specifying to not create empty blocks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The if statement will make it not call the request to make a non-empty block which otherwise would throw an error log.

If I recall that's the original reason for the original if statement, but it only applied in interval sealing mode.

--dev \
-lruntime=debug \
--sealing=interval \
--sealing-interval=1 \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just a duplicate of the other one with the one second time set.

@wilwade wilwade force-pushed the chore/enable-engine-create-block-interval-sealing branch from 7b15710 to aacdcc3 Compare October 30, 2023 14:57
@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #1745 (8d1fe11) into main (dbdeb5c) will increase coverage by 0.11%.
Report is 1 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1745      +/-   ##
==========================================
+ Coverage   87.95%   88.07%   +0.11%     
==========================================
  Files          50       50              
  Lines        4243     4243              
==========================================
+ Hits         3732     3737       +5     
+ Misses        511      506       -5     
Files Coverage Δ
common/primitives/src/msa.rs 91.56% <ø> (ø)
common/primitives/src/rpc.rs 93.02% <ø> (ø)
common/primitives/src/schema.rs 73.91% <ø> (+1.57%) ⬆️
pallets/capacity/src/types.rs 94.69% <ø> (-0.85%) ⬇️
pallets/frequency-tx-payment/src/lib.rs 85.09% <ø> (+0.48%) ⬆️
pallets/handles/src/handles_signed_extension.rs 56.52% <ø> (ø)
pallets/handles/src/lib.rs 92.41% <ø> (ø)
pallets/msa/src/lib.rs 90.00% <ø> (ø)
pallets/schemas/src/lib.rs 87.32% <ø> (+0.70%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@enddynayn
Copy link
Collaborator

Can you please add clarification to the commit message? I am a little unclear on what problem we are trying to solve.

@wilwade
Copy link
Collaborator Author

wilwade commented Oct 30, 2023

@enddynayn

Can you please add clarification to the commit message? I am a little unclear on what problem we are trying to solve.

I'm not sure how to make it more clear than supporting the engine_createBlock rpc in the interval sealing mode. Ideas?

@enddynayn
Copy link
Collaborator

enddynayn commented Oct 30, 2023

@enddynayn

Can you please add clarification to the commit message? I am a little unclear on what problem we are trying to solve.

I'm not sure how to make it more clear than supporting the engine_createBlock rpc in the interval sealing mode. Ideas?

We did not have it before why do we need it now? What triggers this to be needed? Is this a bug? Are we adding a new test that requires this for some test we plan to add in the future?

@wilwade
Copy link
Collaborator Author

wilwade commented Oct 30, 2023

@enddynayn

Can you please add clarification to the commit message? I am a little unclear on what problem we are trying to solve.

I'm not sure how to make it more clear than supporting the engine_createBlock rpc in the interval sealing mode. Ideas?

We did not have it before why do we need it now? What triggers this to be needed? Is this a bug? Are we adding a new test that requires this for some test we plan to add in the future?

Ah:

  1. Foremost: It was expected to work, but didn't.
  2. Trigger: I am thinking about using interval sealing for e2e tests (which requires engine_createBlock to work)

Or to put another way, I expected to be able to run the e2e tests against interval sealing and was surprised when it didn't work.

@enddynayn
Copy link
Collaborator

@enddynayn

Can you please add clarification to the commit message? I am a little unclear on what problem we are trying to solve.

I'm not sure how to make it more clear than supporting the engine_createBlock rpc in the interval sealing mode. Ideas?

We did not have it before why do we need it now? What triggers this to be needed? Is this a bug? Are we adding a new test that requires this for some test we plan to add in the future?

Ah:

  1. Foremost: It was expected to work, but didn't.
  2. Trigger: I am thinking about using interval sealing for e2e tests (which requires engine_createBlock to work)

Or to put another way, I expected to be able to run the e2e tests against interval sealing and was surprised when it didn't work.

That was helpful. Thanks!

Copy link
Collaborator

@aramikm aramikm left a comment

Choose a reason for hiding this comment

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

Looks good!

I think our current interval-mode does not capture all the scenarios that can happen when submitting an extrinsic since it starts an interval with submission. Ideally we would like an independent block interval that would start independently and only create a block (if any extrinsic inside). this would allow us to be able to get more realistic result let's say for extrinsic that got submitted close to the end of current interval and they might get included in the next one and ...

@wilwade wilwade enabled auto-merge (squash) November 1, 2023 15:40
@wilwade wilwade merged commit 04e0d8d into main Nov 1, 2023
@wilwade wilwade deleted the chore/enable-engine-create-block-interval-sealing branch November 1, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants