-
Notifications
You must be signed in to change notification settings - Fork 74
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
fix(submission): fix counting and time #969
Merged
Merged
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
7e84310
log error from manager err group
danwt 2fb1e65
make produce loop more readable
danwt 552b62b
tidy ups in produce loop
danwt b104705
renames
danwt 40382f5
move log statement
danwt 291cf7d
pre remove start height and end height fields
danwt a714bdb
make batch start and end height into functions, fix builds but not tests
danwt c4d1c4f
delete grey avail test
danwt 6c15052
fixes tests
danwt a8ea801
tests pass, pre remove unneeded nil out
danwt fb59aa8
cleanup
danwt 8594afc
pre fix the pattern
danwt e01f45d
lfg
danwt 82c4c80
start to add the allow production channel
danwt acb7921
CreateNextBatchToSubmit is no longer a method
danwt b89ce10
todo
danwt 3230c3f
refactor without functional change
danwt f070b6a
try
danwt b91ead0
change sign
danwt 4a0eea1
working on tests
danwt fe0baae
gonna move the event to the production side
danwt 142063b
move the production stop logs to the production thread
danwt b3e98a4
need to check go channel behavior
danwt 9a4be77
tests pass
danwt f508d77
fix most tests but have failure in TestCreateNextDABatchWithBytesLimit
danwt 9b5b982
fix log statements
danwt 5111094
tweaks
danwt 45deb44
cp
zale144 d3e27a2
Merge branch 'main' into danwt/963-fix-production-loop-0001
danwt 8b2967b
add proper handling
danwt 5bdad3a
need to test this thing properly
danwt f1a3ff3
lets really get this working
danwt c4fa01c
factor out a unit testable core
danwt 71ecf91
gonna change it a bit
danwt 824b77b
working on it
danwt b07e21d
gonna change to uint64
danwt 0068ee4
need to finish off the test
danwt 81e6d26
gonna check pruning
danwt 0c3d95a
cp
danwt fb61910
bump test
danwt f150a85
why tho
danwt ca4e437
wow
danwt 4d28ad9
cp
danwt 599c6ac
why tho
danwt 3d8773b
can I change teh deisgn a bit
danwt 12fd608
lfg
danwt bc1bf46
can I write a rapid test
danwt e448914
gonna make the skew a hard invariant
danwt 3fc4740
can I get ride of the counter waker
danwt cc47c39
gonna remove panic
danwt edffef1
lets see
danwt 05fa2b0
gonna split into two
danwt ae0f825
gonna wrap it up
danwt 8322173
going to do a long test without the bonus ticker line
danwt 520febe
long test
danwt b3c2fee
cp
danwt 5021a7f
test some requirements
danwt 4cf9fce
remove pending bytes re
danwt 9b1bd07
why so many produced
danwt 151f0d8
need to refine the submission test
danwt 7e9eb6d
test is ok for now
danwt a64c728
lets do timer
danwt 4eb84ea
adds the time check
danwt cae267d
delets the time check todo
danwt 0244c29
just need metrics
danwt af80f99
adds metrics
danwt 3c0c9f4
rename estimate method name
danwt fb9ec8e
better naming
danwt dc0aa8d
make cond more readable
danwt 5c75955
more style suggestion
danwt d23cba5
make method a manager method
danwt 8509b1b
bump last
danwt dd6dafa
make sub utils panic if deadline exceeded
danwt e984d29
add ticker commment
danwt bf63cf5
trying to get rid of chan size 1 constraint
danwt 0d8fe37
use chan without size 1
danwt 9742595
fix test
danwt 01a58df
move comment
danwt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import ( | |
"github.com/dymensionxyz/dymint/mempool" | ||
mempoolv1 "github.com/dymensionxyz/dymint/mempool/v1" | ||
"github.com/dymensionxyz/dymint/node/events" | ||
uchannel "github.com/dymensionxyz/dymint/utils/channel" | ||
uevent "github.com/dymensionxyz/dymint/utils/event" | ||
tmcfg "github.com/tendermint/tendermint/config" | ||
|
||
|
@@ -57,13 +58,11 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { | |
|
||
mCtx, cancel := context.WithTimeout(context.Background(), runTime) | ||
defer cancel() | ||
go manager.ProduceBlockLoop(mCtx) | ||
go managerWithEmptyBlocks.ProduceBlockLoop(mCtx) | ||
|
||
buf1 := make(chan struct{}, 100) // dummy to avoid unhealthy event | ||
buf2 := make(chan struct{}, 100) // dummy to avoid unhealthy event | ||
go manager.AccumulatedDataLoop(mCtx, buf1) | ||
go managerWithEmptyBlocks.AccumulatedDataLoop(mCtx, buf2) | ||
bytesProduced1 := make(chan int) | ||
bytesProduced2 := make(chan int) | ||
go manager.ProduceBlockLoop(mCtx, bytesProduced1) | ||
go managerWithEmptyBlocks.ProduceBlockLoop(mCtx, bytesProduced2) | ||
uchannel.DrainForever(bytesProduced1, bytesProduced2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is draining needed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to stop the producer being blocked |
||
<-mCtx.Done() | ||
|
||
require.Greater(manager.State.Height(), initialHeight) | ||
|
@@ -143,7 +142,9 @@ func TestCreateEmptyBlocksNew(t *testing.T) { | |
|
||
mCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
defer cancel() | ||
go manager.ProduceBlockLoop(mCtx) | ||
bytesProduced := make(chan int) | ||
go manager.ProduceBlockLoop(mCtx, bytesProduced) | ||
uchannel.DrainForever(bytesProduced) | ||
|
||
<-time.Tick(1 * time.Second) | ||
err = mpool.CheckTx([]byte{1, 2, 3, 4}, nil, mempool.TxInfo{}) | ||
|
@@ -182,7 +183,7 @@ func TestStopBlockProduction(t *testing.T) { | |
require := require.New(t) | ||
|
||
managerConfig := testutil.GetManagerConfig() | ||
managerConfig.BlockBatchMaxSizeBytes = 1000 // small batch size to fill up quickly | ||
managerConfig.BatchMaxSizeBytes = 1000 // small batch size to fill up quickly | ||
manager, err := testutil.GetManager(managerConfig, nil, nil, 1, 1, 0, nil, nil) | ||
require.NoError(err) | ||
|
||
|
@@ -201,14 +202,10 @@ func TestStopBlockProduction(t *testing.T) { | |
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) | ||
defer cancel() | ||
|
||
go func() { | ||
manager.ProduceBlockLoop(ctx) | ||
wg.Done() // Decrease counter when this goroutine finishes | ||
}() | ||
bytesProducedC := make(chan int) | ||
|
||
toSubmit := make(chan struct{}) | ||
go func() { | ||
manager.AccumulatedDataLoop(ctx, toSubmit) | ||
manager.ProduceBlockLoop(ctx, bytesProducedC) | ||
wg.Done() // Decrease counter when this goroutine finishes | ||
}() | ||
|
||
|
@@ -232,7 +229,7 @@ func TestStopBlockProduction(t *testing.T) { | |
assert.Equal(stoppedHeight, manager.State.Height()) | ||
|
||
// consume the signal | ||
<-toSubmit | ||
<-bytesProducedC | ||
|
||
// check for health status event and block production to continue | ||
select { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Spawning a Go routine Note