Closed zemyblue closed 2 years ago
This comparison is made between the following versions since lbm-sdk 0.46.0-rcN are derived from cosmos-sdk 0.45.1.
Repository | Version | Hash |
---|---|---|
line/lbm-sdk | v0.46.0-rc2 | ac918ac |
cosmos/cosmos-sdk | v0.45.1 | 2646b47 |
Differences between lbm-sdk ⇄ cosmos-sdk
The source code file names shown here are samples. To see more, you will need to search the project for relevant keywords and explore the reference relationships.
CheckTx()
→ CheckTxAsync()
, CheckTxSync()
Mutex
, mtx.RLock()
, mtx.RUnlock()
, WorkGroup
, channel
are introduced.BeginRecheckTx()
, EndRecheckTx()
baseapp
(ABCI)store/types/store.go
: caching interfacestore/iavl/cache.go
: caching of IAVLstore/rootmulti/store.go
: caching of lower-level storagebaseapp/BaseApp
: IAVLCacheManager
optionstore/cachemulti/store.go
: parallelization of Write()
processstore/types/store.go
: Prefetch()
interfacestore/dbadapter/store.go
baseapp/BaseApp
: PausePrefetcher()
and ResumePrefetcher()
during app.cms.Commit()
client/flags/flags.go
x/genutil/client/cli/collect.go
: private key type (ed25519|composite)proto/lbm/auth/v1/auth.proto
: ed25519, secp256k1, secp256r1, multisigVRFProof
field
crypto/ledger/ledger_secp256k1.go
Validator
→ Validator
+ Voter
VotingPower
→ StakingPower
third_party/proto/ostracon/types/voter.proto
baseapp/iostats.go
: logging /proc/diskstats
?proto/lbm/auth/v1/tx.proto
: PING message for performance measurementbaseapp/GRPCQueryRoute
: mutexproto/lbm/auth/v1/bankplus.proto
LBM
prefix for environment variablesConfig.IdleTimeout
server/config/config.go
BaseConfig
: InterBlockCacheSize
, Bech32CacheSize
, Prometheus
APIConfig
: RPCIdleTimeout
RPCWriteTimeout
server/config/toml.go
: inter-block-cache-size
, iavl-cache-size
, bech32-cache-size
, prometheus
, rpc-idle-timeout
proto/ibc/applications
proto/ibc/core
proto/ibc/lightclients
sdk.AccAddressFromBech32()
→ sdk.ValidateAccAccress()
+ sdk.AccAddress()
sdk.ConsAddress()
→ sdk.BytesToConsAddress()
pubKey.Address().Bytes()
→ types.BytesToAccAddress(pubKey.Address()))
BaseApp.runTx()
: usage of gasWanted
in defer
client/cmd.go
: nil
check for FeeGranter
crypto/keys/secp256k1/secp256k1_cgo.go
: used privKey
for signature verificationtypes/error/abci.go
: adding condition determining for internal errors?crypto/codec/tm.go
x != nil
→ x != ""
, y == nil
→ y.Empty()
test-sim-xxx
variationlibsodium
, bls
, DBs, etc.CoinTypeNotAssigned
constatnt, and a behavior when conType
is unasignedclient/keys/show.go
: when keyring.TypeMulti
LegacyKeyBase
: client/keys/migrate.go
, cryptp/keyring/legacy.go
revive
→ golint
types/address.go
: hashicorp/golang-lru
→ dgraph-io/ristretto
proto/lbm/auth/v1/tx.proto
: PING to measure performanceproto/lbm/base/abci/v1/abci.proto
: transaction index field addedproto/lbm/base/ostracon/v1/query.proto
: GetBlockByHash()
, GetBlockResultsByHeight()
API and these messageproto/lbm/tx/v1/services.proto
: GetTxsEventRequest.prove
Address
→ Address.ToValAddress()
, sdk.AccAddressFromBech32()
→ sdk.AccAddress()
legacy/*
: migrations up to v0.40 for each appante
ante.go
: add BankKeeper
to sequencesetup.go
: check for gas shortagesigverify.go
: add chache of Tx hashmigrations.go
: v0.40 to v0.43module.go
: add NewTxCmd
types/account.go
: key diversity: secp256k1, secp256r1, ed25519, multisigbank
grpc_query.go
: asynchronous prefetch specified account information when the balance is zero (preparing following request?)keeper.go
: set the amount of coin for supplyStore
send.go
: add SetBalance()
bankplus
added
proto/lbm/auth/v1/bankplus.proto
: message for blocked address listcapability
addedcrisis
abci.go
: Power
→ VotingPower
distribution
tx.go
: broadcast message if the number of messages is zero?module.go
: ConsensusVersion
2 → 1evidence
msgs.go
: add verification for Submitter
addressfreegrant
foundation
added
proto/lbm/foundation/*
genutil
collect.go
: add private key type (ed25519|composite)gov
module.go
: ConsensusVersion
2 → 1ibc
addedparams
subspace.go
: Modified()
, transientStore()
slashing
infractions.go
: minHeight
→ voterSetCount
module.go
: ConsensusVersion
2 → 1msg.go
: add veification for msg.ValidatorAddr
in ValidateBasic()
proto/lbm/slashing/v1/slashing.proto
: ValidatorSigningInfo
: start_height
, index_offset
fieldsstaking
grpc_query.go
: add sdk.ValidateValAddress()
for Validator
, ValidatorUnboundingDelegations
, Delegation
, UnboundingDelegation
, etc.stakingplus
added
proto/lbm/stakingplus/v1
token
proto/lbm/token/v1
upgrade
plan.go
: added ValidateBasic()
wasm
added
proto/lbm/wasm/v1
In this comparison, differences related to the naming of lbm ⇄ cosmos, which are noise in the comparison, are removed in advance.
proto/lbm
→ proto/cosmos
third_party/proto/ostracon
→ third_party/proto/cosmos
v1
→ v1beta
, v2
→ v2alpha1`server_oc_cmds.go
→ server/tm_cmds.go
find -ame
*_test.go-exec git checkout v0.45.1 {} \;
*_test.go
*.pb.go
, pb.gw.go
*.mg
, *.yaml
, *.yml
, *.json
, *.sh
, *.toml
, etc.*.go
and *.proto
:
import
:
github.com/line/lbm-sdk
→ github.com/cosmos/cosmos-sdk
github.com/line/ostracon
→ github.com/tendermint/tendermint
ocproto
, octypes
, octcli
, occrypto
, octbytes
, tctcfg
, etc.oc*
→ tm*
FromOcPubKeyInterface
, etc.Ostracon
→ Tendermint
lbm\.([a-zA-Z0-9]+)\.v1
→ cosmos.$1.v1beta1
(regular expression)lbm.v1
→ cosmos.v1beta1
"lbm"
→ "cosmos"
This post is a microbenchmark result for the 2nd assignment, "check the performance of BaseAccount's separated pub_keys and then compare and select better thing". SDK-overall performance measurements using transactions will follow.
This microbenchmark shows the difference in processing time for the BaseAccount
message in proto/cosmos/auth/v1beta1/auth.proto
between the lbm-sdk, which provides a separate field for each key algorithm, and the cosmos-sdk, which provides only one field of type Any
. See also the benchmark code.
PB Message | Feature | LBM (4 fields) | Cosmos (1 field) |
---|---|---|---|
BaseAccount |
GetPubKey() |
0.2435 ns/ops | 6.372 ns/ops |
BaseAccount |
SetPubKey() |
3.420 ns/ops | 173.0 ns/ops |
BaseAccount |
Marshal() |
56.41 ns/ops | 61.22 ns/ops |
BaseAccount |
Unmarshal() |
46.77 ns/ops | 72.68 ns/ops |
BaseAccount |
Marshaled byte size | 82B | 117B |
Although the numerical fact is that the lbm-sdk method is faster, it's on the order of tens of nsec, and even if 1000 operations are performed in a single block generation, the difference is only a few tens of μsec.
Please understand that it's not absolute time, but rather a percentage of the total function that is being closed.
SetPubKey()
is significantly slower, but this is due to the Marshal of the public key in SetPubKey()
. Both Marshal()
and Unmarshal()
are also slightly slower, but the overall processing ratio is about the same.
Use a binary modified to log once for each function executed. Run Tx send command at the moment it stops at the indexed block while watching the log of simd start
so that the log will not be mixed up when Tx is received during block creation.
echo "y" | simd tx bank send xxx yyy 1stake --keyring-backend test --chain-id sim --home ~/.simapp/simapp0
The number of executions between Tx received and block generated is simply the sum of those numbers. The number of executions between Tx reception and block generation is simply the sum of those numbers.
Reception of Tx (block generation
to Timed out
)
Function | num_txs=0 | num_txs=1 | num_txs=2 |
---|---|---|---|
GetPubKey() |
0 | 3 | 6 |
SetPubKey() |
0 | 0 | 0 |
Marshal() |
0 | 1 | 2 |
Unmarshal() |
0 | 7 | 14 |
Block generation (Timed out
to block generated
)
Function | num_txs=0 | num_txs=1 | num_txs=2 |
---|---|---|---|
GetPubKey() |
0 | 3 | 6 |
SetPubKey() |
0 | 0 | 0 |
Marshal() |
0 | 1 | 2 |
Unmarshal() |
10 | 16 | 22 |
Ultimately, each function will be performed the following number of times per block generation and per transaction receipt.
Function | per Block Generated | per Tx Received |
---|---|---|
GetPubKey() |
0 | 6 |
SetPubKey() |
0 | 0 |
Marshal() |
0 | 2 |
Unmarshal() |
10 | 13 |
@torao , what do you think we should select with the benchmarking results? lbm-sdk style? or cosmos-sdk style?
Summary
Compare the difference between lbm-sdk and cosmos-sdk and reflect the better fix.
Problem Definition
Proposal
lbm-sdk
tocosmos-sdk
, and fromv1
tov1beta1
.BaseAccount
's seperated pub_keys and then compare and select better thing. https://github.com/line/lbm-sdk/blob/ac918acc77d77d934e4dff134dcc53b9f83e3370/proto/lbm/auth/v1/auth.proto#L24-L31For Admin Use