-
Notifications
You must be signed in to change notification settings - Fork 871
Fixes for parallel TX and metrics #272
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
Changes from all commits
a701905
0d66daa
525a8c3
444ec74
dab406f
c28ee09
d914dc4
85e6499
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,11 @@ package app | |
|
|
||
| import ( | ||
| "fmt" | ||
| "time" | ||
|
|
||
| acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" | ||
| mapset "github.com/deckarep/golang-set" | ||
| "github.com/sei-protocol/sei-chain/utils/metrics" | ||
| ) | ||
|
|
||
| type DagNodeID int | ||
|
|
@@ -133,6 +135,7 @@ func (dag *Dag) AddEdge(fromIndex DagNodeID, toIndex DagNodeID) *DagEdge { | |
| // | ||
| // It will also register the new node with AccessOpsMap so that future nodes that amy be dependent on this one can properly identify the dependency. | ||
| func (dag *Dag) AddNodeBuildDependency(messageIndex int, txIndex int, accessOp acltypes.AccessOperation) { | ||
| defer metrics.MeasureBuildDagDuration(time.Now(), "AddNodeBuildDependency") | ||
| dagNode := dag.AddNode(messageIndex, txIndex, accessOp) | ||
| // update tx index map | ||
| dag.TxIndexMap[txIndex] = dagNode.NodeID | ||
|
|
@@ -283,6 +286,7 @@ func (dag *Dag) BuildCompletionSignalMaps() ( | |
| completionSignalingMap map[int]MessageCompletionSignalMapping, | ||
| blockingSignalsMap map[int]MessageCompletionSignalMapping, | ||
| ) { | ||
| defer metrics.MeasureBuildDagDuration(time.Now(), "BuildCompletionSignalMaps") | ||
|
Contributor
Author
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. This should be the slowest call called once per block |
||
| completionSignalingMap = make(map[int]MessageCompletionSignalMapping) | ||
| blockingSignalsMap = make(map[int]MessageCompletionSignalMapping) | ||
| // go through every node | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,17 +15,17 @@ echo | |
| cd $seihome/loadtest/contracts/mars && cargo build && docker run --rm -v "$(pwd)":/code \ | ||
| --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ | ||
| --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ | ||
| cosmwasm/rust-optimizer:0.12.5 | ||
| cosmwasm/rust-optimizer:0.12.6 | ||
|
Contributor
Author
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. votex README says to use 0.12.6 |
||
|
|
||
| cd $seihome/loadtest/contracts/saturn && cargo build && docker run --rm -v "$(pwd)":/code \ | ||
| --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ | ||
| --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ | ||
| cosmwasm/rust-optimizer:0.12.5 | ||
| cosmwasm/rust-optimizer:0.12.6 | ||
|
|
||
| cd $seihome/loadtest/contracts/venus && cargo build && docker run --rm -v "$(pwd)":/code \ | ||
| --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ | ||
| --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ | ||
| cosmwasm/rust-optimizer:0.12.5 | ||
| cosmwasm/rust-optimizer:0.12.6 | ||
|
|
||
| # Deploy all contracts | ||
| echo "Deploying contracts..." | ||
|
|
@@ -70,7 +70,7 @@ marsaddr4=$(python3 parser.py contract_address $marsinsres4) | |
| echo "Registering..." | ||
|
|
||
| valaddr=$(printf "12345678\n" | $seidbin keys show $(printf "12345678\n" | $seidbin keys show node_admin --output json | jq -r .address) --bech=val --output json | jq -r '.address') | ||
| printf "12345678\n" | $seidbin tx staking delegate $valaddr 1000000000usei --from=$keyname --chain-id=$chainid -b block -y | ||
| printf "12345678\n" | $seidbin tx staking delegate $valaddr 1000000000usei --from=$keyname --chain-id=$chainid -b block -y --fees 2000usei | ||
|
|
||
| printf "12345678\n" | $seidbin tx dex register-contract $marsaddr $marsid false true -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block | ||
| printf "12345678\n" | $seidbin tx dex register-contract $saturnaddr $saturnid false true -y --from=$keyname --chain-id=$chainid --fees=10000000usei --gas=500000 --broadcast-mode=block | ||
|
|
@@ -145,7 +145,7 @@ printf "12345678\n" | $seidbin tx gov vote $marsproposalid4 yes -y --from=$keyna | |
|
|
||
| sleep 90 | ||
|
|
||
| printf "12345678\n" | $seidbin tx staking unbond $valaddr 1000000000usei --from=$keyname --chain-id=$chainid -b block -y | ||
| printf "12345678\n" | $seidbin tx staking unbond $valaddr 1000000000usei --from=$keyname --chain-id=$chainid -b block -y --fees 2000usei | ||
|
|
||
| echo $marsaddr | ||
| echo $saturnaddr | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package metrics | ||
|
|
||
| const ( | ||
| CONCURRENT = "concurrent" | ||
| SYNCHRONOUS = "synchronous" | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package metrics | ||
|
|
||
| import ( | ||
| "time" | ||
|
|
||
| metrics "github.com/armon/go-metrics" | ||
| "github.com/cosmos/cosmos-sdk/telemetry" | ||
| ) | ||
|
|
||
| // Measures the time taken to execute a sudo msg | ||
| // Metric Names: | ||
| // | ||
| // sei_tx_process_type_count | ||
| func IncrTxProcessTypeCounter(processType string) { | ||
| metrics.IncrCounterWithLabels( | ||
| []string{"sei", "tx", "process", "type"}, | ||
| 1, | ||
| []metrics.Label{telemetry.NewLabel("type", processType)}, | ||
| ) | ||
| } | ||
|
|
||
| // Measures the time taken to execute a sudo msg | ||
| // Metric Names: | ||
| // | ||
| // sei_deliver_tx_duration_miliseconds | ||
| // sei_deliver_tx_duration_miliseconds_count | ||
| // sei_deliver_tx_duration_miliseconds_sum | ||
| func MeasureDeliverTxDuration(start time.Time) { | ||
| metrics.MeasureSince( | ||
| []string{"sei", "deliver", "tx", "milliseconds"}, | ||
| start.UTC(), | ||
| ) | ||
| } | ||
|
|
||
| // Measures the time taken to execute a sudo msg | ||
| // Metric Names: | ||
| // | ||
| // sei_dag_build_duration_miliseconds | ||
| // sei_dag_build_duration_miliseconds_count | ||
| // sei_dag_build_duration_miliseconds_sum | ||
| func MeasureBuildDagDuration(start time.Time, method string) { | ||
| metrics.MeasureSinceWithLabels( | ||
| []string{"sei", "dag", "build", "milliseconds"}, | ||
| start.UTC(), | ||
| []metrics.Label{telemetry.NewLabel("method", method)}, | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,13 +14,13 @@ func (k Keeper) SetEpoch(ctx sdk.Context, epoch uint64) { | |
| bz := make([]byte, 8) | ||
| binary.BigEndian.PutUint64(bz, epoch) | ||
| store.Set([]byte(EpochKey), bz) | ||
| ctx.Logger().Info(fmt.Sprintf("Current epoch %d", epoch)) | ||
| } | ||
|
|
||
| func (k Keeper) IsNewEpoch(ctx sdk.Context) (bool, uint64) { | ||
| store := ctx.KVStore(k.storeKey) | ||
| b := store.Get([]byte(EpochKey)) | ||
| lastEpoch := binary.BigEndian.Uint64(b) | ||
| currentEpoch := k.EpochKeeper.GetEpoch(ctx).CurrentEpoch | ||
| ctx.Logger().Info(fmt.Sprintf("Current epoch %d", currentEpoch)) | ||
|
Contributor
Author
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. |
||
| return currentEpoch > lastEpoch, currentEpoch | ||
| } | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding it to the two high level calls that are not constant time cc @philipsu522