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

[OCC] change incarnation metric type #433

Open
wants to merge 36 commits into
base: occ-main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1923a47
Add occ todos / comments (#317)
udpatil Sep 13, 2023
5ad76e0
Multiversion Item Implementation and Tests (#318)
udpatil Sep 26, 2023
5e5b4ce
[occ] Add incarnation field (#321)
udpatil Sep 29, 2023
cda8c31
[occ] Implement basic multiversion store (#322)
udpatil Oct 6, 2023
703b28a
[occ] Add concurrency worker configuration (#324)
stevenlanders Oct 9, 2023
1e60246
[occ] Occ multiversion store (#326)
udpatil Oct 10, 2023
a3aec8a
[occ] Add batch tx delivery interface (#327)
stevenlanders Oct 10, 2023
0520ced
[occ] MVKV store implementation and tests (#323)
udpatil Oct 10, 2023
0864c32
[occ] Add validation function for transaction state to multiversionst…
udpatil Oct 13, 2023
de92cbc
[occ] Add basic worker task and scheduler shell (#328)
stevenlanders Oct 17, 2023
6406dd9
[occ] Implement iterator for mvkv (#329)
udpatil Oct 17, 2023
f6b0b9f
fix dependency (#334)
udpatil Oct 17, 2023
f3a6cf4
[occ] Iterateset tracking and validation implementation (#337)
udpatil Oct 19, 2023
60b2113
[occ] Add scheduler logic for validation (#336)
stevenlanders Oct 19, 2023
1178e0b
[occ] Fix situation where no stores causes a panic (#338)
stevenlanders Oct 20, 2023
6ec1620
Add occ flag check to context (#340)
stevenlanders Oct 23, 2023
9530aeb
[occ] Add struct field and helpers for estimate prefills (#341)
udpatil Oct 24, 2023
3bdbc96
Fix map access panic (#343)
stevenlanders Oct 30, 2023
954c5a9
Gen estimates writeset (#344)
udpatil Nov 3, 2023
be45bb5
[OCC] Add trace spans to scheduler (#347)
stevenlanders Nov 6, 2023
061ef70
[occ] Fix parent store readset validation (#348)
udpatil Nov 10, 2023
f9541fb
[occ] OCC scheduler and validation fixes (#359)
udpatil Nov 22, 2023
30b7fab
[occ] Add optimizations for multiversion and mvkv (#361)
udpatil Nov 27, 2023
4d12564
[OCC] Add scheduler goroutine pool and optimizations (#362)
stevenlanders Nov 29, 2023
a780a58
update concurrency workers (#380)
udpatil Dec 12, 2023
cb02f7e
[OCC] Fix hang where abort channel blocks iterator (#379)
stevenlanders Dec 13, 2023
fa4b76d
Occ iterator fix (#389)
udpatil Jan 2, 2024
6bf4d72
fix interface
udpatil Jan 2, 2024
6878b96
fix deleteIterateSet and leave some comments (#395)
udpatil Jan 12, 2024
d08b8f0
Occ enabled cfg (#398)
udpatil Jan 18, 2024
75d1151
Remove block gas meter in occ (#407)
udpatil Jan 25, 2024
48dfff5
Relax locking contention (#427)
udpatil Feb 9, 2024
f9805fe
Rebase occ main (#428)
udpatil Feb 9, 2024
6b43421
fix assignment to not cause panic (#429)
udpatil Feb 9, 2024
5a05027
[OCC] add metrics for scheduler (#431)
stevenlanders Feb 13, 2024
00cc70d
change incarnation type
stevenlanders Feb 13, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main
- occ-main # TODO: remove after occ work is done

permissions:
contents: read
Expand Down
52 changes: 27 additions & 25 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"syscall"
"time"

"github.com/cosmos/cosmos-sdk/tasks"

"github.com/armon/go-metrics"
"github.com/gogo/protobuf/proto"
abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -69,11 +71,6 @@ func (app *BaseApp) InitChain(ctx context.Context, req *abci.RequestInitChain) (
return
}

// add block gas meter for any genesis transactions (allow infinite gas)
app.deliverState.ctx = app.deliverState.ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter())
app.prepareProposalState.ctx = app.prepareProposalState.ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter())
app.processProposalState.ctx = app.processProposalState.ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter())

resp := app.initChainer(app.deliverState.ctx, *req)
app.initChainer(app.prepareProposalState.ctx, *req)
app.initChainer(app.processProposalState.ctx, *req)
Expand Down Expand Up @@ -235,11 +232,31 @@ func (app *BaseApp) CheckTx(ctx context.Context, req *abci.RequestCheckTx) (*abc
}, nil
}

// DeliverTxBatch executes multiple txs
func (app *BaseApp) DeliverTxBatch(ctx sdk.Context, req sdk.DeliverTxBatchRequest) (res sdk.DeliverTxBatchResponse) {
scheduler := tasks.NewScheduler(app.concurrencyWorkers, app.TracingInfo, app.DeliverTx)
// This will basically no-op the actual prefill if the metadata for the txs is empty

// process all txs, this will also initializes the MVS if prefill estimates was disabled
txRes, err := scheduler.ProcessAll(ctx, req.TxEntries)
if err != nil {
// TODO: handle error
}

responses := make([]*sdk.DeliverTxResult, 0, len(req.TxEntries))
for _, tx := range txRes {
responses = append(responses, &sdk.DeliverTxResult{Response: tx})
}
return sdk.DeliverTxBatchResponse{Results: responses}
}

// DeliverTx implements the ABCI interface and executes a tx in DeliverTx mode.
// State only gets persisted if all messages are valid and get executed successfully.
// Otherwise, the ResponseDeliverTx will contain releveant error information.
// Otherwise, the ResponseDeliverTx will contain relevant error information.
// Regardless of tx execution outcome, the ResponseDeliverTx will contain relevant
// gas execution context.
// TODO: (occ) this is the function called from sei-chain to perform execution of a transaction.
// We'd likely replace this with an execution tasks that is scheduled by the OCC scheduler
func (app *BaseApp) DeliverTx(ctx sdk.Context, req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) {
defer telemetry.MeasureSince(time.Now(), "abci", "deliver_tx")
defer func() {
Expand Down Expand Up @@ -1012,16 +1029,9 @@ func (app *BaseApp) ProcessProposal(ctx context.Context, req *abci.RequestProces
app.setProcessProposalHeader(header)
}

// add block gas meter
var gasMeter sdk.GasMeter
if maxGas := app.getMaximumBlockGas(app.processProposalState.ctx); maxGas > 0 {
gasMeter = sdk.NewGasMeter(maxGas)
} else {
gasMeter = sdk.NewInfiniteGasMeter()
}

// NOTE: header hash is not set in NewContext, so we manually set it here
app.prepareProcessProposalState(gasMeter, req.Hash)

app.prepareProcessProposalState(req.Hash)

defer func() {
if err := recover(); err != nil {
Expand Down Expand Up @@ -1094,22 +1104,14 @@ func (app *BaseApp) FinalizeBlock(ctx context.Context, req *abci.RequestFinalize
app.setDeliverStateHeader(header)
}

// add block gas meter
var gasMeter sdk.GasMeter
if maxGas := app.getMaximumBlockGas(app.deliverState.ctx); maxGas > 0 {
gasMeter = sdk.NewGasMeter(maxGas)
} else {
gasMeter = sdk.NewInfiniteGasMeter()
}

// NOTE: header hash is not set in NewContext, so we manually set it here

app.prepareDeliverState(gasMeter, req.Hash)
app.prepareDeliverState(req.Hash)

// we also set block gas meter to checkState in case the application needs to
// verify gas consumption during (Re)CheckTx
if app.checkState != nil {
app.checkState.SetContext(app.checkState.ctx.WithBlockGasMeter(gasMeter).WithHeaderHash(req.Hash))
app.checkState.SetContext(app.checkState.ctx.WithHeaderHash(req.Hash))
}

if app.finalizeBlocker != nil {
Expand Down
Loading
Loading