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

[chain] Parallel Transaction Execution During Building and Verification #560

Merged
merged 36 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cbc0939
start planning changes
patrick-ogrady Oct 15, 2023
b6b8843
add more notes
patrick-ogrady Oct 15, 2023
8cde43c
update default map sizes in executor
patrick-ogrady Oct 15, 2023
f07c35f
layout prefetch
patrick-ogrady Oct 15, 2023
5605e25
add stop/error return to executor
patrick-ogrady Oct 15, 2023
737b6d9
add locking to fee manager
patrick-ogrady Oct 15, 2023
3525e06
redesign tstate functionality to allow for parallel exec
patrick-ogrady Oct 15, 2023
bbc92c2
update chan transaction
patrick-ogrady Oct 15, 2023
a1d667a
update chain block
patrick-ogrady Oct 15, 2023
5216a37
fix builder
patrick-ogrady Oct 15, 2023
3f1eda5
fix feeManger locking
patrick-ogrady Oct 15, 2023
535470b
make sure to default to creation allowed
patrick-ogrady Oct 15, 2023
3116a8a
fix cache escape
patrick-ogrady Oct 15, 2023
9331606
integration tests passing
patrick-ogrady Oct 15, 2023
7276207
change var names
patrick-ogrady Oct 15, 2023
880c8dc
remove prints
patrick-ogrady Oct 15, 2023
24530dc
pre-allocate tstate_view memory
patrick-ogrady Oct 15, 2023
24bfb60
make memory usage tighter
patrick-ogrady Oct 15, 2023
1142a75
progress
patrick-ogrady Oct 15, 2023
87f9c11
fix fee manager limit
patrick-ogrady Oct 16, 2023
1942407
make tx execution cores configurable
patrick-ogrady Oct 16, 2023
bb8fc63
update vm resolutions
patrick-ogrady Oct 16, 2023
e3199f5
make execution concurrency configurable
patrick-ogrady Oct 16, 2023
ed616cb
remove unused struct
patrick-ogrady Oct 16, 2023
1d66f36
executor tests passing
patrick-ogrady Oct 16, 2023
0aca945
add test for err and stop
patrick-ogrady Oct 16, 2023
ae70fe9
add missing licenses
patrick-ogrady Oct 16, 2023
8b53955
all tests passing
patrick-ogrady Oct 16, 2023
4cec744
use ExportMerkleView
patrick-ogrady Oct 16, 2023
137ae44
add executor metrics
patrick-ogrady Oct 16, 2023
c9a48ef
add prometheus charts
patrick-ogrady Oct 16, 2023
d5db9ec
remove unnecesary else
patrick-ogrady Oct 16, 2023
5a98fff
update name of ExportMerkleView
patrick-ogrady Oct 16, 2023
8619b32
update executor interface
patrick-ogrady Oct 16, 2023
955ef78
finish parallel transaction execution section
patrick-ogrady Oct 16, 2023
cd463ef
add programs section
patrick-ogrady Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions chain/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,8 @@ func (b *StatelessBlock) innerVerify(ctx context.Context, vctx VerifyContext) er
return err
}

// Optimisticaly fetch view
processor := NewProcessor(b.vm.Tracer(), b)
processor.Prefetch(ctx, parentView)

// Process new transactions
results, ts, err := processor.Execute(ctx, feeManager, r)
// Process transactions
results, ts, err := b.Execute(ctx, b.vm.Tracer(), parentView, feeManager, r)
if err != nil {
log.Error("failed to execute block", zap.Error(err))
return err
Expand Down Expand Up @@ -613,20 +609,21 @@ func (b *StatelessBlock) innerVerify(ctx context.Context, vctx VerifyContext) er
heightKeyStr := string(heightKey)
timestampKeyStr := string(timestampKey)
feeKeyStr := string(feeKey)
ts.SetScope(ctx, set.Of(heightKeyStr, timestampKeyStr, feeKeyStr), map[string][]byte{
tsv := ts.NewView(set.Of(heightKeyStr, timestampKeyStr, feeKeyStr), map[string][]byte{
heightKeyStr: parentHeightRaw,
timestampKeyStr: parentTimestampRaw,
feeKeyStr: parentFeeManager.Bytes(),
})
if err := ts.Insert(ctx, heightKey, binary.BigEndian.AppendUint64(nil, b.Hght)); err != nil {
if err := tsv.Insert(ctx, heightKey, binary.BigEndian.AppendUint64(nil, b.Hght)); err != nil {
return err
}
if err := ts.Insert(ctx, timestampKey, binary.BigEndian.AppendUint64(nil, uint64(b.Tmstmp))); err != nil {
if err := tsv.Insert(ctx, timestampKey, binary.BigEndian.AppendUint64(nil, uint64(b.Tmstmp))); err != nil {
return err
}
if err := ts.Insert(ctx, feeKey, feeManager.Bytes()); err != nil {
if err := tsv.Insert(ctx, feeKey, feeManager.Bytes()); err != nil {
return err
}
tsv.Commit()

// Compare state root
//
Expand Down Expand Up @@ -662,7 +659,7 @@ func (b *StatelessBlock) innerVerify(ctx context.Context, vctx VerifyContext) er
// Get view from [tstate] after processing all state transitions
b.vm.RecordStateChanges(ts.PendingChanges())
b.vm.RecordStateOperations(ts.OpIndex())
view, err := ts.CreateView(ctx, parentView, b.vm.Tracer())
view, err := ts.ExportMerkleDBView(ctx, b.vm.Tracer(), parentView)
if err != nil {
return err
}
Expand Down
Loading