Skip to content

Commit

Permalink
Bump Go Client SDK to 0.7.0, Core to 23.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Oct 18, 2023
1 parent 5870157 commit 4aadf27
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 1,026 deletions.
94 changes: 20 additions & 74 deletions cmd/paratime/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ import (
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"

"github.com/oasisprotocol/oasis-core/go/common/cbor"
"github.com/oasisprotocol/oasis-core/go/common/crypto/signature"
"github.com/oasisprotocol/oasis-core/go/common/node"
consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
"github.com/oasisprotocol/oasis-core/go/consensus/api/transaction"
roothash "github.com/oasisprotocol/oasis-core/go/roothash/api"
"github.com/oasisprotocol/oasis-core/go/roothash/api/block"
"github.com/oasisprotocol/oasis-core/go/roothash/api/commitment"
scheduler "github.com/oasisprotocol/oasis-core/go/scheduler/api"
"github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection"
"github.com/oasisprotocol/oasis-sdk/client-sdk/go/types"
Expand Down Expand Up @@ -69,24 +66,19 @@ type entityStats struct {
// Rounds entity node was a proposer.
roundsProposer uint64

// How many times entity node proposed a timeout.
proposedTimeout uint64

// How many good blocks committed while being primary worker.
committeedGoodBlocksPrimary uint64
committedGoodBlocksPrimary uint64
// How many bad blocs committed while being primary worker.
committeedBadBlocksPrimary uint64
committedBadBlocksPrimary uint64
// How many good blocks committed while being backup worker.
committeedGoodBlocksBackup uint64
committedGoodBlocksBackup uint64
// How many bad blocks committed while being backup worker.
committeedBadBlocksBackup uint64
committedBadBlocksBackup uint64

// How many rounds missed committing a block while being a primary worker.
missedPrimary uint64
// How many rounds missed committing a block while being a backup worker (and discrepancy detection was invoked).
missedBackup uint64
// How many rounds proposer timeout was triggered while being the proposer.
missedProposer uint64
}

var statsCmd = &cobra.Command{
Expand Down Expand Up @@ -229,43 +221,6 @@ var statsCmd = &cobra.Command{
evs, err = roothashConn.GetEvents(ctx, height)
cobra.CheckErr(err)

var proposerTimeout bool
if currentRound != blk.Header.Round && currentCommittee != nil {
// If new round, check for proposer timeout.
// Need to look at submitted transactions if round failure was caused by a proposer timeout.
var rsp *consensus.TransactionsWithResults
rsp, err = consensusConn.GetTransactionsWithResults(ctx, height)
cobra.CheckErr(err)
for i := 0; i < len(rsp.Transactions); i++ {
// Ignore failed txs.
if !rsp.Results[i].IsSuccess() {
continue
}
var sigTx transaction.SignedTransaction
err = cbor.Unmarshal(rsp.Transactions[i], &sigTx)
cobra.CheckErr(err)
var tx transaction.Transaction
err = sigTx.Open(&tx)
cobra.CheckErr(err)
// Ignore non proposer timeout txs.
if tx.Method != roothash.MethodExecutorProposerTimeout {
continue
}
var xc roothash.ExecutorProposerTimeoutRequest
err = cbor.Unmarshal(tx.Body, &xc)
cobra.CheckErr(err)
// Ignore txs of other runtimes.
if xc.ID != runtimeID {
continue
}
// Proposer timeout triggered the round failure, update stats.
stats.entities[nodeToEntity(sigTx.Signature.PublicKey)].proposedTimeout++
stats.entities[nodeToEntity(currentScheduler.PublicKey)].missedProposer++
proposerTimeout = true
break
}
}

// Go over events before updating potential new round committee info.
// Even if round transition happened at this height, all events emitted
// at this height belong to the previous round.
Expand Down Expand Up @@ -302,10 +257,6 @@ var statsCmd = &cobra.Command{
if blk.Header.HeaderType == block.EpochTransition || blk.Header.HeaderType == block.Suspended {
continue
}
// Skip if proposer timeout.
if proposerTimeout {
continue
}

// Update stats.
OUTER:
Expand All @@ -328,11 +279,11 @@ var statsCmd = &cobra.Command{
}
switch member.Role {
case scheduler.RoleWorker:
stats.entities[entity].committeedGoodBlocksPrimary++
stats.entities[entity].committedGoodBlocksPrimary++
continue OUTER
case scheduler.RoleBackupWorker:
if roundDiscrepancy {
stats.entities[entity].committeedGoodBlocksBackup++
stats.entities[entity].committedGoodBlocksBackup++
continue OUTER
}
case scheduler.RoleInvalid:
Expand All @@ -346,11 +297,11 @@ var statsCmd = &cobra.Command{
}
switch member.Role {
case scheduler.RoleWorker:
stats.entities[entity].committeedBadBlocksPrimary++
stats.entities[entity].committedBadBlocksPrimary++
continue OUTER
case scheduler.RoleBackupWorker:
if roundDiscrepancy {
stats.entities[entity].committeedBadBlocksBackup++
stats.entities[entity].committedBadBlocksBackup++
continue OUTER
}
case scheduler.RoleInvalid:
Expand Down Expand Up @@ -379,11 +330,7 @@ var statsCmd = &cobra.Command{
case block.EpochTransition:
stats.epochTransitionRounds++
case block.RoundFailed:
if proposerTimeout {
stats.proposerTimeoutedRounds++
} else {
stats.failedRounds++
}
stats.failedRounds++
case block.Suspended:
stats.suspendedRounds++
currentCommittee = nil
Expand All @@ -401,17 +348,20 @@ var statsCmd = &cobra.Command{
var state *roothash.RuntimeState
state, err = roothashConn.GetRuntimeState(ctx, rtRequest)
cobra.CheckErr(err)
if state.ExecutorPool == nil {
if state.Committee == nil || state.CommitmentPool == nil {
// No committee - election failed(?)
fmt.Printf("\nWarning: unexpected or missing committee for runtime: height: %d\n", height)
currentCommittee = nil
currentScheduler = nil
continue
}
// Set committee info.
currentCommittee = state.ExecutorPool.Committee
currentScheduler, err = commitment.GetTransactionScheduler(currentCommittee, currentRound)
cobra.CheckErr(err)
var ok bool
currentCommittee = state.Committee
currentScheduler, ok = currentCommittee.Scheduler(currentRound, 0)
if !ok {
cobra.CheckErr("failed to query primary scheduler, no workers in committee")
}
roundDiscrepancy = false

// Update election stats.
Expand Down Expand Up @@ -491,8 +441,6 @@ func (s *runtimeStats) prepareEntitiesOutput(
"Bckp Bad commit",
"Primary missed",
"Bckp missed",
"Proposer missed",
"Proposed timeout",
}

addrToName := func(addr types.Address) string {
Expand All @@ -517,15 +465,13 @@ func (s *runtimeStats) prepareEntitiesOutput(
strconv.FormatUint(stats.roundsBackup, 10),
strconv.FormatUint(stats.roundsProposer, 10),
strconv.FormatUint(stats.roundsPrimaryRequired, 10),
strconv.FormatUint(stats.committeedGoodBlocksPrimary, 10),
strconv.FormatUint(stats.committeedBadBlocksPrimary, 10),
strconv.FormatUint(stats.committedGoodBlocksPrimary, 10),
strconv.FormatUint(stats.committedBadBlocksPrimary, 10),
strconv.FormatUint(stats.roundsBackupRequired, 10),
strconv.FormatUint(stats.committeedGoodBlocksBackup, 10),
strconv.FormatUint(stats.committeedBadBlocksBackup, 10),
strconv.FormatUint(stats.committedGoodBlocksBackup, 10),
strconv.FormatUint(stats.committedBadBlocksBackup, 10),
strconv.FormatUint(stats.missedPrimary, 10),
strconv.FormatUint(stats.missedBackup, 10),
strconv.FormatUint(stats.missedProposer, 10),
strconv.FormatUint(stats.proposedTimeout, 10),
)
s.entitiesOutput = append(s.entitiesOutput, line)
}
Expand Down
79 changes: 50 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
module github.com/oasisprotocol/cli

go 1.19
go 1.21

toolchain go1.21.3

// v1.5.0 has broken uint parsing, use a commit with the fix until the
// the maintainers merge the PR: https://github.com/spf13/cast/pull/144
replace github.com/spf13/cast => github.com/oasisprotocol/cast v0.0.0-20220606122631-eba453e69641

replace github.com/cometbft/cometbft => github.com/oasisprotocol/cometbft v0.37.2-oasis1

require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/adrg/xdg v0.4.0
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/ethereum/go-ethereum v1.12.1
github.com/ethereum/go-ethereum v1.13.4
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/mitchellh/mapstructure v1.5.0
github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a
github.com/oasisprotocol/deoxysii v0.0.0-20220228165953-2091330c22b7
github.com/oasisprotocol/metadata-registry-tools v0.0.0-20220406100644-7e9a2b991920
github.com/oasisprotocol/oasis-core/go v0.2202.11
github.com/oasisprotocol/oasis-sdk/client-sdk/go v0.6.1
github.com/oasisprotocol/oasis-core/go v0.2300.1
github.com/oasisprotocol/oasis-sdk/client-sdk/go v0.7.0
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand All @@ -30,37 +34,46 @@ require (
)

require (
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220404123522-616f957b79ad // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/cometbft/cometbft v0.0.0-00010101000000-000000000000 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/eapache/channels v1.1.0 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-git/v5 v5.4.2 // indirect
github.com/go-git/go-billy/v5 v5.4.0 // indirect
github.com/go-git/go-git/v5 v5.5.2 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/hashicorp/go-hclog v1.3.1 // indirect
github.com/hashicorp/go-plugin v1.4.5 // indirect
github.com/hashicorp/go-hclog v1.4.0 // indirect
github.com/hashicorp/go-plugin v1.4.6 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
Expand All @@ -69,58 +82,66 @@ require (
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.29.2 // indirect
github.com/libp2p/go-libp2p v0.30.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/matryer/is v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.10.1 // indirect
github.com/multiformats/go-multiaddr v0.11.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pjbgf/sha1cd v0.2.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tendermint/tendermint v0.35.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tidwall/btree v1.6.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/zondax/hid v0.9.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/net v0.13.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/grpc/security/advancedtls v0.0.0-20221004221323-12db695f1648 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading

0 comments on commit 4aadf27

Please sign in to comment.