From efaac8b5621562caf874e3f1a34cf4c9baccf725 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:30:47 +0800 Subject: [PATCH 01/85] add consensus finalizer interface --- system/consensus/base.go | 6 ++++++ system/consensus/finalize.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 system/consensus/finalize.go diff --git a/system/consensus/base.go b/system/consensus/base.go index 92c1c43a5..06f3d7f9f 100644 --- a/system/consensus/base.go +++ b/system/consensus/base.go @@ -60,6 +60,7 @@ type BaseClient struct { mulock sync.Mutex child Miner committer Committer + finalizer Finalizer minerstartCB func() isCaughtUp int32 Context context.Context @@ -256,6 +257,11 @@ func (bc *BaseClient) ExecConsensus(data *types.ChainExecutor) (types.Message, e } func (bc *BaseClient) pubToSubModule(msg *queue.Message) { + + if bc.finalizer != nil && bc.finalizer.ProcessMsg(msg) { + return + } + bc.child.ProcEvent(msg) if bc.committer != nil { bc.committer.SubMsg(msg) diff --git a/system/consensus/finalize.go b/system/consensus/finalize.go new file mode 100644 index 000000000..f36017fd2 --- /dev/null +++ b/system/consensus/finalize.go @@ -0,0 +1,29 @@ +package consensus + +import "github.com/33cn/chain33/queue" + +// Finalizer block finalize +type Finalizer interface { + Init(base *BaseClient, subCfg []byte) + ProcessMsg(msg *queue.Message) (processed bool) +} + +var finalizers = make(map[string]Finalizer) + +// RegFinalizer register committer +func RegFinalizer(name string, f Finalizer) { + + if f == nil { + panic("RegCommitter: committer is nil") + } + if _, dup := committers[name]; dup { + panic("RegCommitter: duplicate committer " + name) + } + finalizers[name] = f +} + +// LoadFinalizer load +func LoadFinalizer(name string) Finalizer { + + return finalizers[name] +} From d89fad9bd0d53f908553ffc31369ed75a3fb531b Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 22 Aug 2023 17:26:54 +0800 Subject: [PATCH 02/85] update finalize interface --- system/consensus/consensus.go | 5 +++++ system/consensus/finalize.go | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/system/consensus/consensus.go b/system/consensus/consensus.go index 7027c4995..73550cc86 100644 --- a/system/consensus/consensus.go +++ b/system/consensus/consensus.go @@ -62,3 +62,8 @@ func LoadCommiter(name string) Committer { return committers[name] } + +// Context 共识相关依赖 +type Context struct { + Base *BaseClient +} diff --git a/system/consensus/finalize.go b/system/consensus/finalize.go index f36017fd2..81b810c16 100644 --- a/system/consensus/finalize.go +++ b/system/consensus/finalize.go @@ -1,10 +1,17 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package consensus -import "github.com/33cn/chain33/queue" +import ( + "github.com/33cn/chain33/queue" +) // Finalizer block finalize type Finalizer interface { - Init(base *BaseClient, subCfg []byte) + Initialize(ctx *Context) error + Start() error ProcessMsg(msg *queue.Message) (processed bool) } From cec2fa88f03e213adc6220ba7b3cb31c44f9334a Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:11:46 +0800 Subject: [PATCH 03/85] add snowman consensus engine --- go.mod | 26 +- go.sum | 14 + system/consensus/snowman/README.md | 4 + system/consensus/snowman/ancestor_tree.go | 95 +++ system/consensus/snowman/block.go | 86 +++ system/consensus/snowman/config.go | 33 + system/consensus/snowman/finalize.go | 21 + system/consensus/snowman/getter.go | 16 + system/consensus/snowman/handler.go | 9 + system/consensus/snowman/issuer.go | 49 ++ system/consensus/snowman/memory_block.go | 30 + system/consensus/snowman/metrics.go | 87 +++ system/consensus/snowman/sender.go | 23 + system/consensus/snowman/transitive.go | 701 ++++++++++++++++++++++ system/consensus/snowman/voter.go | 171 ++++++ 15 files changed, 1352 insertions(+), 13 deletions(-) create mode 100644 system/consensus/snowman/README.md create mode 100644 system/consensus/snowman/ancestor_tree.go create mode 100644 system/consensus/snowman/block.go create mode 100644 system/consensus/snowman/config.go create mode 100644 system/consensus/snowman/finalize.go create mode 100644 system/consensus/snowman/getter.go create mode 100644 system/consensus/snowman/handler.go create mode 100644 system/consensus/snowman/issuer.go create mode 100644 system/consensus/snowman/memory_block.go create mode 100644 system/consensus/snowman/metrics.go create mode 100644 system/consensus/snowman/sender.go create mode 100644 system/consensus/snowman/transitive.go create mode 100644 system/consensus/snowman/voter.go diff --git a/go.mod b/go.mod index ecccf0c38..36bd22bf0 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,15 @@ module github.com/33cn/chain33 go 1.16 require ( - github.com/BurntSushi/toml v0.3.1 + github.com/BurntSushi/toml v1.1.0 github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b - github.com/btcsuite/btcd v0.22.0-beta + github.com/ava-labs/avalanchego v1.7.17 // indirect + github.com/btcsuite/btcd v0.23.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/decred/base58 v1.0.3 github.com/dgraph-io/badger v1.6.2 github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 - github.com/ethereum/go-ethereum v1.10.16 + github.com/ethereum/go-ethereum v1.10.20 github.com/go-stack/stack v1.8.0 github.com/golang/protobuf v1.5.2 github.com/golang/snappy v0.0.4 @@ -31,7 +32,7 @@ require ( github.com/libp2p/go-libp2p-swarm v0.5.3 github.com/libp2p/go-msgio v0.0.6 github.com/lucas-clemente/quic-go v0.26.0 // indirect - github.com/mattn/go-colorable v0.1.8 + github.com/mattn/go-colorable v0.1.12 github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.4.1 github.com/pkg/errors v0.9.1 @@ -40,18 +41,17 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 github.com/rs/cors v1.7.0 github.com/shopspring/decimal v1.2.0 - github.com/spf13/cobra v0.0.5 - github.com/stretchr/testify v1.7.0 - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + github.com/spf13/cobra v1.3.0 + github.com/stretchr/testify v1.7.2 + github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a github.com/tjfoc/gmsm v1.3.2 - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 - golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 + golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d + golang.org/x/net v0.0.0-20220708220712-1185a9018129 + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect golang.org/x/tools v0.1.10 // indirect - golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect - google.golang.org/grpc v1.40.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/grpc v1.47.0 + google.golang.org/protobuf v1.28.0 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/go-playground/webhooks.v5 v5.2.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 diff --git a/go.sum b/go.sum index 839c554ee..51d37f5ae 100644 --- a/go.sum +++ b/go.sum @@ -88,6 +88,7 @@ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUM github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM= @@ -151,6 +152,8 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/ava-labs/avalanchego v1.7.17 h1:+Kafk8GaveL/J97yiw+DDtt8TaLWDsyrB61p/QTiEuU= +github.com/ava-labs/avalanchego v1.7.17/go.mod h1:PDJudeWWz4IXxexK95XRMuziAv6XPpMPbCHGwwlzNfw= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.29.16/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= @@ -190,6 +193,7 @@ github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13P github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= +github.com/btcsuite/btcd v0.23.1/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= @@ -318,6 +322,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.10.16 h1:3oPrumn0bCW/idjcxMn5YYVCdK7VzJYIvwGZUGLEaoc= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= +github.com/ethereum/go-ethereum v1.10.20/go.mod h1:LWUN82TCHGpxB3En5HVmLLzPD7YSrEUFmFfN1nKkVN0= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -1092,6 +1097,7 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -1456,6 +1462,7 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1481,9 +1488,11 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= @@ -1645,6 +1654,7 @@ golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1752,6 +1762,7 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1873,6 +1884,7 @@ golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 h1:EH1Deb8WZJ0xc0WK//leUHXcX9aLE5SymusoTmMZye8= @@ -2082,6 +2094,7 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -2096,6 +2109,7 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/system/consensus/snowman/README.md b/system/consensus/snowman/README.md new file mode 100644 index 000000000..14e2b6bf8 --- /dev/null +++ b/system/consensus/snowman/README.md @@ -0,0 +1,4 @@ + +## snowman + +基于avlanche snowman共识的区块最终化设计 diff --git a/system/consensus/snowman/ancestor_tree.go b/system/consensus/snowman/ancestor_tree.go new file mode 100644 index 000000000..7f411ba60 --- /dev/null +++ b/system/consensus/snowman/ancestor_tree.go @@ -0,0 +1,95 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snowman + +import ( + "github.com/ava-labs/avalanchego/ids" +) + +type AncestorTree interface { + Add(blkID ids.ID, parentID ids.ID) + Has(blkID ids.ID) bool + GetRoot(blkID ids.ID) ids.ID + Remove(blkID ids.ID) + RemoveSubtree(blkID ids.ID) + Len() int +} + +type ancestorTree struct { + childToParent map[ids.ID]ids.ID + parentToChildren map[ids.ID]ids.Set +} + +func NewAncestorTree() AncestorTree { + return &ancestorTree{ + childToParent: make(map[ids.ID]ids.ID), + parentToChildren: make(map[ids.ID]ids.Set), + } +} + +// Add maps given blkID to given parentID +func (p *ancestorTree) Add(blkID ids.ID, parentID ids.ID) { + p.childToParent[blkID] = parentID + + children := p.parentToChildren[parentID] + children.Add(blkID) + p.parentToChildren[parentID] = children +} + +// GetRoot returns the oldest parent of blkID, might return blkID if no parent is available. +func (p *ancestorTree) GetRoot(blkID ids.ID) ids.ID { + for { + parentID, ok := p.childToParent[blkID] + // this is the furthest parent available, break loop and return blkID + if !ok { + return blkID + } + // continue to loop with parentID + blkID = parentID + } +} + +// Has returns if blkID is in the tree or not +func (p *ancestorTree) Has(blkID ids.ID) bool { + _, ok := p.childToParent[blkID] + return ok +} + +// Remove removes blkID from the tree +func (p *ancestorTree) Remove(blkID ids.ID) { + parent, ok := p.childToParent[blkID] + if !ok { + return + } + delete(p.childToParent, blkID) + + // remove blkID from children + children := p.parentToChildren[parent] + children.Remove(blkID) + // this parent has no more children, remove it from map + if children.Len() == 0 { + delete(p.parentToChildren, parent) + } +} + +// Returns tree length +func (p *ancestorTree) Len() int { + return len(p.childToParent) +} + +// RemoveSubtree removes whole subtree that blkID holds +func (p *ancestorTree) RemoveSubtree(blkID ids.ID) { + childrenList := []ids.ID{blkID} + for len(childrenList) > 0 { + newChildrenSize := len(childrenList) - 1 + childID := childrenList[newChildrenSize] + childrenList = childrenList[:newChildrenSize] + p.Remove(childID) + // get children of child + for grandChildID := range p.parentToChildren[childID] { + childrenList = append(childrenList, grandChildID) + } + } +} diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go new file mode 100644 index 000000000..0541eb979 --- /dev/null +++ b/system/consensus/snowman/block.go @@ -0,0 +1,86 @@ +package snowman + +import ( + "fmt" + "time" + + "github.com/33cn/chain33/types" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow/choices" + "github.com/ava-labs/avalanchego/snow/consensus/snowman" +) + +// wrap chain33 block for implementing the snowman.Block interface +type snowBlock struct { + id ids.ID + block *types.Block + status choices.Status +} + +func newSnowBlock(blk *types.Block, cfg *types.Chain33Config) snowman.Block { + + sb := &snowBlock{block: blk} + copy(sb.id[:], blk.Hash(cfg)) + return sb +} + +// ID implements the snowman.Block interface +func (b *snowBlock) ID() ids.ID { return b.id } + +// Accept implements the snowman.Block interface +func (b *snowBlock) Accept() error { + + b.status = choices.Accepted + log.Debug(fmt.Sprintf("Accepting block %s at height %d", b.ID().Hex(), b.Height())) + // TODO accept block + return nil +} + +// Reject implements the snowman.Block interface +func (b *snowBlock) Reject() error { + b.status = choices.Rejected + log.Debug(fmt.Sprintf("Rejecting block %s at height %d", b.ID().Hex(), b.Height())) + // TODO reject block + return nil +} + +// SetStatus implements the InternalBlock interface allowing ChainState +// to set the status on an existing block +func (b *snowBlock) SetStatus(status choices.Status) { b.status = status } + +// Status implements the snowman.Block interface +func (b *snowBlock) Status() choices.Status { + return b.status +} + +// Parent implements the snowman.Block interface +func (b *snowBlock) Parent() (id ids.ID) { + + copy(id[:], b.block.ParentHash) + return +} + +// Height implements the snowman.Block interface +func (b *snowBlock) Height() uint64 { + return uint64(b.block.Height) +} + +// Timestamp implements the snowman.Block interface +func (b *snowBlock) Timestamp() time.Time { + return time.Unix(b.block.BlockTime, 0) +} + +// Verify implements the snowman.Block interface +func (b *snowBlock) Verify() error { + + log.Debug(fmt.Sprintf("Verify block %s at height %d", b.ID().Hex(), b.Height())) + // TODO verify block + return nil +} + +// Bytes implements the snowman.Block interface +func (b *snowBlock) Bytes() []byte { + return types.Encode(b.block) +} + +func (b *snowBlock) String() string { return fmt.Sprintf("chain33 block, hash = %s", b.ID().Hex()) } diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go new file mode 100644 index 000000000..b1e0aaeea --- /dev/null +++ b/system/consensus/snowman/config.go @@ -0,0 +1,33 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snowman + +import ( + "github.com/33cn/chain33/types" + "github.com/ava-labs/avalanchego/snow" + "github.com/ava-labs/avalanchego/snow/consensus/snowball" + "github.com/ava-labs/avalanchego/snow/consensus/snowman" + "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/ava-labs/avalanchego/snow/validators" + "github.com/ava-labs/avalanchego/utils/logging" + "github.com/prometheus/client_golang/prometheus" +) + +// Config wraps all the parameters needed for a snowman engine +type Config struct { + common.AllGetsServer + + //ctx *consensus.Context + chainCfg *types.Chain33Config + + ctx *snow.ConsensusContext + log logging.Logger + registerer prometheus.Registerer + //VM block.ChainVM + //Sender common.Sender + validators validators.Set + params snowball.Parameters + consensus snowman.Consensus +} diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/finalize.go new file mode 100644 index 000000000..6c2afcbd8 --- /dev/null +++ b/system/consensus/snowman/finalize.go @@ -0,0 +1,21 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package snowman +package snowman + +import ( + "github.com/33cn/chain33/common/log/log15" + "github.com/33cn/chain33/system/consensus" +) + +var ( + log = log15.New("module", "snowman") +) + +func init() { + + consensus.RegFinalizer("snowman", &Transitive{}) + +} diff --git a/system/consensus/snowman/getter.go b/system/consensus/snowman/getter.go new file mode 100644 index 000000000..6ff96a7ca --- /dev/null +++ b/system/consensus/snowman/getter.go @@ -0,0 +1,16 @@ +package snowman + +import "github.com/33cn/chain33/types" + +type getter struct { +} + +func (g *getter) getLastAcceptBlock() *types.Block { + + return nil +} + +func (g *getter) getBlock(hash []byte) (*types.Block, error) { + + return nil, nil +} diff --git a/system/consensus/snowman/handler.go b/system/consensus/snowman/handler.go new file mode 100644 index 000000000..c15cd86e6 --- /dev/null +++ b/system/consensus/snowman/handler.go @@ -0,0 +1,9 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snowman + +// handler 外部事件处理 +type handler struct { +} diff --git a/system/consensus/snowman/issuer.go b/system/consensus/snowman/issuer.go new file mode 100644 index 000000000..179177563 --- /dev/null +++ b/system/consensus/snowman/issuer.go @@ -0,0 +1,49 @@ +// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package snowman + +import ( + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow/consensus/snowman" +) + +// issuer issues [blk] into to consensus after its dependencies are met. +type issuer struct { + t *Transitive + blk snowman.Block + abandoned bool + deps ids.Set +} + +func (i *issuer) Dependencies() ids.Set { return i.deps } + +// Mark that a dependency has been met +func (i *issuer) Fulfill(id ids.ID) { + i.deps.Remove(id) + i.Update() +} + +// Abandon the attempt to issue [i.block] +func (i *issuer) Abandon(ids.ID) { + if !i.abandoned { + blkID := i.blk.ID() + i.t.removeFromPending(i.blk) + i.t.addToNonVerifieds(i.blk) + i.t.blocked.Abandon(blkID) + + // Tracks performance statistics + i.t.metrics.numRequests.Set(float64(i.t.blkReqs.Len())) + i.t.metrics.numBlocked.Set(float64(len(i.t.pending))) + i.t.metrics.numBlockers.Set(float64(i.t.blocked.Len())) + } + i.abandoned = true +} + +func (i *issuer) Update() { + if i.abandoned || i.deps.Len() != 0 || i.t.errs.Errored() { + return + } + // Issue the block into consensus + i.t.errs.Add(i.t.deliver(i.blk)) +} diff --git a/system/consensus/snowman/memory_block.go b/system/consensus/snowman/memory_block.go new file mode 100644 index 000000000..a71842b57 --- /dev/null +++ b/system/consensus/snowman/memory_block.go @@ -0,0 +1,30 @@ +// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package snowman + +import ( + "github.com/ava-labs/avalanchego/snow/consensus/snowman" +) + +// memoryBlock wraps a snowman Block to manage non-verified blocks +type memoryBlock struct { + snowman.Block + + tree AncestorTree + metrics *metrics +} + +// Accept accepts the underlying block & removes sibling subtrees +func (mb *memoryBlock) Accept() error { + mb.tree.RemoveSubtree(mb.Parent()) + mb.metrics.numNonVerifieds.Set(float64(mb.tree.Len())) + return mb.Block.Accept() +} + +// Reject rejects the underlying block & removes child subtrees +func (mb *memoryBlock) Reject() error { + mb.tree.RemoveSubtree(mb.ID()) + mb.metrics.numNonVerifieds.Set(float64(mb.tree.Len())) + return mb.Block.Reject() +} diff --git a/system/consensus/snowman/metrics.go b/system/consensus/snowman/metrics.go new file mode 100644 index 000000000..e18bac2ba --- /dev/null +++ b/system/consensus/snowman/metrics.go @@ -0,0 +1,87 @@ +// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package snowman + +import ( + "github.com/prometheus/client_golang/prometheus" + + "github.com/ava-labs/avalanchego/utils/metric" + "github.com/ava-labs/avalanchego/utils/wrappers" +) + +type metrics struct { + bootstrapFinished, numRequests, numBlocked, numBlockers, numNonVerifieds prometheus.Gauge + numBuilt, numBuildsFailed, numUselessPutBytes, numUselessPushQueryBytes prometheus.Counter + getAncestorsBlks metric.Averager +} + +// Initialize the metrics +func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error { + errs := wrappers.Errs{} + m.bootstrapFinished = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: namespace, + Name: "bootstrap_finished", + Help: "Whether or not bootstrap process has completed. 1 is success, 0 is fail or ongoing.", + }) + m.numRequests = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: namespace, + Name: "requests", + Help: "Number of outstanding block requests", + }) + m.numBlocked = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: namespace, + Name: "blocked", + Help: "Number of blocks that are pending issuance", + }) + m.numBlockers = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: namespace, + Name: "blockers", + Help: "Number of blocks that are blocking other blocks from being issued because they haven't been issued", + }) + m.numBuilt = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: namespace, + Name: "blks_built", + Help: "Number of blocks that have been built locally", + }) + m.numBuildsFailed = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: namespace, + Name: "blk_builds_failed", + Help: "Number of BuildBlock calls that have failed", + }) + m.numUselessPutBytes = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: namespace, + Name: "num_useless_put_bytes", + Help: "Amount of useless bytes received in Put messages", + }) + m.numUselessPushQueryBytes = prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: namespace, + Name: "num_useless_push_query_bytes", + Help: "Amount of useless bytes received in PushQuery messages", + }) + m.getAncestorsBlks = metric.NewAveragerWithErrs( + namespace, + "get_ancestors_blks", + "blocks fetched in a call to GetAncestors", + reg, + &errs, + ) + m.numNonVerifieds = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: namespace, + Name: "non_verified_blks", + Help: "Number of non-verified blocks in the memory", + }) + + errs.Add( + reg.Register(m.bootstrapFinished), + reg.Register(m.numRequests), + reg.Register(m.numBlocked), + reg.Register(m.numBlockers), + reg.Register(m.numNonVerifieds), + reg.Register(m.numBuilt), + reg.Register(m.numBuildsFailed), + reg.Register(m.numUselessPutBytes), + reg.Register(m.numUselessPushQueryBytes), + ) + return errs.Err +} diff --git a/system/consensus/snowman/sender.go b/system/consensus/snowman/sender.go new file mode 100644 index 000000000..65a57f3ba --- /dev/null +++ b/system/consensus/snowman/sender.go @@ -0,0 +1,23 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snowman + +import "github.com/ava-labs/avalanchego/ids" + +// 向外部模块发送请求, blockchain/p2p等 +type sender struct { +} + +func (s *sender) sendChits(nodeID ids.NodeID, requestID uint32, votes []ids.ID) { + +} + +func (s *sender) sendGet(nodeID ids.NodeID, requestID uint32, containerID ids.ID) { + +} + +func (s *sender) sendPullQuery(nodeIDs ids.NodeIDSet, requestID uint32, containerID ids.ID) { + +} diff --git a/system/consensus/snowman/transitive.go b/system/consensus/snowman/transitive.go new file mode 100644 index 000000000..8d03b8ef4 --- /dev/null +++ b/system/consensus/snowman/transitive.go @@ -0,0 +1,701 @@ +// Copyright Fuzamei Corp. 2018 All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snowman + +import ( + "github.com/33cn/chain33/types" + + "go.uber.org/zap" + + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow" + "github.com/ava-labs/avalanchego/snow/choices" + "github.com/ava-labs/avalanchego/snow/consensus/snowman" + "github.com/ava-labs/avalanchego/snow/consensus/snowman/poll" + "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/ava-labs/avalanchego/snow/events" + "github.com/ava-labs/avalanchego/utils/wrappers" + //"github.com/ava-labs/avalanchego/version" +) + +func New(config Config) (*Transitive, error) { + return newTransitive(config) +} + +// Transitive implements the Engine interface by attempting to fetch all +// Transitive dependencies. +type Transitive struct { + metrics + getter + sender + Config + + // list of NoOpsHandler for messages dropped by engine + //common.StateSummaryFrontierHandler + //common.AcceptedStateSummaryHandler + //common.AcceptedFrontierHandler + //common.AcceptedHandler + //common.AncestorsHandler + + RequestID uint32 + + // track outstanding preference requests + polls poll.Set + + // blocks that have we have sent get requests for but haven't yet received + blkReqs common.Requests + + // blocks that are queued to be issued to consensus once missing dependencies are fetched + // Block ID --> Block + pending map[ids.ID]snowman.Block + + // Block ID --> Parent ID + nonVerifieds AncestorTree + + // operations that are blocked on a block being issued. This could be + // issuing another block, responding to a query, or applying votes to consensus + blocked events.Blocker + + // number of times build block needs to be called once the number of + // processing blocks has gone below the optimal number. + pendingBuildBlocks int + + // errs tracks if an error has occurred in a callback + errs wrappers.Errs +} + +func newTransitive(config Config) (*Transitive, error) { + log.Info("initializing consensus engine") + + factory := poll.NewEarlyTermNoTraversalFactory(config.params.Alpha) + t := &Transitive{ + Config: config, + //StateSummaryFrontierHandler: common.NewNoOpStateSummaryFrontierHandler(config.log), + //AcceptedStateSummaryHandler: common.NewNoOpAcceptedStateSummaryHandler(config.log), + //AcceptedFrontierHandler: common.NewNoOpAcceptedFrontierHandler(config.ctx.Log), + //AcceptedHandler: common.NewNoOpAcceptedHandler(config.ctx.Log), + //AncestorsHandler: common.NewNoOpAncestorsHandler(config.ctx.Log), + pending: make(map[ids.ID]snowman.Block), + nonVerifieds: NewAncestorTree(), + polls: poll.NewSet(factory, + config.log, + "", + config.registerer, + ), + } + + return t, t.metrics.Initialize("", config.registerer) +} + +func (t *Transitive) Put(nodeID ids.NodeID, block *types.Block) error { + + sb := newSnowBlock(block, t.chainCfg) + + if t.wasIssued(sb) { + t.metrics.numUselessPutBytes.Add(float64(block.Size())) + } + + // issue the block into consensus. If the block has already been issued, + // this will be a noop. If this block has missing dependencies, vdr will + // receive requests to fill the ancestry. dependencies that have already + // been fetched, but with missing dependencies themselves won't be requested + // from the vdr. + if _, err := t.issueFrom(nodeID, sb); err != nil { + return err + } + return t.buildBlocks() +} + +func (t *Transitive) GetFailed(nodeID ids.NodeID, requestID uint32) error { + // We don't assume that this function is called after a failed Get message. + // Check to see if we have an outstanding request and also get what the request was for if it exists. + blkID, ok := t.blkReqs.Remove(nodeID, requestID) + if !ok { + t.log.Debug("unexpected GetFailed", + zap.Stringer("nodeID", nodeID), + zap.Uint32("requestID", requestID), + ) + return nil + } + + // Because the get request was dropped, we no longer expect blkID to be issued. + t.blocked.Abandon(blkID) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.buildBlocks() +} + +func (t *Transitive) PullQuery(nodeID ids.NodeID, requestID uint32, blkID ids.ID) error { + // TODO: once everyone supports ChitsV2 - we should be sending that message + // type here. + t.sendChits(nodeID, requestID, []ids.ID{t.consensus.Preference()}) + + // Try to issue [blkID] to consensus. + // If we're missing an ancestor, request it from [vdr] + if _, err := t.issueFromByID(nodeID, blkID); err != nil { + return err + } + + return t.buildBlocks() +} + +func (t *Transitive) PushQuery(nodeID ids.NodeID, requestID uint32, block *types.Block) error { + // TODO: once everyone supports ChitsV2 - we should be sending that message + // type here. + t.sendChits(nodeID, requestID, []ids.ID{t.consensus.Preference()}) + + sb := newSnowBlock(block, t.chainCfg) + + if t.wasIssued(sb) { + t.metrics.numUselessPushQueryBytes.Add(float64(block.Size())) + } + + // issue the block into consensus. If the block has already been issued, + // this will be a noop. If this block has missing dependencies, nodeID will + // receive requests to fill the ancestry. dependencies that have already + // been fetched, but with missing dependencies themselves won't be requested + // from the vdr. + if _, err := t.issueFrom(nodeID, sb); err != nil { + return err + } + + return t.buildBlocks() +} + +func (t *Transitive) Chits(nodeID ids.NodeID, requestID uint32, votes []ids.ID) error { + // Since this is a linear chain, there should only be one ID in the vote set + if len(votes) != 1 { + t.log.Debug("failing Chits", + zap.String("reason", "expected only 1 vote"), + zap.Int("numVotes", len(votes)), + zap.Stringer("nodeID", nodeID), + zap.Uint32("requestID", requestID), + ) + // because QueryFailed doesn't utilize the assumption that we actually + // sent a Query message, we can safely call QueryFailed here to + // potentially abandon the request. + return t.QueryFailed(nodeID, requestID) + } + blkID := votes[0] + + t.log.Verbo("called Chits for the block", + zap.Stringer("blkID", blkID), + zap.Stringer("nodeID", nodeID), + zap.Uint32("requestID", requestID)) + + // Will record chits once [blkID] has been issued into consensus + v := &voter{ + t: t, + vdr: nodeID, + requestID: requestID, + response: blkID, + } + + added, err := t.issueFromByID(nodeID, blkID) + if err != nil { + return err + } + // Wait until [blkID] has been issued to consensus before applying this chit. + if !added { + v.deps.Add(blkID) + } + + t.blocked.Register(v) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.buildBlocks() +} + +func (t *Transitive) ChitsV2(vdr ids.NodeID, requestID uint32, _ []ids.ID, vote ids.ID) error { + return t.Chits(vdr, requestID, []ids.ID{vote}) +} + +func (t *Transitive) QueryFailed(vdr ids.NodeID, requestID uint32) error { + t.blocked.Register(&voter{ + t: t, + vdr: vdr, + requestID: requestID, + }) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.buildBlocks() +} + +func (t *Transitive) Notify(msg common.Message) error { + if msg != common.PendingTxs { + t.log.Warn("received an unexpected message from the VM", + zap.Stringer("message", msg), + ) + return nil + } + + // the pending txs message means we should attempt to build a block. + t.pendingBuildBlocks++ + return t.buildBlocks() +} + +func (t *Transitive) Context() *snow.ConsensusContext { + return t.ctx +} + +func (t *Transitive) Start(startReqID uint32) error { + t.RequestID = startReqID + + lastAccepted := newSnowBlock(t.getter.getLastAcceptBlock(), t.chainCfg) + lastAcceptedID := lastAccepted.ID() + // initialize consensus to the last accepted blockID + if err := t.consensus.Initialize(t.ctx, t.params, lastAcceptedID, lastAccepted.Height()); err != nil { + return err + } + + // to maintain the invariant that oracle blocks are issued in the correct + // preferences, we need to handle the case that we are bootstrapping into an oracle block + //if oracleBlk, ok := lastAccepted.(snowman.OracleBlock); ok { + // options, err := oracleBlk.Options() + // switch { + // case err == snowman.ErrNotOracle: + // // if there aren't blocks we need to deliver on startup, we need to set + // // the preference to the last accepted block + // if err := t.VM.SetPreference(lastAcceptedID); err != nil { + // return err + // } + // case err != nil: + // return err + // default: + // for _, blk := range options { + // // note that deliver will set the VM's preference + // if err := t.deliver(blk); err != nil { + // return err + // } + // } + // } + //} else if err := t.VM.SetPreference(lastAcceptedID); err != nil { + // return err + //} + + t.ctx.Log.Info("consensus starting", + zap.Stringer("lastAcceptedBlock", lastAcceptedID), + ) + t.metrics.bootstrapFinished.Set(1) + + t.ctx.SetState(snow.NormalOp) + //if err := t.VM.SetState(snow.NormalOp); err != nil { + // return fmt.Errorf("failed to notify VM that consensus is starting: %w", + // err) + //} + return nil +} + +func (t *Transitive) HealthCheck() (interface{}, error) { + consensusIntf, consensusErr := t.consensus.HealthCheck() + return consensusIntf, consensusErr +} + +func (t *Transitive) GetBlock(blkID ids.ID) (snowman.Block, error) { + if blk, ok := t.pending[blkID]; ok { + return blk, nil + } + blk, err := t.getBlock(blkID[:]) + if err != nil { + return nil, err + } + return newSnowBlock(blk, t.chainCfg), nil +} + +// Build blocks if they have been requested and the number of processing blocks +// is less than optimal. +func (t *Transitive) buildBlocks() error { + if err := t.errs.Err; err != nil { + return err + } + + return nil +} + +// Issue another poll to the network, asking what it prefers given the block we prefer. +// Helps move consensus along. +func (t *Transitive) repoll() { + // if we are issuing a repoll, we should gossip our current preferences to + // propagate the most likely branch as quickly as possible + prefID := t.consensus.Preference() + + for i := t.polls.Len(); i < t.params.ConcurrentRepolls; i++ { + t.pullQuery(prefID) + } +} + +// issueFromByID attempts to issue the branch ending with a block [blkID] into consensus. +// If we do not have [blkID], request it. +// Returns true if the block is processing in consensus or is decided. +func (t *Transitive) issueFromByID(nodeID ids.NodeID, blkID ids.ID) (bool, error) { + blk, err := t.GetBlock(blkID) + if err != nil { + t.sendRequest(nodeID, blkID) + return false, nil + } + return t.issueFrom(nodeID, blk) +} + +// issueFrom attempts to issue the branch ending with block [blkID] to consensus. +// Returns true if the block is processing in consensus or is decided. +// If a dependency is missing, request it from [vdr]. +func (t *Transitive) issueFrom(nodeID ids.NodeID, blk snowman.Block) (bool, error) { + blkID := blk.ID() + // issue [blk] and its ancestors to consensus. + for !t.wasIssued(blk) { + if err := t.issue(blk); err != nil { + return false, err + } + + blkID = blk.Parent() + var err error + blk, err = t.GetBlock(blkID) + + // If we don't have this ancestor, request it from [vdr] + if err != nil || !blk.Status().Fetched() { + t.sendRequest(nodeID, blkID) + return false, nil + } + } + + // Remove any outstanding requests for this block + t.blkReqs.RemoveAny(blkID) + + issued := t.consensus.Decided(blk) || t.consensus.Processing(blkID) + if issued { + // A dependency should never be waiting on a decided or processing + // block. However, if the block was marked as rejected by the VM, the + // dependencies may still be waiting. Therefore, they should abandoned. + t.blocked.Abandon(blkID) + } + + // Tracks performance statistics + t.metrics.numRequests.Set(float64(t.blkReqs.Len())) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return issued, t.errs.Err +} + +// issueWithAncestors attempts to issue the branch ending with [blk] to consensus. +// Returns true if the block is processing in consensus or is decided. +// If a dependency is missing and the dependency hasn't been requested, the issuance will be abandoned. +func (t *Transitive) issueWithAncestors(blk snowman.Block) (bool, error) { + blkID := blk.ID() + // issue [blk] and its ancestors into consensus + status := blk.Status() + for status.Fetched() && !t.wasIssued(blk) { + if err := t.issue(blk); err != nil { + return false, err + } + blkID = blk.Parent() + var err error + if blk, err = t.GetBlock(blkID); err != nil { + status = choices.Unknown + break + } + status = blk.Status() + } + + // The block was issued into consensus. This is the happy path. + if status != choices.Unknown && (t.consensus.Decided(blk) || t.consensus.Processing(blkID)) { + return true, nil + } + + // There's an outstanding request for this block. + // We can just wait for that request to succeed or fail. + if t.blkReqs.Contains(blkID) { + return false, nil + } + + // We don't have this block and have no reason to expect that we will get it. + // Abandon the block to avoid a memory leak. + t.blocked.Abandon(blkID) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return false, t.errs.Err +} + +// If the block has been decided, then it is marked as having been issued. +// If the block is processing, then it was issued. +// If the block is queued to be added to consensus, then it was issued. +func (t *Transitive) wasIssued(blk snowman.Block) bool { + blkID := blk.ID() + return t.consensus.Decided(blk) || t.consensus.Processing(blkID) || t.pendingContains(blkID) +} + +// Issue [blk] to consensus once its ancestors have been issued. +func (t *Transitive) issue(blk snowman.Block) error { + blkID := blk.ID() + + // mark that the block is queued to be added to consensus once its ancestors have been + t.pending[blkID] = blk + + // Remove any outstanding requests for this block + t.blkReqs.RemoveAny(blkID) + + // Will add [blk] to consensus once its ancestors have been + i := &issuer{ + t: t, + blk: blk, + } + + // block on the parent if needed + parentID := blk.Parent() + if parent, err := t.GetBlock(parentID); err != nil || !(t.consensus.Decided(parent) || t.consensus.Processing(parentID)) { + t.ctx.Log.Verbo("block waiting for parent to be issued", + zap.Stringer("blkID", blkID), + zap.Stringer("parentID", parentID), + ) + i.deps.Add(parentID) + } + + t.blocked.Register(i) + + // Tracks performance statistics + t.metrics.numRequests.Set(float64(t.blkReqs.Len())) + t.metrics.numBlocked.Set(float64(len(t.pending))) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.errs.Err +} + +// Request that [vdr] send us block [blkID] +func (t *Transitive) sendRequest(nodeID ids.NodeID, blkID ids.ID) { + // There is already an outstanding request for this block + if t.blkReqs.Contains(blkID) { + return + } + + t.RequestID++ + t.blkReqs.Add(nodeID, t.RequestID, blkID) + t.ctx.Log.Verbo("sending Get request", + zap.Stringer("nodeID", nodeID), + zap.Uint32("requestID", t.RequestID), + zap.Stringer("blkID", blkID), + ) + t.sender.sendGet(nodeID, t.RequestID, blkID) + + // Tracks performance statistics + t.metrics.numRequests.Set(float64(t.blkReqs.Len())) +} + +// send a pull query for this block ID +func (t *Transitive) pullQuery(blkID ids.ID) { + t.ctx.Log.Verbo("sampling from validators", + zap.Stringer("validators", t.validators), + ) + // The validators we will query + vdrs, err := t.validators.Sample(t.params.K) + if err != nil { + t.ctx.Log.Error("dropped query for block", + zap.String("reason", "insufficient number of validators"), + zap.Stringer("blkID", blkID), + ) + return + } + + vdrBag := ids.NodeIDBag{} + for _, vdr := range vdrs { + vdrBag.Add(vdr.ID()) + } + + t.RequestID++ + if t.polls.Add(t.RequestID, vdrBag) { + vdrList := vdrBag.List() + vdrSet := ids.NewNodeIDSet(len(vdrList)) + vdrSet.Add(vdrList...) + t.sender.sendPullQuery(vdrSet, t.RequestID, blkID) + } +} + +// Send a query for this block. Some validators will be sent +// a Push Query and some will be sent a Pull Query. +func (t *Transitive) sendMixedQuery(blk snowman.Block) { + t.ctx.Log.Verbo("sampling from validators", + zap.Stringer("validators", t.validators), + ) + vdrs, err := t.validators.Sample(t.params.K) + if err != nil { + t.ctx.Log.Error("dropped query for block", + zap.String("reason", "insufficient number of validators"), + zap.Stringer("blkID", blk.ID()), + ) + return + } + + vdrBag := ids.NodeIDBag{} + for _, vdr := range vdrs { + vdrBag.Add(vdr.ID()) + } + + t.RequestID++ + if t.polls.Add(t.RequestID, vdrBag) { + // Send a push query to some of the validators, and a pull query to the rest. + numPushTo := t.params.MixedQueryNumPushVdr + if !t.validators.Contains(t.ctx.NodeID) { + numPushTo = t.params.MixedQueryNumPushNonVdr + } + common.SendMixedQuery( + t.sender, + vdrBag.List(), // Note that this doesn't contain duplicates; length may be < k + numPushTo, + t.RequestID, + blk.ID(), + blk.Bytes(), + ) + } +} + +// issue [blk] to consensus +func (t *Transitive) deliver(blk snowman.Block) error { + blkID := blk.ID() + if t.consensus.Decided(blk) || t.consensus.Processing(blkID) { + return nil + } + + // we are no longer waiting on adding the block to consensus, so it is no + // longer pending + t.removeFromPending(blk) + parentID := blk.Parent() + parent, err := t.GetBlock(parentID) + // Because the dependency must have been fulfilled by the time this function + // is called - we don't expect [err] to be non-nil. But it is handled for + // completness and future proofing. + if err != nil || !(parent.Status() == choices.Accepted || t.consensus.Processing(parentID)) { + // if the parent isn't processing or the last accepted block, then this + // block is effectively rejected + t.blocked.Abandon(blkID) + t.metrics.numBlocked.Set(float64(len(t.pending))) // Tracks performance statistics + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.errs.Err + } + + // By ensuring that the parent is either processing or accepted, it is + // guaranteed that the parent was successfully verified. This means that + // calling Verify on this block is allowed. + + // make sure this block is valid + if err := blk.Verify(); err != nil { + t.ctx.Log.Debug("block verification failed", + zap.Error(err), + ) + + // if verify fails, then all descendants are also invalid + t.addToNonVerifieds(blk) + t.blocked.Abandon(blkID) + t.metrics.numBlocked.Set(float64(len(t.pending))) // Tracks performance statistics + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.errs.Err + } + t.nonVerifieds.Remove(blkID) + t.metrics.numNonVerifieds.Set(float64(t.nonVerifieds.Len())) + t.ctx.Log.Verbo("adding block to consensus", + zap.Stringer("blkID", blkID), + ) + wrappedBlk := &memoryBlock{ + Block: blk, + metrics: &t.metrics, + tree: t.nonVerifieds, + } + if err := t.consensus.Add(wrappedBlk); err != nil { + return err + } + + // Add all the oracle blocks if they exist. We call verify on all the blocks + // and add them to consensus before marking anything as fulfilled to avoid + // any potential reentrant bugs. + var added []snowman.Block + var dropped []snowman.Block + if blk, ok := blk.(snowman.OracleBlock); ok { + options, err := blk.Options() + if err != snowman.ErrNotOracle { + if err != nil { + return err + } + + for _, blk := range options { + if err := blk.Verify(); err != nil { + t.ctx.Log.Debug("block verification failed", + zap.Error(err), + ) + dropped = append(dropped, blk) + // block fails verification, hold this in memory for bubbling + t.addToNonVerifieds(blk) + } else { + // correctly verified will be passed to consensus as processing block + // no need to keep it anymore + t.nonVerifieds.Remove(blk.ID()) + t.metrics.numNonVerifieds.Set(float64(t.nonVerifieds.Len())) + wrappedBlk := &memoryBlock{ + Block: blk, + metrics: &t.metrics, + tree: t.nonVerifieds, + } + if err := t.consensus.Add(wrappedBlk); err != nil { + return err + } + added = append(added, blk) + } + } + } + } + + if err := t.VM.SetPreference(t.consensus.Preference()); err != nil { + return err + } + + // If the block is now preferred, query the network for its preferences + // with this new block. + if t.consensus.IsPreferred(blk) { + t.sendMixedQuery(blk) + } + + t.blocked.Fulfill(blkID) + for _, blk := range added { + if t.consensus.IsPreferred(blk) { + t.sendMixedQuery(blk) + } + + blkID := blk.ID() + t.removeFromPending(blk) + t.blocked.Fulfill(blkID) + t.blkReqs.RemoveAny(blkID) + } + for _, blk := range dropped { + blkID := blk.ID() + t.removeFromPending(blk) + t.blocked.Abandon(blkID) + t.blkReqs.RemoveAny(blkID) + } + + // If we should issue multiple queries at the same time, we need to repoll + t.repoll() + + // Tracks performance statistics + t.metrics.numRequests.Set(float64(t.blkReqs.Len())) + t.metrics.numBlocked.Set(float64(len(t.pending))) + t.metrics.numBlockers.Set(float64(t.blocked.Len())) + return t.errs.Err +} + +// Returns true if the block whose ID is [blkID] is waiting to be issued to consensus +func (t *Transitive) pendingContains(blkID ids.ID) bool { + _, ok := t.pending[blkID] + return ok +} + +func (t *Transitive) removeFromPending(blk snowman.Block) { + delete(t.pending, blk.ID()) +} + +func (t *Transitive) addToNonVerifieds(blk snowman.Block) { + // don't add this blk if it's decided or processing. + blkID := blk.ID() + if t.consensus.Decided(blk) || t.consensus.Processing(blkID) { + return + } + parentID := blk.Parent() + // we might still need this block so we can bubble votes to the parent + // only add blocks with parent already in the tree or processing. + // decided parents should not be in this map. + if t.nonVerifieds.Has(parentID) || t.consensus.Processing(parentID) { + t.nonVerifieds.Add(blkID, parentID) + t.metrics.numNonVerifieds.Set(float64(t.nonVerifieds.Len())) + } +} diff --git a/system/consensus/snowman/voter.go b/system/consensus/snowman/voter.go new file mode 100644 index 000000000..5c0a83f45 --- /dev/null +++ b/system/consensus/snowman/voter.go @@ -0,0 +1,171 @@ +// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package snowman + +import ( + "go.uber.org/zap" + + "github.com/ava-labs/avalanchego/ids" +) + +// Voter records chits received from [vdr] once its dependencies are met. +type voter struct { + t *Transitive + vdr ids.NodeID + requestID uint32 + response ids.ID + deps ids.Set +} + +func (v *voter) Dependencies() ids.Set { return v.deps } + +// Fulfill Mark that a dependency has been met. +func (v *voter) Fulfill(id ids.ID) { + v.deps.Remove(id) + v.Update() +} + +// Abandon this attempt to record chits. +func (v *voter) Abandon(id ids.ID) { v.Fulfill(id) } + +func (v *voter) Update() { + if v.deps.Len() != 0 || v.t.errs.Errored() { + return + } + + var results []ids.Bag + if v.response == ids.Empty { + results = v.t.polls.Drop(v.requestID, v.vdr) + } else { + results = v.t.polls.Vote(v.requestID, v.vdr, v.response) + } + + if len(results) == 0 { + return + } + + // To prevent any potential deadlocks with un-disclosed dependencies, votes + // must be bubbled to the nearest valid block + for i, result := range results { + results[i] = v.bubbleVotes(result) + } + + for _, result := range results { + result := result + + v.t.ctx.Log.Debug("finishing poll", + zap.Stringer("result", &result), + ) + if err := v.t.consensus.RecordPoll(result); err != nil { + v.t.errs.Add(err) + } + } + + if v.t.errs.Errored() { + return + } + + if err := v.t.VM.SetPreference(v.t.consensus.Preference()); err != nil { + v.t.errs.Add(err) + return + } + + if v.t.consensus.Finalized() { + v.t.ctx.Log.Debug("Snowman engine can quiesce") + return + } + + v.t.ctx.Log.Debug("Snowman engine can't quiesce") + v.t.repoll() +} + +// bubbleVotes bubbles the [votes] a set of the number of votes for specific +// blkIDs that received votes in consensus, to their most recent ancestor that +// has been issued to consensus. +// +// Note: bubbleVotes does not bubbleVotes to all of the ancestors in consensus, +// just the most recent one. bubbling to the rest of the ancestors, which may +// also be in consensus is handled in RecordPoll. +func (v *voter) bubbleVotes(votes ids.Bag) ids.Bag { + bubbledVotes := ids.Bag{} + +votesLoop: + for _, vote := range votes.List() { + count := votes.Count(vote) + // use rootID in case of this is a non-verified block ID + rootID := v.t.nonVerifieds.GetRoot(vote) + v.t.ctx.Log.Verbo("bubbling vote(s) through unverified blocks", + zap.Int("numVotes", count), + zap.Stringer("voteID", vote), + zap.Stringer("parentID", rootID), + ) + + blk, err := v.t.GetBlock(rootID) + // If we cannot retrieve the block, drop [vote] + if err != nil { + v.t.ctx.Log.Debug("dropping vote(s)", + zap.String("reason", "parent couldn't be fetched"), + zap.Stringer("parentID", rootID), + zap.Int("numVotes", count), + zap.Stringer("voteID", vote), + zap.Error(err), + ) + continue + } + + status := blk.Status() + blkID := blk.ID() + // If we have not fetched [blkID] break from the loop. We will drop the + // vote below and move on to the next vote. + // + // If [blk] has already been decided, break from the loop, we will drop + // the vote below since there is no need to count the votes for a [blk] + // we've already finalized. + // + // If [blk] is currently in consensus, break from the loop, we have + // reached the first ancestor of the original [vote] that has been + // issued consensus. In this case, the votes will be bubbled further + // from [blk] to any of its ancestors that are also in consensus. + for status.Fetched() && !(v.t.consensus.Decided(blk) || v.t.consensus.Processing(blkID)) { + parentID := blk.Parent() + v.t.ctx.Log.Verbo("pushing vote(s)", + zap.Int("numVotes", count), + zap.Stringer("voteID", vote), + zap.Stringer("parentID", rootID), + ) + + blkID = parentID + blk, err = v.t.GetBlock(blkID) + // If we cannot retrieve the block, drop [vote] + if err != nil { + v.t.ctx.Log.Debug("dropping vote(s)", + zap.String("reason", "block couldn't be fetched"), + zap.Stringer("blkID", blkID), + zap.Int("numVotes", count), + zap.Stringer("voteID", vote), + zap.Error(err), + ) + continue votesLoop + } + status = blk.Status() + } + + // If [blkID] is currently in consensus, count the votes + if v.t.consensus.Processing(blkID) { + v.t.ctx.Log.Verbo("applying vote(s)", + zap.Int("numVotes", count), + zap.Stringer("blkID", blkID), + zap.Stringer("status", status), + ) + bubbledVotes.AddCount(blkID, count) + } else { + v.t.ctx.Log.Verbo("dropping vote(s)", + zap.Int("numVotes", count), + zap.Stringer("blkID", blkID), + zap.Stringer("status", status), + ) + } + } + return bubbledVotes +} From ce53b1ff322f18ead79aa9b6eb84ff6762d62972 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:04:32 +0800 Subject: [PATCH 04/85] add avlanchego package --- go.mod | 73 +++++++---- go.sum | 401 +++++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 325 insertions(+), 149 deletions(-) diff --git a/go.mod b/go.mod index efe461374..50bec0d37 100644 --- a/go.mod +++ b/go.mod @@ -3,18 +3,19 @@ module github.com/33cn/chain33 go 1.19 require ( - github.com/BurntSushi/toml v0.3.1 + github.com/BurntSushi/toml v1.2.0 github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b + github.com/ava-labs/avalanchego v1.10.9 github.com/btcsuite/btcd v0.22.1 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/decred/base58 v1.0.3 github.com/dgraph-io/badger v1.6.2 github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 - github.com/ethereum/go-ethereum v1.10.16 - github.com/go-stack/stack v1.8.0 + github.com/ethereum/go-ethereum v1.12.0 + github.com/go-stack/stack v1.8.1 github.com/golang/protobuf v1.5.3 - github.com/golang/snappy v0.0.4 + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb github.com/google/uuid v1.3.0 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/influxdata/influxdb v1.9.5 @@ -25,22 +26,24 @@ require ( github.com/libp2p/go-libp2p-kbucket v0.5.0 github.com/libp2p/go-libp2p-pubsub v0.9.3 github.com/libp2p/go-msgio v0.3.0 - github.com/mattn/go-colorable v0.1.8 + github.com/mattn/go-colorable v0.1.13 github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.9.0 github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.14.0 github.com/qianlnk/pgbar v0.0.0-20210208085217-8c19b9f2477e github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 github.com/rs/cors v1.7.0 github.com/shopspring/decimal v1.2.0 - github.com/spf13/cobra v0.0.5 + github.com/spf13/cobra v1.0.0 github.com/stretchr/testify v1.8.2 - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a github.com/tjfoc/gmsm v1.3.2 + go.uber.org/zap v1.24.0 golang.org/x/crypto v0.7.0 golang.org/x/net v0.8.0 - golang.org/x/sys v0.7.0 - google.golang.org/grpc v1.40.0 + golang.org/x/sys v0.8.0 + google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/go-playground/webhooks.v5 v5.2.0 @@ -48,23 +51,29 @@ require ( ) require ( - cloud.google.com/go v0.65.0 // indirect github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/DataDog/zstd v1.5.2 // indirect github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 // indirect github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01 // indirect + github.com/apache/arrow/go/v10 v10.0.1 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/benbjohnson/immutable v0.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect - github.com/cenkalti/backoff/v4 v4.1.1 // indirect + github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cockroachdb/errors v1.9.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect + github.com/cockroachdb/redact v1.1.3 // indirect github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect - github.com/deckarep/golang-set v1.8.0 // indirect + github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/dgraph-io/ristretto v0.0.2 // indirect @@ -74,23 +83,29 @@ require ( github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/flynn/noise v1.0.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect + github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gofrs/flock v0.8.1 // indirect github.com/gofrs/uuid v3.3.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v4 v4.3.0 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/google/flatbuffers v2.0.0+incompatible // indirect + github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b // indirect + github.com/gorilla/rpc v1.2.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.2 // indirect + github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect github.com/huin/goupnp v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/influxdata/flux v0.131.0 // indirect @@ -127,7 +142,7 @@ require ( github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.0 // indirect - github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect @@ -138,6 +153,7 @@ require ( github.com/multiformats/go-multihash v0.2.1 // indirect github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onsi/ginkgo/v2 v2.9.2 // indirect github.com/opencontainers/runtime-spec v1.0.2 // indirect @@ -146,11 +162,9 @@ require ( github.com/pegasus-kv/thrift v0.13.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - github.com/prometheus/tsdb v0.7.1 // indirect github.com/qianlnk/to v0.0.0-20191230085244-91e712717368 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-19 v0.3.3 // indirect @@ -159,38 +173,49 @@ require ( github.com/quic-go/webtransport-go v0.5.2 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sergi/go-diff v1.0.0 // indirect - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/sirupsen/logrus v1.8.1 // indirect + github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/sirupsen/logrus v1.9.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.0 // indirect + github.com/supranational/blst v0.3.11 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect github.com/uber/jaeger-client-go v2.28.0+incompatible // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect + github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/dig v1.16.1 // indirect go.uber.org/fx v1.19.2 // indirect + go.uber.org/mock v0.2.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-20230321023759-10a507213a29 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/sync v0.1.0 // indirect + golang.org/x/term v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect golang.org/x/tools v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gonum.org/v1/gonum v0.11.0 // indirect - google.golang.org/api v0.30.0 // indirect - google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect + google.golang.org/api v0.110.0 // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect - gopkg.in/urfave/cli.v1 v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apimachinery v0.17.5 // indirect lukechampine.com/blake3 v1.1.7 // indirect diff --git a/go.sum b/go.sum index 78de29f17..62ccf50e1 100644 --- a/go.sum +++ b/go.sum @@ -16,20 +16,24 @@ cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bP cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigquery v1.48.0 h1:u+fhS1jJOkPO9vdM84M8HO5VznTfVUicBeoXNKD26ho= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/bigtable v1.3.0 h1:PAplkJLXheOLlK5PPyy4/HXtPzHn+1/LaYDWIeGxnio= cloud.google.com/go/bigtable v1.3.0/go.mod h1:z5EyKrPE8OQmeg4h5MNdKvuSnI9CCT49Ki3f23aBzio= +cloud.google.com/go/compute v1.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE= +cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -46,12 +50,10 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= github.com/Azure/azure-sdk-for-go v41.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= @@ -59,7 +61,6 @@ github.com/Azure/go-autorest/autorest v0.10.0/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUd github.com/Azure/go-autorest/autorest v0.11.9 h1:P0ZF0dEYoUPUVDQo3mA1CvH5b8mKev7DDcmTwauuNME= github.com/Azure/go-autorest/autorest v0.11.9/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= github.com/Azure/go-autorest/autorest/adal v0.8.3/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= github.com/Azure/go-autorest/autorest/adal v0.9.5 h1:Y3bBUV4rTuxenJJs41HU3qmqsb+auo+a3Lz+PlJPpL0= @@ -84,15 +85,21 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= +github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM= github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/HdrHistogram/hdrhistogram-go v1.1.0 h1:6dpdDPTRoo78HxAJ6T1HfMiKSnqhgRRqzCuPshRkQ7I= +github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.16.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= @@ -106,12 +113,10 @@ github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdko github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/SAP/go-hdb v0.14.1 h1:hkw4ozGZ/i4eak7ZuGkY5e0hxiXFdNUBNhr4AvZVNFE= github.com/SAP/go-hdb v0.14.1/go.mod h1:7fdQLVC2lER3urZLjZCm0AuMQfApof92n3aylBPEkMo= +github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/VictoriaMetrics/fastcache v1.10.0 h1:5hDJnLsKLpnUEToub7ETuRu8RCkb40woBZAUiKonXzY= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b h1:KF7k0g1S53oeveZxGM2wfyT5PSpO82ZxBrYlA5mM0cw= github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b/go.mod h1:VrfgKISflRhFm32m3e0SXLccvNJTyG8PRywWbUuGEfY= @@ -120,15 +125,16 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw= github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= +github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -137,8 +143,11 @@ github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VT github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01 h1:FSqtT0UCktIlSU19mxj0YE5HK3HOO4IFMU9BpOif/7A= github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= +github.com/apache/arrow/go/v10 v10.0.1 h1:n9dERvixoC/1JjDmBcs9FPaEryoANa2sCgVFo6ez9cI= +github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -148,21 +157,15 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/ava-labs/avalanchego v1.10.9 h1:qxhp3YoD2Wm/iIKP6Wb1isbkUPWmIrJxWgivDoL0obM= +github.com/ava-labs/avalanchego v1.10.9/go.mod h1:C8R5uiltpc8MQ62ixxgODR+15mesWF0aAw3H+Qrl9Iw= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.29.16/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= github.com/aws/aws-sdk-go v1.30.12 h1:KrjyosZvkpJjcwMk0RNxMZewQ47v7+ZkbQDXjWsJMs8= github.com/aws/aws-sdk-go v1.30.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -182,6 +185,8 @@ github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBT github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= @@ -202,10 +207,9 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n github.com/cenkalti/backoff v0.0.0-20181003080854-62661b46c409/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= -github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= @@ -220,29 +224,47 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= +github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= +github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= +github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= +github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= +github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -254,8 +276,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= -github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= -github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= +github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/base58 v1.0.3 h1:KGZuh8d1WEMIrK0leQRM47W85KqCAdl2N+uagbctdDI= github.com/decred/base58 v1.0.3/go.mod h1:pXP9cXCfM2sFLb2viz2FNIdeMWmZDBKG3ZBYbiSM78E= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= @@ -264,9 +286,9 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/denisenkom/go-mssqldb v0.10.0 h1:QykgLZBorFE95+gO3u9esLd0BmbvpWp0/waNNZfHBM8= github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8= github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= github.com/dgraph-io/ristretto v0.0.2 h1:a5WaUrDa0qm0YrAAS1tUykT5El3kt62KNZZeMxQn3po= @@ -279,16 +301,12 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/dgryski/go-sip13 v0.0.0-20190329191031-25c5027a8c7b/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -297,8 +315,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.0 h1:1F8mhG9+aO5/xpdtFkW4SxOJB67ukuDC3t2y2qayIX0= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= @@ -309,13 +327,18 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.10.16 h1:3oPrumn0bCW/idjcxMn5YYVCdK7VzJYIvwGZUGLEaoc= -github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= +github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -335,44 +358,50 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= +github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= +github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= +github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-chi/chi v4.1.0+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -433,19 +462,20 @@ github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2K github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= @@ -479,13 +509,18 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -494,14 +529,21 @@ github.com/gogo/protobuf v1.2.2-0.20190730201129-28a6bbf47e48/go.mod h1:SlYgWuQ5 github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= +github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -537,15 +579,17 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/flatbuffers v2.0.0+incompatible h1:dicJ2oXwypfwUGnB2/TYWYEKiuk9eYQlQO/AnOHl5mI= github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/flatbuffers v2.0.8+incompatible h1:ivUb1cGomAB101ZM1T0nOiWz9pSrTMoa9+EiY7igmkM= +github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -557,13 +601,13 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -577,21 +621,22 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200417002340-c6e0a841f49a/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b h1:Qcx5LM0fSiks9uCyFZwDBUasd3lxd1RM0GYpL+Li5o4= github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.4.0/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -602,19 +647,25 @@ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51 github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= +github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.14.4/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 h1:kr3j8iIMR4ywO/O0rvksXaJvauGGCMg2zAZIiNZ9uIQ= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -661,43 +712,39 @@ github.com/hashicorp/memberlist v0.2.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.0/go.mod h1:YL0HO+FifKOW2u1ke99DGVu1zhcpZzNwrLIqBC7vbYU= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= -github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= +github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= github.com/huin/goupnp v1.1.0 h1:gEe0Dp/lZmPZiDFzJJaOfUpOvv2MKUkoBX8lDrn9vKU= github.com/huin/goupnp v1.1.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/flux v0.65.0/go.mod h1:BwN2XG2lMszOoquQaFdPET8FRQfrXiZsWmcMO9rkaVY= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/flux v0.131.0 h1:b6vCQyJorkbUEv25eHbNL1XIjSQ4/XMNFW8p9Uytm2k= github.com/influxdata/flux v0.131.0/go.mod h1:CKvnYe6FHpTj/E0YGI7TcOZdGiYHoToOPSnoa12RtKI= github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69/go.mod h1:pwymjR6SrP3gD3pRj9RJwdl1j5s3doEEV8gS4X9qSzA= github.com/influxdata/influxdb v1.8.0/go.mod h1:SIzcnsjaHRFpmlxpJ4S3NT64qtEKYweNTUMb/vh0OMQ= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= github.com/influxdata/influxdb v1.9.5 h1:4O7AC5jOA9RoqtDuD2rysXbumcEwaqWlWXmwuyK+a2s= github.com/influxdata/influxdb v1.9.5/go.mod h1:4uPVvcry9KWQVWLxyT9641qpkRXUBN+xa0MJFFNNLKo= github.com/influxdata/influxdb-client-go/v2 v2.3.1-0.20210518120617-5d1fff431040/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb-client-go/v2 v2.4.0 h1:HGBfZYStlx3Kqvsv1h2pJixbCl/jhnFtxpKFAv9Tu5k= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxql v1.1.0/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZgb3N+tzevNgo= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= github.com/influxdata/influxql v1.1.1-0.20210223160523-b6ab99450c93 h1:4t/8PcmLnI2vrcaHcEKeeLsGxC0WMRaOQdPX9b7DF8Y= github.com/influxdata/influxql v1.1.1-0.20210223160523-b6ab99450c93/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 h1:vilfsDSy7TDxedi9gyBkMvAirat/oRcL0lFdJBf6tdM= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/influxdata/pkg-config v0.2.8/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk= github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= @@ -722,6 +769,11 @@ github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= +github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= +github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= +github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= +github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= +github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= @@ -729,7 +781,6 @@ github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABo github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -749,7 +800,6 @@ github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jsternberg/zap-logfmt v1.2.0/go.mod h1:kz+1CUmCutPWABnNkOu9hOHKdT2q3TDYCcsFy9hpqb0= @@ -759,9 +809,14 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= +github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= +github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= +github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= +github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kevinms/leakybucket-go v0.0.0-20200115003610-082473db97ca h1:qNtd6alRqd3qOdPrKXMZImV192ngQ0WSh1briEO33Tk= github.com/kevinms/leakybucket-go v0.0.0-20200115003610-082473db97ca/go.mod h1:ph+C5vpnCcQvKBwJwKLTK3JLNGnBXYlG7m7JjoC/zYA= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -769,12 +824,16 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= @@ -790,6 +849,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -799,12 +859,12 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= +github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -862,18 +922,20 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -883,10 +945,13 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104 h1:d8RFOZ2IiFtFWBcKEHAFYJcPTf0wY5q0exFNJZVWa1U= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.22/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= @@ -902,7 +967,9 @@ github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKo github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= github.com/mileusna/useragent v0.0.0-20190129205925-3e331f0949a5/go.mod h1:JWhYAp2EXqUtsxTKdeGlY8Wp44M7VxThC9FEoNGi2IE= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= @@ -917,8 +984,9 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -929,6 +997,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -964,8 +1033,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -973,11 +1040,14 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= @@ -989,9 +1059,12 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= @@ -999,6 +1072,8 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNiaglX6v2DM6FI0= @@ -1027,13 +1102,18 @@ github.com/pegasus-kv/thrift v0.13.0 h1:4ESwaNoHImfbHa9RUGJiJZ4hrxorihZHk5aarYwY github.com/pegasus-kv/thrift v0.13.0/go.mod h1:Gl9NT/WHG6ABm6NsrbfE8LiJN0sAyneCrvB4qN4NPqQ= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -1054,6 +1134,7 @@ github.com/prometheus/alertmanager v0.20.0/go.mod h1:9g2i48FAyZW6BtbsnvHtMHQXl2a github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= @@ -1072,6 +1153,7 @@ github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3d github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -1081,6 +1163,7 @@ github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -1088,7 +1171,6 @@ github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4 github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/prometheus v0.0.0-20200609090129-a6600f564e3c/go.mod h1:S5n0C6tSgdnwWshBUceRx5G1OsjLv/EeZ9t3wIfEtsY= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/qianlnk/pgbar v0.0.0-20210208085217-8c19b9f2477e h1:d2mxZa66Z5wS4zhRt8KiMmzIPLzZsMnYHR+uWXGz6m0= github.com/qianlnk/pgbar v0.0.0-20210208085217-8c19b9f2477e/go.mod h1:4YWkn3EVkh8c1BDlVmw+Zh2QLhs+MbAg4xy4RqcKMsA= @@ -1110,13 +1192,13 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= -github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -1124,19 +1206,23 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sanity-io/litter v1.5.1 h1:dwnrSypP6q56o3lFxTU+t2fwQ9A+U5qrXVO4Qg9KwVU= github.com/satori/go.uuid v0.0.0-20160603004225-b111a074d5ef/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0 h1:HtCSf6B4gN/87yc5qTl7WsxPKQIIGXLPPM1bMCPOsoY= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= +github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= @@ -1169,8 +1255,8 @@ github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= @@ -1190,8 +1276,9 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1199,8 +1286,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1219,13 +1306,17 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/thepudds/fzgen v0.4.2 h1:HlEHl5hk2/cqEomf2uK5SA/FeJc12s/vIHmOG+FbACw= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= @@ -1236,9 +1327,9 @@ github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITn github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/uber-go/tally v3.3.15+incompatible h1:9hLSgNBP28CjIaDmAuRTq9qV+UZY+9PcvAkXO4nNMwg= github.com/uber-go/tally v3.3.15+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU= github.com/uber/athenadriver v1.1.4 h1:k6k0RBeXjR7oZ8NO557MsRw3eX1cc/9B0GNx+W9eHiQ= @@ -1249,19 +1340,24 @@ github.com/uber/jaeger-client-go v2.28.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMW github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= +github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= @@ -1273,15 +1369,28 @@ github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPyS github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6 h1:YdYsPAZ2pC6Tow/nPZOPQ96O3hm/ToAkGsPLzedXERk= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= @@ -1301,10 +1410,23 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 h1:0dly5et1i/6Th3WHn0M6kYiJfFNzhhxanrJ0bOfnjEo= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0/go.mod h1:+Lq4/WkdCkjbGcBMVHHg2apTbv8oMBf29QCnyCCJjNQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 h1:eyJ6njZmH16h9dOKCi7lMswAnGsSOwgTqWzfxqcuNr8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0/go.mod h1:FnDp7XemjN3oZ3xGunnfOUTVwd2XcvLbtRAuOSU3oc8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0/go.mod h1:pILgiTEtrqvZpoiuGdblDgS5dbIaTgDrkIuKfEFkt+A= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.0 h1:v29I/NbVp7LXQYMFZhU6q17D0jSEbYOAVONlrO1oH5s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.0/go.mod h1:/RpLsmbQLDO1XCbWAM4S6TSwj8FKwwgyKKyqtvVfAnw= +go.opentelemetry.io/otel/sdk v1.11.0 h1:ZnKIL9V9Ztaq+ME43IUi/eo22mNsb6a7tGfzaOWB5fo= +go.opentelemetry.io/otel/sdk v1.11.0/go.mod h1:REusa8RsyKaq0OlyangWXaw97t2VogoO4SSEeKkSTAk= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1316,7 +1438,9 @@ go.uber.org/dig v1.16.1/go.mod h1:557JTAUZT5bUK0SvCwikmLPPtdQhfvLYtO5tJgQSbnk= go.uber.org/fx v1.19.2 h1:SyFgYQFr1Wl0AYstE8vyYIzP4bFz2URrScjwC4cwUvY= go.uber.org/fx v1.19.2/go.mod h1:43G1VcqSzbIv77y00p1DRAsyZS8WdzuYdhZXmEUkMyQ= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= +go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= @@ -1354,12 +1478,12 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1370,6 +1494,7 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1400,8 +1525,8 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -1431,9 +1556,11 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1461,16 +1588,17 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1480,7 +1608,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1530,6 +1659,7 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1558,43 +1688,50 @@ golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1603,8 +1740,8 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1612,6 +1749,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1619,6 +1757,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -1672,9 +1811,10 @@ golang.org/x/tools v0.0.0-20200721032237-77f530d86f9a/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= @@ -1682,6 +1822,7 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= @@ -1712,8 +1853,9 @@ google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= +google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1723,6 +1865,7 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -1761,8 +1904,12 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -1787,8 +1934,11 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1801,6 +1951,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1815,21 +1966,22 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify/fsnotify.v1 v1.4.7/go.mod h1:Fyux9zXlo4rWoMSIzpn9fDAYjalPqJ/K1qJ27s+7ltE= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/go-playground/webhooks.v5 v5.2.0 h1:HW1FxS+xpgXMkGW2+8+ZXhEK+REQtw66SF2pPDALxbQ= gopkg.in/go-playground/webhooks.v5 v5.2.0/go.mod h1:LZbya/qLVdbqDR1aKrGuWV6qbia2zCYSR5dpom2SInQ= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= -gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1842,11 +1994,11 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1856,7 +2008,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= k8s.io/api v0.17.5/go.mod h1:0zV5/ungglgy2Rlm3QK8fbxkXVs+BSJWpJP/+8gUVLY= k8s.io/apimachinery v0.0.0-20191123233150-4c4803ed55e3/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.17.5 h1:QAjfgeTtSGksdkgyaPrIb4lhU16FWMIzxKejYD5S0gc= From decac75472c92d05535ccbcfc84b7f31e50529a7 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:49:23 +0800 Subject: [PATCH 05/85] update snowman engine --- system/consensus/snowman/transitive.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/system/consensus/snowman/transitive.go b/system/consensus/snowman/transitive.go index 8d03b8ef4..20c38529d 100644 --- a/system/consensus/snowman/transitive.go +++ b/system/consensus/snowman/transitive.go @@ -5,6 +5,7 @@ package snowman import ( + "context" "github.com/33cn/chain33/types" "go.uber.org/zap" @@ -20,6 +21,7 @@ import ( //"github.com/ava-labs/avalanchego/version" ) +// New new snow engine func New(config Config) (*Transitive, error) { return newTransitive(config) } @@ -89,6 +91,7 @@ func newTransitive(config Config) (*Transitive, error) { return t, t.metrics.Initialize("", config.registerer) } +// Put put block func (t *Transitive) Put(nodeID ids.NodeID, block *types.Block) error { sb := newSnowBlock(block, t.chainCfg) @@ -108,7 +111,8 @@ func (t *Transitive) Put(nodeID ids.NodeID, block *types.Block) error { return t.buildBlocks() } -func (t *Transitive) GetFailed(nodeID ids.NodeID, requestID uint32) error { +// GetFailed get failed +func (t *Transitive) GetFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error { // We don't assume that this function is called after a failed Get message. // Check to see if we have an outstanding request and also get what the request was for if it exists. blkID, ok := t.blkReqs.Remove(nodeID, requestID) @@ -121,13 +125,13 @@ func (t *Transitive) GetFailed(nodeID ids.NodeID, requestID uint32) error { } // Because the get request was dropped, we no longer expect blkID to be issued. - t.blocked.Abandon(blkID) + t.blocked.Abandon(ctx, blkID) t.metrics.numBlockers.Set(float64(t.blocked.Len())) return t.buildBlocks() } -func (t *Transitive) PullQuery(nodeID ids.NodeID, requestID uint32, blkID ids.ID) error { - // TODO: once everyone supports ChitsV2 - we should be sending that message +// handlePullQuery handle pull query from nodeID +func (t *Transitive) handlePullQuery(nodeID ids.NodeID, requestID uint32, blkID ids.ID) error { // type here. t.sendChits(nodeID, requestID, []ids.ID{t.consensus.Preference()}) @@ -140,7 +144,8 @@ func (t *Transitive) PullQuery(nodeID ids.NodeID, requestID uint32, blkID ids.ID return t.buildBlocks() } -func (t *Transitive) PushQuery(nodeID ids.NodeID, requestID uint32, block *types.Block) error { +// handlePushQuery handle push query from other node +func (t *Transitive) handlePushQuery(nodeID ids.NodeID, requestID uint32, block *types.Block) error { // TODO: once everyone supports ChitsV2 - we should be sending that message // type here. t.sendChits(nodeID, requestID, []ids.ID{t.consensus.Preference()}) @@ -163,7 +168,8 @@ func (t *Transitive) PushQuery(nodeID ids.NodeID, requestID uint32, block *types return t.buildBlocks() } -func (t *Transitive) Chits(nodeID ids.NodeID, requestID uint32, votes []ids.ID) error { +// handleChits handle chits +func (t *Transitive) handleChits(nodeID ids.NodeID, requestID uint32, votes []ids.ID) error { // Since this is a linear chain, there should only be one ID in the vote set if len(votes) != 1 { t.log.Debug("failing Chits", From fe776d22afcd256c1a271035f50102805c16e6e9 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:32:14 +0800 Subject: [PATCH 06/85] add snow config construct --- system/consensus/snowman/config.go | 43 ++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index b1e0aaeea..40e375d8b 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -8,11 +8,13 @@ import ( "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/avalanchego/snow/consensus/snowball" - "github.com/ava-labs/avalanchego/snow/consensus/snowman" + smcon "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/common" + smeng "github.com/ava-labs/avalanchego/snow/engine/snowman" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/utils/logging" "github.com/prometheus/client_golang/prometheus" + "gopkg.in/natefinch/lumberjack.v2" ) // Config wraps all the parameters needed for a snowman engine @@ -29,5 +31,42 @@ type Config struct { //Sender common.Sender validators validators.Set params snowball.Parameters - consensus snowman.Consensus + consensus smcon.Consensus +} + +func newSnowmanConfig(vm *chain33VM, params snowball.Parameters, ctx *snow.ConsensusContext) smeng.Config { + + engineConfig := smeng.Config{ + Ctx: ctx, + VM: vm, + Validators: newVdrSet(), + Params: params, + Consensus: &smcon.Topological{}, + PartialSync: false, + Sender: newMsgSender(ctx), + } + + return engineConfig +} + +func newSnowContext(cfg *types.Chain33Config) *snow.ConsensusContext { + + ctx := snow.DefaultConsensusContextTest() + + // TODO use chain33 log writer + logCfg := cfg.GetModuleConfig().Log + + logger := &lumberjack.Logger{ + Filename: logCfg.LogFile, + MaxSize: int(logCfg.MaxFileSize), + MaxBackups: int(logCfg.MaxBackups), + MaxAge: int(logCfg.MaxAge), + LocalTime: logCfg.LocalTime, + Compress: logCfg.Compress, + } + + fileCore := logging.NewWrappedCore(logging.Debug, logger, logging.Colors.FileEncoder()) + ctx.Context.Log = logging.NewLogger("", fileCore) + + return ctx } From 38ab01d7778b2c00f7c178d66479df8b40caf4bf Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:33:26 +0800 Subject: [PATCH 07/85] add blank blockchain vm --- system/consensus/snowman/blankvm.go | 119 ++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 system/consensus/snowman/blankvm.go diff --git a/system/consensus/snowman/blankvm.go b/system/consensus/snowman/blankvm.go new file mode 100644 index 000000000..c6112c127 --- /dev/null +++ b/system/consensus/snowman/blankvm.go @@ -0,0 +1,119 @@ +package snowman + +import ( + "context" + "time" + + "github.com/ava-labs/avalanchego/api/health" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/ava-labs/avalanchego/snow/validators" + "github.com/ava-labs/avalanchego/version" + "github.com/ava-labs/avalanchego/vms/platformvm/txs" +) + +var ( + _ common.AppHandler = (*blankVM)(nil) + _ health.Checker = (*blankVM)(nil) + _ validators.Connector = (*blankVM)(nil) +) + +type blankVM struct { + //ctx *snow.Context +} + +// CrossChainAppRequestFailed blank +func (*blankVM) CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error { + recordUnimplementedError("CrossChainAppRequestFailed") + return nil +} + +// CrossChainAppRequest blank +func (*blankVM) CrossChainAppRequest(context.Context, ids.ID, uint32, time.Time, []byte) error { + recordUnimplementedError("CrossChainAppRequest") + return nil +} + +// CrossChainAppResponse blank +func (*blankVM) CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error { + recordUnimplementedError("CrossChainAppResponse") + return nil +} + +// AppRequestFailed blank +func (*blankVM) AppRequestFailed(context.Context, ids.NodeID, uint32) error { + // This VM currently only supports gossiping of txs, so there are no + // requests. + recordUnimplementedError("AppRequestFailed") + return nil +} + +// AppRequest blank +func (*blankVM) AppRequest(context.Context, ids.NodeID, uint32, time.Time, []byte) error { + // This VM currently only supports gossiping of txs, so there are no + // requests. + recordUnimplementedError("AppRequest") + return nil +} + +// AppResponse blank +func (*blankVM) AppResponse(context.Context, ids.NodeID, uint32, []byte) error { + // This VM currently only supports gossiping of txs, so there are no + // requests. + recordUnimplementedError("AppResponse") + return nil +} + +// AppGossip blank +func (*blankVM) AppGossip(_ context.Context, nodeID ids.NodeID, msgBytes []byte) error { + recordUnimplementedError("AppGossip") + return nil +} + +// GossipTx blank +func (*blankVM) GossipTx(tx *txs.Tx) error { + + recordUnimplementedError("GossipTx") + return nil +} + +// HealthCheck health check +func (*blankVM) HealthCheck(ctx context.Context) (interface{}, error) { + recordUnimplementedError("HealthCheck") + return nil, nil +} + +// Connected notify connected +func (*blankVM) Connected(_ context.Context, nodeID ids.NodeID, _ *version.Application) error { + recordUnimplementedError("Connected") + return nil +} + +// Disconnected notify disconnected +func (*blankVM) Disconnected(_ context.Context, nodeID ids.NodeID) error { + recordUnimplementedError("Disconnected") + return nil +} + +// CreateHandlers makes new http handlers that can handle API calls +func (*blankVM) CreateHandlers(context.Context) (map[string]*common.HTTPHandler, error) { + recordUnimplementedError("CreateHandlers") + return nil, nil +} + +// CreateStaticHandlers makes new http handlers that can handle API calls +func (*blankVM) CreateStaticHandlers(context.Context) (map[string]*common.HTTPHandler, error) { + recordUnimplementedError("CreateStaticHandlers") + return nil, nil +} + +// Version returns the version of the VM. +func (*blankVM) Version(context.Context) (string, error) { + return "blank-version", nil +} + +func recordUnimplementedError(funcName string) { + + log.Error("Call unimplemented function", "func", funcName) + panic("") +} From 7fcc2a0f7f538ad8c8a3e8618ccde2daf5800f53 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:37:01 +0800 Subject: [PATCH 08/85] add snowman finalizer --- system/consensus/snowman/finalize.go | 45 +++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/finalize.go index 6c2afcbd8..51dd41822 100644 --- a/system/consensus/snowman/finalize.go +++ b/system/consensus/snowman/finalize.go @@ -7,15 +7,58 @@ package snowman import ( "github.com/33cn/chain33/common/log/log15" + "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" + "github.com/ava-labs/avalanchego/snow/consensus/snowball" + + smeng "github.com/ava-labs/avalanchego/snow/engine/snowman" ) var ( log = log15.New("module", "snowman") + + _ consensus.Finalizer = (*snowman)(nil) ) func init() { - consensus.RegFinalizer("snowman", &Transitive{}) + consensus.RegFinalizer("snowman", &snowman{}) + +} + +type snowman struct { + engine smeng.Engine + ctx *consensus.Context +} + +func (s *snowman) Initialize(ctx *consensus.Context) error { + + params := snowball.Parameters{} + engineConfig := newSnowmanConfig(&chain33VM{}, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) + + engine, err := smeng.New(engineConfig) + + if err != nil { + panic("Initialize snowman engine err:" + err.Error()) + } + s.engine = engine + + return nil + +} + +func (s *snowman) Start() error { + + err := s.engine.Start(s.ctx.Base.Context, 0) + + if err != nil { + + return err + } + return nil + +} +func (s *snowman) ProcessMsg(msg *queue.Message) (processed bool) { + return false } From e2e00a6f36e0e07b5472a748ac1f8af8745fcf08 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 17 Nov 2023 18:07:48 +0800 Subject: [PATCH 09/85] add chain33 vm implementing snowman.ChainVM interface --- system/consensus/snowman/blankvm.go | 2 +- system/consensus/snowman/block.go | 23 ++-- system/consensus/snowman/vm.go | 156 ++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+), 15 deletions(-) create mode 100644 system/consensus/snowman/vm.go diff --git a/system/consensus/snowman/blankvm.go b/system/consensus/snowman/blankvm.go index c6112c127..46b37c2ee 100644 --- a/system/consensus/snowman/blankvm.go +++ b/system/consensus/snowman/blankvm.go @@ -114,6 +114,6 @@ func (*blankVM) Version(context.Context) (string, error) { func recordUnimplementedError(funcName string) { - log.Error("Call unimplemented function", "func", funcName) + snowLog.Error("Call unimplemented function", "func", funcName) panic("") } diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index 0541eb979..fe09091f0 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -1,13 +1,13 @@ package snowman import ( + "context" "fmt" "time" "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/choices" - "github.com/ava-labs/avalanchego/snow/consensus/snowman" ) // wrap chain33 block for implementing the snowman.Block interface @@ -15,31 +15,26 @@ type snowBlock struct { id ids.ID block *types.Block status choices.Status -} - -func newSnowBlock(blk *types.Block, cfg *types.Chain33Config) snowman.Block { - - sb := &snowBlock{block: blk} - copy(sb.id[:], blk.Hash(cfg)) - return sb + vm *chain33VM } // ID implements the snowman.Block interface func (b *snowBlock) ID() ids.ID { return b.id } // Accept implements the snowman.Block interface -func (b *snowBlock) Accept() error { +func (b *snowBlock) Accept(ctx context.Context) error { b.status = choices.Accepted - log.Debug(fmt.Sprintf("Accepting block %s at height %d", b.ID().Hex(), b.Height())) + snowLog.Debug(fmt.Sprintf("Accepting block %s at height %d", b.ID().Hex(), b.Height())) // TODO accept block return nil } // Reject implements the snowman.Block interface -func (b *snowBlock) Reject() error { +// This element will not be accepted by any correct node in the network. +func (b *snowBlock) Reject(ctx context.Context) error { b.status = choices.Rejected - log.Debug(fmt.Sprintf("Rejecting block %s at height %d", b.ID().Hex(), b.Height())) + snowLog.Debug(fmt.Sprintf("Rejecting block %s at height %d", b.ID().Hex(), b.Height())) // TODO reject block return nil } @@ -71,9 +66,9 @@ func (b *snowBlock) Timestamp() time.Time { } // Verify implements the snowman.Block interface -func (b *snowBlock) Verify() error { +func (b *snowBlock) Verify(ctx context.Context) error { - log.Debug(fmt.Sprintf("Verify block %s at height %d", b.ID().Hex(), b.Height())) + snowLog.Debug(fmt.Sprintf("Verify block %s at height %d", b.ID().Hex(), b.Height())) // TODO verify block return nil } diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go new file mode 100644 index 000000000..6cc502935 --- /dev/null +++ b/system/consensus/snowman/vm.go @@ -0,0 +1,156 @@ +package snowman + +import ( + "github.com/33cn/chain33/client" + "github.com/33cn/chain33/system/consensus" + "github.com/33cn/chain33/types" + "github.com/ava-labs/avalanchego/database" + "github.com/ava-labs/avalanchego/database/manager" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow" + snowcon "github.com/ava-labs/avalanchego/snow/consensus/snowman" + "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/ava-labs/avalanchego/snow/engine/snowman/block" + + "context" +) + +var ( + _ common.VM = (*chain33VM)(nil) + _ block.ChainVM = (*chain33VM)(nil) +) + +// implements the snowman.ChainVM interface +type chain33VM struct { + blankVM + api client.QueueProtocolAPI + cfg *types.Chain33Config +} + +func (vm *chain33VM) newSnowBlock(blk *types.Block) snowcon.Block { + + sb := &snowBlock{block: blk, vm: vm} + copy(sb.id[:], blk.Hash(vm.cfg)) + return sb +} + +// Init init chain33 vm +func (vm *chain33VM) Init(ctx *consensus.Context) { + + vm.api = ctx.Base.GetAPI() + vm.cfg = vm.api.GetConfig() +} + +// Initialize implements the snowman.ChainVM interface +func (vm *chain33VM) Initialize( + _ context.Context, + chainCtx *snow.Context, + dbManager manager.Manager, + genesisBytes []byte, + upgradeBytes []byte, + configBytes []byte, + toEngine chan<- common.Message, + fxs []*common.Fx, + appSender common.AppSender, +) error { + + return nil + +} + +// SetState communicates to VM its next state it starts +func (vm *chain33VM) SetState(ctx context.Context, state snow.State) error { + + return nil +} + +// Shutdown is called when the node is shutting down. +func (vm *chain33VM) Shutdown(context.Context) error { + + return nil +} + +// GetBlock get block +func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, error) { + + details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) + if err != nil || details.GetItems()[0].GetBlock() == nil { + snowLog.Error("GetBlock", "GetBlockByHashes err", err) + return nil, database.ErrNotFound + } + + return vm.newSnowBlock(details.GetItems()[0].GetBlock()), nil +} + +// ParseBlock parse block +func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, error) { + + blk := &types.Block{} + err := types.Decode(b, blk) + if err != nil { + snowLog.Error("ParseBlock", "decode err", err) + return nil, err + } + + return vm.newSnowBlock(blk), nil +} + +// BuildBlock Attempt to create a new block from data contained in the VM. +// +// If the VM doesn't want to issue a new block, an error should be +// returned. +func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { + + // TODO new block + return nil, nil +} + +// SetPreference Notify the VM of the currently preferred block. +// +// This should always be a block that has no children known to consensus. +func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { + + return nil +} + +// LastAccepted returns the ID of the last accepted block. +// +// If no blocks have been accepted by consensus yet, it is assumed there is +// a definitionally accepted block, the Genesis block, that will be +// returned. +func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { + + return ids.Empty, nil +} + +// VerifyHeightIndex should return: +// - nil if the height index is available. +// - ErrIndexIncomplete if the height index is not currently available. +// - Any other non-standard error that may have occurred when verifying the +// index. +// +// TODO: Remove after v1.11.x activates. +func (vm *chain33VM) VerifyHeightIndex(context.Context) error { + return nil +} + +// GetBlockIDAtHeight returns: +// - The ID of the block that was accepted with [height]. +// - database.ErrNotFound if the [height] index is unknown. +// +// Note: A returned value of [database.ErrNotFound] typically means that the +// +// underlying VM was state synced and does not have access to the +// blockID at [height]. +func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error) { + + reply, err := vm.api.GetBlockHash(&types.ReqInt{Height: int64(height)}) + if err != nil { + snowLog.Error("GetBlock", "height", height, "GetBlockHash err", err) + return ids.Empty, database.ErrNotFound + } + var id ids.ID + copy(id[:], reply.Hash) + + return id, nil +} From fda0955f4822a5360e87c752b61c99c2425837b8 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:40:59 +0800 Subject: [PATCH 10/85] add validator set wrapper --- system/consensus/snowman/validators.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 system/consensus/snowman/validators.go diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go new file mode 100644 index 000000000..408d0d6e3 --- /dev/null +++ b/system/consensus/snowman/validators.go @@ -0,0 +1,24 @@ +package snowman + +import ( + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow/validators" +) + +type vdrSet struct { + validators.Set +} + +func newVdrSet() *vdrSet { + + s := &vdrSet{} + s.Set = validators.NewSet() + return s +} + +// Sample returns a collection of validatorIDs, potentially with duplicates. +// If sampling the requested size isn't possible, an error will be returned. +func (*vdrSet) Sample(size int) ([]ids.NodeID, error) { + + return nil, nil +} From 29a1a269911d531b35239941f1e49cdfec59e441 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:58:30 +0800 Subject: [PATCH 11/85] add consensus finalizer initialize, message subcrible --- system/consensus/base.go | 104 +++++++++++++++------------ system/consensus/consensus.go | 8 +-- system/consensus/finalize.go | 7 +- system/consensus/snowman/finalize.go | 57 +++++++++++++-- 4 files changed, 116 insertions(+), 60 deletions(-) diff --git a/system/consensus/base.go b/system/consensus/base.go index 06f3d7f9f..69193fd37 100644 --- a/system/consensus/base.go +++ b/system/consensus/base.go @@ -36,7 +36,7 @@ func init() { QueryData.Register("base", &BaseClient{}) } -//Miner 矿工 +// Miner 矿工 type Miner interface { CreateGenesisTx() []*types.Transaction GetGenesisBlockTime() int64 @@ -48,7 +48,7 @@ type Miner interface { GetBaseClient() *BaseClient } -//BaseClient ... +// BaseClient ... type BaseClient struct { client queue.Client api client.QueueProtocolAPI @@ -67,7 +67,7 @@ type BaseClient struct { Cancel context.CancelFunc } -//NewBaseClient ... +// NewBaseClient ... func NewBaseClient(cfg *types.Consensus) *BaseClient { var flag int32 if cfg.Minerstart { @@ -80,12 +80,12 @@ func NewBaseClient(cfg *types.Consensus) *BaseClient { return client } -//GetGenesisBlockTime 获取创世区块时间 +// GetGenesisBlockTime 获取创世区块时间 func (bc *BaseClient) GetGenesisBlockTime() int64 { return bc.Cfg.GenesisBlockTime } -//SetChild ... +// SetChild ... func (bc *BaseClient) SetChild(c Miner) { bc.child = c } @@ -100,22 +100,22 @@ func (bc *BaseClient) GetBaseClient() *BaseClient { return bc } -//GetAPI 获取api +// GetAPI 获取api func (bc *BaseClient) GetAPI() client.QueueProtocolAPI { return bc.api } -//SetAPI ... +// SetAPI ... func (bc *BaseClient) SetAPI(api client.QueueProtocolAPI) { bc.api = api } -//AddBlock 添加区块的时候,通知系统做处理 +// AddBlock 添加区块的时候,通知系统做处理 func (bc *BaseClient) AddBlock(b *types.Block) error { return nil } -//InitClient 初始化 +// InitClient 初始化 func (bc *BaseClient) InitClient(c queue.Client, minerstartCB func()) { log.Info("Enter SetQueueClient method of consensus") bc.client = c @@ -125,25 +125,34 @@ func (bc *BaseClient) InitClient(c queue.Client, minerstartCB func()) { if err != nil { panic(err) } + bc.initFinalizer() bc.InitStateCommitter() bc.InitMiner() } -//GetQueueClient 获取客户端队列 +// GetQueueClient 获取客户端队列 func (bc *BaseClient) GetQueueClient() queue.Client { return bc.client } -//RandInt64 随机数 +// RandInt64 随机数 func (bc *BaseClient) RandInt64() int64 { return randgen.Int63() } -//InitMiner 初始化矿工 +// InitMiner 初始化矿工 func (bc *BaseClient) InitMiner() { bc.once.Do(bc.minerstartCB) } +func (bc *BaseClient) initFinalizer() { + + f := LoadFinalizer(bc.Cfg.Finalizer) + if f != nil { + f.Initialize(&Context{Base: bc}) + } +} + // InitStateCommitter init committer func (bc *BaseClient) InitStateCommitter() { @@ -157,10 +166,10 @@ func (bc *BaseClient) InitStateCommitter() { } } -//Wait wait for ready +// Wait wait for ready func (bc *BaseClient) Wait() {} -//SetQueueClient 设置客户端队列 +// SetQueueClient 设置客户端队列 func (bc *BaseClient) SetQueueClient(c queue.Client) { bc.InitClient(c, func() { //call init block @@ -170,7 +179,7 @@ func (bc *BaseClient) SetQueueClient(c queue.Client) { go bc.child.CreateBlock() } -//InitBlock change init block +// InitBlock change init block func (bc *BaseClient) InitBlock() { cfg := bc.client.GetConfig() block, err := bc.RequestLastBlock() @@ -200,7 +209,7 @@ func (bc *BaseClient) InitBlock() { } } -//Close 关闭 +// Close 关闭 func (bc *BaseClient) Close() { atomic.StoreInt32(&bc.minerStart, 0) atomic.StoreInt32(&bc.isclosed, 1) @@ -209,12 +218,12 @@ func (bc *BaseClient) Close() { log.Info("consensus base closed") } -//IsClosed 是否已经关闭 +// IsClosed 是否已经关闭 func (bc *BaseClient) IsClosed() bool { return atomic.LoadInt32(&bc.isclosed) == 1 } -//CheckTxDup 为了不引起交易检查时候产生的无序 +// CheckTxDup 为了不引起交易检查时候产生的无序 func (bc *BaseClient) CheckTxDup(txs []*types.Transaction) (transactions []*types.Transaction) { cacheTxs := types.TxsToCache(txs) var err error @@ -225,12 +234,12 @@ func (bc *BaseClient) CheckTxDup(txs []*types.Transaction) (transactions []*type return types.CacheToTxs(cacheTxs) } -//IsMining 是否在挖矿 +// IsMining 是否在挖矿 func (bc *BaseClient) IsMining() bool { return atomic.LoadInt32(&bc.minerStart) == 1 } -//IsCaughtUp 是否追上最新高度 +// IsCaughtUp 是否追上最新高度 func (bc *BaseClient) IsCaughtUp() bool { if bc.client == nil { panic("bc not bind message queue.") @@ -247,7 +256,7 @@ func (bc *BaseClient) IsCaughtUp() bool { return resp.GetData().(*types.IsCaughtUp).GetIscaughtup() } -//ExecConsensus 执行共识 +// ExecConsensus 执行共识 func (bc *BaseClient) ExecConsensus(data *types.ChainExecutor) (types.Message, error) { param, err := QueryData.Decode(data.Driver, data.FuncName, data.Param) if err != nil { @@ -258,17 +267,13 @@ func (bc *BaseClient) ExecConsensus(data *types.ChainExecutor) (types.Message, e func (bc *BaseClient) pubToSubModule(msg *queue.Message) { - if bc.finalizer != nil && bc.finalizer.ProcessMsg(msg) { - return - } - bc.child.ProcEvent(msg) if bc.committer != nil { bc.committer.SubMsg(msg) } } -//EventLoop 准备新区块 +// EventLoop 准备新区块 func (bc *BaseClient) EventLoop() { // 监听blockchain模块,获取当前最高区块 bc.client.Sub("consensus") @@ -292,6 +297,9 @@ func (bc *BaseClient) EventLoop() { block := msg.GetData().(*types.BlockDetail).Block bc.SetCurrentBlock(block) bc.child.AddBlock(block) + if bc.finalizer != nil { + bc.finalizer.AddBlock(block) + } } else if msg.Ty == types.EventCheckBlock { block := msg.GetData().(*types.BlockDetail) err := bc.CheckBlock(block) @@ -317,6 +325,10 @@ func (bc *BaseClient) EventLoop() { cmpBlock := msg.GetData().(*types.CmpBlock) reply.IsOk = bc.CmpBestBlock(cmpBlock.Block, cmpBlock.CmpHash) msg.Reply(bc.api.NewMessage("", 0, &reply)) + } else if msg.Ty == types.EventForFinalizer && bc.finalizer != nil { + + bc.finalizer.SubMsg(msg) + } else { bc.pubToSubModule(msg) } @@ -324,7 +336,7 @@ func (bc *BaseClient) EventLoop() { }() } -//CheckBlock 检查区块 +// CheckBlock 检查区块 func (bc *BaseClient) CheckBlock(block *types.BlockDetail) error { //check parent if block.Block.Height <= 0 { //genesis block not check @@ -361,7 +373,7 @@ func (bc *BaseClient) CheckBlock(block *types.BlockDetail) error { return err } -//RequestTx Mempool中取交易列表 +// RequestTx Mempool中取交易列表 func (bc *BaseClient) RequestTx(listSize int, txHashList [][]byte) []*types.Transaction { if bc.client == nil { panic("bc not bind message queue.") @@ -378,7 +390,7 @@ func (bc *BaseClient) RequestTx(listSize int, txHashList [][]byte) []*types.Tran return resp.GetData().(*types.ReplyTxList).GetTxs() } -//RequestBlock 请求区块 +// RequestBlock 请求区块 func (bc *BaseClient) RequestBlock(start int64) (*types.Block, error) { if bc.client == nil { panic("bc not bind message queue.") @@ -397,7 +409,7 @@ func (bc *BaseClient) RequestBlock(start int64) (*types.Block, error) { return blocks.Items[0].Block, nil } -//RequestLastBlock 获取最新的block从blockchain模块 +// RequestLastBlock 获取最新的block从blockchain模块 func (bc *BaseClient) RequestLastBlock() (*types.Block, error) { if bc.client == nil { panic("client not bind message queue.") @@ -415,7 +427,7 @@ func (bc *BaseClient) RequestLastBlock() (*types.Block, error) { return block, nil } -//del mempool +// del mempool func (bc *BaseClient) delMempoolTx(deltx []*types.Transaction) error { hashList := buildHashList(deltx) msg := bc.client.NewMessage("mempool", types.EventDelTxList, hashList) @@ -441,7 +453,7 @@ func buildHashList(deltx []*types.Transaction) *types.TxHashList { return list } -//WriteBlock 向blockchain写区块 +// WriteBlock 向blockchain写区块 func (bc *BaseClient) WriteBlock(prev []byte, block *types.Block) error { //保存block的原始信息用于删除mempool中的错误交易 rawtxs := make([]*types.Transaction, len(block.Txs)) @@ -516,14 +528,14 @@ func diffTx(tx1, tx2 []*types.Transaction) (deltx []*types.Transaction) { return deltx } -//SetCurrentBlock 设置当前区块 +// SetCurrentBlock 设置当前区块 func (bc *BaseClient) SetCurrentBlock(b *types.Block) { bc.mulock.Lock() bc.currentBlock = b bc.mulock.Unlock() } -//UpdateCurrentBlock 更新当前区块 +// UpdateCurrentBlock 更新当前区块 func (bc *BaseClient) UpdateCurrentBlock(b *types.Block) { bc.mulock.Lock() defer bc.mulock.Unlock() @@ -535,14 +547,14 @@ func (bc *BaseClient) UpdateCurrentBlock(b *types.Block) { bc.currentBlock = block } -//GetCurrentBlock 获取当前区块 +// GetCurrentBlock 获取当前区块 func (bc *BaseClient) GetCurrentBlock() (b *types.Block) { bc.mulock.Lock() defer bc.mulock.Unlock() return bc.currentBlock } -//GetCurrentHeight 获取当前高度 +// GetCurrentHeight 获取当前高度 func (bc *BaseClient) GetCurrentHeight() int64 { bc.mulock.Lock() start := bc.currentBlock.Height @@ -550,17 +562,17 @@ func (bc *BaseClient) GetCurrentHeight() int64 { return start } -//Lock 上锁 +// Lock 上锁 func (bc *BaseClient) Lock() { bc.mulock.Lock() } -//Unlock 解锁 +// Unlock 解锁 func (bc *BaseClient) Unlock() { bc.mulock.Unlock() } -//ConsensusTicketMiner ... +// ConsensusTicketMiner ... func (bc *BaseClient) ConsensusTicketMiner(iscaughtup *types.IsCaughtUp) { if !atomic.CompareAndSwapInt32(&bc.isCaughtUp, 0, 1) { log.Info("ConsensusTicketMiner", "isCaughtUp", bc.isCaughtUp) @@ -569,7 +581,7 @@ func (bc *BaseClient) ConsensusTicketMiner(iscaughtup *types.IsCaughtUp) { } } -//AddTxsToBlock 添加交易到区块中 +// AddTxsToBlock 添加交易到区块中 func (bc *BaseClient) AddTxsToBlock(block *types.Block, txs []*types.Transaction) []*types.Transaction { size := block.Size() max := types.MaxBlockSize - 100000 //留下100K空间,添加其他的交易 @@ -612,7 +624,7 @@ func (bc *BaseClient) AddTxsToBlock(block *types.Block, txs []*types.Transaction return addedTx } -//CheckTxExpire 此时的tx交易组都是展开的,过滤掉已经过期的tx交易,目前只有ticket共识需要在updateBlock时调用 +// CheckTxExpire 此时的tx交易组都是展开的,过滤掉已经过期的tx交易,目前只有ticket共识需要在updateBlock时调用 func (bc *BaseClient) CheckTxExpire(txs []*types.Transaction, height int64, blocktime int64) (transactions []*types.Transaction) { var txlist types.Transactions var hasTxExpire bool @@ -659,7 +671,7 @@ func (bc *BaseClient) CheckTxExpire(txs []*types.Transaction, height int64, bloc return txs } -//检测交易数组是否过期,只要有一个过期就认为整个交易组过期 +// 检测交易数组是否过期,只要有一个过期就认为整个交易组过期 func isExpire(cfg *types.Chain33Config, txs []*types.Transaction, height int64, blocktime int64) bool { for _, tx := range txs { if height > 0 && blocktime > 0 && tx.IsExpire(cfg, height, blocktime) { @@ -670,9 +682,9 @@ func isExpire(cfg *types.Chain33Config, txs []*types.Transaction, height int64, return false } -//CmpBestBlock 最优区块的比较 -//height,BlockTime,ParentHash必须一致才可以继续比较 -//通过比较newBlock是最优区块就返回true,否则返回false +// CmpBestBlock 最优区块的比较 +// height,BlockTime,ParentHash必须一致才可以继续比较 +// 通过比较newBlock是最优区块就返回true,否则返回false func (bc *BaseClient) CmpBestBlock(newBlock *types.Block, cmpHash []byte) bool { cfg := bc.client.GetConfig() @@ -698,7 +710,7 @@ func (bc *BaseClient) CmpBestBlock(newBlock *types.Block, cmpHash []byte) bool { return false } -//ReqBlockByHash 通过区块hash获取区块信息 +// ReqBlockByHash 通过区块hash获取区块信息 func (bc *BaseClient) ReqBlockByHash(hash []byte) (*types.Block, error) { if bc.client == nil { panic("bc not bind message queue.") diff --git a/system/consensus/consensus.go b/system/consensus/consensus.go index 73550cc86..8010f736a 100644 --- a/system/consensus/consensus.go +++ b/system/consensus/consensus.go @@ -10,15 +10,15 @@ import ( "github.com/33cn/chain33/types" ) -//Create 创建共识 +// Create 创建共识 type Create func(cfg *types.Consensus, sub []byte) queue.Module var regConsensus = make(map[string]Create) -//QueryData 检索数据 +// QueryData 检索数据 var QueryData = types.NewQueryData("Query_") -//Reg ... +// Reg ... func Reg(name string, create Create) { if create == nil { panic("Consensus: Register driver is nil") @@ -29,7 +29,7 @@ func Reg(name string, create Create) { regConsensus[name] = create } -//Load 加载 +// Load 加载 func Load(name string) (create Create, err error) { if driver, ok := regConsensus[name]; ok { return driver, nil diff --git a/system/consensus/finalize.go b/system/consensus/finalize.go index 81b810c16..eac3a41c3 100644 --- a/system/consensus/finalize.go +++ b/system/consensus/finalize.go @@ -6,13 +6,14 @@ package consensus import ( "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" ) // Finalizer block finalize type Finalizer interface { - Initialize(ctx *Context) error - Start() error - ProcessMsg(msg *queue.Message) (processed bool) + Initialize(ctx *Context) + AddBlock(blk *types.Block) + SubMsg(msg *queue.Message) } var finalizers = make(map[string]Finalizer) diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/finalize.go index 51dd41822..58944fc5c 100644 --- a/system/consensus/snowman/finalize.go +++ b/system/consensus/snowman/finalize.go @@ -6,16 +6,19 @@ package snowman import ( + "runtime" + "github.com/33cn/chain33/common/log/log15" "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" + "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/snow/consensus/snowball" smeng "github.com/ava-labs/avalanchego/snow/engine/snowman" ) var ( - log = log15.New("module", "snowman") + snowLog = log15.New("module", "snowman") _ consensus.Finalizer = (*snowman)(nil) ) @@ -28,13 +31,19 @@ func init() { type snowman struct { engine smeng.Engine + vm *chain33VM ctx *consensus.Context + inMsg chan *queue.Message } -func (s *snowman) Initialize(ctx *consensus.Context) error { +func (s *snowman) Initialize(ctx *consensus.Context) { + + s.inMsg = make(chan *queue.Message, 32) params := snowball.Parameters{} - engineConfig := newSnowmanConfig(&chain33VM{}, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) + vm := &chain33VM{} + vm.Init(ctx) + engineConfig := newSnowmanConfig(vm, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) engine, err := smeng.New(engineConfig) @@ -42,8 +51,7 @@ func (s *snowman) Initialize(ctx *consensus.Context) error { panic("Initialize snowman engine err:" + err.Error()) } s.engine = engine - - return nil + s.vm = vm } @@ -55,10 +63,45 @@ func (s *snowman) Start() error { return err } + + //使用多个协程并发处理,提高效率 + concurrency := runtime.NumCPU() * 2 + for i := 0; i < concurrency; i++ { + go s.handleMsgRountine() + } return nil } -func (s *snowman) ProcessMsg(msg *queue.Message) (processed bool) { - return false +func (s *snowman) AddBlock(blk *types.Block) { + + s.vm.addNewBlock(blk) +} + +func (s *snowman) SubMsg(msg *queue.Message) { + + s.inMsg <- msg +} + +func (s *snowman) handleMsgRountine() { + + for { + + select { + + case <-s.ctx.Base.Context.Done(): + return + + case msg := <-s.inMsg: + s.handleMsg(msg) + } + + } +} + +func (s *snowman) handleMsg(msg *queue.Message) { + + switch msg.ID { + + } } From f2033cd223bb630b09df3e5655a4d3b166ae5dff Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:03:43 +0800 Subject: [PATCH 12/85] refactor snowman finalizer --- system/consensus/snowman/ancestor_tree.go | 95 --- system/consensus/snowman/block.go | 1 + system/consensus/snowman/getter.go | 16 - system/consensus/snowman/handler.go | 9 - system/consensus/snowman/issuer.go | 49 -- system/consensus/snowman/memory_block.go | 30 - system/consensus/snowman/metrics.go | 87 --- system/consensus/snowman/sender.go | 49 +- system/consensus/snowman/transitive.go | 707 ---------------------- system/consensus/snowman/vm.go | 20 + system/consensus/snowman/voter.go | 171 ------ types/cfg.go | 2 + types/event.go | 4 + 13 files changed, 71 insertions(+), 1169 deletions(-) delete mode 100644 system/consensus/snowman/ancestor_tree.go delete mode 100644 system/consensus/snowman/getter.go delete mode 100644 system/consensus/snowman/handler.go delete mode 100644 system/consensus/snowman/issuer.go delete mode 100644 system/consensus/snowman/memory_block.go delete mode 100644 system/consensus/snowman/metrics.go delete mode 100644 system/consensus/snowman/transitive.go delete mode 100644 system/consensus/snowman/voter.go diff --git a/system/consensus/snowman/ancestor_tree.go b/system/consensus/snowman/ancestor_tree.go deleted file mode 100644 index 7f411ba60..000000000 --- a/system/consensus/snowman/ancestor_tree.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright Fuzamei Corp. 2018 All Rights Reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package snowman - -import ( - "github.com/ava-labs/avalanchego/ids" -) - -type AncestorTree interface { - Add(blkID ids.ID, parentID ids.ID) - Has(blkID ids.ID) bool - GetRoot(blkID ids.ID) ids.ID - Remove(blkID ids.ID) - RemoveSubtree(blkID ids.ID) - Len() int -} - -type ancestorTree struct { - childToParent map[ids.ID]ids.ID - parentToChildren map[ids.ID]ids.Set -} - -func NewAncestorTree() AncestorTree { - return &ancestorTree{ - childToParent: make(map[ids.ID]ids.ID), - parentToChildren: make(map[ids.ID]ids.Set), - } -} - -// Add maps given blkID to given parentID -func (p *ancestorTree) Add(blkID ids.ID, parentID ids.ID) { - p.childToParent[blkID] = parentID - - children := p.parentToChildren[parentID] - children.Add(blkID) - p.parentToChildren[parentID] = children -} - -// GetRoot returns the oldest parent of blkID, might return blkID if no parent is available. -func (p *ancestorTree) GetRoot(blkID ids.ID) ids.ID { - for { - parentID, ok := p.childToParent[blkID] - // this is the furthest parent available, break loop and return blkID - if !ok { - return blkID - } - // continue to loop with parentID - blkID = parentID - } -} - -// Has returns if blkID is in the tree or not -func (p *ancestorTree) Has(blkID ids.ID) bool { - _, ok := p.childToParent[blkID] - return ok -} - -// Remove removes blkID from the tree -func (p *ancestorTree) Remove(blkID ids.ID) { - parent, ok := p.childToParent[blkID] - if !ok { - return - } - delete(p.childToParent, blkID) - - // remove blkID from children - children := p.parentToChildren[parent] - children.Remove(blkID) - // this parent has no more children, remove it from map - if children.Len() == 0 { - delete(p.parentToChildren, parent) - } -} - -// Returns tree length -func (p *ancestorTree) Len() int { - return len(p.childToParent) -} - -// RemoveSubtree removes whole subtree that blkID holds -func (p *ancestorTree) RemoveSubtree(blkID ids.ID) { - childrenList := []ids.ID{blkID} - for len(childrenList) > 0 { - newChildrenSize := len(childrenList) - 1 - childID := childrenList[newChildrenSize] - childrenList = childrenList[:newChildrenSize] - p.Remove(childID) - // get children of child - for grandChildID := range p.parentToChildren[childID] { - childrenList = append(childrenList, grandChildID) - } - } -} diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index fe09091f0..2013b698d 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -27,6 +27,7 @@ func (b *snowBlock) Accept(ctx context.Context) error { b.status = choices.Accepted snowLog.Debug(fmt.Sprintf("Accepting block %s at height %d", b.ID().Hex(), b.Height())) // TODO accept block + b.vm.acceptBlock(b.block) return nil } diff --git a/system/consensus/snowman/getter.go b/system/consensus/snowman/getter.go deleted file mode 100644 index 6ff96a7ca..000000000 --- a/system/consensus/snowman/getter.go +++ /dev/null @@ -1,16 +0,0 @@ -package snowman - -import "github.com/33cn/chain33/types" - -type getter struct { -} - -func (g *getter) getLastAcceptBlock() *types.Block { - - return nil -} - -func (g *getter) getBlock(hash []byte) (*types.Block, error) { - - return nil, nil -} diff --git a/system/consensus/snowman/handler.go b/system/consensus/snowman/handler.go deleted file mode 100644 index c15cd86e6..000000000 --- a/system/consensus/snowman/handler.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright Fuzamei Corp. 2018 All Rights Reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package snowman - -// handler 外部事件处理 -type handler struct { -} diff --git a/system/consensus/snowman/issuer.go b/system/consensus/snowman/issuer.go deleted file mode 100644 index 179177563..000000000 --- a/system/consensus/snowman/issuer.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package snowman - -import ( - "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/consensus/snowman" -) - -// issuer issues [blk] into to consensus after its dependencies are met. -type issuer struct { - t *Transitive - blk snowman.Block - abandoned bool - deps ids.Set -} - -func (i *issuer) Dependencies() ids.Set { return i.deps } - -// Mark that a dependency has been met -func (i *issuer) Fulfill(id ids.ID) { - i.deps.Remove(id) - i.Update() -} - -// Abandon the attempt to issue [i.block] -func (i *issuer) Abandon(ids.ID) { - if !i.abandoned { - blkID := i.blk.ID() - i.t.removeFromPending(i.blk) - i.t.addToNonVerifieds(i.blk) - i.t.blocked.Abandon(blkID) - - // Tracks performance statistics - i.t.metrics.numRequests.Set(float64(i.t.blkReqs.Len())) - i.t.metrics.numBlocked.Set(float64(len(i.t.pending))) - i.t.metrics.numBlockers.Set(float64(i.t.blocked.Len())) - } - i.abandoned = true -} - -func (i *issuer) Update() { - if i.abandoned || i.deps.Len() != 0 || i.t.errs.Errored() { - return - } - // Issue the block into consensus - i.t.errs.Add(i.t.deliver(i.blk)) -} diff --git a/system/consensus/snowman/memory_block.go b/system/consensus/snowman/memory_block.go deleted file mode 100644 index a71842b57..000000000 --- a/system/consensus/snowman/memory_block.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package snowman - -import ( - "github.com/ava-labs/avalanchego/snow/consensus/snowman" -) - -// memoryBlock wraps a snowman Block to manage non-verified blocks -type memoryBlock struct { - snowman.Block - - tree AncestorTree - metrics *metrics -} - -// Accept accepts the underlying block & removes sibling subtrees -func (mb *memoryBlock) Accept() error { - mb.tree.RemoveSubtree(mb.Parent()) - mb.metrics.numNonVerifieds.Set(float64(mb.tree.Len())) - return mb.Block.Accept() -} - -// Reject rejects the underlying block & removes child subtrees -func (mb *memoryBlock) Reject() error { - mb.tree.RemoveSubtree(mb.ID()) - mb.metrics.numNonVerifieds.Set(float64(mb.tree.Len())) - return mb.Block.Reject() -} diff --git a/system/consensus/snowman/metrics.go b/system/consensus/snowman/metrics.go deleted file mode 100644 index e18bac2ba..000000000 --- a/system/consensus/snowman/metrics.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package snowman - -import ( - "github.com/prometheus/client_golang/prometheus" - - "github.com/ava-labs/avalanchego/utils/metric" - "github.com/ava-labs/avalanchego/utils/wrappers" -) - -type metrics struct { - bootstrapFinished, numRequests, numBlocked, numBlockers, numNonVerifieds prometheus.Gauge - numBuilt, numBuildsFailed, numUselessPutBytes, numUselessPushQueryBytes prometheus.Counter - getAncestorsBlks metric.Averager -} - -// Initialize the metrics -func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error { - errs := wrappers.Errs{} - m.bootstrapFinished = prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: namespace, - Name: "bootstrap_finished", - Help: "Whether or not bootstrap process has completed. 1 is success, 0 is fail or ongoing.", - }) - m.numRequests = prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: namespace, - Name: "requests", - Help: "Number of outstanding block requests", - }) - m.numBlocked = prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: namespace, - Name: "blocked", - Help: "Number of blocks that are pending issuance", - }) - m.numBlockers = prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: namespace, - Name: "blockers", - Help: "Number of blocks that are blocking other blocks from being issued because they haven't been issued", - }) - m.numBuilt = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: namespace, - Name: "blks_built", - Help: "Number of blocks that have been built locally", - }) - m.numBuildsFailed = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: namespace, - Name: "blk_builds_failed", - Help: "Number of BuildBlock calls that have failed", - }) - m.numUselessPutBytes = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: namespace, - Name: "num_useless_put_bytes", - Help: "Amount of useless bytes received in Put messages", - }) - m.numUselessPushQueryBytes = prometheus.NewCounter(prometheus.CounterOpts{ - Namespace: namespace, - Name: "num_useless_push_query_bytes", - Help: "Amount of useless bytes received in PushQuery messages", - }) - m.getAncestorsBlks = metric.NewAveragerWithErrs( - namespace, - "get_ancestors_blks", - "blocks fetched in a call to GetAncestors", - reg, - &errs, - ) - m.numNonVerifieds = prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: namespace, - Name: "non_verified_blks", - Help: "Number of non-verified blocks in the memory", - }) - - errs.Add( - reg.Register(m.bootstrapFinished), - reg.Register(m.numRequests), - reg.Register(m.numBlocked), - reg.Register(m.numBlockers), - reg.Register(m.numNonVerifieds), - reg.Register(m.numBuilt), - reg.Register(m.numBuildsFailed), - reg.Register(m.numUselessPutBytes), - reg.Register(m.numUselessPushQueryBytes), - ) - return errs.Err -} diff --git a/system/consensus/snowman/sender.go b/system/consensus/snowman/sender.go index 65a57f3ba..de86fa1e2 100644 --- a/system/consensus/snowman/sender.go +++ b/system/consensus/snowman/sender.go @@ -4,20 +4,59 @@ package snowman -import "github.com/ava-labs/avalanchego/ids" +import ( + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/proto/pb/p2p" + "github.com/ava-labs/avalanchego/snow" + "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/ava-labs/avalanchego/snow/networking/sender" + "github.com/ava-labs/avalanchego/utils/set" + + "context" +) // 向外部模块发送请求, blockchain/p2p等 -type sender struct { +type msgSender struct { + common.Sender +} + +func newMsgSender(ctx *snow.ConsensusContext) *msgSender { + + s := &msgSender{} + sd, err := sender.New(ctx, nil, nil, nil, nil, p2p.EngineType_ENGINE_TYPE_SNOWMAN, nil) + + if err != nil { + panic("newMsgSender err:" + err.Error()) + } + s.Sender = sd + + return s +} + +// SendChits send chits to the specified node +func (s *msgSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) { + +} + +// SendGet Request that the specified node send the specified container to this node. +func (s *msgSender) SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockID ids.ID) { + } -func (s *sender) sendChits(nodeID ids.NodeID, requestID uint32, votes []ids.ID) { +// SendPullQuery Request from the specified nodes their preferred frontier, given the existence of the specified container. +func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID) { } -func (s *sender) sendGet(nodeID ids.NodeID, requestID uint32, containerID ids.ID) { +// SendPushQuery Request from the specified nodes their preferred frontier, given the +// existence of the specified container. +// This is the same as PullQuery, except that this message includes the body +// of the container rather than its ID. +func (s *msgSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, container []byte) { } -func (s *sender) sendPullQuery(nodeIDs ids.NodeIDSet, requestID uint32, containerID ids.ID) { +// SendGossip Gossip the provided container throughout the network +func (s *msgSender) SendGossip(ctx context.Context, container []byte) { } diff --git a/system/consensus/snowman/transitive.go b/system/consensus/snowman/transitive.go deleted file mode 100644 index 20c38529d..000000000 --- a/system/consensus/snowman/transitive.go +++ /dev/null @@ -1,707 +0,0 @@ -// Copyright Fuzamei Corp. 2018 All Rights Reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package snowman - -import ( - "context" - "github.com/33cn/chain33/types" - - "go.uber.org/zap" - - "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" - "github.com/ava-labs/avalanchego/snow/consensus/snowman" - "github.com/ava-labs/avalanchego/snow/consensus/snowman/poll" - "github.com/ava-labs/avalanchego/snow/engine/common" - "github.com/ava-labs/avalanchego/snow/events" - "github.com/ava-labs/avalanchego/utils/wrappers" - //"github.com/ava-labs/avalanchego/version" -) - -// New new snow engine -func New(config Config) (*Transitive, error) { - return newTransitive(config) -} - -// Transitive implements the Engine interface by attempting to fetch all -// Transitive dependencies. -type Transitive struct { - metrics - getter - sender - Config - - // list of NoOpsHandler for messages dropped by engine - //common.StateSummaryFrontierHandler - //common.AcceptedStateSummaryHandler - //common.AcceptedFrontierHandler - //common.AcceptedHandler - //common.AncestorsHandler - - RequestID uint32 - - // track outstanding preference requests - polls poll.Set - - // blocks that have we have sent get requests for but haven't yet received - blkReqs common.Requests - - // blocks that are queued to be issued to consensus once missing dependencies are fetched - // Block ID --> Block - pending map[ids.ID]snowman.Block - - // Block ID --> Parent ID - nonVerifieds AncestorTree - - // operations that are blocked on a block being issued. This could be - // issuing another block, responding to a query, or applying votes to consensus - blocked events.Blocker - - // number of times build block needs to be called once the number of - // processing blocks has gone below the optimal number. - pendingBuildBlocks int - - // errs tracks if an error has occurred in a callback - errs wrappers.Errs -} - -func newTransitive(config Config) (*Transitive, error) { - log.Info("initializing consensus engine") - - factory := poll.NewEarlyTermNoTraversalFactory(config.params.Alpha) - t := &Transitive{ - Config: config, - //StateSummaryFrontierHandler: common.NewNoOpStateSummaryFrontierHandler(config.log), - //AcceptedStateSummaryHandler: common.NewNoOpAcceptedStateSummaryHandler(config.log), - //AcceptedFrontierHandler: common.NewNoOpAcceptedFrontierHandler(config.ctx.Log), - //AcceptedHandler: common.NewNoOpAcceptedHandler(config.ctx.Log), - //AncestorsHandler: common.NewNoOpAncestorsHandler(config.ctx.Log), - pending: make(map[ids.ID]snowman.Block), - nonVerifieds: NewAncestorTree(), - polls: poll.NewSet(factory, - config.log, - "", - config.registerer, - ), - } - - return t, t.metrics.Initialize("", config.registerer) -} - -// Put put block -func (t *Transitive) Put(nodeID ids.NodeID, block *types.Block) error { - - sb := newSnowBlock(block, t.chainCfg) - - if t.wasIssued(sb) { - t.metrics.numUselessPutBytes.Add(float64(block.Size())) - } - - // issue the block into consensus. If the block has already been issued, - // this will be a noop. If this block has missing dependencies, vdr will - // receive requests to fill the ancestry. dependencies that have already - // been fetched, but with missing dependencies themselves won't be requested - // from the vdr. - if _, err := t.issueFrom(nodeID, sb); err != nil { - return err - } - return t.buildBlocks() -} - -// GetFailed get failed -func (t *Transitive) GetFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error { - // We don't assume that this function is called after a failed Get message. - // Check to see if we have an outstanding request and also get what the request was for if it exists. - blkID, ok := t.blkReqs.Remove(nodeID, requestID) - if !ok { - t.log.Debug("unexpected GetFailed", - zap.Stringer("nodeID", nodeID), - zap.Uint32("requestID", requestID), - ) - return nil - } - - // Because the get request was dropped, we no longer expect blkID to be issued. - t.blocked.Abandon(ctx, blkID) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.buildBlocks() -} - -// handlePullQuery handle pull query from nodeID -func (t *Transitive) handlePullQuery(nodeID ids.NodeID, requestID uint32, blkID ids.ID) error { - // type here. - t.sendChits(nodeID, requestID, []ids.ID{t.consensus.Preference()}) - - // Try to issue [blkID] to consensus. - // If we're missing an ancestor, request it from [vdr] - if _, err := t.issueFromByID(nodeID, blkID); err != nil { - return err - } - - return t.buildBlocks() -} - -// handlePushQuery handle push query from other node -func (t *Transitive) handlePushQuery(nodeID ids.NodeID, requestID uint32, block *types.Block) error { - // TODO: once everyone supports ChitsV2 - we should be sending that message - // type here. - t.sendChits(nodeID, requestID, []ids.ID{t.consensus.Preference()}) - - sb := newSnowBlock(block, t.chainCfg) - - if t.wasIssued(sb) { - t.metrics.numUselessPushQueryBytes.Add(float64(block.Size())) - } - - // issue the block into consensus. If the block has already been issued, - // this will be a noop. If this block has missing dependencies, nodeID will - // receive requests to fill the ancestry. dependencies that have already - // been fetched, but with missing dependencies themselves won't be requested - // from the vdr. - if _, err := t.issueFrom(nodeID, sb); err != nil { - return err - } - - return t.buildBlocks() -} - -// handleChits handle chits -func (t *Transitive) handleChits(nodeID ids.NodeID, requestID uint32, votes []ids.ID) error { - // Since this is a linear chain, there should only be one ID in the vote set - if len(votes) != 1 { - t.log.Debug("failing Chits", - zap.String("reason", "expected only 1 vote"), - zap.Int("numVotes", len(votes)), - zap.Stringer("nodeID", nodeID), - zap.Uint32("requestID", requestID), - ) - // because QueryFailed doesn't utilize the assumption that we actually - // sent a Query message, we can safely call QueryFailed here to - // potentially abandon the request. - return t.QueryFailed(nodeID, requestID) - } - blkID := votes[0] - - t.log.Verbo("called Chits for the block", - zap.Stringer("blkID", blkID), - zap.Stringer("nodeID", nodeID), - zap.Uint32("requestID", requestID)) - - // Will record chits once [blkID] has been issued into consensus - v := &voter{ - t: t, - vdr: nodeID, - requestID: requestID, - response: blkID, - } - - added, err := t.issueFromByID(nodeID, blkID) - if err != nil { - return err - } - // Wait until [blkID] has been issued to consensus before applying this chit. - if !added { - v.deps.Add(blkID) - } - - t.blocked.Register(v) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.buildBlocks() -} - -func (t *Transitive) ChitsV2(vdr ids.NodeID, requestID uint32, _ []ids.ID, vote ids.ID) error { - return t.Chits(vdr, requestID, []ids.ID{vote}) -} - -func (t *Transitive) QueryFailed(vdr ids.NodeID, requestID uint32) error { - t.blocked.Register(&voter{ - t: t, - vdr: vdr, - requestID: requestID, - }) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.buildBlocks() -} - -func (t *Transitive) Notify(msg common.Message) error { - if msg != common.PendingTxs { - t.log.Warn("received an unexpected message from the VM", - zap.Stringer("message", msg), - ) - return nil - } - - // the pending txs message means we should attempt to build a block. - t.pendingBuildBlocks++ - return t.buildBlocks() -} - -func (t *Transitive) Context() *snow.ConsensusContext { - return t.ctx -} - -func (t *Transitive) Start(startReqID uint32) error { - t.RequestID = startReqID - - lastAccepted := newSnowBlock(t.getter.getLastAcceptBlock(), t.chainCfg) - lastAcceptedID := lastAccepted.ID() - // initialize consensus to the last accepted blockID - if err := t.consensus.Initialize(t.ctx, t.params, lastAcceptedID, lastAccepted.Height()); err != nil { - return err - } - - // to maintain the invariant that oracle blocks are issued in the correct - // preferences, we need to handle the case that we are bootstrapping into an oracle block - //if oracleBlk, ok := lastAccepted.(snowman.OracleBlock); ok { - // options, err := oracleBlk.Options() - // switch { - // case err == snowman.ErrNotOracle: - // // if there aren't blocks we need to deliver on startup, we need to set - // // the preference to the last accepted block - // if err := t.VM.SetPreference(lastAcceptedID); err != nil { - // return err - // } - // case err != nil: - // return err - // default: - // for _, blk := range options { - // // note that deliver will set the VM's preference - // if err := t.deliver(blk); err != nil { - // return err - // } - // } - // } - //} else if err := t.VM.SetPreference(lastAcceptedID); err != nil { - // return err - //} - - t.ctx.Log.Info("consensus starting", - zap.Stringer("lastAcceptedBlock", lastAcceptedID), - ) - t.metrics.bootstrapFinished.Set(1) - - t.ctx.SetState(snow.NormalOp) - //if err := t.VM.SetState(snow.NormalOp); err != nil { - // return fmt.Errorf("failed to notify VM that consensus is starting: %w", - // err) - //} - return nil -} - -func (t *Transitive) HealthCheck() (interface{}, error) { - consensusIntf, consensusErr := t.consensus.HealthCheck() - return consensusIntf, consensusErr -} - -func (t *Transitive) GetBlock(blkID ids.ID) (snowman.Block, error) { - if blk, ok := t.pending[blkID]; ok { - return blk, nil - } - blk, err := t.getBlock(blkID[:]) - if err != nil { - return nil, err - } - return newSnowBlock(blk, t.chainCfg), nil -} - -// Build blocks if they have been requested and the number of processing blocks -// is less than optimal. -func (t *Transitive) buildBlocks() error { - if err := t.errs.Err; err != nil { - return err - } - - return nil -} - -// Issue another poll to the network, asking what it prefers given the block we prefer. -// Helps move consensus along. -func (t *Transitive) repoll() { - // if we are issuing a repoll, we should gossip our current preferences to - // propagate the most likely branch as quickly as possible - prefID := t.consensus.Preference() - - for i := t.polls.Len(); i < t.params.ConcurrentRepolls; i++ { - t.pullQuery(prefID) - } -} - -// issueFromByID attempts to issue the branch ending with a block [blkID] into consensus. -// If we do not have [blkID], request it. -// Returns true if the block is processing in consensus or is decided. -func (t *Transitive) issueFromByID(nodeID ids.NodeID, blkID ids.ID) (bool, error) { - blk, err := t.GetBlock(blkID) - if err != nil { - t.sendRequest(nodeID, blkID) - return false, nil - } - return t.issueFrom(nodeID, blk) -} - -// issueFrom attempts to issue the branch ending with block [blkID] to consensus. -// Returns true if the block is processing in consensus or is decided. -// If a dependency is missing, request it from [vdr]. -func (t *Transitive) issueFrom(nodeID ids.NodeID, blk snowman.Block) (bool, error) { - blkID := blk.ID() - // issue [blk] and its ancestors to consensus. - for !t.wasIssued(blk) { - if err := t.issue(blk); err != nil { - return false, err - } - - blkID = blk.Parent() - var err error - blk, err = t.GetBlock(blkID) - - // If we don't have this ancestor, request it from [vdr] - if err != nil || !blk.Status().Fetched() { - t.sendRequest(nodeID, blkID) - return false, nil - } - } - - // Remove any outstanding requests for this block - t.blkReqs.RemoveAny(blkID) - - issued := t.consensus.Decided(blk) || t.consensus.Processing(blkID) - if issued { - // A dependency should never be waiting on a decided or processing - // block. However, if the block was marked as rejected by the VM, the - // dependencies may still be waiting. Therefore, they should abandoned. - t.blocked.Abandon(blkID) - } - - // Tracks performance statistics - t.metrics.numRequests.Set(float64(t.blkReqs.Len())) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return issued, t.errs.Err -} - -// issueWithAncestors attempts to issue the branch ending with [blk] to consensus. -// Returns true if the block is processing in consensus or is decided. -// If a dependency is missing and the dependency hasn't been requested, the issuance will be abandoned. -func (t *Transitive) issueWithAncestors(blk snowman.Block) (bool, error) { - blkID := blk.ID() - // issue [blk] and its ancestors into consensus - status := blk.Status() - for status.Fetched() && !t.wasIssued(blk) { - if err := t.issue(blk); err != nil { - return false, err - } - blkID = blk.Parent() - var err error - if blk, err = t.GetBlock(blkID); err != nil { - status = choices.Unknown - break - } - status = blk.Status() - } - - // The block was issued into consensus. This is the happy path. - if status != choices.Unknown && (t.consensus.Decided(blk) || t.consensus.Processing(blkID)) { - return true, nil - } - - // There's an outstanding request for this block. - // We can just wait for that request to succeed or fail. - if t.blkReqs.Contains(blkID) { - return false, nil - } - - // We don't have this block and have no reason to expect that we will get it. - // Abandon the block to avoid a memory leak. - t.blocked.Abandon(blkID) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return false, t.errs.Err -} - -// If the block has been decided, then it is marked as having been issued. -// If the block is processing, then it was issued. -// If the block is queued to be added to consensus, then it was issued. -func (t *Transitive) wasIssued(blk snowman.Block) bool { - blkID := blk.ID() - return t.consensus.Decided(blk) || t.consensus.Processing(blkID) || t.pendingContains(blkID) -} - -// Issue [blk] to consensus once its ancestors have been issued. -func (t *Transitive) issue(blk snowman.Block) error { - blkID := blk.ID() - - // mark that the block is queued to be added to consensus once its ancestors have been - t.pending[blkID] = blk - - // Remove any outstanding requests for this block - t.blkReqs.RemoveAny(blkID) - - // Will add [blk] to consensus once its ancestors have been - i := &issuer{ - t: t, - blk: blk, - } - - // block on the parent if needed - parentID := blk.Parent() - if parent, err := t.GetBlock(parentID); err != nil || !(t.consensus.Decided(parent) || t.consensus.Processing(parentID)) { - t.ctx.Log.Verbo("block waiting for parent to be issued", - zap.Stringer("blkID", blkID), - zap.Stringer("parentID", parentID), - ) - i.deps.Add(parentID) - } - - t.blocked.Register(i) - - // Tracks performance statistics - t.metrics.numRequests.Set(float64(t.blkReqs.Len())) - t.metrics.numBlocked.Set(float64(len(t.pending))) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.errs.Err -} - -// Request that [vdr] send us block [blkID] -func (t *Transitive) sendRequest(nodeID ids.NodeID, blkID ids.ID) { - // There is already an outstanding request for this block - if t.blkReqs.Contains(blkID) { - return - } - - t.RequestID++ - t.blkReqs.Add(nodeID, t.RequestID, blkID) - t.ctx.Log.Verbo("sending Get request", - zap.Stringer("nodeID", nodeID), - zap.Uint32("requestID", t.RequestID), - zap.Stringer("blkID", blkID), - ) - t.sender.sendGet(nodeID, t.RequestID, blkID) - - // Tracks performance statistics - t.metrics.numRequests.Set(float64(t.blkReqs.Len())) -} - -// send a pull query for this block ID -func (t *Transitive) pullQuery(blkID ids.ID) { - t.ctx.Log.Verbo("sampling from validators", - zap.Stringer("validators", t.validators), - ) - // The validators we will query - vdrs, err := t.validators.Sample(t.params.K) - if err != nil { - t.ctx.Log.Error("dropped query for block", - zap.String("reason", "insufficient number of validators"), - zap.Stringer("blkID", blkID), - ) - return - } - - vdrBag := ids.NodeIDBag{} - for _, vdr := range vdrs { - vdrBag.Add(vdr.ID()) - } - - t.RequestID++ - if t.polls.Add(t.RequestID, vdrBag) { - vdrList := vdrBag.List() - vdrSet := ids.NewNodeIDSet(len(vdrList)) - vdrSet.Add(vdrList...) - t.sender.sendPullQuery(vdrSet, t.RequestID, blkID) - } -} - -// Send a query for this block. Some validators will be sent -// a Push Query and some will be sent a Pull Query. -func (t *Transitive) sendMixedQuery(blk snowman.Block) { - t.ctx.Log.Verbo("sampling from validators", - zap.Stringer("validators", t.validators), - ) - vdrs, err := t.validators.Sample(t.params.K) - if err != nil { - t.ctx.Log.Error("dropped query for block", - zap.String("reason", "insufficient number of validators"), - zap.Stringer("blkID", blk.ID()), - ) - return - } - - vdrBag := ids.NodeIDBag{} - for _, vdr := range vdrs { - vdrBag.Add(vdr.ID()) - } - - t.RequestID++ - if t.polls.Add(t.RequestID, vdrBag) { - // Send a push query to some of the validators, and a pull query to the rest. - numPushTo := t.params.MixedQueryNumPushVdr - if !t.validators.Contains(t.ctx.NodeID) { - numPushTo = t.params.MixedQueryNumPushNonVdr - } - common.SendMixedQuery( - t.sender, - vdrBag.List(), // Note that this doesn't contain duplicates; length may be < k - numPushTo, - t.RequestID, - blk.ID(), - blk.Bytes(), - ) - } -} - -// issue [blk] to consensus -func (t *Transitive) deliver(blk snowman.Block) error { - blkID := blk.ID() - if t.consensus.Decided(blk) || t.consensus.Processing(blkID) { - return nil - } - - // we are no longer waiting on adding the block to consensus, so it is no - // longer pending - t.removeFromPending(blk) - parentID := blk.Parent() - parent, err := t.GetBlock(parentID) - // Because the dependency must have been fulfilled by the time this function - // is called - we don't expect [err] to be non-nil. But it is handled for - // completness and future proofing. - if err != nil || !(parent.Status() == choices.Accepted || t.consensus.Processing(parentID)) { - // if the parent isn't processing or the last accepted block, then this - // block is effectively rejected - t.blocked.Abandon(blkID) - t.metrics.numBlocked.Set(float64(len(t.pending))) // Tracks performance statistics - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.errs.Err - } - - // By ensuring that the parent is either processing or accepted, it is - // guaranteed that the parent was successfully verified. This means that - // calling Verify on this block is allowed. - - // make sure this block is valid - if err := blk.Verify(); err != nil { - t.ctx.Log.Debug("block verification failed", - zap.Error(err), - ) - - // if verify fails, then all descendants are also invalid - t.addToNonVerifieds(blk) - t.blocked.Abandon(blkID) - t.metrics.numBlocked.Set(float64(len(t.pending))) // Tracks performance statistics - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.errs.Err - } - t.nonVerifieds.Remove(blkID) - t.metrics.numNonVerifieds.Set(float64(t.nonVerifieds.Len())) - t.ctx.Log.Verbo("adding block to consensus", - zap.Stringer("blkID", blkID), - ) - wrappedBlk := &memoryBlock{ - Block: blk, - metrics: &t.metrics, - tree: t.nonVerifieds, - } - if err := t.consensus.Add(wrappedBlk); err != nil { - return err - } - - // Add all the oracle blocks if they exist. We call verify on all the blocks - // and add them to consensus before marking anything as fulfilled to avoid - // any potential reentrant bugs. - var added []snowman.Block - var dropped []snowman.Block - if blk, ok := blk.(snowman.OracleBlock); ok { - options, err := blk.Options() - if err != snowman.ErrNotOracle { - if err != nil { - return err - } - - for _, blk := range options { - if err := blk.Verify(); err != nil { - t.ctx.Log.Debug("block verification failed", - zap.Error(err), - ) - dropped = append(dropped, blk) - // block fails verification, hold this in memory for bubbling - t.addToNonVerifieds(blk) - } else { - // correctly verified will be passed to consensus as processing block - // no need to keep it anymore - t.nonVerifieds.Remove(blk.ID()) - t.metrics.numNonVerifieds.Set(float64(t.nonVerifieds.Len())) - wrappedBlk := &memoryBlock{ - Block: blk, - metrics: &t.metrics, - tree: t.nonVerifieds, - } - if err := t.consensus.Add(wrappedBlk); err != nil { - return err - } - added = append(added, blk) - } - } - } - } - - if err := t.VM.SetPreference(t.consensus.Preference()); err != nil { - return err - } - - // If the block is now preferred, query the network for its preferences - // with this new block. - if t.consensus.IsPreferred(blk) { - t.sendMixedQuery(blk) - } - - t.blocked.Fulfill(blkID) - for _, blk := range added { - if t.consensus.IsPreferred(blk) { - t.sendMixedQuery(blk) - } - - blkID := blk.ID() - t.removeFromPending(blk) - t.blocked.Fulfill(blkID) - t.blkReqs.RemoveAny(blkID) - } - for _, blk := range dropped { - blkID := blk.ID() - t.removeFromPending(blk) - t.blocked.Abandon(blkID) - t.blkReqs.RemoveAny(blkID) - } - - // If we should issue multiple queries at the same time, we need to repoll - t.repoll() - - // Tracks performance statistics - t.metrics.numRequests.Set(float64(t.blkReqs.Len())) - t.metrics.numBlocked.Set(float64(len(t.pending))) - t.metrics.numBlockers.Set(float64(t.blocked.Len())) - return t.errs.Err -} - -// Returns true if the block whose ID is [blkID] is waiting to be issued to consensus -func (t *Transitive) pendingContains(blkID ids.ID) bool { - _, ok := t.pending[blkID] - return ok -} - -func (t *Transitive) removeFromPending(blk snowman.Block) { - delete(t.pending, blk.ID()) -} - -func (t *Transitive) addToNonVerifieds(blk snowman.Block) { - // don't add this blk if it's decided or processing. - blkID := blk.ID() - if t.consensus.Decided(blk) || t.consensus.Processing(blkID) { - return - } - parentID := blk.Parent() - // we might still need this block so we can bubble votes to the parent - // only add blocks with parent already in the tree or processing. - // decided parents should not be in this map. - if t.nonVerifieds.Has(parentID) || t.consensus.Processing(parentID) { - t.nonVerifieds.Add(blkID, parentID) - t.metrics.numNonVerifieds.Set(float64(t.nonVerifieds.Len())) - } -} diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 6cc502935..f38767633 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -20,11 +20,20 @@ var ( _ block.ChainVM = (*chain33VM)(nil) ) +type preferBlock struct { + height int64 + hash []byte +} + // implements the snowman.ChainVM interface type chain33VM struct { blankVM api client.QueueProtocolAPI cfg *types.Chain33Config + + pendingBlock map[ids.ID][]*types.Block + preferenceID ids.ID + acceptHeight int64 } func (vm *chain33VM) newSnowBlock(blk *types.Block) snowcon.Block { @@ -39,6 +48,7 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { vm.api = ctx.Base.GetAPI() vm.cfg = vm.api.GetConfig() + vm.pendingBlock = make(map[ids.ID][]*types.Block, 8) } // Initialize implements the snowman.ChainVM interface @@ -95,6 +105,10 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err return vm.newSnowBlock(blk), nil } +func (vm *chain33VM) addNewBlock(blk *types.Block) { + +} + // BuildBlock Attempt to create a new block from data contained in the VM. // // If the VM doesn't want to issue a new block, an error should be @@ -110,6 +124,7 @@ func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { // This should always be a block that has no children known to consensus. func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { + vm.preferenceID = blkID return nil } @@ -154,3 +169,8 @@ func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids return id, nil } + +func (vm *chain33VM) acceptBlock(blk *types.Block) { + + vm.acceptHeight = blk.Height +} diff --git a/system/consensus/snowman/voter.go b/system/consensus/snowman/voter.go deleted file mode 100644 index 5c0a83f45..000000000 --- a/system/consensus/snowman/voter.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package snowman - -import ( - "go.uber.org/zap" - - "github.com/ava-labs/avalanchego/ids" -) - -// Voter records chits received from [vdr] once its dependencies are met. -type voter struct { - t *Transitive - vdr ids.NodeID - requestID uint32 - response ids.ID - deps ids.Set -} - -func (v *voter) Dependencies() ids.Set { return v.deps } - -// Fulfill Mark that a dependency has been met. -func (v *voter) Fulfill(id ids.ID) { - v.deps.Remove(id) - v.Update() -} - -// Abandon this attempt to record chits. -func (v *voter) Abandon(id ids.ID) { v.Fulfill(id) } - -func (v *voter) Update() { - if v.deps.Len() != 0 || v.t.errs.Errored() { - return - } - - var results []ids.Bag - if v.response == ids.Empty { - results = v.t.polls.Drop(v.requestID, v.vdr) - } else { - results = v.t.polls.Vote(v.requestID, v.vdr, v.response) - } - - if len(results) == 0 { - return - } - - // To prevent any potential deadlocks with un-disclosed dependencies, votes - // must be bubbled to the nearest valid block - for i, result := range results { - results[i] = v.bubbleVotes(result) - } - - for _, result := range results { - result := result - - v.t.ctx.Log.Debug("finishing poll", - zap.Stringer("result", &result), - ) - if err := v.t.consensus.RecordPoll(result); err != nil { - v.t.errs.Add(err) - } - } - - if v.t.errs.Errored() { - return - } - - if err := v.t.VM.SetPreference(v.t.consensus.Preference()); err != nil { - v.t.errs.Add(err) - return - } - - if v.t.consensus.Finalized() { - v.t.ctx.Log.Debug("Snowman engine can quiesce") - return - } - - v.t.ctx.Log.Debug("Snowman engine can't quiesce") - v.t.repoll() -} - -// bubbleVotes bubbles the [votes] a set of the number of votes for specific -// blkIDs that received votes in consensus, to their most recent ancestor that -// has been issued to consensus. -// -// Note: bubbleVotes does not bubbleVotes to all of the ancestors in consensus, -// just the most recent one. bubbling to the rest of the ancestors, which may -// also be in consensus is handled in RecordPoll. -func (v *voter) bubbleVotes(votes ids.Bag) ids.Bag { - bubbledVotes := ids.Bag{} - -votesLoop: - for _, vote := range votes.List() { - count := votes.Count(vote) - // use rootID in case of this is a non-verified block ID - rootID := v.t.nonVerifieds.GetRoot(vote) - v.t.ctx.Log.Verbo("bubbling vote(s) through unverified blocks", - zap.Int("numVotes", count), - zap.Stringer("voteID", vote), - zap.Stringer("parentID", rootID), - ) - - blk, err := v.t.GetBlock(rootID) - // If we cannot retrieve the block, drop [vote] - if err != nil { - v.t.ctx.Log.Debug("dropping vote(s)", - zap.String("reason", "parent couldn't be fetched"), - zap.Stringer("parentID", rootID), - zap.Int("numVotes", count), - zap.Stringer("voteID", vote), - zap.Error(err), - ) - continue - } - - status := blk.Status() - blkID := blk.ID() - // If we have not fetched [blkID] break from the loop. We will drop the - // vote below and move on to the next vote. - // - // If [blk] has already been decided, break from the loop, we will drop - // the vote below since there is no need to count the votes for a [blk] - // we've already finalized. - // - // If [blk] is currently in consensus, break from the loop, we have - // reached the first ancestor of the original [vote] that has been - // issued consensus. In this case, the votes will be bubbled further - // from [blk] to any of its ancestors that are also in consensus. - for status.Fetched() && !(v.t.consensus.Decided(blk) || v.t.consensus.Processing(blkID)) { - parentID := blk.Parent() - v.t.ctx.Log.Verbo("pushing vote(s)", - zap.Int("numVotes", count), - zap.Stringer("voteID", vote), - zap.Stringer("parentID", rootID), - ) - - blkID = parentID - blk, err = v.t.GetBlock(blkID) - // If we cannot retrieve the block, drop [vote] - if err != nil { - v.t.ctx.Log.Debug("dropping vote(s)", - zap.String("reason", "block couldn't be fetched"), - zap.Stringer("blkID", blkID), - zap.Int("numVotes", count), - zap.Stringer("voteID", vote), - zap.Error(err), - ) - continue votesLoop - } - status = blk.Status() - } - - // If [blkID] is currently in consensus, count the votes - if v.t.consensus.Processing(blkID) { - v.t.ctx.Log.Verbo("applying vote(s)", - zap.Int("numVotes", count), - zap.Stringer("blkID", blkID), - zap.Stringer("status", status), - ) - bubbledVotes.AddCount(blkID, count) - } else { - v.t.ctx.Log.Verbo("dropping vote(s)", - zap.Int("numVotes", count), - zap.Stringer("blkID", blkID), - zap.Stringer("status", status), - ) - } - } - return bubbledVotes -} diff --git a/types/cfg.go b/types/cfg.go index c7d0a9f3e..485c779c8 100644 --- a/types/cfg.go +++ b/types/cfg.go @@ -142,6 +142,8 @@ type Consensus struct { EnableBestBlockCmp bool `json:"enableBestBlockCmp,omitempty"` // 不回滚的共识设为true NoneRollback bool `json:"noneRollback,omitempty"` + // block finalizer, snowman + Finalizer string `json:"finalizer,omitempty"` } // Wallet 配置 diff --git a/types/event.go b/types/event.go index 0e3c7e47e..f6e7887f2 100644 --- a/types/event.go +++ b/types/event.go @@ -209,6 +209,9 @@ const ( //返回节点中最高的区块高度 EventHighestBlock = 370 EventGetEvmNonce = 371 + + // EventForFinalizer 最终化共识专属消息类型 + EventForFinalizer = 372 ) var eventName = map[int]string{ @@ -379,4 +382,5 @@ var eventName = map[int]string{ EventPushTxResult: "EventPushTxResult", EventHighestBlock: "EventHighestBlock", EventGetEvmNonce: "EventGetEvmNonce", + EventForFinalizer: "EventForFinalizer", } From c3ba69aee61d5d800c70fbd849fe4824943e1be3 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 12 Dec 2023 19:23:12 +0800 Subject: [PATCH 13/85] add perfer and accept block event --- system/consensus/snowman/block.go | 8 ++-- system/consensus/snowman/vm.go | 74 +++++++++++++++++++++++++++---- types/event.go | 5 ++- 3 files changed, 74 insertions(+), 13 deletions(-) diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index 2013b698d..0337ca843 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -25,9 +25,11 @@ func (b *snowBlock) ID() ids.ID { return b.id } func (b *snowBlock) Accept(ctx context.Context) error { b.status = choices.Accepted - snowLog.Debug(fmt.Sprintf("Accepting block %s at height %d", b.ID().Hex(), b.Height())) - // TODO accept block - b.vm.acceptBlock(b.block) + snowLog.Debug("Accepting block", "hash", b.id.Hex(), "height", b.Height()) + err := b.vm.acceptBlock(b.block.Height, b.id) + if err != nil { + snowLog.Error("Accepting block error", "hash", b.id.Hex(), "height", b.Height()) + } return nil } diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index f38767633..4cab8e25a 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -1,8 +1,13 @@ package snowman import ( + "encoding/hex" + "sync" + "github.com/33cn/chain33/client" + "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" + "github.com/33cn/chain33/system/consensus/snowman/utils" "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/database/manager" @@ -28,10 +33,11 @@ type preferBlock struct { // implements the snowman.ChainVM interface type chain33VM struct { blankVM - api client.QueueProtocolAPI - cfg *types.Chain33Config - - pendingBlock map[ids.ID][]*types.Block + api client.QueueProtocolAPI + cfg *types.Chain33Config + qclient queue.Client + pendingBlock map[string]*types.Block + lock sync.RWMutex preferenceID ids.ID acceptHeight int64 } @@ -48,7 +54,9 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { vm.api = ctx.Base.GetAPI() vm.cfg = vm.api.GetConfig() - vm.pendingBlock = make(map[ids.ID][]*types.Block, 8) + vm.qclient = ctx.Base.GetQueueClient() + vm.pendingBlock = make(map[string]*types.Block, 8) + ctx.Base.GetQueueClient() } // Initialize implements the snowman.ChainVM interface @@ -107,6 +115,15 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err func (vm *chain33VM) addNewBlock(blk *types.Block) { + vm.lock.Lock() + defer vm.lock.Unlock() + key := string(blk.ParentHash) + exist, ok := vm.pendingBlock[key] + if !ok { + snowLog.Debug("addNewBlock replace block", "old", hex.EncodeToString(exist.Hash(vm.cfg)), + "new", hex.EncodeToString(blk.Hash(vm.cfg))) + } + vm.pendingBlock[key] = blk } // BuildBlock Attempt to create a new block from data contained in the VM. @@ -115,8 +132,16 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) { // returned. func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { - // TODO new block - return nil, nil + vm.lock.RLock() + defer vm.lock.RUnlock() + + blk, ok := vm.pendingBlock[string(vm.preferenceID[:])] + + if !ok { + return nil, utils.ErrBlockNotReady + } + + return vm.newSnowBlock(blk), nil } // SetPreference Notify the VM of the currently preferred block. @@ -124,7 +149,20 @@ func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { // This should always be a block that has no children known to consensus. func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { + vm.lock.Lock() vm.preferenceID = blkID + vm.lock.Unlock() + + snowLog.Debug("SetPreference", "blkHash", blkID.Hex()) + + err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", + types.EventSnowmanPreferBlk, &types.ReqBytes{Data: blkID[:]}), false) + + if err != nil { + snowLog.Error("SetPreference", "blkHash", blkID.Hex(), "err", err) + return err + } + return nil } @@ -170,7 +208,25 @@ func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids return id, nil } -func (vm *chain33VM) acceptBlock(blk *types.Block) { +func (vm *chain33VM) acceptBlock(height int64, blkID ids.ID) error { + + vm.lock.Lock() + defer vm.lock.Unlock() + vm.acceptHeight = height + vm.removeExpireBlock() + + err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", + types.EventSnowmanAcceptBlk, &types.ReqBytes{Data: blkID[:]}), false) + + return err +} + +func (vm *chain33VM) removeExpireBlock() { - vm.acceptHeight = blk.Height + for key, blk := range vm.pendingBlock { + + if blk.Height <= vm.acceptHeight { + delete(vm.pendingBlock, key) + } + } } diff --git a/types/event.go b/types/event.go index f6e7887f2..b8bd98f6f 100644 --- a/types/event.go +++ b/types/event.go @@ -210,8 +210,11 @@ const ( EventHighestBlock = 370 EventGetEvmNonce = 371 - // EventForFinalizer 最终化共识专属消息类型 + // EventForFinalizer 最终化共识一级消息类型 EventForFinalizer = 372 + EventSnowmanPreferBlk = 373 + EventSnowmanAcceptBlk = 374 + EventSnowmanLastAcceptHeight = 375 ) var eventName = map[int]string{ From b8cf4683e32f321425189f14f6bbe09ede2db604 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 25 Dec 2023 16:34:52 +0800 Subject: [PATCH 14/85] handle block finalize events in blockchain moudle --- blockchain/blockfinalize.go | 104 +++++++++++++++++++++++++++++++++ blockchain/chain.go | 3 + blockchain/proc.go | 6 ++ system/consensus/snowman/vm.go | 21 ++++++- 4 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 blockchain/blockfinalize.go diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go new file mode 100644 index 000000000..42399300a --- /dev/null +++ b/blockchain/blockfinalize.go @@ -0,0 +1,104 @@ +package blockchain + +import ( + "encoding/hex" + "sync" + + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" +) + +var ( + blkFinalizingStartHeight int64 + blkFinalizeLastAcceptBlkKey = []byte("chain-blockfinalize-acceptblk") +) + +type finalizer struct { + chain *BlockChain + header types.Header + lock sync.RWMutex +} + +func newFinalizer(chain *BlockChain) *finalizer { + + f := &finalizer{chain: chain} + + raw, err := chain.blockStore.db.Get(blkFinalizeLastAcceptBlkKey) + + if err == nil { + types.Decode(raw, &f.header) + return f + } + + detail, err := chain.GetBlock(blkFinalizingStartHeight) + if err != nil { + chainlog.Error("newFinalizer", "height", blkFinalizingStartHeight, "get block err", err) + panic(err) + } + + f.header.Hash = detail.GetBlock().Hash(chain.client.GetConfig()) + f.header.Height = detail.GetBlock().GetHeight() + return f +} + +func (f *finalizer) syncNeighborsFinalizedHeader(selfHeight int64) { + +} + +func (f *finalizer) eventPreferBlock(msg *queue.Message) { + req := (msg.Data).(*types.ReqBytes) + + detail, err := f.chain.LoadBlockByHash(req.GetData()) + if err != nil { + chainlog.Error("eventPrferBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) + return + } + chainlog.Debug("eventPreferBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) + + return + +} + +func (f *finalizer) eventAcceptBlock(msg *queue.Message) { + + req := (msg.Data).(*types.ReqBytes) + detail, err := f.chain.LoadBlockByHash(req.GetData()) + if err != nil { + chainlog.Error("eventAcceptBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) + return + } + + chainlog.Debug("eventAcceptBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) + err = f.setFinalizedBlock(detail.GetBlock().GetHeight(), req.GetData()) + + if err != nil { + chainlog.Error("eventAcceptBlock", "setFinalizedBlock err", err.Error()) + } +} + +func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { + + f.lock.Lock() + defer f.lock.Unlock() + err := f.chain.blockStore.db.Set(blkFinalizeLastAcceptBlkKey, types.Encode(&f.header)) + + if err != nil { + return err + } + f.header.Height = height + f.header.Hash = hash + return nil +} + +func (f *finalizer) getFinalizedHeight() int64 { + f.lock.RLock() + defer f.lock.RUnlock() + return f.header.Height +} + +func (f *finalizer) eventLastAcceptHeight(msg *queue.Message) { + + height := f.getFinalizedHeight() + chainlog.Debug("eventLastAcceptHeight", "height", height) + msg.Reply(f.chain.client.NewMessage("consensus", types.EventSnowmanLastAcceptHeight, &types.Int64{Data: height})) +} diff --git a/blockchain/chain.go b/blockchain/chain.go index caa9f25bf..b68765f93 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -49,6 +49,7 @@ type BlockChain struct { // 永久存储数据到db中 blockStore *BlockStore + finalizer *finalizer push *Push //cache 缓存block方便快速查询 cfg *types.BlockChain @@ -288,6 +289,8 @@ func (chain *BlockChain) SetQueueClient(client queue.Client) { // 获取当前最大chunk连续高度 chain.maxSerialChunkNum = chain.blockStore.GetMaxSerialChunkNum() + chain.finalizer = newFinalizer(chain) + //recv 消息的处理,共识模块需要获取lastblock从数据库中 chain.recvwg.Add(1) //初始化blockchian模块 diff --git a/blockchain/proc.go b/blockchain/proc.go index 7fc5ced07..74016d42c 100644 --- a/blockchain/proc.go +++ b/blockchain/proc.go @@ -118,6 +118,12 @@ func (chain *BlockChain) ProcRecvMsg() { go chain.processMsg(msg, reqnum, chain.addChunkBlock) case types.EventHighestBlock: go chain.processMsg(msg, reqnum, chain.highestBlockNum) + case types.EventSnowmanPreferBlk: + go chain.finalizer.eventPrferBlock(msg) + case types.EventSnowmanAcceptBlk: + go chain.finalizer.eventAcceptBlock(msg) + case types.EventSnowmanLastAcceptHeight: + go chain.finalizer.eventLastAcceptHeight(msg) default: go chain.processMsg(msg, reqnum, chain.unknowMsg) } diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 4cab8e25a..c580a1703 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -56,7 +56,6 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { vm.cfg = vm.api.GetConfig() vm.qclient = ctx.Base.GetQueueClient() vm.pendingBlock = make(map[string]*types.Block, 8) - ctx.Base.GetQueueClient() } // Initialize implements the snowman.ChainVM interface @@ -159,7 +158,7 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { types.EventSnowmanPreferBlk, &types.ReqBytes{Data: blkID[:]}), false) if err != nil { - snowLog.Error("SetPreference", "blkHash", blkID.Hex(), "err", err) + snowLog.Error("SetPreference", "blkHash", blkID.Hex(), "send queue err", err) return err } @@ -173,7 +172,23 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { // returned. func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { - return ids.Empty, nil + + msg := vm.qclient.NewMessage("blockchain", types.EventSnowmanLastAcceptHeight, &types.ReqNil{}) + err := vm.qclient.Send(msg, true) + if err != nil { + snowLog.Error("LastAccepted", "send msg err", err) + return ids.Empty, err + } + + reply, err := vm.qclient.Wait(msg) + if err != nil { + snowLog.Error("LastAccepted", "wait msg err", err) + return ids.Empty, err + } + hash := reply.GetData().(*types.ReqBytes) + var id ids.ID + copy(id[:], hash.Data) + return id, nil } // VerifyHeightIndex should return: From e67688c6c8cc6b2c097ad84ec9f8b75f879bd730 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 25 Dec 2023 20:30:25 +0800 Subject: [PATCH 15/85] integrate snowman validator with libp2p peers --- system/consensus/snowman/config.go | 2 +- system/consensus/snowman/finalize.go | 40 +++++++-- system/consensus/snowman/validators.go | 109 ++++++++++++++++++++++++- 3 files changed, 142 insertions(+), 9 deletions(-) diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index 40e375d8b..69139f123 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -34,7 +34,7 @@ type Config struct { consensus smcon.Consensus } -func newSnowmanConfig(vm *chain33VM, params snowball.Parameters, ctx *snow.ConsensusContext) smeng.Config { +func newSnowmanConfig(vm *chain33VM, vs *vdrSet, params snowball.Parameters, ctx *snow.ConsensusContext) smeng.Config { engineConfig := smeng.Config{ Ctx: ctx, diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/finalize.go index 58944fc5c..07913c85f 100644 --- a/system/consensus/snowman/finalize.go +++ b/system/consensus/snowman/finalize.go @@ -7,6 +7,7 @@ package snowman import ( "runtime" + "time" "github.com/33cn/chain33/common/log/log15" "github.com/33cn/chain33/queue" @@ -32,18 +33,28 @@ func init() { type snowman struct { engine smeng.Engine vm *chain33VM + vs *vdrSet ctx *consensus.Context inMsg chan *queue.Message + params snowball.Parameters } func (s *snowman) Initialize(ctx *consensus.Context) { s.inMsg = make(chan *queue.Message, 32) - params := snowball.Parameters{} + params := snowball.DefaultParameters + err := params.Verify() + if err != nil { + panic("Initialize snowman engine invalid snowball parameters:" + err.Error()) + } + s.params = params vm := &chain33VM{} vm.Init(ctx) - engineConfig := newSnowmanConfig(vm, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) + + vs := &vdrSet{} + vs.init(ctx) + engineConfig := newSnowmanConfig(vm, vs, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) engine, err := smeng.New(engineConfig) @@ -52,16 +63,34 @@ func (s *snowman) Initialize(ctx *consensus.Context) { } s.engine = engine s.vm = vm + s.vs = vs + + go s.startRoutine() } -func (s *snowman) Start() error { +func (s *snowman) startRoutine() { + + // check sync status + + + // check connected peers + + for { + + peers, err := s.vs.getConnectedPeers() + if err == nil && len(peers) >= s.params.K { + break + } + snowLog.Debug("startRoutine", "getConnectedPeers", len(peers), "err", err) + time.Sleep(time.Second) + } + err := s.engine.Start(s.ctx.Base.Context, 0) if err != nil { - - return err + panic("start snowman engine err:" + err.Error()) } //使用多个协程并发处理,提高效率 @@ -69,7 +98,6 @@ func (s *snowman) Start() error { for i := 0; i < concurrency; i++ { go s.handleMsgRountine() } - return nil } diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index 408d0d6e3..33bcddb25 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -1,12 +1,25 @@ package snowman import ( + "github.com/33cn/chain33/system/consensus" + "github.com/33cn/chain33/system/consensus/snowman/utils" + "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/validators" + "math/rand" + "sync" + "time" + + libpeer "github.com/libp2p/go-libp2p/core/peer" ) type vdrSet struct { validators.Set + ctx *consensus.Context + self *types.Peer + peerIDs map[ids.NodeID]string + lock sync.RWMutex + rand *rand.Rand } func newVdrSet() *vdrSet { @@ -16,9 +29,101 @@ func newVdrSet() *vdrSet { return s } +func (s *vdrSet) init(ctx *consensus.Context) { + + s.Set = validators.NewSet() + s.ctx = ctx + s.rand = rand.New(rand.NewSource(types.Now().Unix())) +} + // Sample returns a collection of validatorIDs, potentially with duplicates. // If sampling the requested size isn't possible, an error will be returned. -func (*vdrSet) Sample(size int) ([]ids.NodeID, error) { +func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { + + peers, err := s.getConnectedPeers() + if err != nil || len(peers) < size { + snowLog.Error("Sample", "len", len(peers), "size", size, "err", err) + return nil, utils.ErrValidatorSample + } + indices := s.rand.Perm(len(peers)) + ids := make([]ids.NodeID, 0, size) + + s.lock.Lock() + defer s.lock.Unlock() + for _, idx := range indices { + + nid, err := s.toNodeID(peers[idx].Name) + if err != nil { + snowLog.Error("Sample", "pid", peers[idx].Name, "to nodeID err", err) + continue + } + s.peerIDs[nid] = peers[idx].Name + ids = append(ids, nid) + + if len(ids) >= size { + break + } + } + + if len(ids) < size { + snowLog.Error("Sample not enough", "len", len(peers), "size", size, "err", err) + return nil, utils.ErrValidatorSample + } + + return ids, nil +} + +func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { + + msg := s.ctx.Base.GetQueueClient().NewMessage("p2p", types.EventPeerInfo, nil) + err := s.ctx.Base.GetQueueClient().Send(msg, true) + if err != nil { + snowLog.Error("getConnectedPeers", "client.Send err:", err) + return nil, err + } + resp, err := s.ctx.Base.GetQueueClient().WaitTimeout(msg, 5*time.Second) + if err != nil { + snowLog.Error("getConnectedPeers", "client.Wait err:", err) + return nil, err + } + + peerlist, ok := resp.GetData().(*types.PeerList) + count := len(peerlist.GetPeers()) + if !ok || count < 2 { + snowLog.Error("getConnectedPeers", "len", len(peerlist.GetPeers()), "ok", ok) + return nil, types.ErrTypeAsset + } + + s.self = peerlist.GetPeers()[count-1] + peers := make([]*types.Peer, 0, count) + for _, p := range peerlist.GetPeers() { + + if p.Self || p.Blocked || p.Header.GetHeight() < s.self.Header.GetHeight()-128 { + continue + } + peers = append(peers, p) + + } + return peers, nil +} + +func (s *vdrSet) toLibp2pID(id ids.NodeID) string { + s.lock.RLock() + defer s.lock.RUnlock() + return s.peerIDs[id] +} + +func (s *vdrSet) toNodeID(id string) (ids.NodeID, error) { + + pid, err := libpeer.Decode(id) + if err != nil { + return ids.EmptyNodeID, err + } + + nid, err := ids.ToNodeID([]byte(pid)[:20]) + if err != nil { + return ids.EmptyNodeID, err + } - return nil, nil + return nid, nil } From 3047e3f43d9916e453aefe2a1afbb5198f244b5f Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:58:52 +0800 Subject: [PATCH 16/85] update snowman config --- system/consensus/snowman/config.go | 33 ++++++++++++++++++++------ system/consensus/snowman/utils/util.go | 12 ++++++++++ 2 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 system/consensus/snowman/utils/util.go diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index 69139f123..8e4ad2618 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -5,12 +5,16 @@ package snowman import ( + "time" + "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/avalanchego/snow/consensus/snowball" smcon "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/common" + snowcom "github.com/ava-labs/avalanchego/snow/engine/common" smeng "github.com/ava-labs/avalanchego/snow/engine/snowman" + snowgetter "github.com/ava-labs/avalanchego/snow/engine/snowman/getter" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/utils/logging" "github.com/prometheus/client_golang/prometheus" @@ -34,30 +38,45 @@ type Config struct { consensus smcon.Consensus } -func newSnowmanConfig(vm *chain33VM, vs *vdrSet, params snowball.Parameters, ctx *snow.ConsensusContext) smeng.Config { +func newSnowmanConfig(sm *snowman, params snowball.Parameters, snowCtx *snow.ConsensusContext) smeng.Config { + sender := newMsgSender(sm, snowCtx) engineConfig := smeng.Config{ - Ctx: ctx, - VM: vm, - Validators: newVdrSet(), + Ctx: snowCtx, + VM: sm.vm, + Validators: sm.vs, Params: params, Consensus: &smcon.Topological{}, PartialSync: false, - Sender: newMsgSender(ctx), + Sender: sender, + } + + ccfg := snowcom.Config{ + + Ctx: snowCtx, + SampleK: params.K, + Sender: sender, + MaxTimeGetAncestors: time.Second * 5, + AncestorsMaxContainersSent: 2000, + AncestorsMaxContainersReceived: 2000, } + getter, err := snowgetter.New(sm.vm, ccfg) + if err != nil { + panic("newSnowmanConfig newSnowGetter err" + err.Error()) + } + engineConfig.AllGetsServer = getter return engineConfig } func newSnowContext(cfg *types.Chain33Config) *snow.ConsensusContext { ctx := snow.DefaultConsensusContextTest() - // TODO use chain33 log writer logCfg := cfg.GetModuleConfig().Log logger := &lumberjack.Logger{ - Filename: logCfg.LogFile, + Filename: "logs/snowman.log", MaxSize: int(logCfg.MaxFileSize), MaxBackups: int(logCfg.MaxBackups), MaxAge: int(logCfg.MaxAge), diff --git a/system/consensus/snowman/utils/util.go b/system/consensus/snowman/utils/util.go new file mode 100644 index 000000000..ad9820958 --- /dev/null +++ b/system/consensus/snowman/utils/util.go @@ -0,0 +1,12 @@ +package utils + +import "errors" + +const ( + UnknowMsgID = iota +) + +var ( + ErrBlockNotReady = errors.New("ErrBlockNotReady") + ErrValidatorSample = errors.New("ErrValidatorSample") +) From a7e6c5517080f81276c9d7a35ab3f54d5e92b323 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 4 Jan 2024 18:14:43 +0800 Subject: [PATCH 17/85] decrease peer info refresh frequency --- system/p2p/dht/protocol/peer/peer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/p2p/dht/protocol/peer/peer.go b/system/p2p/dht/protocol/peer/peer.go index 780b3ff93..3da292053 100644 --- a/system/p2p/dht/protocol/peer/peer.go +++ b/system/p2p/dht/protocol/peer/peer.go @@ -27,7 +27,7 @@ const ( mempool = "mempool" ) -//UnitTime key time value:time.Second +// UnitTime key time value:time.Second var UnitTime = map[string]int64{ "hour": 3600, "min": 60, @@ -36,7 +36,7 @@ var UnitTime = map[string]int64{ var log = log15.New("module", "p2p.peer") var processStart = time.Now() -//CaculateLifeTime parase time string to time.Duration +// CaculateLifeTime parase time string to time.Duration func CaculateLifeTime(timestr string) (time.Duration, error) { var lifetime int64 if timestr == "" { @@ -132,7 +132,7 @@ func InitProtocol(env *protocol.P2PEnv) { go p.detectNodeAddr() go p.checkBlocked() go func() { - ticker := time.NewTicker(time.Second / 2) + ticker := time.NewTicker(time.Second) defer ticker.Stop() ticker2 := time.NewTicker(time.Minute * 5) defer ticker2.Stop() From 4d1cb382d30a22942e480c56bd1289e40d851b2a Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:45:17 +0800 Subject: [PATCH 18/85] add snowman message sender and handler --- system/consensus/snowman/block.go | 11 +- system/consensus/snowman/finalize.go | 144 +++++- system/consensus/snowman/sender.go | 115 ++++- system/consensus/snowman/validators.go | 18 +- system/consensus/snowman/vm.go | 20 +- types/event.go | 21 +- types/proto/snowman.proto | 55 +++ types/snowman.pb.go | 577 +++++++++++++++++++++++++ 8 files changed, 915 insertions(+), 46 deletions(-) create mode 100644 types/proto/snowman.proto create mode 100644 types/snowman.pb.go diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index 0337ca843..47f5ae649 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -52,10 +52,8 @@ func (b *snowBlock) Status() choices.Status { } // Parent implements the snowman.Block interface -func (b *snowBlock) Parent() (id ids.ID) { - - copy(id[:], b.block.ParentHash) - return +func (b *snowBlock) Parent() ids.ID { + return toSnowID(b.block.ParentHash) } // Height implements the snowman.Block interface @@ -82,3 +80,8 @@ func (b *snowBlock) Bytes() []byte { } func (b *snowBlock) String() string { return fmt.Sprintf("chain33 block, hash = %s", b.ID().Hex()) } + +func toSnowID(blkHash []byte) (id ids.ID) { + copy(id[:], blkHash) + return +} diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/finalize.go index 07913c85f..4c1095886 100644 --- a/system/consensus/snowman/finalize.go +++ b/system/consensus/snowman/finalize.go @@ -6,6 +6,7 @@ package snowman import ( + "encoding/hex" "runtime" "time" @@ -33,7 +34,7 @@ func init() { type snowman struct { engine smeng.Engine vm *chain33VM - vs *vdrSet + vs *vdrSet ctx *consensus.Context inMsg chan *queue.Message params snowball.Parameters @@ -54,7 +55,11 @@ func (s *snowman) Initialize(ctx *consensus.Context) { vs := &vdrSet{} vs.init(ctx) - engineConfig := newSnowmanConfig(vm, vs, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) + + s.vm = vm + s.vs = vs + + engineConfig := newSnowmanConfig(s, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) engine, err := smeng.New(engineConfig) @@ -62,38 +67,32 @@ func (s *snowman) Initialize(ctx *consensus.Context) { panic("Initialize snowman engine err:" + err.Error()) } s.engine = engine - s.vm = vm - s.vs = vs go s.startRoutine() } -func (s *snowman) startRoutine() { - - // check sync status +func (s *snowman) startRoutine() { + // TODO check sync status // check connected peers - for { peers, err := s.vs.getConnectedPeers() if err == nil && len(peers) >= s.params.K { break } - snowLog.Debug("startRoutine", "getConnectedPeers", len(peers), "err", err) - time.Sleep(time.Second) + snowLog.Debug("startRoutine wait Peers", "getConnectedPeers", len(peers), "err", err) + time.Sleep(2 * time.Second) } - err := s.engine.Start(s.ctx.Base.Context, 0) - if err != nil { panic("start snowman engine err:" + err.Error()) } - //使用多个协程并发处理,提高效率 + //启用handler协程 concurrency := runtime.NumCPU() * 2 for i := 0; i < concurrency; i++ { go s.handleMsgRountine() @@ -121,15 +120,130 @@ func (s *snowman) handleMsgRountine() { return case msg := <-s.inMsg: - s.handleMsg(msg) + s.handleInMsg(msg) + snowLog.Debug("handleInMsg Done", "event", types.GetEventName(int(msg.ID))) } } } -func (s *snowman) handleMsg(msg *queue.Message) { +func (s *snowman) handleInMsg(msg *queue.Message) { switch msg.ID { + case types.EventSnowmanChits: + + req := msg.Data.(*types.SnowChits) + snowLog.Debug("handleInMsg chits", "reqID", req.GetRequestID(), "peerName", req.GetPeerName(), + "prefer", hex.EncodeToString(req.GetPreferredBlkHash()), "acept", hex.EncodeToString(req.GetAcceptedBlkHash())) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg chits", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.Chits(s.ctx.Base.Context, nodeID, req.RequestID, + toSnowID(req.PreferredBlkHash), toSnowID(req.AcceptedBlkHash)) + if err != nil { + + snowLog.Error("handleInMsg chits", "reqID", req.RequestID, "peerName", req.PeerName, + "prefer", hex.EncodeToString(req.PreferredBlkHash), "acept", hex.EncodeToString(req.AcceptedBlkHash), + "chits err", err) + } + + case types.EventSnowmanGetBlock: + + req := msg.Data.(*types.SnowGetBlock) + snowLog.Debug("handleInMsg getBlock", "reqID", req.GetRequestID(), "peerName", req.GetPeerName(), + "hash", hex.EncodeToString(req.BlockHash)) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.Get(s.ctx.Base.Context, nodeID, req.RequestID, toSnowID(req.BlockHash)) + if err != nil { + snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, "peerName", req.PeerName, "Get err", err) + } + case types.EventSnowmanPutBlock: + + req := msg.Data.(*types.SnowPutBlock) + snowLog.Debug("handleInMsg putBlock", "reqID", req.GetRequestID(), "peerName", req.GetPeerName()) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg putBlock", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.Put(s.ctx.Base.Context, nodeID, req.RequestID, req.BlockData) + if err != nil { + snowLog.Error("handleInMsg putBlock", "reqID", req.RequestID, "peerName", req.PeerName, "Put err", err) + } + + case types.EventSnowmanPullQuery: + + req := msg.Data.(*types.SnowPullQuery) + snowLog.Debug("handleInMsg pullQuery", "reqID", req.GetRequestID(), "peerName", req.GetPeerName(), + "hash", hex.EncodeToString(req.BlockHash)) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg pullQuery", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.PullQuery(s.ctx.Base.Context, nodeID, req.RequestID, toSnowID(req.BlockHash)) + if err != nil { + snowLog.Error("handleInMsg pullQuery", "reqID", req.RequestID, "peerName", req.PeerName, "pullQuery err", err) + } + + case types.EventSnowmanPushQuery: + + req := msg.Data.(*types.SnowPushQuery) + snowLog.Debug("handleInMsg pushQuery", "reqID", req.GetRequestID(), "peerName", req.GetPeerName()) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg pushQuery", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.PushQuery(s.ctx.Base.Context, nodeID, req.RequestID, req.BlockData) + if err != nil { + snowLog.Error("handleInMsg pushQuery", "reqID", req.RequestID, "peerName", req.PeerName, "pushQuery err", err) + } + + case types.EventSnowmanQueryFailed: + + req := msg.Data.(*types.SnowFailedQuery) + snowLog.Debug("handleInMsg failQuery", "reqID", req.RequestID, "peerName", req.GetPeerName()) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg failQuery", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.QueryFailed(s.ctx.Base.Context, nodeID, req.RequestID) + if err != nil { + snowLog.Error("handleInMsg failQuery", "reqID", req.RequestID, "peerName", req.PeerName, "failQuery err", err) + } + + case types.EventSnowmanGetFailed: + + req := msg.Data.(*types.SnowFailedQuery) + snowLog.Debug("handleInMsg failGet", "reqID", req.RequestID, "peerName", req.GetPeerName()) + nodeID, err := s.vs.toNodeID(req.PeerName) + if err != nil { + snowLog.Error("handleInMsg failGet", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + return + } + + err = s.engine.GetFailed(s.ctx.Base.Context, nodeID, req.RequestID) + if err != nil { + snowLog.Error("handleInMsg failGet", "reqID", req.RequestID, "peerName", req.PeerName, "failGet err", err) + } + + default: + snowLog.Error("snowman handleInMsg, recv unknow msg", "id", msg.ID) + } } diff --git a/system/consensus/snowman/sender.go b/system/consensus/snowman/sender.go index de86fa1e2..e2d56d624 100644 --- a/system/consensus/snowman/sender.go +++ b/system/consensus/snowman/sender.go @@ -5,6 +5,9 @@ package snowman import ( + "encoding/hex" + client "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/proto/pb/p2p" "github.com/ava-labs/avalanchego/snow" @@ -18,12 +21,15 @@ import ( // 向外部模块发送请求, blockchain/p2p等 type msgSender struct { common.Sender + cli client.Client + sm *snowman } -func newMsgSender(ctx *snow.ConsensusContext) *msgSender { +func newMsgSender(sm *snowman, snowCtx *snow.ConsensusContext) *msgSender { - s := &msgSender{} - sd, err := sender.New(ctx, nil, nil, nil, nil, p2p.EngineType_ENGINE_TYPE_SNOWMAN, nil) + s := &msgSender{sm: sm} + s.cli = sm.ctx.Base.GetQueueClient() + sd, err := sender.New(snowCtx, nil, nil, nil, nil, p2p.EngineType_ENGINE_TYPE_SNOWMAN, nil) if err != nil { panic("newMsgSender err:" + err.Error()) @@ -36,15 +42,85 @@ func newMsgSender(ctx *snow.ConsensusContext) *msgSender { // SendChits send chits to the specified node func (s *msgSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) { + peerName := s.sm.vs.toLibp2pID(nodeID) + snowLog.Debug("msgSender SendGet", "reqID", requestID, "peer", peerName, + "preferHash", hex.EncodeToString(preferredID[:]), + "acceptHash", hex.EncodeToString(acceptedID[:])) + + req := &types.SnowChits{ + RequestID: requestID, + PreferredBlkHash: preferredID[:], + AcceptedBlkHash: acceptedID[:], + PeerName: peerName, + } + + msg := s.cli.NewMessage("p2p", types.EventSnowmanChits, req) + err := s.cli.Send(msg, false) + if err != nil { + snowLog.Error("msgSender SendChits", "peer", req.PeerName, "reqID", requestID, + "perferHash", hex.EncodeToString(req.PreferredBlkHash), + "accept", hex.EncodeToString(req.AcceptedBlkHash), "client.Send err:", err) + } } // SendGet Request that the specified node send the specified container to this node. func (s *msgSender) SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockID ids.ID) { + peerName := s.sm.vs.toLibp2pID(nodeID) + snowLog.Debug("msgSender SendGet", "reqID", requestID, "peer", peerName, "blkHash", hex.EncodeToString(blockID[:])) + req := &types.SnowGetBlock{ + RequestID: requestID, + BlockHash: blockID[:], + PeerName: peerName, + } + + msg := s.cli.NewMessage("p2p", types.EventSnowmanGetBlock, req) + err := s.cli.Send(msg, false) + if err != nil { + snowLog.Error("msgSender SendGet", "peer", req.PeerName, "reqID", requestID, + "blkHash", hex.EncodeToString(req.BlockHash), "client.Send err:", err) + } +} + +// SendPut Tell the specified node about [container]. +func (s *msgSender) SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, blkData []byte) { + + peerName := s.sm.vs.toLibp2pID(nodeID) + snowLog.Debug("msgSender SendPut", "reqID", requestID, "peer", peerName) + req := &types.SnowPutBlock{ + RequestID: requestID, + PeerName: peerName, + BlockData: blkData, + } + + msg := s.cli.NewMessage("p2p", types.EventSnowmanPutBlock, req) + err := s.cli.Send(msg, false) + if err != nil { + snowLog.Error("msgSender SendPut", "peer", req.PeerName, "reqID", requestID, "client.Send err:", err) + } } // SendPullQuery Request from the specified nodes their preferred frontier, given the existence of the specified container. -func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID) { +func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, blockID ids.ID) { + + snowLog.Debug("msgSender SendPullQuery", "reqID", requestID, "peerLen", nodeIDs.Len(), + "blkHash", hex.EncodeToString(blockID[:])) + + for nodeID := range nodeIDs { + + req := &types.SnowPullQuery{ + RequestID: requestID, + BlockHash: blockID[:], + PeerName: s.sm.vs.toLibp2pID(nodeID), + } + + msg := s.cli.NewMessage("p2p", types.EventSnowmanPullQuery, req) + err := s.cli.Send(msg, false) + if err != nil { + snowLog.Error("msgSender SendPullQuery", "peer", req.PeerName, "reqID", requestID, + "blkHash", hex.EncodeToString(req.BlockHash), "client.Send err:", err) + } + } } @@ -52,11 +128,40 @@ func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeI // existence of the specified container. // This is the same as PullQuery, except that this message includes the body // of the container rather than its ID. -func (s *msgSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, container []byte) { +func (s *msgSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, blockData []byte) { + + snowLog.Debug("msgSender SendPushQuery", "reqID", requestID, "peerLen", nodeIDs.Len()) + for nodeID := range nodeIDs { + + req := &types.SnowPushQuery{ + RequestID: requestID, + BlockData: blockData, + PeerName: s.sm.vs.toLibp2pID(nodeID), + } + + msg := s.cli.NewMessage("p2p", types.EventSnowmanPullQuery, req) + err := s.cli.Send(msg, false) + if err != nil { + snowLog.Error("msgSender SendPushQuery", "peer", req.PeerName, "reqID", requestID, "client.Send err:", err) + } + } } // SendGossip Gossip the provided container throughout the network func (s *msgSender) SendGossip(ctx context.Context, container []byte) { + recordUnimplementedError("msgSender SendGossip") +} + +// SendGetAncestors requests that node [nodeID] send container [containerID] +// and its ancestors. +func (s *msgSender) SendGetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) { + recordUnimplementedError("msgSender SendGetAncestors") +} + +// SendAncestors Give the specified node several containers at once. Should be in response +// to a GetAncestors message with request ID [requestID] from the node. +func (s *msgSender) SendAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) { + recordUnimplementedError("msgSender SendAncestors") } diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index 33bcddb25..a908ced71 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -1,14 +1,15 @@ package snowman import ( + "math/rand" + "sync" + "time" + "github.com/33cn/chain33/system/consensus" "github.com/33cn/chain33/system/consensus/snowman/utils" "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/validators" - "math/rand" - "sync" - "time" libpeer "github.com/libp2p/go-libp2p/core/peer" ) @@ -22,13 +23,6 @@ type vdrSet struct { rand *rand.Rand } -func newVdrSet() *vdrSet { - - s := &vdrSet{} - s.Set = validators.NewSet() - return s -} - func (s *vdrSet) init(ctx *consensus.Context) { s.Set = validators.NewSet() @@ -127,3 +121,7 @@ func (s *vdrSet) toNodeID(id string) (ids.NodeID, error) { return nid, nil } + +func (s *vdrSet) RegisterCallbackListener(callbackListener validators.SetCallbackListener) { + snowLog.Debug("RegisterCallbackListener Not Implemented Function") +} diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index c580a1703..e2b05ea1b 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -4,6 +4,8 @@ import ( "encoding/hex" "sync" + "github.com/ava-labs/avalanchego/snow/choices" + "github.com/33cn/chain33/client" "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" @@ -42,10 +44,10 @@ type chain33VM struct { acceptHeight int64 } -func (vm *chain33VM) newSnowBlock(blk *types.Block) snowcon.Block { +func (vm *chain33VM) newSnowBlock(blk *types.Block) *snowBlock { sb := &snowBlock{block: blk, vm: vm} - copy(sb.id[:], blk.Hash(vm.cfg)) + sb.id = toSnowID(blk.Hash(vm.cfg)) return sb } @@ -91,12 +93,16 @@ func (vm *chain33VM) Shutdown(context.Context) error { func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, error) { details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) - if err != nil || details.GetItems()[0].GetBlock() == nil { + if err != nil || len(details.GetItems()) < 1 { snowLog.Error("GetBlock", "GetBlockByHashes err", err) return nil, database.ErrNotFound } + sb := vm.newSnowBlock(details.GetItems()[0].GetBlock()) + if sb.block.Height <= vm.acceptHeight { + sb.status = choices.Accepted + } - return vm.newSnowBlock(details.GetItems()[0].GetBlock()), nil + return sb, nil } // ParseBlock parse block @@ -172,7 +178,6 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { // returned. func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { - msg := vm.qclient.NewMessage("blockchain", types.EventSnowmanLastAcceptHeight, &types.ReqNil{}) err := vm.qclient.Send(msg, true) if err != nil { @@ -217,10 +222,7 @@ func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids snowLog.Error("GetBlock", "height", height, "GetBlockHash err", err) return ids.Empty, database.ErrNotFound } - var id ids.ID - copy(id[:], reply.Hash) - - return id, nil + return toSnowID(reply.Hash), nil } func (vm *chain33VM) acceptBlock(height int64, blkID ids.ID) error { diff --git a/types/event.go b/types/event.go index b8bd98f6f..1ac1b14a8 100644 --- a/types/event.go +++ b/types/event.go @@ -211,10 +211,17 @@ const ( EventGetEvmNonce = 371 // EventForFinalizer 最终化共识一级消息类型 - EventForFinalizer = 372 - EventSnowmanPreferBlk = 373 - EventSnowmanAcceptBlk = 374 + EventForFinalizer = 372 + EventSnowmanPreferBlk = 373 + EventSnowmanAcceptBlk = 374 EventSnowmanLastAcceptHeight = 375 + EventSnowmanChits = 376 + EventSnowmanGetBlock = 377 + EventSnowmanPutBlock = 378 + EventSnowmanPullQuery = 379 + EventSnowmanPushQuery = 380 + EventSnowmanGetFailed = 381 + EventSnowmanQueryFailed = 382 ) var eventName = map[int]string{ @@ -386,4 +393,12 @@ var eventName = map[int]string{ EventHighestBlock: "EventHighestBlock", EventGetEvmNonce: "EventGetEvmNonce", EventForFinalizer: "EventForFinalizer", + EventSnowmanChits: "EventSnowmanChits", + EventSnowmanGetBlock: "EventSnowmanGetBlock", + EventSnowmanPutBlock: "EventSnowmanPutBlock", + EventSnowmanPullQuery: "EventSnowmanPullQuery", + EventSnowmanPushQuery: "EventSnowmanPushQuery", + + EventSnowmanGetFailed: "EventSnowmanGetFailed", + EventSnowmanQueryFailed: "EventSnowmanQueryFailed", } diff --git a/types/proto/snowman.proto b/types/proto/snowman.proto new file mode 100644 index 000000000..bf0d325c7 --- /dev/null +++ b/types/proto/snowman.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + + + +package types; +option go_package = "github.com/33cn/chain33/types"; + +message snowChits { + + uint32 requestID = 1; + string peerName = 2; + bytes preferredBlkHash = 3; + bytes acceptedBlkHash = 4; +} + + +message snowGetBlock { + + uint32 requestID = 1; + string peerName = 2; + bytes blockHash = 3; +} + +message snowPutBlock { + + uint32 requestID = 1; + string peerName = 2; + bytes blockData = 3; +} + + +message snowPullQuery { + + uint32 requestID = 1; + string peerName = 2; + bytes blockHash = 3; +} + + +message snowPushQuery { + + uint32 requestID = 1; + string peerName = 2; + bytes blockData = 3; +} + + +message snowFailedQuery { + uint32 requestID = 1; + string peerName = 2; +} + + + + diff --git a/types/snowman.pb.go b/types/snowman.pb.go new file mode 100644 index 000000000..e65eb4e43 --- /dev/null +++ b/types/snowman.pb.go @@ -0,0 +1,577 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.9.1 +// source: snowman.proto + +package types + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SnowChits struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` + PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` + PreferredBlkHash []byte `protobuf:"bytes,3,opt,name=preferredBlkHash,proto3" json:"preferredBlkHash,omitempty"` + AcceptedBlkHash []byte `protobuf:"bytes,4,opt,name=acceptedBlkHash,proto3" json:"acceptedBlkHash,omitempty"` +} + +func (x *SnowChits) Reset() { + *x = SnowChits{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowChits) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowChits) ProtoMessage() {} + +func (x *SnowChits) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowChits.ProtoReflect.Descriptor instead. +func (*SnowChits) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{0} +} + +func (x *SnowChits) GetRequestID() uint32 { + if x != nil { + return x.RequestID + } + return 0 +} + +func (x *SnowChits) GetPeerName() string { + if x != nil { + return x.PeerName + } + return "" +} + +func (x *SnowChits) GetPreferredBlkHash() []byte { + if x != nil { + return x.PreferredBlkHash + } + return nil +} + +func (x *SnowChits) GetAcceptedBlkHash() []byte { + if x != nil { + return x.AcceptedBlkHash + } + return nil +} + +type SnowGetBlock struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` + PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` + BlockHash []byte `protobuf:"bytes,3,opt,name=blockHash,proto3" json:"blockHash,omitempty"` +} + +func (x *SnowGetBlock) Reset() { + *x = SnowGetBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowGetBlock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowGetBlock) ProtoMessage() {} + +func (x *SnowGetBlock) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowGetBlock.ProtoReflect.Descriptor instead. +func (*SnowGetBlock) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{1} +} + +func (x *SnowGetBlock) GetRequestID() uint32 { + if x != nil { + return x.RequestID + } + return 0 +} + +func (x *SnowGetBlock) GetPeerName() string { + if x != nil { + return x.PeerName + } + return "" +} + +func (x *SnowGetBlock) GetBlockHash() []byte { + if x != nil { + return x.BlockHash + } + return nil +} + +type SnowPutBlock struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` + PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` + BlockData []byte `protobuf:"bytes,3,opt,name=blockData,proto3" json:"blockData,omitempty"` +} + +func (x *SnowPutBlock) Reset() { + *x = SnowPutBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowPutBlock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowPutBlock) ProtoMessage() {} + +func (x *SnowPutBlock) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowPutBlock.ProtoReflect.Descriptor instead. +func (*SnowPutBlock) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{2} +} + +func (x *SnowPutBlock) GetRequestID() uint32 { + if x != nil { + return x.RequestID + } + return 0 +} + +func (x *SnowPutBlock) GetPeerName() string { + if x != nil { + return x.PeerName + } + return "" +} + +func (x *SnowPutBlock) GetBlockData() []byte { + if x != nil { + return x.BlockData + } + return nil +} + +type SnowPullQuery struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` + PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` + BlockHash []byte `protobuf:"bytes,3,opt,name=blockHash,proto3" json:"blockHash,omitempty"` +} + +func (x *SnowPullQuery) Reset() { + *x = SnowPullQuery{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowPullQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowPullQuery) ProtoMessage() {} + +func (x *SnowPullQuery) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowPullQuery.ProtoReflect.Descriptor instead. +func (*SnowPullQuery) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{3} +} + +func (x *SnowPullQuery) GetRequestID() uint32 { + if x != nil { + return x.RequestID + } + return 0 +} + +func (x *SnowPullQuery) GetPeerName() string { + if x != nil { + return x.PeerName + } + return "" +} + +func (x *SnowPullQuery) GetBlockHash() []byte { + if x != nil { + return x.BlockHash + } + return nil +} + +type SnowPushQuery struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` + PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` + BlockData []byte `protobuf:"bytes,3,opt,name=blockData,proto3" json:"blockData,omitempty"` +} + +func (x *SnowPushQuery) Reset() { + *x = SnowPushQuery{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowPushQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowPushQuery) ProtoMessage() {} + +func (x *SnowPushQuery) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowPushQuery.ProtoReflect.Descriptor instead. +func (*SnowPushQuery) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{4} +} + +func (x *SnowPushQuery) GetRequestID() uint32 { + if x != nil { + return x.RequestID + } + return 0 +} + +func (x *SnowPushQuery) GetPeerName() string { + if x != nil { + return x.PeerName + } + return "" +} + +func (x *SnowPushQuery) GetBlockData() []byte { + if x != nil { + return x.BlockData + } + return nil +} + +type SnowFailedQuery struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` + PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` +} + +func (x *SnowFailedQuery) Reset() { + *x = SnowFailedQuery{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowFailedQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowFailedQuery) ProtoMessage() {} + +func (x *SnowFailedQuery) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowFailedQuery.ProtoReflect.Descriptor instead. +func (*SnowFailedQuery) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{5} +} + +func (x *SnowFailedQuery) GetRequestID() uint32 { + if x != nil { + return x.RequestID + } + return 0 +} + +func (x *SnowFailedQuery) GetPeerName() string { + if x != nil { + return x.PeerName + } + return "" +} + +var File_snowman_proto protoreflect.FileDescriptor + +var file_snowman_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x6d, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x09, 0x73, 0x6e, 0x6f, 0x77, 0x43, + 0x68, 0x69, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, + 0x0a, 0x10, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x42, 0x6c, 0x6b, 0x48, 0x61, + 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x72, 0x65, 0x64, 0x42, 0x6c, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x42, 0x6c, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x42, 0x6c, 0x6b, + 0x48, 0x61, 0x73, 0x68, 0x22, 0x66, 0x0a, 0x0c, 0x73, 0x6e, 0x6f, 0x77, 0x47, 0x65, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x66, 0x0a, 0x0c, + 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, + 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, + 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x44, + 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x44, 0x61, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x6c, 0x6c, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x67, 0x0a, + 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, + 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, + 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x22, 0x4b, 0x0a, 0x0f, 0x73, 0x6e, 0x6f, 0x77, 0x46, 0x61, + 0x69, 0x6c, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x42, 0x1f, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x33, 0x33, 0x63, 0x6e, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_snowman_proto_rawDescOnce sync.Once + file_snowman_proto_rawDescData = file_snowman_proto_rawDesc +) + +func file_snowman_proto_rawDescGZIP() []byte { + file_snowman_proto_rawDescOnce.Do(func() { + file_snowman_proto_rawDescData = protoimpl.X.CompressGZIP(file_snowman_proto_rawDescData) + }) + return file_snowman_proto_rawDescData +} + +var file_snowman_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_snowman_proto_goTypes = []interface{}{ + (*SnowChits)(nil), // 0: types.snowChits + (*SnowGetBlock)(nil), // 1: types.snowGetBlock + (*SnowPutBlock)(nil), // 2: types.snowPutBlock + (*SnowPullQuery)(nil), // 3: types.snowPullQuery + (*SnowPushQuery)(nil), // 4: types.snowPushQuery + (*SnowFailedQuery)(nil), // 5: types.snowFailedQuery +} +var file_snowman_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_snowman_proto_init() } +func file_snowman_proto_init() { + if File_snowman_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_snowman_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowChits); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_snowman_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowGetBlock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_snowman_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowPutBlock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_snowman_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowPullQuery); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_snowman_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowPushQuery); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_snowman_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowFailedQuery); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_snowman_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_snowman_proto_goTypes, + DependencyIndexes: file_snowman_proto_depIdxs, + MessageInfos: file_snowman_proto_msgTypes, + }.Build() + File_snowman_proto = out.File + file_snowman_proto_rawDesc = nil + file_snowman_proto_goTypes = nil + file_snowman_proto_depIdxs = nil +} From 3c78f389ab43a16dabe47056e714980cb01a6abd Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 8 Jan 2024 17:23:23 +0800 Subject: [PATCH 19/85] integrate snowman communication protocol in dht --- system/p2p/dht/protocol/snowman/handler.go | 237 +++++++++++++++++++++ system/p2p/dht/protocol/snowman/snowman.go | 54 +++++ system/p2p/dht/protocol/snowman/util.go | 45 ++++ 3 files changed, 336 insertions(+) create mode 100644 system/p2p/dht/protocol/snowman/handler.go create mode 100644 system/p2p/dht/protocol/snowman/snowman.go create mode 100644 system/p2p/dht/protocol/snowman/util.go diff --git a/system/p2p/dht/protocol/snowman/handler.go b/system/p2p/dht/protocol/snowman/handler.go new file mode 100644 index 000000000..c6d3dc1e4 --- /dev/null +++ b/system/p2p/dht/protocol/snowman/handler.go @@ -0,0 +1,237 @@ +package snowman + +import ( + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/system/p2p/dht/protocol" + "github.com/33cn/chain33/types" + "github.com/libp2p/go-libp2p/core/network" + "github.com/libp2p/go-libp2p/core/peer" + "time" +) + + +/* + +event handler 为内部系统模块通信消息处理 + +stream handler 为外部网络节点通信消息处理 + + */ + + + + +func (s *snowman) handleEventChits(msg *queue.Message) { + + + req := msg.GetData().(*types.SnowChits) + + pid, _ := peer.Decode(req.PeerName) + stream, err := s.Host.NewStream(s.Ctx, pid, snowChitsID) + if err != nil { + log.Error("handleEventChits", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanQueryFailed, req.RequestID, req.PeerName) + return + } + + _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) + defer protocol.CloseStream(stream) + + err = protocol.WriteStream(req, stream) + if err != nil { + log.Error("handleEventChits", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanQueryFailed, req.RequestID, req.PeerName) + } + +} + + +func (s *snowman) handleEventGetBlock(msg *queue.Message) { + + req := msg.GetData().(*types.SnowGetBlock) + + pid, _ := peer.Decode(req.PeerName) + stream, err := s.Host.NewStream(s.Ctx, pid, snowGetBlock) + if err != nil { + log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanGetFailed, req.RequestID, req.PeerName) + return + } + + _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) + defer protocol.CloseStream(stream) + + err = protocol.WriteStream(req, stream) + if err != nil { + log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanGetFailed, req.RequestID, req.PeerName) + } + + rep := &types.SnowPutBlock{} + err = protocol.ReadStream(rep, stream) + + if err != nil || len(rep.GetBlockData()) == 0 { + log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "readStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanGetFailed, req.RequestID, req.PeerName) + } + + rep.PeerName = req.PeerName + err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanPutBlock, rep), false) + if err != nil { + log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "send queue err", err) + } + +} + + +func (s *snowman) handleEventPutBlock(msg *queue.Message) { + + req := msg.GetData().(*types.SnowPutBlock) + + pid, _ := peer.Decode(req.PeerName) + stream, err := s.Host.NewStream(s.Ctx, pid, snowPutBlock) + if err != nil { + log.Error("handleEventPutBlock", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) + return + } + + _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) + defer protocol.CloseStream(stream) + + err = protocol.WriteStream(req, stream) + if err != nil { + log.Error("handleEventPutBlock", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) + } +} + + + +func (s *snowman) handleEventPullQuery(msg *queue.Message) { + + req := msg.GetData().(*types.SnowPullQuery) + + pid, _ := peer.Decode(req.PeerName) + stream, err := s.Host.NewStream(s.Ctx, pid, snowPullQuery) + if err != nil { + log.Error("handleEventPullQuery", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanQueryFailed, req.RequestID, req.PeerName) + return + } + + _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) + defer protocol.CloseStream(stream) + + err = protocol.WriteStream(req, stream) + if err != nil { + log.Error("handleEventPullQuery", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanQueryFailed, req.RequestID, req.PeerName) + } +} + + +func (s *snowman) handleEventPushQuery(msg *queue.Message) { + + req := msg.GetData().(*types.SnowPushQuery) + + pid, _ := peer.Decode(req.PeerName) + stream, err := s.Host.NewStream(s.Ctx, pid, snowPushQuery) + if err != nil { + log.Error("handleEventPushQuery", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanQueryFailed, req.RequestID, req.PeerName) + return + } + + _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) + defer protocol.CloseStream(stream) + + err = protocol.WriteStream(req, stream) + if err != nil { + log.Error("handleEventPushQuery", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) + s.sendQueryFailedMsg(types.EventSnowmanQueryFailed, req.RequestID, req.PeerName) + } +} + + + +func (s *snowman) handleStreamChits(stream network.Stream) { + + + req := &types.SnowChits{} + err := protocol.ReadStream(req, stream) + peerName := stream.Conn().RemotePeer().String() + if err != nil { + log.Error("handleStreamChits", "reqID", req.RequestID, "peer", peerName, "readStream err", err) + return + } + req.PeerName = peerName + err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanChits, req), false) + + if err != nil { + log.Error("handleStreamChits", "reqID", req.RequestID, "peer", peerName, "send queue err", err) + } +} + + +func (s *snowman) handleStreamGetBlock(stream network.Stream) { + + req := &types.SnowGetBlock{} + err := protocol.ReadStream(req, stream) + peerName := stream.Conn().RemotePeer().String() + if err != nil { + log.Error("handleStreamGetBlock", "reqID", req.RequestID, "peer", peerName, "readStream err", err) + return + } + + reply := &types.SnowPutBlock{RequestID: req.RequestID, PeerName: req.GetPeerName()} + + blk, err := s.getBlock(req.GetBlockHash()) + + if err != nil { + log.Error("handleStreamGetBlock", "reqID", req.RequestID, "peer", peerName, "getBlock err", err) + }else { + reply.BlockData = types.Encode(blk) + } + + err = protocol.WriteStream(reply, stream) + if err != nil { + log.Error("handleStreamGetBlock", "reqID", req.RequestID, "peer", peerName, "writeStream err", err) + } +} + + + +func (s *snowman) handleStreamPullQuery(stream network.Stream) { + + req := &types.SnowPullQuery{} + err := protocol.ReadStream(req, stream) + peerName := stream.Conn().RemotePeer().String() + if err != nil { + log.Error("handleStreamPullQuery", "reqID", req.RequestID, "peer", peerName, "readStream err", err) + return + } + req.PeerName = peerName + err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanPullQuery, req), false) + + if err != nil { + log.Error("handleStreamPullQuery", "reqID", req.RequestID, "peer", req.PeerName, "send queue err", err) + } +} + + +func (s *snowman) handleStreamPushQuery(stream network.Stream) { + + + req := &types.SnowPushQuery{} + err := protocol.ReadStream(req, stream) + peerName := stream.Conn().RemotePeer().String() + if err != nil { + log.Error("handleStreamPushQuery", "reqID", req.RequestID, "peer", peerName, "readStream err", err) + return + } + req.PeerName = peerName + err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanPushQuery, req), false) + + if err != nil { + log.Error("handleStreamPushQuery", "reqID", req.RequestID, "peer", req.PeerName, "send queue err", err) + } +} diff --git a/system/p2p/dht/protocol/snowman/snowman.go b/system/p2p/dht/protocol/snowman/snowman.go new file mode 100644 index 000000000..d3c80f9fd --- /dev/null +++ b/system/p2p/dht/protocol/snowman/snowman.go @@ -0,0 +1,54 @@ +package snowman + +import ( + "github.com/33cn/chain33/common/log/log15" + "github.com/33cn/chain33/system/p2p/dht/protocol" + "github.com/33cn/chain33/types" +) + + +const ( + + snowChitsID = "/chain33/snowman/chits/1.0" + snowGetBlock = "/chain33/snowman/get/1.0" + snowPutBlock = "/chain33/snowman/put/1.0" + snowPullQuery = "/chain33/snowman/pullq/1.0" + snowPushQuery= "/chain33/snowman/pushq/1.0" +) + + + +var log = log15.New("module", "dht.snowman") + +func init() { + protocol.RegisterProtocolInitializer(InitProtocol) +} + + +type snowman struct { + *protocol.P2PEnv +} + + + +// InitProtocol init protocol +func InitProtocol(env *protocol.P2PEnv) { + new(snowman).init(env) +} + +func (s *snowman) init(env *protocol.P2PEnv) { + + + s.P2PEnv = env + protocol.RegisterEventHandler(types.EventSnowmanChits, s.handleEventChits) + protocol.RegisterEventHandler(types.EventSnowmanGetBlock, s.handleEventGetBlock) + protocol.RegisterEventHandler(types.EventSnowmanPutBlock, s.handleEventPutBlock) + protocol.RegisterEventHandler(types.EventSnowmanPullQuery, s.handleEventPullQuery) + protocol.RegisterEventHandler(types.EventSnowmanPushQuery, s.handleEventPushQuery) + + + protocol.RegisterStreamHandler(s.Host, snowChitsID, s.handleStreamChits) + protocol.RegisterStreamHandler(s.Host, snowGetBlock, s.handleStreamGetBlock) + protocol.RegisterStreamHandler(s.Host, snowPullQuery, s.handleStreamPullQuery) + protocol.RegisterStreamHandler(s.Host, snowPushQuery, s.handleStreamPushQuery) +} diff --git a/system/p2p/dht/protocol/snowman/util.go b/system/p2p/dht/protocol/snowman/util.go new file mode 100644 index 000000000..19eb3ccff --- /dev/null +++ b/system/p2p/dht/protocol/snowman/util.go @@ -0,0 +1,45 @@ +package snowman + +import ( + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" +) + +const ( + + consensusTopic = "consensus" +) + + + +func consensusMsg(msgID int64, data interface{}) *queue.Message { + + return queue.NewMessage(msgID, consensusTopic, types.EventForFinalizer, data) +} + + +func (s *snowman) sendQueryFailedMsg(msgID int64, reqID uint32, peerName string) { + + msg := &types.SnowFailedQuery{ + RequestID: reqID, + PeerName: peerName, + } + + err := s.P2PManager.Client.Send(consensusMsg(msgID, msg), false) + + if err != nil { + + log.Error("sendQueryFailedMsg", "reqID", reqID, "send queue err", err) + } +} + + +func (s *snowman) getBlock(hash []byte) (*types.Block, error) { + + details, err := s.API.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{hash}}) + if err != nil || len(details.GetItems()) < 1 { + return nil, err + } + + return details.GetItems()[0].GetBlock(), nil +} From 0bf08a4a5cad36e28792af9287371280f097157b Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 8 Jan 2024 18:33:22 +0800 Subject: [PATCH 20/85] add snowball parameters config --- blockchain/proc.go | 2 +- system/consensus/snowman/config.go | 20 ------- system/consensus/snowman/finalize.go | 80 ++++++++++++++++++++++------ 3 files changed, 64 insertions(+), 38 deletions(-) diff --git a/blockchain/proc.go b/blockchain/proc.go index 74016d42c..8191ff73d 100644 --- a/blockchain/proc.go +++ b/blockchain/proc.go @@ -119,7 +119,7 @@ func (chain *BlockChain) ProcRecvMsg() { case types.EventHighestBlock: go chain.processMsg(msg, reqnum, chain.highestBlockNum) case types.EventSnowmanPreferBlk: - go chain.finalizer.eventPrferBlock(msg) + go chain.finalizer.eventPreferBlock(msg) case types.EventSnowmanAcceptBlk: go chain.finalizer.eventAcceptBlock(msg) case types.EventSnowmanLastAcceptHeight: diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index 8e4ad2618..fc370e46a 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -11,33 +11,13 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/avalanchego/snow/consensus/snowball" smcon "github.com/ava-labs/avalanchego/snow/consensus/snowman" - "github.com/ava-labs/avalanchego/snow/engine/common" snowcom "github.com/ava-labs/avalanchego/snow/engine/common" smeng "github.com/ava-labs/avalanchego/snow/engine/snowman" snowgetter "github.com/ava-labs/avalanchego/snow/engine/snowman/getter" - "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/utils/logging" - "github.com/prometheus/client_golang/prometheus" "gopkg.in/natefinch/lumberjack.v2" ) -// Config wraps all the parameters needed for a snowman engine -type Config struct { - common.AllGetsServer - - //ctx *consensus.Context - chainCfg *types.Chain33Config - - ctx *snow.ConsensusContext - log logging.Logger - registerer prometheus.Registerer - //VM block.ChainVM - //Sender common.Sender - validators validators.Set - params snowball.Parameters - consensus smcon.Consensus -} - func newSnowmanConfig(sm *snowman, params snowball.Parameters, snowCtx *snow.ConsensusContext) smeng.Config { sender := newMsgSender(sm, snowCtx) diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/finalize.go index 4c1095886..22bb77683 100644 --- a/system/consensus/snowman/finalize.go +++ b/system/consensus/snowman/finalize.go @@ -31,6 +31,15 @@ func init() { } +// Config snowman 参数配置 +type Config struct { + K int `json:"k" yaml:"k"` + Alpha int `json:"alpha" yaml:"alpha"` + BetaVirtuous int `json:"betaVirtuous" yaml:"betaVirtuous"` + BetaRogue int `json:"betaRogue" yaml:"betaRogue"` + ConcurrentRepolls int `json:"concurrentRepolls" yaml:"concurrentRepolls"` +} + type snowman struct { engine smeng.Engine vm *chain33VM @@ -42,39 +51,75 @@ type snowman struct { func (s *snowman) Initialize(ctx *consensus.Context) { - s.inMsg = make(chan *queue.Message, 32) - - params := snowball.DefaultParameters - err := params.Verify() + s.params = snowball.DefaultParameters + s.applyConfig(ctx.Base.GetAPI().GetConfig().GetSubConfig()) + err := s.params.Verify() if err != nil { - panic("Initialize snowman engine invalid snowball parameters:" + err.Error()) + panic("Initialize invalid snowball parameters:" + err.Error()) } - s.params = params - vm := &chain33VM{} - vm.Init(ctx) - vs := &vdrSet{} - vs.init(ctx) + s.vm = &chain33VM{} + s.vm.Init(ctx) - s.vm = vm - s.vs = vs - - engineConfig := newSnowmanConfig(s, params, newSnowContext(ctx.Base.GetAPI().GetConfig())) + s.vs = &vdrSet{} + s.vs.init(ctx) + engineConfig := newSnowmanConfig(s, s.params, newSnowContext(ctx.Base.GetAPI().GetConfig())) engine, err := smeng.New(engineConfig) - if err != nil { panic("Initialize snowman engine err:" + err.Error()) } s.engine = engine + s.inMsg = make(chan *queue.Message, 32) go s.startRoutine() +} + +func (s *snowman) applyConfig(subCfg *types.ConfigSubModule) { + + cfg := &Config{} + types.MustDecode(subCfg.Consensus["snowman"], cfg) + + if cfg.K > 0 { + s.params.K = cfg.K + } + + if cfg.Alpha > 0 { + s.params.Alpha = cfg.Alpha + } + if cfg.BetaVirtuous > 0 { + s.params.BetaVirtuous = cfg.BetaVirtuous + } + + if cfg.BetaRogue > 0 { + s.params.BetaRogue = cfg.BetaRogue + } + + if cfg.ConcurrentRepolls > 0 { + s.params.ConcurrentRepolls = cfg.ConcurrentRepolls + } +} + +func (s *snowman) getChainSyncStatus() bool { + + reply, err := s.ctx.Base.GetAPI().IsSync() + + if err != nil { + snowLog.Error("getChainSyncStatus", "err", err) + return false + } + + return reply.GetIsOk() } func (s *snowman) startRoutine() { - // TODO check sync status + // check chain sync status + for !s.getChainSyncStatus() { + snowLog.Info("startRoutine wait chain state syncing...") + time.Sleep(5 * time.Second) + } // check connected peers for { @@ -83,7 +128,8 @@ func (s *snowman) startRoutine() { if err == nil && len(peers) >= s.params.K { break } - snowLog.Debug("startRoutine wait Peers", "getConnectedPeers", len(peers), "err", err) + snowLog.Debug("startRoutine wait more snowman peer connected...", + "currConnected", len(peers), "minRequiredNum", s.params.K, "err", err) time.Sleep(2 * time.Second) } From 5a2bb5f7b48d41088484c80f01da22497c887525 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:27:37 +0800 Subject: [PATCH 21/85] adapt to grpc version update --- rpc/grpcclient/resolver.go | 2 +- rpc/grpcclient/syncBalancer.go | 3 +-- rpc/grpcclient/syncResolver.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rpc/grpcclient/resolver.go b/rpc/grpcclient/resolver.go index bd15c669f..b6c480182 100644 --- a/rpc/grpcclient/resolver.go +++ b/rpc/grpcclient/resolver.go @@ -51,7 +51,7 @@ func (*multipleBuilder) Build(target resolver.Target, cc resolver.ClientConn, op cc: cc, } - urls := strings.Split(target.Endpoint, ",") + urls := strings.Split(target.Endpoint(), ",") if len(urls) < 1 { return nil, fmt.Errorf("invalid target address %v", target) } diff --git a/rpc/grpcclient/syncBalancer.go b/rpc/grpcclient/syncBalancer.go index d7d2567b8..5b20a8d12 100644 --- a/rpc/grpcclient/syncBalancer.go +++ b/rpc/grpcclient/syncBalancer.go @@ -30,8 +30,7 @@ type AddrInfo struct { // SetAddrInfo returns a copy of addr in which the Attributes field is updated // with addrInfo. func SetAddrInfo(addr resolver.Address, addrInfo AddrInfo) resolver.Address { - addr.Attributes = attributes.New() - addr.Attributes = addr.Attributes.WithValues(attributeKey{}, addrInfo) + addr.Attributes = attributes.New(attributeKey{}, addrInfo) return addr } diff --git a/rpc/grpcclient/syncResolver.go b/rpc/grpcclient/syncResolver.go index c860a1efe..25de6ecba 100644 --- a/rpc/grpcclient/syncResolver.go +++ b/rpc/grpcclient/syncResolver.go @@ -43,7 +43,7 @@ func (*syncBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts r stopC: make(chan struct{}, 1), } - urls := strings.Split(target.Endpoint, ",") + urls := strings.Split(target.Endpoint(), ",") if len(urls) < 1 { return nil, fmt.Errorf("invalid target address %v", target) } From 0eab4ca69fe1898600c18d778a4209e86e4b7d5e Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:41:01 +0800 Subject: [PATCH 22/85] update dependency btcd/btcec to v2 --- common/vrf/secp256k1/secp256k1.go | 2 +- go.mod | 52 +++++---- go.sum | 127 +++++++++++++-------- system/consensus/init/init.go | 1 + system/crypto/btcscript/btcscript_test.go | 2 +- system/crypto/btcscript/script/builtin.go | 2 +- system/crypto/btcscript/script/util.go | 8 +- system/crypto/secp256k1/secp256k1.go | 2 +- system/crypto/secp256k1eth/secp256k1eth.go | 2 +- system/crypto/sm2/utils.go | 2 +- 10 files changed, 120 insertions(+), 80 deletions(-) diff --git a/common/vrf/secp256k1/secp256k1.go b/common/vrf/secp256k1/secp256k1.go index 0b97b6a64..d809d361a 100644 --- a/common/vrf/secp256k1/secp256k1.go +++ b/common/vrf/secp256k1/secp256k1.go @@ -33,7 +33,7 @@ import ( "math/big" vrfp "github.com/33cn/chain33/common/vrf" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/btcec" ) var ( diff --git a/go.mod b/go.mod index 50bec0d37..9efc02e5c 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,14 @@ module github.com/33cn/chain33 go 1.19 require ( - github.com/BurntSushi/toml v1.2.0 + github.com/BurntSushi/toml v1.2.1 github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b github.com/ava-labs/avalanchego v1.10.9 - github.com/btcsuite/btcd v0.22.1 + github.com/btcsuite/btcd v0.23.4 + github.com/btcsuite/btcd/btcec v0.0.0-00010101000000-000000000000 + github.com/btcsuite/btcd/btcec/v2 v2.3.2 + github.com/btcsuite/btcd/btcutil v1.1.3 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 - github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/decred/base58 v1.0.3 github.com/dgraph-io/badger v1.6.2 github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 @@ -30,7 +32,6 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.9.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.14.0 github.com/qianlnk/pgbar v0.0.0-20210208085217-8c19b9f2477e github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 github.com/rs/cors v1.7.0 @@ -39,12 +40,11 @@ require ( github.com/stretchr/testify v1.8.2 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a github.com/tjfoc/gmsm v1.3.2 - go.uber.org/zap v1.24.0 - golang.org/x/crypto v0.7.0 - golang.org/x/net v0.8.0 - golang.org/x/sys v0.8.0 - google.golang.org/grpc v1.55.0 - google.golang.org/protobuf v1.30.0 + golang.org/x/crypto v0.9.0 + golang.org/x/net v0.10.0 + golang.org/x/sys v0.9.0 + google.golang.org/grpc v1.56.1 + google.golang.org/protobuf v1.31.0 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/go-playground/webhooks.v5 v5.2.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 @@ -55,13 +55,12 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 // indirect github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01 // indirect - github.com/apache/arrow/go/v10 v10.0.1 // indirect + github.com/apache/arrow/go/v11 v11.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/benbjohnson/immutable v0.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/errors v1.9.1 // indirect @@ -98,6 +97,7 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/rpc v1.2.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 // indirect @@ -162,6 +162,7 @@ require ( github.com/pegasus-kv/thrift v0.13.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect + github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect @@ -192,11 +193,11 @@ require ( github.com/yusufpapurcu/wmi v1.2.2 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.10.0 // indirect @@ -204,16 +205,19 @@ require ( go.uber.org/fx v1.19.2 // indirect go.uber.org/mock v0.2.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-20230321023759-10a507213a29 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/term v0.7.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/term v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gonum.org/v1/gonum v0.11.0 // indirect - google.golang.org/api v0.110.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + google.golang.org/api v0.128.0 // indirect + google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -221,3 +225,5 @@ require ( lukechampine.com/blake3 v1.1.7 // indirect nhooyr.io/websocket v1.8.7 // indirect ) + +replace github.com/btcsuite/btcd/btcec => github.com/btcsuite/btcd v0.22.3 diff --git a/go.sum b/go.sum index 62ccf50e1..089d950eb 100644 --- a/go.sum +++ b/go.sum @@ -24,15 +24,15 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/bigquery v1.48.0 h1:u+fhS1jJOkPO9vdM84M8HO5VznTfVUicBeoXNKD26ho= +cloud.google.com/go/bigquery v1.50.0 h1:RscMV6LbnAmhAzD893Lv9nXXy2WCaJmbxYPWDLbGqNQ= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/bigtable v1.3.0 h1:PAplkJLXheOLlK5PPyy4/HXtPzHn+1/LaYDWIeGxnio= cloud.google.com/go/bigtable v1.3.0/go.mod h1:z5EyKrPE8OQmeg4h5MNdKvuSnI9CCT49Ki3f23aBzio= -cloud.google.com/go/compute v1.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY= +cloud.google.com/go/compute v1.19.3 h1:DcTwsFgGev/wV5+q8o2fzgcHOaac+DKGC91ZlvpsQds= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE= +cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= @@ -86,8 +86,8 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= -github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= @@ -120,6 +120,7 @@ github.com/VictoriaMetrics/fastcache v1.10.0 h1:5hDJnLsKLpnUEToub7ETuRu8RCkb40wo github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b h1:KF7k0g1S53oeveZxGM2wfyT5PSpO82ZxBrYlA5mM0cw= github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b/go.mod h1:VrfgKISflRhFm32m3e0SXLccvNJTyG8PRywWbUuGEfY= +github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw= @@ -143,8 +144,8 @@ github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VT github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01 h1:FSqtT0UCktIlSU19mxj0YE5HK3HOO4IFMU9BpOif/7A= github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= -github.com/apache/arrow/go/v10 v10.0.1 h1:n9dERvixoC/1JjDmBcs9FPaEryoANa2sCgVFo6ez9cI= -github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= +github.com/apache/arrow/go/v11 v11.0.0 h1:hqauxvFQxww+0mEU/2XHG6LT7eZternCZq+A5Yly2uM= +github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= @@ -183,21 +184,36 @@ github.com/bonitoo-io/go-sql-bigquery v0.3.4-1.4.0 h1:MaVh0h9+KaMnJcoDvvIGp+O3fe github.com/bonitoo-io/go-sql-bigquery v0.3.4-1.4.0/go.mod h1:J4Y6YJm0qTWB9aFziB7cPeSyc6dOZFyJdteSeybVpXQ= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg= +github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ= +github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= +github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= @@ -207,8 +223,8 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n github.com/cenkalti/backoff v0.0.0-20181003080854-62661b46c409/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -282,8 +298,11 @@ github.com/decred/base58 v1.0.3 h1:KGZuh8d1WEMIrK0leQRM47W85KqCAdl2N+uagbctdDI= github.com/decred/base58 v1.0.3/go.mod h1:pXP9cXCfM2sFLb2viz2FNIdeMWmZDBKG3ZBYbiSM78E= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= github.com/denisenkom/go-mssqldb v0.10.0 h1:QykgLZBorFE95+gO3u9esLd0BmbvpWp0/waNNZfHBM8= @@ -625,18 +644,19 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b h1:Qcx5LM0fSiks9uCyFZwDBUasd3lxd1RM0GYpL+Li5o4= github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= +github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.4.0/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -783,6 +803,7 @@ github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0 github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= @@ -792,6 +813,7 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -823,6 +845,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -1061,6 +1084,7 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= @@ -1068,6 +1092,7 @@ github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3 github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= @@ -1313,6 +1338,7 @@ github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= @@ -1410,16 +1436,16 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 h1:0dly5et1i/6Th3WHn0M6kYiJfFNzhhxanrJ0bOfnjEo= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0/go.mod h1:+Lq4/WkdCkjbGcBMVHHg2apTbv8oMBf29QCnyCCJjNQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 h1:eyJ6njZmH16h9dOKCi7lMswAnGsSOwgTqWzfxqcuNr8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0/go.mod h1:FnDp7XemjN3oZ3xGunnfOUTVwd2XcvLbtRAuOSU3oc8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0/go.mod h1:pILgiTEtrqvZpoiuGdblDgS5dbIaTgDrkIuKfEFkt+A= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.0 h1:v29I/NbVp7LXQYMFZhU6q17D0jSEbYOAVONlrO1oH5s= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.0/go.mod h1:/RpLsmbQLDO1XCbWAM4S6TSwj8FKwwgyKKyqtvVfAnw= -go.opentelemetry.io/otel/sdk v1.11.0 h1:ZnKIL9V9Ztaq+ME43IUi/eo22mNsb6a7tGfzaOWB5fo= -go.opentelemetry.io/otel/sdk v1.11.0/go.mod h1:REusa8RsyKaq0OlyangWXaw97t2VogoO4SSEeKkSTAk= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 h1:fqR1kli93643au1RKo0Uma3d2aPQKT+WBKfTSBaKbOc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2/go.mod h1:5Qn6qvgkMsLDX+sYK64rHb1FPhpn0UtxF+ouX1uhyJE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKPn9Aer7Gxsc0+ZlutlH1bEEAUXAUhqm3Y45ABbk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2/go.mod h1:jWZUM2MWhWCJ9J9xVbRx7tzK1mXKpAlze4CeulycwVY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2 h1:Us8tbCmuN16zAnK5TC69AtODLycKbwnskQzaB6DfFhc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2/go.mod h1:GZWSQQky8AgdJj50r1KJm8oiQiIPaAX7uZCFQX9GzC8= +go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= +go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= @@ -1484,7 +1510,6 @@ golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1495,8 +1520,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1539,6 +1564,7 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1588,6 +1614,7 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -1599,8 +1626,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1609,7 +1636,7 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= +golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1622,8 +1649,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1688,9 +1715,11 @@ golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1716,13 +1745,13 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1732,8 +1761,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1854,8 +1883,8 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= +google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= +google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1907,8 +1936,12 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -1937,8 +1970,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1952,8 +1985,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/system/consensus/init/init.go b/system/consensus/init/init.go index aa4e945c4..f18cc6398 100644 --- a/system/consensus/init/init.go +++ b/system/consensus/init/init.go @@ -6,6 +6,7 @@ package init import ( + _ "github.com/33cn/chain33/system/consensus/snowman" //初始化 _ "github.com/33cn/chain33/system/consensus/solo" ) diff --git a/system/crypto/btcscript/btcscript_test.go b/system/crypto/btcscript/btcscript_test.go index 906e9010c..75f7c72bc 100644 --- a/system/crypto/btcscript/btcscript_test.go +++ b/system/crypto/btcscript/btcscript_test.go @@ -16,8 +16,8 @@ import ( cryptocli "github.com/33cn/chain33/common/crypto/client" "github.com/stretchr/testify/mock" + "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/txscript" - "github.com/btcsuite/btcutil" "github.com/33cn/chain33/system/crypto/btcscript/script" _ "github.com/33cn/chain33/system/dapp/init" diff --git a/system/crypto/btcscript/script/builtin.go b/system/crypto/btcscript/script/builtin.go index 03bb7a785..6abde24fb 100644 --- a/system/crypto/btcscript/script/builtin.go +++ b/system/crypto/btcscript/script/builtin.go @@ -3,7 +3,7 @@ package script import ( "github.com/33cn/chain33/common/log" "github.com/btcsuite/btcd/txscript" - "github.com/btcsuite/btcutil" + "github.com/btcsuite/btcd/btcutil" ) var ( diff --git a/system/crypto/btcscript/script/util.go b/system/crypto/btcscript/script/util.go index 3f6c84fa4..89d6c3e0f 100644 --- a/system/crypto/btcscript/script/util.go +++ b/system/crypto/btcscript/script/util.go @@ -10,12 +10,12 @@ import ( "github.com/golang/protobuf/proto" "github.com/33cn/chain33/common" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" ) const ( @@ -56,7 +56,7 @@ type BtcAddr2Script struct { // NewBtcKeyFromBytes 获取比特币公私钥 func NewBtcKeyFromBytes(priv []byte) (*btcec.PrivateKey, *btcec.PublicKey) { - return btcec.PrivKeyFromBytes(btcec.S256(), priv) + return btcec.PrivKeyFromBytes(priv) } // GetBtcLockScript 根据地址类型,生成锁定脚本 @@ -103,7 +103,7 @@ func CheckBtcScript(msg []byte, sig *Signature) error { tx := getBindBtcTx(msg) setBtcTx(tx, sig.LockTime, sig.UtxoSequence, sig.UnlockScript) - vm, err := txscript.NewEngine(sig.LockScript, tx, 0, txscript.StandardVerifyFlags, nil, nil, 0) + vm, err := txscript.NewEngine(sig.LockScript, tx, 0, txscript.StandardVerifyFlags, nil, nil, 0, nil) if err != nil { return errors.New("new Script engine err:" + err.Error()) } diff --git a/system/crypto/secp256k1/secp256k1.go b/system/crypto/secp256k1/secp256k1.go index 9e3183bc9..a0b21831e 100644 --- a/system/crypto/secp256k1/secp256k1.go +++ b/system/crypto/secp256k1/secp256k1.go @@ -11,7 +11,7 @@ import ( "fmt" "github.com/33cn/chain33/common/crypto" - secp256k1 "github.com/btcsuite/btcd/btcec" + secp256k1 "github.com/btcsuite/btcd/btcec/btcec" ) //Driver 驱动 diff --git a/system/crypto/secp256k1eth/secp256k1eth.go b/system/crypto/secp256k1eth/secp256k1eth.go index 88fb11e0d..1871e405f 100644 --- a/system/crypto/secp256k1eth/secp256k1eth.go +++ b/system/crypto/secp256k1eth/secp256k1eth.go @@ -21,7 +21,7 @@ import ( "math/big" "github.com/33cn/chain33/system/crypto/secp256k1eth/types" - secp256k1 "github.com/btcsuite/btcd/btcec" + secp256k1 "github.com/btcsuite/btcd/btcec/btcec" etypes "github.com/ethereum/go-ethereum/core/types" ethcrypto "github.com/ethereum/go-ethereum/crypto" ) diff --git a/system/crypto/sm2/utils.go b/system/crypto/sm2/utils.go index 07964c62c..ac0497f6b 100644 --- a/system/crypto/sm2/utils.go +++ b/system/crypto/sm2/utils.go @@ -7,7 +7,7 @@ package sm2 import ( "math/big" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/btcec" "github.com/tjfoc/gmsm/sm2" ) From 7906244e156f0b62ecc9bddbe372d1afa4c41b54 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:54:55 +0800 Subject: [PATCH 23/85] mod:update vulnerable dep --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index c7f0ad6cb..fafe3c244 100644 --- a/go.mod +++ b/go.mod @@ -40,9 +40,9 @@ require ( github.com/stretchr/testify v1.8.2 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a github.com/tjfoc/gmsm v1.3.2 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.18.0 golang.org/x/net v0.17.0 - golang.org/x/sys v0.13.0 + golang.org/x/sys v0.16.0 google.golang.org/grpc v1.56.1 google.golang.org/protobuf v1.31.0 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c @@ -209,8 +209,8 @@ require ( golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/sync v0.2.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/term v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gonum.org/v1/gonum v0.11.0 // indirect diff --git a/go.sum b/go.sum index e205013d6..3f744e7d2 100644 --- a/go.sum +++ b/go.sum @@ -1520,8 +1520,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1745,13 +1745,13 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1761,8 +1761,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 29886438640f26c8b4cde03301d8c98c2a406108 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 11 Jan 2024 18:52:30 +0800 Subject: [PATCH 24/85] disable exec local tx log --- executor/executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/executor.go b/executor/executor.go index bf1c2223b..d14949c46 100755 --- a/executor/executor.go +++ b/executor/executor.go @@ -445,7 +445,7 @@ func (exec *Executor) procExecAddBlock(msg *queue.Message) { for i := 0; i < len(b.Txs); i++ { tx := b.Txs[i] execute.localDB.(*LocalDB).StartTx() - elog.Info("procExecAddBlock", "execute.execLocalTx:", ctx.height, "tx.From", tx.From(), "tx.Nonce", tx.Nonce) + //elog.Info("procExecAddBlock", "execute.execLocalTx:", ctx.height, "tx.From", tx.From(), "tx.Nonce", tx.Nonce) //解析TX PROXY_EXEC,优先解析代理执行交易进行execlocal 处理 if execute.checkProxyExecTx(tx) { From 552b3af55f0a744636b39a39d996caf045ac99cb Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:29:27 +0800 Subject: [PATCH 25/85] use zero len []byte instead of nil []byte --- common/db/go_level_db.go | 64 +++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/common/db/go_level_db.go b/common/db/go_level_db.go index c4c6aa46f..8e5fdcd1d 100644 --- a/common/db/go_level_db.go +++ b/common/db/go_level_db.go @@ -43,7 +43,7 @@ func init() { registerDBCreator(goLevelDBBackendStr, dbCreator, false) } -//GoLevelDB db +// GoLevelDB db type GoLevelDB struct { BaseDB db *leveldb.DB @@ -64,7 +64,7 @@ type GoLevelDB struct { quitChan chan chan error // Quit channel to stop the metrics collection before closing the database } -//NewGoLevelDB new +// NewGoLevelDB new func NewGoLevelDB(name string, dir string, cache int) (*GoLevelDB, error) { dbPath := path.Join(dir, name+".db") if cache == 0 { @@ -115,7 +115,7 @@ func NewGoLevelDB(name string, dir string, cache int) (*GoLevelDB, error) { return database, nil } -//Get get +// Get get func (db *GoLevelDB) Get(key []byte) ([]byte, error) { res, err := db.db.Get(key, nil) if err != nil { @@ -126,10 +126,13 @@ func (db *GoLevelDB) Get(key []byte) ([]byte, error) { return nil, err } + if res == nil { + return []byte{}, nil + } return res, nil } -//Set set +// Set set func (db *GoLevelDB) Set(key []byte, value []byte) error { err := db.db.Put(key, value, nil) if err != nil { @@ -139,7 +142,7 @@ func (db *GoLevelDB) Set(key []byte, value []byte) error { return nil } -//SetSync 同步 +// SetSync 同步 func (db *GoLevelDB) SetSync(key []byte, value []byte) error { err := db.db.Put(key, value, &opt.WriteOptions{Sync: true}) if err != nil { @@ -149,7 +152,7 @@ func (db *GoLevelDB) SetSync(key []byte, value []byte) error { return nil } -//Delete 删除 +// Delete 删除 func (db *GoLevelDB) Delete(key []byte) error { err := db.db.Delete(key, nil) if err != nil { @@ -159,7 +162,7 @@ func (db *GoLevelDB) Delete(key []byte) error { return nil } -//DeleteSync 删除同步 +// DeleteSync 删除同步 func (db *GoLevelDB) DeleteSync(key []byte) error { err := db.db.Delete(key, &opt.WriteOptions{Sync: true}) if err != nil { @@ -169,12 +172,12 @@ func (db *GoLevelDB) DeleteSync(key []byte) error { return nil } -//DB db +// DB db func (db *GoLevelDB) DB() *leveldb.DB { return db.db } -//Close 关闭 +// Close 关闭 func (db *GoLevelDB) Close() { if db.quitChan != nil { errc := make(chan error) @@ -191,7 +194,7 @@ func (db *GoLevelDB) Close() { } } -//Print 打印 +// Print 打印 func (db *GoLevelDB) Print() { str, err := db.db.GetProperty("leveldb.stats") if err != nil { @@ -208,7 +211,7 @@ func (db *GoLevelDB) Print() { } } -//Stats ... +// Stats ... func (db *GoLevelDB) Stats() map[string]string { keys := []string{ "leveldb.num-files-at-level{n}", @@ -231,7 +234,7 @@ func (db *GoLevelDB) Stats() map[string]string { return stats } -//Iterator 迭代器 +// Iterator 迭代器 func (db *GoLevelDB) Iterator(start []byte, end []byte, reverse bool) Iterator { if end == nil { end = bytesPrefix(start) @@ -244,7 +247,7 @@ func (db *GoLevelDB) Iterator(start []byte, end []byte, reverse bool) Iterator { return &goLevelDBIt{it, itBase{start, end, reverse}} } -//BeginTx call panic when BeginTx not rewrite +// BeginTx call panic when BeginTx not rewrite func (db *GoLevelDB) BeginTx() (TxKV, error) { tx, err := db.db.OpenTransaction() if err != nil { @@ -263,13 +266,14 @@ func (db *GoLevelDB) CompactRange(start, limit []byte) error { // the metrics subsystem. // // This is how a LevelDB stats table looks like (currently): -// Compactions -// Level | Tables | Size(MB) | Time(sec) | Read(MB) | Write(MB) -// -------+------------+---------------+---------------+---------------+--------------- -// 0 | 0 | 0.00000 | 1.27969 | 0.00000 | 12.31098 -// 1 | 85 | 109.27913 | 28.09293 | 213.92493 | 214.26294 -// 2 | 523 | 1000.37159 | 7.26059 | 66.86342 | 66.77884 -// 3 | 570 | 1113.18458 | 0.00000 | 0.00000 | 0.00000 +// +// Compactions +// Level | Tables | Size(MB) | Time(sec) | Read(MB) | Write(MB) +// -------+------------+---------------+---------------+---------------+--------------- +// 0 | 0 | 0.00000 | 1.27969 | 0.00000 | 12.31098 +// 1 | 85 | 109.27913 | 28.09293 | 213.92493 | 214.26294 +// 2 | 523 | 1000.37159 | 7.26059 | 66.86342 | 66.77884 +// 3 | 570 | 1113.18458 | 0.00000 | 0.00000 | 0.00000 // // This is how the write delay look like (currently): // DelayN:5 Delay:406.604657ms Paused: false @@ -466,12 +470,12 @@ type goLevelDBIt struct { itBase } -//Close 关闭 +// Close 关闭 func (dbit *goLevelDBIt) Close() { dbit.Iterator.Release() } -//Next next +// Next next func (dbit *goLevelDBIt) Next() bool { if dbit.reverse { return dbit.Iterator.Prev() && dbit.Valid() @@ -479,7 +483,7 @@ func (dbit *goLevelDBIt) Next() bool { return dbit.Iterator.Next() && dbit.Valid() } -//Seek seek key +// Seek seek key func (dbit *goLevelDBIt) Seek(key []byte) bool { exist := dbit.Iterator.Seek(key) @@ -490,7 +494,7 @@ func (dbit *goLevelDBIt) Seek(key []byte) bool { return exist } -//Rewind ... +// Rewind ... func (dbit *goLevelDBIt) Rewind() bool { if dbit.reverse { return dbit.Iterator.Last() && dbit.Valid() @@ -525,7 +529,7 @@ type goLevelDBBatch struct { len int } -//NewBatch new +// NewBatch new func (db *GoLevelDB) NewBatch(sync bool) Batch { batch := new(leveldb.Batch) wop := &opt.WriteOptions{Sync: sync} @@ -558,7 +562,7 @@ func (mBatch *goLevelDBBatch) ValueSize() int { return mBatch.size } -//ValueLen batch数量 +// ValueLen batch数量 func (mBatch *goLevelDBBatch) ValueLen() int { return mBatch.len } @@ -585,7 +589,7 @@ func (db *goLevelDBTx) Rollback() { db.tx.Discard() } -//Get get in transaction +// Get get in transaction func (db *goLevelDBTx) Get(key []byte) ([]byte, error) { res, err := db.tx.Get(key, nil) if err != nil { @@ -598,7 +602,7 @@ func (db *goLevelDBTx) Get(key []byte) ([]byte, error) { return res, nil } -//Set set in transaction +// Set set in transaction func (db *goLevelDBTx) Set(key []byte, value []byte) error { err := db.tx.Put(key, value, nil) if err != nil { @@ -608,7 +612,7 @@ func (db *goLevelDBTx) Set(key []byte, value []byte) error { return nil } -//Iterator 迭代器 in transaction +// Iterator 迭代器 in transaction func (db *goLevelDBTx) Iterator(start []byte, end []byte, reverse bool) Iterator { if end == nil { end = bytesPrefix(start) @@ -621,7 +625,7 @@ func (db *goLevelDBTx) Iterator(start []byte, end []byte, reverse bool) Iterator return &goLevelDBIt{it, itBase{start, end, reverse}} } -//Begin call panic when Begin not rewrite +// Begin call panic when Begin not rewrite func (db *goLevelDBTx) Begin() { panic("Begin not impl") } From c93fcc1732d30d9b898b64dfd0194b642183bd4d Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:30:58 +0800 Subject: [PATCH 26/85] set initial finalized block --- blockchain/blockfinalize.go | 27 ++++++++++++++------------- blockchain/process.go | 15 ++++++++++----- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 42399300a..a57105a9c 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -9,7 +9,7 @@ import ( ) var ( - blkFinalizingStartHeight int64 + blockFinalizeStartHeight int64 blkFinalizeLastAcceptBlkKey = []byte("chain-blockfinalize-acceptblk") ) @@ -27,17 +27,18 @@ func newFinalizer(chain *BlockChain) *finalizer { if err == nil { types.Decode(raw, &f.header) - return f } - detail, err := chain.GetBlock(blkFinalizingStartHeight) - if err != nil { - chainlog.Error("newFinalizer", "height", blkFinalizingStartHeight, "get block err", err) - panic(err) + if chain.blockStore.Height() >= blockFinalizeStartHeight { + + detail, err := chain.GetBlock(blockFinalizeStartHeight) + if err != nil { + chainlog.Error("newFinalizer", "height", blockFinalizeStartHeight, "get block err", err) + panic(err) + } + f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(chain.client.GetConfig())) } - f.header.Hash = detail.GetBlock().Hash(chain.client.GetConfig()) - f.header.Height = detail.GetBlock().GetHeight() return f } @@ -90,15 +91,15 @@ func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { return nil } -func (f *finalizer) getFinalizedHeight() int64 { +func (f *finalizer) getFinalizedBlock() (int64, []byte) { f.lock.RLock() defer f.lock.RUnlock() - return f.header.Height + return f.header.Height, f.header.Hash } func (f *finalizer) eventLastAcceptHeight(msg *queue.Message) { - height := f.getFinalizedHeight() - chainlog.Debug("eventLastAcceptHeight", "height", height) - msg.Reply(f.chain.client.NewMessage("consensus", types.EventSnowmanLastAcceptHeight, &types.Int64{Data: height})) + height, hash := f.getFinalizedBlock() + chainlog.Debug("eventLastAcceptHeight", "height", height, "hash", hex.EncodeToString(hash)) + msg.Reply(f.chain.client.NewMessage("consensus", types.EventSnowmanLastAcceptHeight, &types.ReqBytes{Data: hash})) } diff --git a/blockchain/process.go b/blockchain/process.go index 44c91cd65..f881c89db 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -283,6 +283,7 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD var lastSequence int64 cfg := chain.client.GetConfig() block := blockdetail.Block + blkHash := block.Hash(cfg) prevStateHash := chain.bestChain.Tip().statehash errReturn := (node.pid != "self") blockdetail, _, err = execBlock(chain.client, prevStateHash, block, errReturn, sync) @@ -313,7 +314,7 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD if node.pid == "self" { prevhash := node.hash node.statehash = blockdetail.Block.GetStateHash() - node.hash = blockdetail.Block.Hash(cfg) + node.hash = blkHash chain.index.UpdateNode(prevhash, node) } @@ -358,7 +359,7 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD blocktd = new(big.Int).Add(difficulty, parenttd) } - err = chain.blockStore.SaveTdByBlockHash(newbatch, blockdetail.Block.Hash(cfg), blocktd) + err = chain.blockStore.SaveTdByBlockHash(newbatch, blkHash, blocktd) if err != nil { chainlog.Error("connectBlock SaveTdByBlockHash:", "height", block.Height, "err", err) return nil, err @@ -371,12 +372,16 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD } writeCost := types.Since(beg) chainlog.Info("ConnectBlock", "execLocal", txCost, "saveBlk", saveBlkCost, "cacheBlk", cacheCost, "writeBatch", writeCost) - chainlog.Debug("connectBlock info", "height", block.Height, "batchsync", sync, "hash", common.ToHex(blockdetail.Block.Hash(cfg))) + chainlog.Debug("connectBlock info", "height", block.Height, "batchsync", sync, "hash", common.ToHex(blkHash)) // 更新最新的高度和header chain.blockStore.UpdateHeight2(blockdetail.GetBlock().GetHeight()) chain.blockStore.UpdateLastBlock2(blockdetail.Block) + if block.Height == blockFinalizeStartHeight { + chain.finalizer.setFinalizedBlock(block.Height, blkHash) + } + // 更新 best chain的tip节点 chain.bestChain.SetTip(node) @@ -393,8 +398,8 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD if node.broadcast && !chain.cfg.DisableBlockBroadcast { if blockdetail.Block.BlockTime-types.Now().Unix() > FutureBlockDelayTime { //将此block添加到futureblocks中延时广播 - chain.futureBlocks.Add(string(blockdetail.Block.Hash(cfg)), blockdetail) - chainlog.Debug("connectBlock futureBlocks.Add", "height", block.Height, "hash", common.ToHex(blockdetail.Block.Hash(cfg)), "blocktime", blockdetail.Block.BlockTime, "curtime", types.Now().Unix()) + chain.futureBlocks.Add(string(blkHash), blockdetail) + chainlog.Debug("connectBlock futureBlocks.Add", "height", block.Height, "hash", common.ToHex(blkHash), "blocktime", blockdetail.Block.BlockTime, "curtime", types.Now().Unix()) } else { chain.SendBlockBroadcast(blockdetail) } From f0ef48c4c3ca82c9412101869d0f597684ef93e8 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:44:23 +0800 Subject: [PATCH 27/85] rename finalize to snowman --- system/consensus/snowman/{finalize.go => snowman.go} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename system/consensus/snowman/{finalize.go => snowman.go} (98%) diff --git a/system/consensus/snowman/finalize.go b/system/consensus/snowman/snowman.go similarity index 98% rename from system/consensus/snowman/finalize.go rename to system/consensus/snowman/snowman.go index 22bb77683..912954f9d 100644 --- a/system/consensus/snowman/finalize.go +++ b/system/consensus/snowman/snowman.go @@ -51,6 +51,7 @@ type snowman struct { func (s *snowman) Initialize(ctx *consensus.Context) { + s.ctx = ctx s.params = snowball.DefaultParameters s.applyConfig(ctx.Base.GetAPI().GetConfig().GetSubConfig()) err := s.params.Verify() @@ -128,9 +129,9 @@ func (s *snowman) startRoutine() { if err == nil && len(peers) >= s.params.K { break } - snowLog.Debug("startRoutine wait more snowman peer connected...", + snowLog.Info("startRoutine wait more snowman peer connected...", "currConnected", len(peers), "minRequiredNum", s.params.K, "err", err) - time.Sleep(2 * time.Second) + time.Sleep(5 * time.Second) } err := s.engine.Start(s.ctx.Base.Context, 0) From 4386e3f726dd6f5018c27ab173df931317f254f1 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:48:07 +0800 Subject: [PATCH 28/85] check if nil result when get block by hash --- system/consensus/snowman/validators.go | 19 ++++++++--------- system/consensus/snowman/vm.go | 9 ++------ system/p2p/dht/protocol/snowman/handler.go | 24 +++------------------- 3 files changed, 14 insertions(+), 38 deletions(-) diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index a908ced71..c097eae99 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -40,7 +40,7 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { return nil, utils.ErrValidatorSample } indices := s.rand.Perm(len(peers)) - ids := make([]ids.NodeID, 0, size) + nodeIDS := make([]ids.NodeID, 0, size) s.lock.Lock() defer s.lock.Unlock() @@ -52,19 +52,19 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { continue } s.peerIDs[nid] = peers[idx].Name - ids = append(ids, nid) + nodeIDS = append(nodeIDS, nid) - if len(ids) >= size { + if len(nodeIDS) >= size { break } } - if len(ids) < size { + if len(nodeIDS) < size { snowLog.Error("Sample not enough", "len", len(peers), "size", size, "err", err) return nil, utils.ErrValidatorSample } - return ids, nil + return nodeIDS, nil } func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { @@ -81,13 +81,12 @@ func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { return nil, err } - peerlist, ok := resp.GetData().(*types.PeerList) + peerlist := resp.GetData().(*types.PeerList) count := len(peerlist.GetPeers()) - if !ok || count < 2 { - snowLog.Error("getConnectedPeers", "len", len(peerlist.GetPeers()), "ok", ok) - return nil, types.ErrTypeAsset - } + if count < 2 { + return nil, nil + } s.self = peerlist.GetPeers()[count-1] peers := make([]*types.Peer, 0, count) for _, p := range peerlist.GetPeers() { diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index e2b05ea1b..c9de9fa68 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -27,11 +27,6 @@ var ( _ block.ChainVM = (*chain33VM)(nil) ) -type preferBlock struct { - height int64 - hash []byte -} - // implements the snowman.ChainVM interface type chain33VM struct { blankVM @@ -93,8 +88,8 @@ func (vm *chain33VM) Shutdown(context.Context) error { func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, error) { details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) - if err != nil || len(details.GetItems()) < 1 { - snowLog.Error("GetBlock", "GetBlockByHashes err", err) + if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { + snowLog.Error("GetBlock", "hash", blkID.Hex(), "GetBlockByHashes err", err) return nil, database.ErrNotFound } sb := vm.newSnowBlock(details.GetItems()[0].GetBlock()) diff --git a/system/p2p/dht/protocol/snowman/handler.go b/system/p2p/dht/protocol/snowman/handler.go index c6d3dc1e4..2dea32da5 100644 --- a/system/p2p/dht/protocol/snowman/handler.go +++ b/system/p2p/dht/protocol/snowman/handler.go @@ -9,21 +9,16 @@ import ( "time" ) - /* event handler 为内部系统模块通信消息处理 stream handler 为外部网络节点通信消息处理 - */ - - - +*/ func (s *snowman) handleEventChits(msg *queue.Message) { - req := msg.GetData().(*types.SnowChits) pid, _ := peer.Decode(req.PeerName) @@ -45,7 +40,6 @@ func (s *snowman) handleEventChits(msg *queue.Message) { } - func (s *snowman) handleEventGetBlock(msg *queue.Message) { req := msg.GetData().(*types.SnowGetBlock) @@ -83,7 +77,6 @@ func (s *snowman) handleEventGetBlock(msg *queue.Message) { } - func (s *snowman) handleEventPutBlock(msg *queue.Message) { req := msg.GetData().(*types.SnowPutBlock) @@ -104,8 +97,6 @@ func (s *snowman) handleEventPutBlock(msg *queue.Message) { } } - - func (s *snowman) handleEventPullQuery(msg *queue.Message) { req := msg.GetData().(*types.SnowPullQuery) @@ -128,7 +119,6 @@ func (s *snowman) handleEventPullQuery(msg *queue.Message) { } } - func (s *snowman) handleEventPushQuery(msg *queue.Message) { req := msg.GetData().(*types.SnowPushQuery) @@ -151,11 +141,8 @@ func (s *snowman) handleEventPushQuery(msg *queue.Message) { } } - - func (s *snowman) handleStreamChits(stream network.Stream) { - req := &types.SnowChits{} err := protocol.ReadStream(req, stream) peerName := stream.Conn().RemotePeer().String() @@ -171,7 +158,6 @@ func (s *snowman) handleStreamChits(stream network.Stream) { } } - func (s *snowman) handleStreamGetBlock(stream network.Stream) { req := &types.SnowGetBlock{} @@ -186,9 +172,9 @@ func (s *snowman) handleStreamGetBlock(stream network.Stream) { blk, err := s.getBlock(req.GetBlockHash()) - if err != nil { + if blk == nil { log.Error("handleStreamGetBlock", "reqID", req.RequestID, "peer", peerName, "getBlock err", err) - }else { + } else { reply.BlockData = types.Encode(blk) } @@ -198,8 +184,6 @@ func (s *snowman) handleStreamGetBlock(stream network.Stream) { } } - - func (s *snowman) handleStreamPullQuery(stream network.Stream) { req := &types.SnowPullQuery{} @@ -217,10 +201,8 @@ func (s *snowman) handleStreamPullQuery(stream network.Stream) { } } - func (s *snowman) handleStreamPushQuery(stream network.Stream) { - req := &types.SnowPushQuery{} err := protocol.ReadStream(req, stream) peerName := stream.Conn().RemotePeer().String() From 73858c06e601d7edad7fb2e28b1d13d6bc61de12 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:19:36 +0800 Subject: [PATCH 29/85] update log --- blockchain/proc.go | 14 ++++++++------ system/consensus/snowman/validators.go | 9 +++++---- system/consensus/snowman/vm.go | 2 +- types/event.go | 12 +++++++----- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/blockchain/proc.go b/blockchain/proc.go index 8191ff73d..4c4c8b825 100644 --- a/blockchain/proc.go +++ b/blockchain/proc.go @@ -19,7 +19,8 @@ func (chain *BlockChain) ProcRecvMsg() { defer chain.recvwg.Done() reqnum := make(chan struct{}, 1000) for msg := range chain.client.Recv() { - chainlog.Debug("blockchain recv", "msg", types.GetEventName(int(msg.Ty)), "id", msg.ID, "cap", len(reqnum)) + chainlog.Debug("chain ProcRecvMsg", "msg", types.GetEventName(int(msg.Ty)), + "id", msg.ID, "ty", msg.Ty, "cap", len(reqnum)) msgtype := msg.Ty reqnum <- struct{}{} atomic.AddInt32(&chain.runcount, 1) @@ -119,11 +120,11 @@ func (chain *BlockChain) ProcRecvMsg() { case types.EventHighestBlock: go chain.processMsg(msg, reqnum, chain.highestBlockNum) case types.EventSnowmanPreferBlk: - go chain.finalizer.eventPreferBlock(msg) + go chain.processMsg(msg, reqnum, chain.finalizer.eventPreferBlock) case types.EventSnowmanAcceptBlk: - go chain.finalizer.eventAcceptBlock(msg) + go chain.processMsg(msg, reqnum, chain.finalizer.eventAcceptBlock) case types.EventSnowmanLastAcceptHeight: - go chain.finalizer.eventLastAcceptHeight(msg) + go chain.processMsg(msg, reqnum, chain.finalizer.eventLastAcceptHeight) default: go chain.processMsg(msg, reqnum, chain.unknowMsg) } @@ -404,9 +405,10 @@ func (chain *BlockChain) processMsg(msg *queue.Message, reqnum chan struct{}, cb defer func() { <-reqnum atomic.AddInt32(&chain.runcount, -1) - chainlog.Debug("process", "cost", types.Since(beg), "msg", types.GetEventName(int(ty))) + chainlog.Debug("chain ProcRecvMsg", "cost", types.Since(beg), + "msg", types.GetEventName(int(ty)), "ty", ty) if r := recover(); r != nil { - chainlog.Error("blockchain panic error", "err", r) + chainlog.Error("blockchain panic error", "msg", types.GetEventName(int(ty)), "err", r) msg.Reply(chain.client.NewMessage("", ty, fmt.Errorf("%s:%v", types.ErrExecPanic.Error(), r))) return } diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index c097eae99..251fe5bd3 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -34,9 +34,10 @@ func (s *vdrSet) init(ctx *consensus.Context) { // If sampling the requested size isn't possible, an error will be returned. func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { + snowLog.Debug("vdrSet Sample", "require", size) peers, err := s.getConnectedPeers() if err != nil || len(peers) < size { - snowLog.Error("Sample", "len", len(peers), "size", size, "err", err) + snowLog.Error("vdrSet Sample", "connected", len(peers), "require", size, "err", err) return nil, utils.ErrValidatorSample } indices := s.rand.Perm(len(peers)) @@ -48,7 +49,7 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { nid, err := s.toNodeID(peers[idx].Name) if err != nil { - snowLog.Error("Sample", "pid", peers[idx].Name, "to nodeID err", err) + snowLog.Error("vdrSet Sample", "pid", peers[idx].Name, "to nodeID err", err) continue } s.peerIDs[nid] = peers[idx].Name @@ -60,7 +61,7 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { } if len(nodeIDS) < size { - snowLog.Error("Sample not enough", "len", len(peers), "size", size, "err", err) + snowLog.Error("vdrSet Sample not enough", "len", len(peers), "size", size, "err", err) return nil, utils.ErrValidatorSample } @@ -68,7 +69,7 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { } func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { - + snowLog.Debug("vdrSet getConnectedPeers") msg := s.ctx.Base.GetQueueClient().NewMessage("p2p", types.EventPeerInfo, nil) err := s.ctx.Base.GetQueueClient().Send(msg, true) if err != nil { diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index c9de9fa68..3e19237b7 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -136,7 +136,7 @@ func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { defer vm.lock.RUnlock() blk, ok := vm.pendingBlock[string(vm.preferenceID[:])] - + snowLog.Debug("BuildBlock", "ok", ok) if !ok { return nil, utils.ErrBlockNotReady } diff --git a/types/event.go b/types/event.go index 1ac1b14a8..29d62331e 100644 --- a/types/event.go +++ b/types/event.go @@ -220,8 +220,8 @@ const ( EventSnowmanPutBlock = 378 EventSnowmanPullQuery = 379 EventSnowmanPushQuery = 380 - EventSnowmanGetFailed = 381 - EventSnowmanQueryFailed = 382 + EventSnowmanGetFailed = 381 + EventSnowmanQueryFailed = 382 ) var eventName = map[int]string{ @@ -393,12 +393,14 @@ var eventName = map[int]string{ EventHighestBlock: "EventHighestBlock", EventGetEvmNonce: "EventGetEvmNonce", EventForFinalizer: "EventForFinalizer", + EventSnowmanPreferBlk: "EventSnowmanPreferBlk", + EventSnowmanAcceptBlk: "EventSnowmanAcceptBlk", + EventSnowmanLastAcceptHeight: "EventSnowmanLastAcceptHeight", EventSnowmanChits: "EventSnowmanChits", EventSnowmanGetBlock: "EventSnowmanGetBlock", EventSnowmanPutBlock: "EventSnowmanPutBlock", EventSnowmanPullQuery: "EventSnowmanPullQuery", EventSnowmanPushQuery: "EventSnowmanPushQuery", - - EventSnowmanGetFailed: "EventSnowmanGetFailed", - EventSnowmanQueryFailed: "EventSnowmanQueryFailed", + EventSnowmanGetFailed: "EventSnowmanGetFailed", + EventSnowmanQueryFailed: "EventSnowmanQueryFailed", } From da65e6c6f158517c7f12763f2bc35ef845f2b17e Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 12 Jan 2024 17:06:54 +0800 Subject: [PATCH 30/85] add console log for snowman engine --- system/consensus/snowman/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index fc370e46a..7257aa5df 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -5,6 +5,7 @@ package snowman import ( + "os" "time" "github.com/33cn/chain33/types" @@ -65,7 +66,8 @@ func newSnowContext(cfg *types.Chain33Config) *snow.ConsensusContext { } fileCore := logging.NewWrappedCore(logging.Debug, logger, logging.Colors.FileEncoder()) - ctx.Context.Log = logging.NewLogger("", fileCore) + consoleCore := logging.NewWrappedCore(logging.Info, os.Stderr, logging.Colors.ConsoleEncoder()) + ctx.Context.Log = logging.NewLogger("", fileCore, consoleCore) return ctx } From 61648a12c14b3d1e64d0a8e793f24c09c81bca5a Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:25:08 +0800 Subject: [PATCH 31/85] calc block hash after block execute --- blockchain/process.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/blockchain/process.go b/blockchain/process.go index f881c89db..e0b0f5ed0 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -17,9 +17,9 @@ import ( "github.com/33cn/chain33/util" ) -//ProcessBlock 处理共识模块过来的blockdetail,peer广播过来的block,以及从peer同步过来的block +// ProcessBlock 处理共识模块过来的blockdetail,peer广播过来的block,以及从peer同步过来的block // 共识模块和peer广播过来的block需要广播出去 -//共识模块过来的Receipts不为空,广播和同步过来的Receipts为空 +// 共识模块过来的Receipts不为空,广播和同步过来的Receipts为空 // 返回参数说明:是否主链,是否孤儿节点,具体err func (chain *BlockChain) ProcessBlock(broadcast bool, block *types.BlockDetail, pid string, addBlock bool, sequence int64) (*types.BlockDetail, bool, bool, error) { chainlog.Debug("ProcessBlock:Processing", "height", block.Block.Height, "blockHash", common.ToHex(block.Block.Hash(chain.client.GetConfig()))) @@ -103,7 +103,7 @@ func (chain *BlockChain) ProcessBlock(broadcast bool, block *types.BlockDetail, return chain.maybeAddBestChain(broadcast, block, pid, sequence) } -//基本检测通过之后尝试将此block添加到主链上 +// 基本检测通过之后尝试将此block添加到主链上 func (chain *BlockChain) maybeAddBestChain(broadcast bool, block *types.BlockDetail, pid string, sequence int64) (*types.BlockDetail, bool, bool, error) { chain.chainLock.Lock() defer chain.chainLock.Unlock() @@ -127,7 +127,7 @@ func (chain *BlockChain) maybeAddBestChain(broadcast bool, block *types.BlockDet return blockdetail, isMainChain, false, nil } -//检查block是否已经存在index或者数据库中 +// 检查block是否已经存在index或者数据库中 func (chain *BlockChain) blockExists(hash []byte) bool { // Check block index first (could be main chain or side chain blocks). if chain.index.HaveBlock(hash) { @@ -192,7 +192,7 @@ func (chain *BlockChain) maybeAcceptBlock(broadcast bool, block *types.BlockDeta return block, isMainChain, nil } -//将block添加到主链中 +// 将block添加到主链中 func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDetail) (*types.BlockDetail, bool, error) { enBestBlockCmp := chain.client.GetConfig().GetModuleConfig().Consensus.EnableBestBlockCmp @@ -260,7 +260,7 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet return nil, true, nil } -//将本block信息存储到数据库中,并更新bestchain的tip节点 +// 将本block信息存储到数据库中,并更新bestchain的tip节点 func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockDetail) (*types.BlockDetail, error) { //blockchain close 时不再处理block if atomic.LoadInt32(&chain.isclosed) == 1 { @@ -281,9 +281,8 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD var err error var lastSequence int64 - cfg := chain.client.GetConfig() + block := blockdetail.Block - blkHash := block.Hash(cfg) prevStateHash := chain.bestChain.Tip().statehash errReturn := (node.pid != "self") blockdetail, _, err = execBlock(chain.client, prevStateHash, block, errReturn, sync) @@ -309,6 +308,7 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD "hash", common.ToHex(node.hash), "err", err) return nil, err } + blkHash := block.Hash(chain.client.GetConfig()) //要更新node的信息 if node.pid == "self" { @@ -413,7 +413,7 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD return blockdetail, nil } -//从主链中删除blocks +// 从主链中删除blocks func (chain *BlockChain) disconnectBlock(node *blockNode, blockdetail *types.BlockDetail, sequence int64) error { var lastSequence int64 // 只能从 best chain tip节点开始删除 @@ -482,7 +482,7 @@ func (chain *BlockChain) disconnectBlock(node *blockNode, blockdetail *types.Blo return nil } -//获取重组blockchain需要删除和添加节点 +// 获取重组blockchain需要删除和添加节点 func (chain *BlockChain) getReorganizeNodes(node *blockNode) (*list.List, *list.List) { attachNodes := list.New() detachNodes := list.New() @@ -501,7 +501,7 @@ func (chain *BlockChain) getReorganizeNodes(node *blockNode) (*list.List, *list. return detachNodes, attachNodes } -//LoadBlockByHash 根据hash值从缓存中查询区块 +// LoadBlockByHash 根据hash值从缓存中查询区块 func (chain *BlockChain) LoadBlockByHash(hash []byte) (block *types.BlockDetail, err error) { //从缓存的最新区块中获取 @@ -529,7 +529,7 @@ func (chain *BlockChain) LoadBlockByHash(hash []byte) (block *types.BlockDetail, return block, err } -//重组blockchain +// 重组blockchain func (chain *BlockChain) reorganizeChain(detachNodes, attachNodes *list.List) error { detachBlocks := make([]*types.BlockDetail, 0, detachNodes.Len()) attachBlocks := make([]*types.BlockDetail, 0, attachNodes.Len()) @@ -607,7 +607,7 @@ func (chain *BlockChain) reorganizeChain(detachNodes, attachNodes *list.List) er return nil } -//ProcessDelParaChainBlock 只能从 best chain tip节点开始删除,目前只提供给平行链使用 +// ProcessDelParaChainBlock 只能从 best chain tip节点开始删除,目前只提供给平行链使用 func (chain *BlockChain) ProcessDelParaChainBlock(broadcast bool, blockdetail *types.BlockDetail, pid string, sequence int64) (*types.BlockDetail, bool, bool, error) { //获取当前的tip节点 From 93c6e2a48a62dbe11858c680cf072425555723e5 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:37:51 +0800 Subject: [PATCH 32/85] update snowman build block logic --- blockchain/blockstore.go | 8 +-- system/consensus/base.go | 1 + system/consensus/snowman/block.go | 6 +- system/consensus/snowman/config.go | 2 +- system/consensus/snowman/snowman.go | 51 ++++++++++++-- system/consensus/snowman/vm.go | 104 ++++++++++++++++++++-------- 6 files changed, 130 insertions(+), 42 deletions(-) diff --git a/blockchain/blockstore.go b/blockchain/blockstore.go index c910f7db9..15b67a2c9 100644 --- a/blockchain/blockstore.go +++ b/blockchain/blockstore.go @@ -6,6 +6,7 @@ package blockchain import ( "bytes" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -864,9 +865,7 @@ func (bs *BlockStore) GetTdByBlockHash(hash []byte) (*big.Int, error) { blocktd, err := bs.db.Get(calcHashToTdKey(hash)) if blocktd == nil || err != nil { - if err != dbm.ErrNotFoundInDb { - storeLog.Error("GetTdByBlockHash ", "error", err) - } + storeLog.Error("GetTdByBlockHash ", "hash", hex.EncodeToString(hash), "err", err) return nil, types.ErrHashNotExist } td := new(big.Int) @@ -944,7 +943,8 @@ func (bs *BlockStore) dbMaybeStoreBlock(blockdetail *types.BlockDetail, sync boo } else { parenttd, err := bs.GetTdByBlockHash(parentHash) if err != nil { - chainlog.Error("dbMaybeStoreBlock GetTdByBlockHash", "height", height, "parentHash", common.ToHex(parentHash)) + chainlog.Error("dbMaybeStoreBlock GetTdByBlockHash", + "height", height, "parentHash", common.ToHex(parentHash), "err", err) return err } blocktd = new(big.Int).Add(difficulty, parenttd) diff --git a/system/consensus/base.go b/system/consensus/base.go index 69193fd37..b89d63b32 100644 --- a/system/consensus/base.go +++ b/system/consensus/base.go @@ -150,6 +150,7 @@ func (bc *BaseClient) initFinalizer() { f := LoadFinalizer(bc.Cfg.Finalizer) if f != nil { f.Initialize(&Context{Base: bc}) + bc.finalizer = f } } diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index 47f5ae649..4361c6d9f 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -25,7 +25,7 @@ func (b *snowBlock) ID() ids.ID { return b.id } func (b *snowBlock) Accept(ctx context.Context) error { b.status = choices.Accepted - snowLog.Debug("Accepting block", "hash", b.id.Hex(), "height", b.Height()) + snowLog.Debug("snowBlock accept", "hash", b.id.Hex(), "height", b.Height()) err := b.vm.acceptBlock(b.block.Height, b.id) if err != nil { snowLog.Error("Accepting block error", "hash", b.id.Hex(), "height", b.Height()) @@ -37,8 +37,8 @@ func (b *snowBlock) Accept(ctx context.Context) error { // This element will not be accepted by any correct node in the network. func (b *snowBlock) Reject(ctx context.Context) error { b.status = choices.Rejected - snowLog.Debug(fmt.Sprintf("Rejecting block %s at height %d", b.ID().Hex(), b.Height())) - // TODO reject block + snowLog.Debug("snowBlock reject", "hash", b.ID().Hex(), "height", b.Height()) + b.vm.rejectBlock(b.block.Height, b.ID()) return nil } diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index 7257aa5df..160f12640 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -65,7 +65,7 @@ func newSnowContext(cfg *types.Chain33Config) *snow.ConsensusContext { Compress: logCfg.Compress, } - fileCore := logging.NewWrappedCore(logging.Debug, logger, logging.Colors.FileEncoder()) + fileCore := logging.NewWrappedCore(logging.Verbo, logger, logging.Colors.FileEncoder()) consoleCore := logging.NewWrappedCore(logging.Info, os.Stderr, logging.Colors.ConsoleEncoder()) ctx.Context.Log = logging.NewLogger("", fileCore, consoleCore) diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 912954f9d..23a3a1cdf 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -8,8 +8,11 @@ package snowman import ( "encoding/hex" "runtime" + "sync/atomic" "time" + sncom "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/33cn/chain33/common/log/log15" "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" @@ -41,12 +44,14 @@ type Config struct { } type snowman struct { - engine smeng.Engine - vm *chain33VM - vs *vdrSet - ctx *consensus.Context - inMsg chan *queue.Message - params snowball.Parameters + engine smeng.Engine + vm *chain33VM + vs *vdrSet + ctx *consensus.Context + inMsg chan *queue.Message + engineNotify chan struct{} + params snowball.Parameters + engineStarted atomic.Bool } func (s *snowman) Initialize(ctx *consensus.Context) { @@ -73,6 +78,7 @@ func (s *snowman) Initialize(ctx *consensus.Context) { s.engine = engine s.inMsg = make(chan *queue.Message, 32) + s.engineNotify = make(chan struct{}, 32) go s.startRoutine() } @@ -145,18 +151,51 @@ func (s *snowman) startRoutine() { go s.handleMsgRountine() } + go s.handleNotifyAddBlock() + s.engineStarted.Store(true) + snowLog.Debug("snowman startRoutine done") + } func (s *snowman) AddBlock(blk *types.Block) { + if !s.engineStarted.Load() { + return + } s.vm.addNewBlock(blk) + s.engineNotify <- struct{}{} + } func (s *snowman) SubMsg(msg *queue.Message) { + if !s.engineStarted.Load() { + snowLog.Debug("snowman SubMsg ignore", "id", msg.ID, "name", types.GetEventName(int(msg.ID))) + return + } s.inMsg <- msg } +// 通知新区快事件 +func (s *snowman) handleNotifyAddBlock() { + + for { + + select { + + case <-s.ctx.Base.Context.Done(): + return + + case <-s.engineNotify: + err := s.engine.Notify(s.ctx.Base.Context, sncom.PendingTxs) + if err != nil { + snowLog.Error("snowman NotifyAddBlock", "err", err) + } + + } + } +} + func (s *snowman) handleMsgRountine() { for { diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 3e19237b7..ba97b6f8a 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -1,8 +1,12 @@ package snowman import ( + "container/list" "encoding/hex" "sync" + "sync/atomic" + + lru "github.com/hashicorp/golang-lru" "github.com/ava-labs/avalanchego/snow/choices" @@ -34,14 +38,19 @@ type chain33VM struct { cfg *types.Chain33Config qclient queue.Client pendingBlock map[string]*types.Block - lock sync.RWMutex - preferenceID ids.ID - acceptHeight int64 + + pendingBlocks *list.List + lock sync.RWMutex + preferenceID ids.ID + acceptedHeight int64 + preferChan chan ids.ID + + decidedHashes *lru.Cache } -func (vm *chain33VM) newSnowBlock(blk *types.Block) *snowBlock { +func (vm *chain33VM) newSnowBlock(blk *types.Block, status choices.Status) *snowBlock { - sb := &snowBlock{block: blk, vm: vm} + sb := &snowBlock{block: blk, vm: vm, status: status} sb.id = toSnowID(blk.Hash(vm.cfg)) return sb } @@ -53,6 +62,15 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { vm.cfg = vm.api.GetConfig() vm.qclient = ctx.Base.GetQueueClient() vm.pendingBlock = make(map[string]*types.Block, 8) + vm.preferChan = make(chan ids.ID, 32) + c, err := lru.New(1024) + if err != nil { + panic("chain33VM Init New lru err" + err.Error()) + } + vm.decidedHashes = c + vm.pendingBlocks = list.New() + + go vm.handleNotifyNewBlock(ctx.Base.Context) } // Initialize implements the snowman.ChainVM interface @@ -72,6 +90,23 @@ func (vm *chain33VM) Initialize( } +func (vm *chain33VM) handleNotifyNewBlock(ctx context.Context) { + + for { + + select { + + case <-ctx.Done(): + return + + case preferID := <-vm.preferChan: + + snowLog.Debug("handleNotifyNewBlock", "hash", hex.EncodeToString(preferID[:])) + } + + } +} + // SetState communicates to VM its next state it starts func (vm *chain33VM) SetState(ctx context.Context, state snow.State) error { @@ -92,8 +127,9 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e snowLog.Error("GetBlock", "hash", blkID.Hex(), "GetBlockByHashes err", err) return nil, database.ErrNotFound } - sb := vm.newSnowBlock(details.GetItems()[0].GetBlock()) - if sb.block.Height <= vm.acceptHeight { + sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) + acceptHeight := atomic.LoadInt64(&vm.acceptedHeight) + if sb.block.Height <= acceptHeight { sb.status = choices.Accepted } @@ -109,21 +145,31 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err snowLog.Error("ParseBlock", "decode err", err) return nil, err } + sb := vm.newSnowBlock(blk, choices.Unknown) + accepted, ok := vm.decidedHashes.Get(sb.ID()) + if ok { + sb.status = choices.Rejected + if accepted.(bool) { + sb.status = choices.Accepted + } + } - return vm.newSnowBlock(blk), nil + return sb, nil } func (vm *chain33VM) addNewBlock(blk *types.Block) { vm.lock.Lock() defer vm.lock.Unlock() - key := string(blk.ParentHash) - exist, ok := vm.pendingBlock[key] - if !ok { - snowLog.Debug("addNewBlock replace block", "old", hex.EncodeToString(exist.Hash(vm.cfg)), - "new", hex.EncodeToString(blk.Hash(vm.cfg))) - } - vm.pendingBlock[key] = blk + vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) + + //key := string(blk.ParentHash) + //exist, ok := vm.pendingBlock[key] + //if ok { + // snowLog.Debug("addNewBlock replace block", "height", blk.Height, "old", hex.EncodeToString(exist.Hash(vm.cfg)), + // "new", hex.EncodeToString(blk.Hash(vm.cfg))) + //} + //vm.pendingBlock[key] = blk } // BuildBlock Attempt to create a new block from data contained in the VM. @@ -132,16 +178,15 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) { // returned. func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { - vm.lock.RLock() - defer vm.lock.RUnlock() - - blk, ok := vm.pendingBlock[string(vm.preferenceID[:])] - snowLog.Debug("BuildBlock", "ok", ok) - if !ok { + vm.lock.Lock() + defer vm.lock.Unlock() + snowLog.Debug("BuildBlock", "pendingNum", vm.pendingBlocks.Len()) + if vm.pendingBlocks.Len() <= 0 { return nil, utils.ErrBlockNotReady } - return vm.newSnowBlock(blk), nil + sb := vm.pendingBlocks.Remove(vm.pendingBlocks.Front()).(*snowBlock) + return sb, nil } // SetPreference Notify the VM of the currently preferred block. @@ -197,7 +242,7 @@ func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { // - Any other non-standard error that may have occurred when verifying the // index. // -// TODO: Remove after v1.11.x activates. +// TODO: Remove after avalanche v1.11.x activates. func (vm *chain33VM) VerifyHeightIndex(context.Context) error { return nil } @@ -222,10 +267,8 @@ func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids func (vm *chain33VM) acceptBlock(height int64, blkID ids.ID) error { - vm.lock.Lock() - defer vm.lock.Unlock() - vm.acceptHeight = height - vm.removeExpireBlock() + atomic.StoreInt64(&vm.acceptedHeight, height) + vm.decidedHashes.Add(blkID, true) err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", types.EventSnowmanAcceptBlk, &types.ReqBytes{Data: blkID[:]}), false) @@ -233,11 +276,16 @@ func (vm *chain33VM) acceptBlock(height int64, blkID ids.ID) error { return err } +func (vm *chain33VM) rejectBlock(height int64, blkID ids.ID) { + + vm.decidedHashes.Add(blkID, false) +} + func (vm *chain33VM) removeExpireBlock() { for key, blk := range vm.pendingBlock { - if blk.Height <= vm.acceptHeight { + if blk.Height <= vm.acceptedHeight { delete(vm.pendingBlock, key) } } From fe2dcf8e3761a153977632e3eeee79e69dadd76d Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 22 Jan 2024 17:48:27 +0800 Subject: [PATCH 33/85] fix peer ID converting --- system/consensus/snowman/sender.go | 4 ++-- system/consensus/snowman/validators.go | 21 +++++++++++++++++---- system/p2p/dht/load.go | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/system/consensus/snowman/sender.go b/system/consensus/snowman/sender.go index e2d56d624..2cda6bf30 100644 --- a/system/consensus/snowman/sender.go +++ b/system/consensus/snowman/sender.go @@ -43,7 +43,7 @@ func newMsgSender(sm *snowman, snowCtx *snow.ConsensusContext) *msgSender { func (s *msgSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) { peerName := s.sm.vs.toLibp2pID(nodeID) - snowLog.Debug("msgSender SendGet", "reqID", requestID, "peer", peerName, + snowLog.Debug("msgSender SendChits", "reqID", requestID, "peer", peerName, "preferHash", hex.EncodeToString(preferredID[:]), "acceptHash", hex.EncodeToString(acceptedID[:])) @@ -140,7 +140,7 @@ func (s *msgSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeI PeerName: s.sm.vs.toLibp2pID(nodeID), } - msg := s.cli.NewMessage("p2p", types.EventSnowmanPullQuery, req) + msg := s.cli.NewMessage("p2p", types.EventSnowmanPushQuery, req) err := s.cli.Send(msg, false) if err != nil { snowLog.Error("msgSender SendPushQuery", "peer", req.PeerName, "reqID", requestID, "client.Send err:", err) diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index 251fe5bd3..fcfc760b8 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -28,6 +28,13 @@ func (s *vdrSet) init(ctx *consensus.Context) { s.Set = validators.NewSet() s.ctx = ctx s.rand = rand.New(rand.NewSource(types.Now().Unix())) + s.peerIDs = make(map[ids.NodeID]string) +} + +func (s *vdrSet) Len() int { + s.lock.RLock() + defer s.lock.RUnlock() + return len(s.peerIDs) } // Sample returns a collection of validatorIDs, potentially with duplicates. @@ -43,8 +50,6 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { indices := s.rand.Perm(len(peers)) nodeIDS := make([]ids.NodeID, 0, size) - s.lock.Lock() - defer s.lock.Unlock() for _, idx := range indices { nid, err := s.toNodeID(peers[idx].Name) @@ -52,7 +57,7 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { snowLog.Error("vdrSet Sample", "pid", peers[idx].Name, "to nodeID err", err) continue } - s.peerIDs[nid] = peers[idx].Name + nodeIDS = append(nodeIDS, nid) if len(nodeIDS) >= size { @@ -104,7 +109,11 @@ func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { func (s *vdrSet) toLibp2pID(id ids.NodeID) string { s.lock.RLock() defer s.lock.RUnlock() - return s.peerIDs[id] + name, ok := s.peerIDs[id] + if !ok { + panic("peer id not exist") + } + return name } func (s *vdrSet) toNodeID(id string) (ids.NodeID, error) { @@ -119,6 +128,10 @@ func (s *vdrSet) toNodeID(id string) (ids.NodeID, error) { return ids.EmptyNodeID, err } + s.lock.Lock() + defer s.lock.Unlock() + s.peerIDs[nid] = id + return nid, nil } diff --git a/system/p2p/dht/load.go b/system/p2p/dht/load.go index 2f4654534..fe187a8bb 100644 --- a/system/p2p/dht/load.go +++ b/system/p2p/dht/load.go @@ -5,4 +5,5 @@ import ( _ "github.com/33cn/chain33/system/p2p/dht/protocol/download" //register init package _ "github.com/33cn/chain33/system/p2p/dht/protocol/p2pstore" //register init package _ "github.com/33cn/chain33/system/p2p/dht/protocol/peer" //register init package + _ "github.com/33cn/chain33/system/p2p/dht/protocol/snowman" // load package ) From 0216ff316c5c03fc61a0b7ca15cbeb795224303a Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Mon, 22 Jan 2024 20:14:16 +0800 Subject: [PATCH 34/85] add finalized block info to peer --- blockchain/blockfinalize.go | 41 +- blockchain/proc.go | 4 +- rpc/types/types.go | 1 - system/consensus/snowman/vm.go | 8 +- system/p2p/dht/protocol/peer/peerinfo.go | 20 + types/event.go | 24 +- types/p2p.pb.go | 545 ++++++++++++----------- types/proto/p2p.proto | 2 + types/proto/snowman.proto | 5 + types/snowman.pb.go | 82 +++- 10 files changed, 428 insertions(+), 304 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index a57105a9c..aabcaff6f 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -9,8 +9,8 @@ import ( ) var ( - blockFinalizeStartHeight int64 - blkFinalizeLastAcceptBlkKey = []byte("chain-blockfinalize-acceptblk") + blockFinalizeStartHeight int64 + blkFinalizeLastChoiceKey = []byte("chain-blockfinalize-lastchoice") ) type finalizer struct { @@ -23,13 +23,11 @@ func newFinalizer(chain *BlockChain) *finalizer { f := &finalizer{chain: chain} - raw, err := chain.blockStore.db.Get(blkFinalizeLastAcceptBlkKey) + raw, err := chain.blockStore.db.Get(blkFinalizeLastChoiceKey) if err == nil { types.Decode(raw, &f.header) - } - - if chain.blockStore.Height() >= blockFinalizeStartHeight { + } else if chain.blockStore.Height() >= blockFinalizeStartHeight { detail, err := chain.GetBlock(blockFinalizeStartHeight) if err != nil { @@ -39,6 +37,8 @@ func newFinalizer(chain *BlockChain) *finalizer { f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(chain.client.GetConfig())) } + chainlog.Debug("newFinalizer", "height", f.header.Height, "hash", hex.EncodeToString(f.header.Hash)) + return f } @@ -62,15 +62,24 @@ func (f *finalizer) eventPreferBlock(msg *queue.Message) { func (f *finalizer) eventAcceptBlock(msg *queue.Message) { - req := (msg.Data).(*types.ReqBytes) - detail, err := f.chain.LoadBlockByHash(req.GetData()) + req := (msg.Data).(*types.SnowChoice) + + chainlog.Debug("eventAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) + detail, err := f.chain.LoadBlockByHash(req.GetHash()) if err != nil { - chainlog.Error("eventAcceptBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) + chainlog.Error("eventAcceptBlock", "height", req.Height, + "hash", hex.EncodeToString(req.GetHash()), "load block err", err.Error()) + return + } + + if detail.GetBlock().GetHeight() != req.GetHeight() { + + chainlog.Error("eventAcceptBlock height not equal", "expect", req.Height, "actual", detail.GetBlock().GetHeight(), + "hash", hex.EncodeToString(req.GetHash())) return } - chainlog.Debug("eventAcceptBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) - err = f.setFinalizedBlock(detail.GetBlock().GetHeight(), req.GetData()) + err = f.setFinalizedBlock(detail.GetBlock().GetHeight(), req.GetHash()) if err != nil { chainlog.Error("eventAcceptBlock", "setFinalizedBlock err", err.Error()) @@ -81,9 +90,10 @@ func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { f.lock.Lock() defer f.lock.Unlock() - err := f.chain.blockStore.db.Set(blkFinalizeLastAcceptBlkKey, types.Encode(&f.header)) + err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&f.header)) if err != nil { + chainlog.Error("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash)) return err } f.header.Height = height @@ -97,9 +107,10 @@ func (f *finalizer) getFinalizedBlock() (int64, []byte) { return f.header.Height, f.header.Hash } -func (f *finalizer) eventLastAcceptHeight(msg *queue.Message) { +func (f *finalizer) eventLastChoice(msg *queue.Message) { height, hash := f.getFinalizedBlock() - chainlog.Debug("eventLastAcceptHeight", "height", height, "hash", hex.EncodeToString(hash)) - msg.Reply(f.chain.client.NewMessage("consensus", types.EventSnowmanLastAcceptHeight, &types.ReqBytes{Data: hash})) + chainlog.Debug("eventLastChoice", "height", height, "hash", hex.EncodeToString(hash)) + msg.Reply(f.chain.client.NewMessage(msg.Topic, + types.EventSnowmanLastChoice, &types.SnowChoice{Height: height, Hash: hash})) } diff --git a/blockchain/proc.go b/blockchain/proc.go index 4c4c8b825..36d0a2c09 100644 --- a/blockchain/proc.go +++ b/blockchain/proc.go @@ -123,8 +123,8 @@ func (chain *BlockChain) ProcRecvMsg() { go chain.processMsg(msg, reqnum, chain.finalizer.eventPreferBlock) case types.EventSnowmanAcceptBlk: go chain.processMsg(msg, reqnum, chain.finalizer.eventAcceptBlock) - case types.EventSnowmanLastAcceptHeight: - go chain.processMsg(msg, reqnum, chain.finalizer.eventLastAcceptHeight) + case types.EventSnowmanLastChoice: + go chain.processMsg(msg, reqnum, chain.finalizer.eventLastChoice) default: go chain.processMsg(msg, reqnum, chain.unknowMsg) } diff --git a/rpc/types/types.go b/rpc/types/types.go index 316e56e28..62944797f 100644 --- a/rpc/types/types.go +++ b/rpc/types/types.go @@ -7,7 +7,6 @@ package types import ( "encoding/json" - _ "github.com/33cn/chain33/system/address" // init address ) diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index ba97b6f8a..358e87f28 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -218,7 +218,7 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { // returned. func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { - msg := vm.qclient.NewMessage("blockchain", types.EventSnowmanLastAcceptHeight, &types.ReqNil{}) + msg := vm.qclient.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) err := vm.qclient.Send(msg, true) if err != nil { snowLog.Error("LastAccepted", "send msg err", err) @@ -230,9 +230,9 @@ func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { snowLog.Error("LastAccepted", "wait msg err", err) return ids.Empty, err } - hash := reply.GetData().(*types.ReqBytes) + choice := reply.GetData().(*types.SnowChoice) var id ids.ID - copy(id[:], hash.Data) + copy(id[:], choice.Hash) return id, nil } @@ -271,7 +271,7 @@ func (vm *chain33VM) acceptBlock(height int64, blkID ids.ID) error { vm.decidedHashes.Add(blkID, true) err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", - types.EventSnowmanAcceptBlk, &types.ReqBytes{Data: blkID[:]}), false) + types.EventSnowmanAcceptBlk, &types.SnowChoice{Height: height, Hash: blkID[:]}), false) return err } diff --git a/system/p2p/dht/protocol/peer/peerinfo.go b/system/p2p/dht/protocol/peer/peerinfo.go index b7d0b5dd4..1a75450cd 100644 --- a/system/p2p/dht/protocol/peer/peerinfo.go +++ b/system/p2p/dht/protocol/peer/peerinfo.go @@ -3,6 +3,7 @@ package peer import ( "context" "fmt" + "github.com/33cn/chain33/queue" "strconv" "strings" "sync" @@ -69,9 +70,28 @@ func (p *Protocol) getLocalPeerInfo() *types.Peer { localPeer.FullNode = p.SubConfig.IsFullNode //增加节点高度增长是否是阻塞状态监测 localPeer.Blocked = p.getBlocked() + localPeer.Finalized = getFinalizedChoice(p.QueueClient) return &localPeer } +func getFinalizedChoice(qclient queue.Client) (choice *types.SnowChoice) { + + choice = &types.SnowChoice{} + msg := qclient.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) + err := qclient.Send(msg, true) + if err != nil { + log.Error("getFinalizedChoice", "send msg err", err) + return + } + + reply, err := qclient.Wait(msg) + if err != nil { + log.Error("getFinalizedChoice", "wait msg err", err) + return + } + return reply.GetData().(*types.SnowChoice) +} + func caculteRunningTime() string { var runningTime string mins := time.Since(processStart).Minutes() diff --git a/types/event.go b/types/event.go index 29d62331e..4968ac7b3 100644 --- a/types/event.go +++ b/types/event.go @@ -211,17 +211,17 @@ const ( EventGetEvmNonce = 371 // EventForFinalizer 最终化共识一级消息类型 - EventForFinalizer = 372 - EventSnowmanPreferBlk = 373 - EventSnowmanAcceptBlk = 374 - EventSnowmanLastAcceptHeight = 375 - EventSnowmanChits = 376 - EventSnowmanGetBlock = 377 - EventSnowmanPutBlock = 378 - EventSnowmanPullQuery = 379 - EventSnowmanPushQuery = 380 - EventSnowmanGetFailed = 381 - EventSnowmanQueryFailed = 382 + EventForFinalizer = 372 + EventSnowmanPreferBlk = 373 + EventSnowmanAcceptBlk = 374 + EventSnowmanLastChoice = 375 + EventSnowmanChits = 376 + EventSnowmanGetBlock = 377 + EventSnowmanPutBlock = 378 + EventSnowmanPullQuery = 379 + EventSnowmanPushQuery = 380 + EventSnowmanGetFailed = 381 + EventSnowmanQueryFailed = 382 ) var eventName = map[int]string{ @@ -395,7 +395,7 @@ var eventName = map[int]string{ EventForFinalizer: "EventForFinalizer", EventSnowmanPreferBlk: "EventSnowmanPreferBlk", EventSnowmanAcceptBlk: "EventSnowmanAcceptBlk", - EventSnowmanLastAcceptHeight: "EventSnowmanLastAcceptHeight", + EventSnowmanLastChoice: "EventSnowmanLastChoice", EventSnowmanChits: "EventSnowmanChits", EventSnowmanGetBlock: "EventSnowmanGetBlock", EventSnowmanPutBlock: "EventSnowmanPutBlock", diff --git a/types/p2p.pb.go b/types/p2p.pb.go index 5f02ea10e..a07196fc9 100644 --- a/types/p2p.pb.go +++ b/types/p2p.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc v3.9.1 // source: p2p.proto package types @@ -2101,18 +2101,19 @@ type Peer struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` - Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Self bool `protobuf:"varint,4,opt,name=self,proto3" json:"self,omitempty"` - MempoolSize int32 `protobuf:"varint,5,opt,name=mempoolSize,proto3" json:"mempoolSize,omitempty"` - Header *Header `protobuf:"bytes,6,opt,name=header,proto3" json:"header,omitempty"` - Version string `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` - LocalDBVersion string `protobuf:"bytes,8,opt,name=localDBVersion,proto3" json:"localDBVersion,omitempty"` - StoreDBVersion string `protobuf:"bytes,9,opt,name=storeDBVersion,proto3" json:"storeDBVersion,omitempty"` - RunningTime string `protobuf:"bytes,10,opt,name=runningTime,proto3" json:"runningTime,omitempty"` - FullNode bool `protobuf:"varint,11,opt,name=fullNode,proto3" json:"fullNode,omitempty"` - Blocked bool `protobuf:"varint,12,opt,name=blocked,proto3" json:"blocked,omitempty"` + Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Self bool `protobuf:"varint,4,opt,name=self,proto3" json:"self,omitempty"` + MempoolSize int32 `protobuf:"varint,5,opt,name=mempoolSize,proto3" json:"mempoolSize,omitempty"` + Header *Header `protobuf:"bytes,6,opt,name=header,proto3" json:"header,omitempty"` + Version string `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` + LocalDBVersion string `protobuf:"bytes,8,opt,name=localDBVersion,proto3" json:"localDBVersion,omitempty"` + StoreDBVersion string `protobuf:"bytes,9,opt,name=storeDBVersion,proto3" json:"storeDBVersion,omitempty"` + RunningTime string `protobuf:"bytes,10,opt,name=runningTime,proto3" json:"runningTime,omitempty"` + FullNode bool `protobuf:"varint,11,opt,name=fullNode,proto3" json:"fullNode,omitempty"` + Blocked bool `protobuf:"varint,12,opt,name=blocked,proto3" json:"blocked,omitempty"` + Finalized *SnowChoice `protobuf:"bytes,13,opt,name=finalized,proto3" json:"finalized,omitempty"` } func (x *Peer) Reset() { @@ -2231,6 +2232,13 @@ func (x *Peer) GetBlocked() bool { return false } +func (x *Peer) GetFinalized() *SnowChoice { + if x != nil { + return x.Finalized + } + return nil +} + //* // peer 列表 type PeerList struct { @@ -2632,220 +2640,224 @@ var file_p2p_proto_rawDesc = []byte{ 0x65, 0x73, 0x1a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2a, 0x0a, 0x0e, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x50, - 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0xd4, 0x02, 0x0a, 0x0b, 0x50, 0x32, 0x50, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, - 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, - 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x26, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x44, - 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x22, 0xec, 0x01, 0x0a, 0x0a, 0x50, 0x32, 0x50, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, - 0x72, 0x52, 0x65, 0x63, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x64, - 0x72, 0x52, 0x65, 0x63, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x72, 0x46, 0x72, 0x6f, - 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x46, 0x72, 0x6f, - 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41, - 0x67, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x55, 0x0a, 0x09, 0x50, 0x32, 0x50, 0x56, 0x65, - 0x72, 0x41, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x6d, - 0x0a, 0x07, 0x50, 0x32, 0x50, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, - 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x22, 0x1f, 0x0a, - 0x07, 0x50, 0x32, 0x50, 0x50, 0x6f, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x22, - 0x0a, 0x0a, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x6d, 0x61, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2a, 0x0a, 0x0e, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x50, 0x65, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0xd4, 0x02, 0x0a, 0x0b, 0x50, 0x32, 0x50, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x25, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x26, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x44, 0x42, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x22, 0xec, 0x01, 0x0a, 0x0a, 0x50, 0x32, 0x50, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x72, + 0x52, 0x65, 0x63, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, + 0x52, 0x65, 0x63, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x72, 0x46, 0x72, 0x6f, 0x6d, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x46, 0x72, 0x6f, 0x6d, + 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, + 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x55, 0x0a, 0x09, 0x50, 0x32, 0x50, 0x56, 0x65, 0x72, + 0x41, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x6d, 0x0a, + 0x07, 0x50, 0x32, 0x50, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, + 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x22, 0x1f, 0x0a, 0x07, + 0x50, 0x32, 0x50, 0x50, 0x6f, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x22, 0x0a, + 0x0a, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6e, + 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x22, 0x3b, 0x0a, 0x07, 0x50, 0x32, 0x50, 0x41, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, - 0x63, 0x65, 0x22, 0x3b, 0x0a, 0x07, 0x50, 0x32, 0x50, 0x41, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, + 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x72, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x53, + 0x0a, 0x0b, 0x50, 0x32, 0x50, 0x41, 0x64, 0x64, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, - 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x72, 0x6c, 0x69, 0x73, 0x74, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x64, 0x64, 0x72, 0x6c, 0x69, 0x73, 0x74, 0x22, - 0x53, 0x0a, 0x0b, 0x50, 0x32, 0x50, 0x41, 0x64, 0x64, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, - 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, - 0x32, 0x50, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, - 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x43, 0x0a, 0x0f, 0x50, 0x32, 0x50, 0x45, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x69, - 0x73, 0x6f, 0x75, 0x74, 0x73, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x69, 0x73, 0x6f, 0x75, 0x74, 0x73, 0x69, 0x64, 0x65, 0x22, 0x68, 0x0a, 0x0c, 0x50, 0x32, 0x50, - 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, - 0x70, 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x2e, - 0x0a, 0x06, 0x50, 0x32, 0x50, 0x49, 0x6e, 0x76, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x76, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, - 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x04, 0x69, 0x6e, 0x76, 0x73, 0x22, 0x47, - 0x0a, 0x09, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x74, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, - 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x4c, 0x0a, 0x0a, 0x50, 0x32, 0x50, 0x47, 0x65, - 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x76, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, - 0x04, 0x69, 0x6e, 0x76, 0x73, 0x22, 0x1c, 0x0a, 0x08, 0x50, 0x32, 0x50, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x54, 0x4c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, - 0x54, 0x54, 0x4c, 0x22, 0x52, 0x0a, 0x05, 0x50, 0x32, 0x50, 0x54, 0x78, 0x12, 0x22, 0x0a, 0x02, - 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x74, 0x78, - 0x12, 0x25, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, - 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x22, 0x2e, 0x0a, 0x08, 0x50, 0x32, 0x50, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x93, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x12, 0x2c, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x78, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x78, 0x12, - 0x1c, 0x0a, 0x09, 0x73, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x09, 0x73, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x41, 0x0a, - 0x0d, 0x50, 0x65, 0x65, 0x72, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4d, 0x73, 0x67, 0x12, 0x14, - 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, - 0x73, 0x67, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x4d, 0x73, 0x67, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x4d, 0x73, 0x67, - 0x22, 0x48, 0x0a, 0x07, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x54, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x74, - 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x74, 0x78, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x22, 0x22, 0x0a, 0x08, 0x50, 0x32, - 0x50, 0x54, 0x78, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x22, 0x4b, - 0x0a, 0x0d, 0x50, 0x32, 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x71, 0x12, - 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, - 0x09, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, - 0x52, 0x09, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x22, 0x73, 0x0a, 0x0f, 0x50, - 0x32, 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, + 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, + 0x50, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x69, + 0x6e, 0x66, 0x6f, 0x22, 0x43, 0x0a, 0x0f, 0x50, 0x32, 0x50, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, + 0x6f, 0x75, 0x74, 0x73, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, + 0x73, 0x6f, 0x75, 0x74, 0x73, 0x69, 0x64, 0x65, 0x22, 0x68, 0x0a, 0x0c, 0x50, 0x32, 0x50, 0x47, + 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, + 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x2e, 0x0a, + 0x06, 0x50, 0x32, 0x50, 0x49, 0x6e, 0x76, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x76, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, + 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x04, 0x69, 0x6e, 0x76, 0x73, 0x22, 0x47, 0x0a, + 0x09, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x16, + 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x4c, 0x0a, 0x0a, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x24, + 0x0a, 0x04, 0x69, 0x6e, 0x76, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x04, + 0x69, 0x6e, 0x76, 0x73, 0x22, 0x1c, 0x0a, 0x08, 0x50, 0x32, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x54, 0x54, 0x4c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x54, + 0x54, 0x4c, 0x22, 0x52, 0x0a, 0x05, 0x50, 0x32, 0x50, 0x54, 0x78, 0x12, 0x22, 0x0a, 0x02, 0x74, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x74, 0x78, 0x12, + 0x25, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, + 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x22, 0x2e, 0x0a, 0x08, 0x50, 0x32, 0x50, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x93, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x2c, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x65, 0x72, 0x54, 0x78, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x54, 0x78, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x0d, + 0x50, 0x65, 0x65, 0x72, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4d, 0x73, 0x67, 0x12, 0x14, 0x0a, + 0x05, 0x6d, 0x73, 0x67, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x73, + 0x67, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x4d, 0x73, 0x67, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x4d, 0x73, 0x67, 0x22, + 0x48, 0x0a, 0x07, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x54, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x78, + 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x25, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x22, 0x22, 0x0a, 0x08, 0x50, 0x32, 0x50, + 0x54, 0x78, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x22, 0x4b, 0x0a, + 0x0d, 0x50, 0x32, 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, - 0x09, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x03, 0x74, 0x78, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x78, 0x73, - 0x22, 0x78, 0x0a, 0x0c, 0x50, 0x32, 0x50, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x27, 0x0a, 0x05, 0x74, 0x78, 0x52, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x54, 0x78, 0x52, 0x65, 0x71, - 0x48, 0x00, 0x52, 0x05, 0x74, 0x78, 0x52, 0x65, 0x71, 0x12, 0x36, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, - 0x52, 0x65, 0x71, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, - 0x71, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x68, 0x0a, 0x08, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x32, 0x70, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x32, 0x70, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x66, 0x74, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, 0x66, - 0x74, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xec, 0x02, 0x0a, 0x0d, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x43, 0x61, - 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x54, 0x78, - 0x48, 0x00, 0x52, 0x02, 0x74, 0x78, 0x12, 0x27, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, - 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, - 0x24, 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x50, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, - 0x04, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x74, 0x54, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x54, 0x78, - 0x48, 0x00, 0x52, 0x04, 0x6c, 0x74, 0x54, 0x78, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x07, - 0x6c, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x2b, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, - 0x32, 0x50, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x05, 0x71, - 0x75, 0x65, 0x72, 0x79, 0x12, 0x34, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, - 0x32, 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, - 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x69, 0x0a, 0x0d, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, - 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x35, - 0x0a, 0x0a, 0x50, 0x32, 0x50, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x07, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x6e, 0x0a, 0x07, 0x49, 0x6e, 0x76, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x24, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x02, 0x74, 0x78, 0x12, 0x24, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x0e, 0x0a, 0x02, - 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x30, 0x0a, 0x08, 0x49, 0x6e, 0x76, 0x44, 0x61, 0x74, 0x61, - 0x73, 0x12, 0x24, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0xe1, 0x02, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x73, 0x65, 0x6c, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x65, 0x6c, 0x66, - 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, - 0x7a, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x44, 0x42, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6c, 0x6f, 0x63, - 0x61, 0x6c, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, - 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, - 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, - 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x22, 0x2d, 0x0a, 0x08, 0x50, + 0x09, 0x74, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x22, 0x73, 0x0a, 0x0f, 0x50, 0x32, + 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x09, + 0x74, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x03, 0x74, 0x78, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x74, 0x78, 0x73, 0x22, + 0x78, 0x0a, 0x0c, 0x50, 0x32, 0x50, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x27, 0x0a, 0x05, 0x74, 0x78, 0x52, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x54, 0x78, 0x52, 0x65, 0x71, 0x48, + 0x00, 0x52, 0x05, 0x74, 0x78, 0x52, 0x65, 0x71, 0x12, 0x36, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x54, 0x78, 0x52, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, + 0x65, 0x71, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x71, + 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x68, 0x0a, 0x08, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x32, 0x70, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x32, 0x70, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x66, 0x74, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, 0x66, 0x74, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0xec, 0x02, 0x0a, 0x0d, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x73, + 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x54, 0x78, 0x48, + 0x00, 0x52, 0x02, 0x74, 0x78, 0x12, 0x27, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x24, + 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x50, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x04, + 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x74, 0x54, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x54, 0x78, 0x48, + 0x00, 0x52, 0x04, 0x6c, 0x74, 0x54, 0x78, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x07, 0x6c, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x2b, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, + 0x50, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x34, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, + 0x50, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x78, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, + 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x69, 0x0a, 0x0d, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, + 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x35, 0x0a, + 0x0a, 0x50, 0x32, 0x50, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x07, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x22, 0x6e, 0x0a, 0x07, 0x49, 0x6e, 0x76, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x24, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x02, 0x74, 0x78, 0x12, 0x24, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x48, 0x00, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x74, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x30, 0x0a, 0x08, 0x49, 0x6e, 0x76, 0x44, 0x61, 0x74, 0x61, 0x73, + 0x12, 0x24, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x92, 0x03, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, + 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, + 0x65, 0x6c, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x65, 0x6c, 0x66, 0x12, + 0x20, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x44, 0x42, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6c, 0x6f, 0x63, 0x61, + 0x6c, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x42, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x6f, 0x64, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x09, 0x66, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x73, 0x6e, 0x6f, 0x77, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x52, 0x09, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x2d, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x29, 0x0a, 0x0d, 0x50, 0x32, @@ -3004,8 +3016,9 @@ var file_p2p_proto_goTypes = []interface{}{ (*Signature)(nil), // 39: types.Signature (*Transaction)(nil), // 40: types.Transaction (*Block)(nil), // 41: types.Block - (*Reply)(nil), // 42: types.Reply - (*ReqNil)(nil), // 43: types.ReqNil + (*SnowChoice)(nil), // 42: types.snowChoice + (*Reply)(nil), // 43: types.Reply + (*ReqNil)(nil), // 44: types.ReqNil } var file_p2p_proto_depIdxs = []int32{ 38, // 0: types.P2PPeerInfo.header:type_name -> types.Header @@ -3035,47 +3048,48 @@ var file_p2p_proto_depIdxs = []int32{ 41, // 24: types.InvData.block:type_name -> types.Block 29, // 25: types.InvDatas.items:type_name -> types.InvData 38, // 26: types.Peer.header:type_name -> types.Header - 31, // 27: types.PeerList.peers:type_name -> types.Peer - 37, // 28: types.PeersReply.peers:type_name -> types.PeersInfo - 16, // 29: types.p2pgservice.BroadCastTx:input_type -> types.P2PTx - 17, // 30: types.p2pgservice.BroadCastBlock:input_type -> types.P2PBlock - 4, // 31: types.p2pgservice.Ping:input_type -> types.P2PPing - 6, // 32: types.p2pgservice.GetAddr:input_type -> types.P2PGetAddr - 6, // 33: types.p2pgservice.GetAddrList:input_type -> types.P2PGetAddr - 2, // 34: types.p2pgservice.Version:input_type -> types.P2PVersion - 2, // 35: types.p2pgservice.Version2:input_type -> types.P2PVersion - 4, // 36: types.p2pgservice.SoftVersion:input_type -> types.P2PPing - 10, // 37: types.p2pgservice.GetBlocks:input_type -> types.P2PGetBlocks - 11, // 38: types.p2pgservice.GetMemPool:input_type -> types.P2PGetMempool - 14, // 39: types.p2pgservice.GetData:input_type -> types.P2PGetData - 27, // 40: types.p2pgservice.GetHeaders:input_type -> types.P2PGetHeaders - 0, // 41: types.p2pgservice.GetPeerInfo:input_type -> types.P2PGetPeerInfo - 26, // 42: types.p2pgservice.ServerStreamRead:input_type -> types.BroadCastData - 4, // 43: types.p2pgservice.ServerStreamSend:input_type -> types.P2PPing - 4, // 44: types.p2pgservice.CollectInPeers:input_type -> types.P2PPing - 4, // 45: types.p2pgservice.CollectInPeers2:input_type -> types.P2PPing - 42, // 46: types.p2pgservice.BroadCastTx:output_type -> types.Reply - 42, // 47: types.p2pgservice.BroadCastBlock:output_type -> types.Reply - 5, // 48: types.p2pgservice.Ping:output_type -> types.P2PPong - 7, // 49: types.p2pgservice.GetAddr:output_type -> types.P2PAddr - 8, // 50: types.p2pgservice.GetAddrList:output_type -> types.P2PAddrList - 3, // 51: types.p2pgservice.Version:output_type -> types.P2PVerAck - 2, // 52: types.p2pgservice.Version2:output_type -> types.P2PVersion - 42, // 53: types.p2pgservice.SoftVersion:output_type -> types.Reply - 12, // 54: types.p2pgservice.GetBlocks:output_type -> types.P2PInv - 12, // 55: types.p2pgservice.GetMemPool:output_type -> types.P2PInv - 30, // 56: types.p2pgservice.GetData:output_type -> types.InvDatas - 28, // 57: types.p2pgservice.GetHeaders:output_type -> types.P2PHeaders - 1, // 58: types.p2pgservice.GetPeerInfo:output_type -> types.P2PPeerInfo - 43, // 59: types.p2pgservice.ServerStreamRead:output_type -> types.ReqNil - 26, // 60: types.p2pgservice.ServerStreamSend:output_type -> types.BroadCastData - 32, // 61: types.p2pgservice.CollectInPeers:output_type -> types.PeerList - 36, // 62: types.p2pgservice.CollectInPeers2:output_type -> types.PeersReply - 46, // [46:63] is the sub-list for method output_type - 29, // [29:46] is the sub-list for method input_type - 29, // [29:29] is the sub-list for extension type_name - 29, // [29:29] is the sub-list for extension extendee - 0, // [0:29] is the sub-list for field type_name + 42, // 27: types.Peer.finalized:type_name -> types.snowChoice + 31, // 28: types.PeerList.peers:type_name -> types.Peer + 37, // 29: types.PeersReply.peers:type_name -> types.PeersInfo + 16, // 30: types.p2pgservice.BroadCastTx:input_type -> types.P2PTx + 17, // 31: types.p2pgservice.BroadCastBlock:input_type -> types.P2PBlock + 4, // 32: types.p2pgservice.Ping:input_type -> types.P2PPing + 6, // 33: types.p2pgservice.GetAddr:input_type -> types.P2PGetAddr + 6, // 34: types.p2pgservice.GetAddrList:input_type -> types.P2PGetAddr + 2, // 35: types.p2pgservice.Version:input_type -> types.P2PVersion + 2, // 36: types.p2pgservice.Version2:input_type -> types.P2PVersion + 4, // 37: types.p2pgservice.SoftVersion:input_type -> types.P2PPing + 10, // 38: types.p2pgservice.GetBlocks:input_type -> types.P2PGetBlocks + 11, // 39: types.p2pgservice.GetMemPool:input_type -> types.P2PGetMempool + 14, // 40: types.p2pgservice.GetData:input_type -> types.P2PGetData + 27, // 41: types.p2pgservice.GetHeaders:input_type -> types.P2PGetHeaders + 0, // 42: types.p2pgservice.GetPeerInfo:input_type -> types.P2PGetPeerInfo + 26, // 43: types.p2pgservice.ServerStreamRead:input_type -> types.BroadCastData + 4, // 44: types.p2pgservice.ServerStreamSend:input_type -> types.P2PPing + 4, // 45: types.p2pgservice.CollectInPeers:input_type -> types.P2PPing + 4, // 46: types.p2pgservice.CollectInPeers2:input_type -> types.P2PPing + 43, // 47: types.p2pgservice.BroadCastTx:output_type -> types.Reply + 43, // 48: types.p2pgservice.BroadCastBlock:output_type -> types.Reply + 5, // 49: types.p2pgservice.Ping:output_type -> types.P2PPong + 7, // 50: types.p2pgservice.GetAddr:output_type -> types.P2PAddr + 8, // 51: types.p2pgservice.GetAddrList:output_type -> types.P2PAddrList + 3, // 52: types.p2pgservice.Version:output_type -> types.P2PVerAck + 2, // 53: types.p2pgservice.Version2:output_type -> types.P2PVersion + 43, // 54: types.p2pgservice.SoftVersion:output_type -> types.Reply + 12, // 55: types.p2pgservice.GetBlocks:output_type -> types.P2PInv + 12, // 56: types.p2pgservice.GetMemPool:output_type -> types.P2PInv + 30, // 57: types.p2pgservice.GetData:output_type -> types.InvDatas + 28, // 58: types.p2pgservice.GetHeaders:output_type -> types.P2PHeaders + 1, // 59: types.p2pgservice.GetPeerInfo:output_type -> types.P2PPeerInfo + 44, // 60: types.p2pgservice.ServerStreamRead:output_type -> types.ReqNil + 26, // 61: types.p2pgservice.ServerStreamSend:output_type -> types.BroadCastData + 32, // 62: types.p2pgservice.CollectInPeers:output_type -> types.PeerList + 36, // 63: types.p2pgservice.CollectInPeers2:output_type -> types.PeersReply + 47, // [47:64] is the sub-list for method output_type + 30, // [30:47] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name } func init() { file_p2p_proto_init() } @@ -3086,6 +3100,7 @@ func file_p2p_proto_init() { file_transaction_proto_init() file_common_proto_init() file_blockchain_proto_init() + file_snowman_proto_init() if !protoimpl.UnsafeEnabled { file_p2p_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*P2PGetPeerInfo); i { diff --git a/types/proto/p2p.proto b/types/proto/p2p.proto index 9fbf42007..def4d5413 100644 --- a/types/proto/p2p.proto +++ b/types/proto/p2p.proto @@ -3,6 +3,7 @@ syntax = "proto3"; import "transaction.proto"; import "common.proto"; import "blockchain.proto"; +import "snowman.proto"; package types; option go_package = "github.com/33cn/chain33/types"; @@ -355,6 +356,7 @@ message Peer { string runningTime = 10; bool fullNode = 11; bool blocked = 12; + snowChoice finalized = 13; } /** diff --git a/types/proto/snowman.proto b/types/proto/snowman.proto index bf0d325c7..9906e8dfc 100644 --- a/types/proto/snowman.proto +++ b/types/proto/snowman.proto @@ -50,6 +50,11 @@ message snowFailedQuery { string peerName = 2; } +message snowChoice { + int64 height = 1; + bytes hash = 2; +} + diff --git a/types/snowman.pb.go b/types/snowman.pb.go index e65eb4e43..daf0275a0 100644 --- a/types/snowman.pb.go +++ b/types/snowman.pb.go @@ -398,6 +398,61 @@ func (x *SnowFailedQuery) GetPeerName() string { return "" } +type SnowChoice struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *SnowChoice) Reset() { + *x = SnowChoice{} + if protoimpl.UnsafeEnabled { + mi := &file_snowman_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SnowChoice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SnowChoice) ProtoMessage() {} + +func (x *SnowChoice) ProtoReflect() protoreflect.Message { + mi := &file_snowman_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SnowChoice.ProtoReflect.Descriptor instead. +func (*SnowChoice) Descriptor() ([]byte, []int) { + return file_snowman_proto_rawDescGZIP(), []int{6} +} + +func (x *SnowChoice) GetHeight() int64 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *SnowChoice) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + var File_snowman_proto protoreflect.FileDescriptor var file_snowman_proto_rawDesc = []byte{ @@ -443,9 +498,13 @@ var file_snowman_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, - 0x61, 0x6d, 0x65, 0x42, 0x1f, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x33, 0x33, 0x63, 0x6e, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x0a, 0x73, 0x6e, 0x6f, 0x77, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x42, 0x1f, 0x5a, + 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x33, 0x33, 0x63, 0x6e, + 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -460,7 +519,7 @@ func file_snowman_proto_rawDescGZIP() []byte { return file_snowman_proto_rawDescData } -var file_snowman_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_snowman_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_snowman_proto_goTypes = []interface{}{ (*SnowChits)(nil), // 0: types.snowChits (*SnowGetBlock)(nil), // 1: types.snowGetBlock @@ -468,6 +527,7 @@ var file_snowman_proto_goTypes = []interface{}{ (*SnowPullQuery)(nil), // 3: types.snowPullQuery (*SnowPushQuery)(nil), // 4: types.snowPushQuery (*SnowFailedQuery)(nil), // 5: types.snowFailedQuery + (*SnowChoice)(nil), // 6: types.snowChoice } var file_snowman_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -555,6 +615,18 @@ func file_snowman_proto_init() { return nil } } + file_snowman_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnowChoice); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -562,7 +634,7 @@ func file_snowman_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_snowman_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, From f513cfaced53ebe60f589c852d82c86c95d10f84 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:15:44 +0800 Subject: [PATCH 35/85] fix block finalizer initial --- blockchain/blockfinalize.go | 25 ++++++++++---------- blockchain/proc.go | 46 ++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index aabcaff6f..28c1b74ce 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -34,11 +34,10 @@ func newFinalizer(chain *BlockChain) *finalizer { chainlog.Error("newFinalizer", "height", blockFinalizeStartHeight, "get block err", err) panic(err) } - f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(chain.client.GetConfig())) + _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(chain.client.GetConfig())) } chainlog.Debug("newFinalizer", "height", f.header.Height, "hash", hex.EncodeToString(f.header.Hash)) - return f } @@ -46,35 +45,35 @@ func (f *finalizer) syncNeighborsFinalizedHeader(selfHeight int64) { } -func (f *finalizer) eventPreferBlock(msg *queue.Message) { +func (f *finalizer) snowmanPreferBlock(msg *queue.Message) { req := (msg.Data).(*types.ReqBytes) detail, err := f.chain.LoadBlockByHash(req.GetData()) if err != nil { - chainlog.Error("eventPrferBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) + chainlog.Error("snowmanPreferBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) return } - chainlog.Debug("eventPreferBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) + chainlog.Debug("snowmanPreferBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) return } -func (f *finalizer) eventAcceptBlock(msg *queue.Message) { +func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { req := (msg.Data).(*types.SnowChoice) - chainlog.Debug("eventAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) + chainlog.Debug("snowmanAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) detail, err := f.chain.LoadBlockByHash(req.GetHash()) if err != nil { - chainlog.Error("eventAcceptBlock", "height", req.Height, + chainlog.Error("snowmanAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.GetHash()), "load block err", err.Error()) return } if detail.GetBlock().GetHeight() != req.GetHeight() { - chainlog.Error("eventAcceptBlock height not equal", "expect", req.Height, "actual", detail.GetBlock().GetHeight(), + chainlog.Error("snowmanAcceptBlock height not equal", "expect", req.Height, "actual", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetHash())) return } @@ -82,7 +81,7 @@ func (f *finalizer) eventAcceptBlock(msg *queue.Message) { err = f.setFinalizedBlock(detail.GetBlock().GetHeight(), req.GetHash()) if err != nil { - chainlog.Error("eventAcceptBlock", "setFinalizedBlock err", err.Error()) + chainlog.Error("snowmanAcceptBlock", "setFinalizedBlock err", err.Error()) } } @@ -93,7 +92,7 @@ func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&f.header)) if err != nil { - chainlog.Error("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash)) + chainlog.Error("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash), "err", err) return err } f.header.Height = height @@ -107,10 +106,10 @@ func (f *finalizer) getFinalizedBlock() (int64, []byte) { return f.header.Height, f.header.Hash } -func (f *finalizer) eventLastChoice(msg *queue.Message) { +func (f *finalizer) snowmanLastChoice(msg *queue.Message) { height, hash := f.getFinalizedBlock() - chainlog.Debug("eventLastChoice", "height", height, "hash", hex.EncodeToString(hash)) + chainlog.Debug("snowmanLastChoice", "height", height, "hash", hex.EncodeToString(hash)) msg.Reply(f.chain.client.NewMessage(msg.Topic, types.EventSnowmanLastChoice, &types.SnowChoice{Height: height, Hash: hash})) } diff --git a/blockchain/proc.go b/blockchain/proc.go index 36d0a2c09..7b649ddcb 100644 --- a/blockchain/proc.go +++ b/blockchain/proc.go @@ -14,7 +14,7 @@ import ( "github.com/33cn/chain33/types" ) -//ProcRecvMsg blockchain模块的消息接收处理 +// ProcRecvMsg blockchain模块的消息接收处理 func (chain *BlockChain) ProcRecvMsg() { defer chain.recvwg.Done() reqnum := make(chan struct{}, 1000) @@ -120,11 +120,11 @@ func (chain *BlockChain) ProcRecvMsg() { case types.EventHighestBlock: go chain.processMsg(msg, reqnum, chain.highestBlockNum) case types.EventSnowmanPreferBlk: - go chain.processMsg(msg, reqnum, chain.finalizer.eventPreferBlock) + go chain.processMsg(msg, reqnum, chain.finalizer.snowmanPreferBlock) case types.EventSnowmanAcceptBlk: - go chain.processMsg(msg, reqnum, chain.finalizer.eventAcceptBlock) + go chain.processMsg(msg, reqnum, chain.finalizer.snowmanAcceptBlock) case types.EventSnowmanLastChoice: - go chain.processMsg(msg, reqnum, chain.finalizer.eventLastChoice) + go chain.processMsg(msg, reqnum, chain.finalizer.snowmanLastChoice) default: go chain.processMsg(msg, reqnum, chain.unknowMsg) } @@ -250,8 +250,8 @@ func (chain *BlockChain) getLastHeader(msg *queue.Message) { } } -//共识过来的block是没有被执行的,首先判断此block的parent block是否是当前best链的tip -//在blockchain执行时需要做tx的去重处理,所以在执行成功之后需要将最新区块详情返回给共识模块 +// 共识过来的block是没有被执行的,首先判断此block的parent block是否是当前best链的tip +// 在blockchain执行时需要做tx的去重处理,所以在执行成功之后需要将最新区块详情返回给共识模块 func (chain *BlockChain) addBlockDetail(msg *queue.Message) { blockDetail := msg.Data.(*types.BlockDetail) Height := blockDetail.Block.Height @@ -272,10 +272,10 @@ func (chain *BlockChain) addBlockDetail(msg *queue.Message) { msg.Reply(chain.client.NewMessage("consensus", types.EventAddBlockDetail, blockDetail)) } -//超前太多或者落后太多的广播区块都不做处理: -//当本节点在同步阶段并且远远落后主网最新高度时不处理广播block,暂定落后128个区块 -//以免广播区块占用go goroutine资源 -//目前回滚只支持10000个区块,所以收到落后10000高度之外的广播区块也不做处理 +// 超前太多或者落后太多的广播区块都不做处理: +// 当本节点在同步阶段并且远远落后主网最新高度时不处理广播block,暂定落后128个区块 +// 以免广播区块占用go goroutine资源 +// 目前回滚只支持10000个区块,所以收到落后10000高度之外的广播区块也不做处理 func (chain *BlockChain) broadcastAddBlock(msg *queue.Message) { var reply types.Reply reply.IsOk = true @@ -416,7 +416,7 @@ func (chain *BlockChain) processMsg(msg *queue.Message, reqnum chan struct{}, cb cb(msg) } -//获取最新的block执行序列号 +// 获取最新的block执行序列号 func (chain *BlockChain) getLastBlockSequence(msg *queue.Message) { var lastSequence types.Int64 var err error @@ -427,7 +427,7 @@ func (chain *BlockChain) getLastBlockSequence(msg *queue.Message) { msg.Reply(chain.client.NewMessage("rpc", types.EventReplyLastBlockSequence, &lastSequence)) } -//获取指定区间的block执行序列信息,包含blockhash和操作类型:add/del +// 获取指定区间的block执行序列信息,包含blockhash和操作类型:add/del func (chain *BlockChain) getBlockSequences(msg *queue.Message) { requestSequences := (msg.Data).(*types.ReqBlocks) BlockSequences, err := chain.GetBlockSequences(requestSequences) @@ -476,7 +476,7 @@ func (chain *BlockChain) getBlockBySeq(msg *queue.Message) { } -//平行链del block的处理 +// 平行链del block的处理 func (chain *BlockChain) delParaChainBlockDetail(msg *queue.Message) { var parablockDetail *types.ParaChainBlockDetail var reply types.Reply @@ -496,7 +496,7 @@ func (chain *BlockChain) delParaChainBlockDetail(msg *queue.Message) { msg.Reply(chain.client.NewMessage("p2p", types.EventReply, &reply)) } -//平行链add block的处理 +// 平行链add block的处理 func (chain *BlockChain) addParaChainBlockDetail(msg *queue.Message) { parablockDetail := msg.Data.(*types.ParaChainBlockDetail) @@ -519,7 +519,7 @@ func (chain *BlockChain) addParaChainBlockDetail(msg *queue.Message) { msg.Reply(chain.client.NewMessage("p2p", types.EventReply, blockDetail)) } -//parachian 通过blockhash获取对应的seq,只记录了addblock时的seq +// parachian 通过blockhash获取对应的seq,只记录了addblock时的seq func (chain *BlockChain) getSeqByHash(msg *queue.Message) { blockhash := (msg.Data).(*types.ReqHash) seq, err := chain.ProcGetSeqByHash(blockhash.Hash) @@ -530,7 +530,7 @@ func (chain *BlockChain) getSeqByHash(msg *queue.Message) { msg.Reply(chain.client.NewMessage("rpc", types.EventGetSeqByHash, &types.Int64{Data: seq})) } -//获取指定地址参与的tx交易计数 +// 获取指定地址参与的tx交易计数 func (chain *BlockChain) localAddrTxCount(msg *queue.Message) { reqkey := (msg.Data).(*types.ReqKey) @@ -561,7 +561,7 @@ func (chain *BlockChain) localAddrTxCount(msg *queue.Message) { msg.Reply(chain.client.NewMessage("rpc", types.EventLocalReplyValue, &types.Int64{Data: counts})) } -//GetLastBlockMainSequence 获取最新的block执行序列号 +// GetLastBlockMainSequence 获取最新的block执行序列号 func (chain *BlockChain) GetLastBlockMainSequence(msg *queue.Message) { var lastSequence types.Int64 var err error @@ -574,7 +574,7 @@ func (chain *BlockChain) GetLastBlockMainSequence(msg *queue.Message) { msg.Reply(chain.client.NewMessage("rpc", types.EventReplyLastBlockMainSequence, &lastSequence)) } -//GetMainSeqByHash parachian 通过blockhash获取对应的seq,只记录了addblock时的seq +// GetMainSeqByHash parachian 通过blockhash获取对应的seq,只记录了addblock时的seq func (chain *BlockChain) GetMainSeqByHash(msg *queue.Message) { blockhash := (msg.Data).(*types.ReqHash) seq, err := chain.ProcGetMainSeqByHash(blockhash.Hash) @@ -586,7 +586,7 @@ func (chain *BlockChain) GetMainSeqByHash(msg *queue.Message) { msg.Reply(chain.client.NewMessage("rpc", types.EventReplyMainSeqByHash, &types.Int64{Data: seq})) } -//setValueByKey 设置kv对到blockchain db中 +// setValueByKey 设置kv对到blockchain db中 func (chain *BlockChain) setValueByKey(msg *queue.Message) { var reply types.Reply reply.IsOk = true @@ -606,7 +606,7 @@ func (chain *BlockChain) setValueByKey(msg *queue.Message) { msg.Reply(chain.client.NewMessage("", types.EventReply, &reply)) } -//GetValueByKey 获取value通过key从blockchain db中 +// GetValueByKey 获取value通过key从blockchain db中 func (chain *BlockChain) getValueByKey(msg *queue.Message) { if !chain.isParaChain { msg.Reply(chain.client.NewMessage("", types.EventLocalReplyValue, nil)) @@ -617,7 +617,7 @@ func (chain *BlockChain) getValueByKey(msg *queue.Message) { msg.Reply(chain.client.NewMessage("", types.EventLocalReplyValue, values)) } -//getParaTxByTitle //通过平行链title获取平行链的交易 +// getParaTxByTitle //通过平行链title获取平行链的交易 func (chain *BlockChain) getParaTxByTitle(msg *queue.Message) { req := (msg.Data).(*types.ReqParaTxByTitle) reply, err := chain.GetParaTxByTitle(req) @@ -629,7 +629,7 @@ func (chain *BlockChain) getParaTxByTitle(msg *queue.Message) { msg.Reply(chain.client.NewMessage("", types.EventReplyParaTxByTitle, reply)) } -//getHeightByTitle //获取拥有此title交易的区块高度 +// getHeightByTitle //获取拥有此title交易的区块高度 func (chain *BlockChain) getHeightByTitle(msg *queue.Message) { req := (msg.Data).(*types.ReqHeightByTitle) reply, err := chain.LoadParaTxByTitle(req) @@ -641,7 +641,7 @@ func (chain *BlockChain) getHeightByTitle(msg *queue.Message) { msg.Reply(chain.client.NewMessage("", types.EventReplyHeightByTitle, reply)) } -//getParaTxByTitleAndHeight //通过区块高度列表+title获取平行链交易 +// getParaTxByTitleAndHeight //通过区块高度列表+title获取平行链交易 func (chain *BlockChain) getParaTxByTitleAndHeight(msg *queue.Message) { req := (msg.Data).(*types.ReqParaTxByHeight) reply, err := chain.GetParaTxByHeight(req) From e3c8070c9b3c851a51a0ff13ef96cf96fcf98ab5 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:17:39 +0800 Subject: [PATCH 36/85] update net peer command with finalized info return --- rpc/jrpchandler.go | 4 ++++ rpc/types/types.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/rpc/jrpchandler.go b/rpc/jrpchandler.go index 2d58dedf7..8a64d9b7b 100644 --- a/rpc/jrpchandler.go +++ b/rpc/jrpchandler.go @@ -659,6 +659,10 @@ func (c *Chain33) GetPeerInfo(in *types.P2PGetPeerReq, result *interface{}) erro pr.RunningTime = peer.GetRunningTime() pr.FullNode = peer.GetFullNode() pr.Blocked = peer.GetBlocked() + pr.Finalized = &rpctypes.SnowChoice{ + Hash: hex.EncodeToString(peer.GetFinalized().GetHash()), + Height: peer.GetFinalized().GetHeight(), + } peerlist.Peers = append(peerlist.Peers, &pr) } diff --git a/rpc/types/types.go b/rpc/types/types.go index 62944797f..c247350ae 100644 --- a/rpc/types/types.go +++ b/rpc/types/types.go @@ -213,6 +213,12 @@ type PeerList struct { Peers []*Peer `json:"peers"` } +// SnowChoice snowman finalized choice +type SnowChoice struct { + Height int64 `json:"height"` + Hash string `json:"hash"` +} + // Peer information type Peer struct { Addr string `json:"addr"` @@ -227,6 +233,7 @@ type Peer struct { RunningTime string `json:"runningTime,omitempty"` FullNode bool `json:"fullNode,omitempty"` Blocked bool `json:"blocked,omitempty"` + Finalized *SnowChoice `json:"finalized"` } // WalletAccounts Wallet Module From 618348bcb4b4abc20c83825bac9a9a76a1f9b645 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:40:36 +0800 Subject: [PATCH 37/85] update p2p peer info refresh protocol --- system/p2p/dht/protocol/peer/peerinfo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/p2p/dht/protocol/peer/peerinfo.go b/system/p2p/dht/protocol/peer/peerinfo.go index 1a75450cd..3a86bd8e7 100644 --- a/system/p2p/dht/protocol/peer/peerinfo.go +++ b/system/p2p/dht/protocol/peer/peerinfo.go @@ -131,7 +131,7 @@ func (p *Protocol) refreshPeerInfo(peers []peer.ID) { <-ch wg.Done() }() - pInfo, err := p.queryPeerInfoOld(pid) + pInfo, err := p.queryPeerInfo(pid) if err != nil { log.Error("refreshPeerInfo", "error", err, "pid", pid) return @@ -185,7 +185,7 @@ func (p *Protocol) detectNodeAddr() { if err != nil { continue } - err = p.queryVersionOld(peerInfo.ID) + err = p.queryVersion(peerInfo.ID) if err != nil { continue } @@ -210,7 +210,7 @@ func (p *Protocol) detectNodeAddr() { if utils.IsPublicIP(p.getPublicIP()) && p.containsPublicIP(pid) { continue } - err := p.queryVersionOld(pid) + err := p.queryVersion(pid) if err != nil { log.Error("detectNodeAddr", "queryVersion error", err, "pid", pid) continue From 89580172c46178bf0e521de48dcb6bd8d36d4d7b Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:26:25 +0800 Subject: [PATCH 38/85] handle snowman message synchronously --- system/consensus/snowman/snowman.go | 27 +++++++++++++++----------- system/consensus/snowman/validators.go | 5 +++++ system/consensus/snowman/vm.go | 1 + 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 23a3a1cdf..406537a6c 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -145,12 +145,7 @@ func (s *snowman) startRoutine() { panic("start snowman engine err:" + err.Error()) } - //启用handler协程 - concurrency := runtime.NumCPU() * 2 - for i := 0; i < concurrency; i++ { - go s.handleMsgRountine() - } - + go s.dispatchSyncMsg() go s.handleNotifyAddBlock() s.engineStarted.Store(true) snowLog.Debug("snowman startRoutine done") @@ -196,7 +191,7 @@ func (s *snowman) handleNotifyAddBlock() { } } -func (s *snowman) handleMsgRountine() { +func (s *snowman) dispatchSyncMsg() { for { @@ -206,14 +201,22 @@ func (s *snowman) handleMsgRountine() { return case msg := <-s.inMsg: - s.handleInMsg(msg) + s.handleSyncMsg(msg) snowLog.Debug("handleInMsg Done", "event", types.GetEventName(int(msg.ID))) } } } -func (s *snowman) handleInMsg(msg *queue.Message) { +func (s *snowman) handleSyncMsg(msg *queue.Message) { + + defer func() { + if r := recover(); r != nil { + var buf [4048]byte + n := runtime.Stack(buf[:], false) + snowLog.Error("handleInMsg", "err", r, "stack", buf[:n]) + } + }() switch msg.ID { @@ -250,7 +253,8 @@ func (s *snowman) handleInMsg(msg *queue.Message) { err = s.engine.Get(s.ctx.Base.Context, nodeID, req.RequestID, toSnowID(req.BlockHash)) if err != nil { - snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, "peerName", req.PeerName, "Get err", err) + snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, + "hash", hex.EncodeToString(req.BlockHash), "peerName", req.PeerName, "Get err", err) } case types.EventSnowmanPutBlock: @@ -280,7 +284,8 @@ func (s *snowman) handleInMsg(msg *queue.Message) { err = s.engine.PullQuery(s.ctx.Base.Context, nodeID, req.RequestID, toSnowID(req.BlockHash)) if err != nil { - snowLog.Error("handleInMsg pullQuery", "reqID", req.RequestID, "peerName", req.PeerName, "pullQuery err", err) + snowLog.Error("handleInMsg pullQuery", "reqID", req.RequestID, + "hash", hex.EncodeToString(req.BlockHash), "peerName", req.PeerName, "pullQuery err", err) } case types.EventSnowmanPushQuery: diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index fcfc760b8..cc8b609d4 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -1,6 +1,7 @@ package snowman import ( + "fmt" "math/rand" "sync" "time" @@ -37,6 +38,10 @@ func (s *vdrSet) Len() int { return len(s.peerIDs) } +func (s *vdrSet) String() string { + return fmt.Sprintf("Validator Set: Size = %d", s.Len()) +} + // Sample returns a collection of validatorIDs, potentially with duplicates. // If sampling the requested size isn't possible, an error will be returned. func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 358e87f28..1c751e026 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -231,6 +231,7 @@ func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { return ids.Empty, err } choice := reply.GetData().(*types.SnowChoice) + atomic.StoreInt64(&vm.acceptedHeight, choice.Height) var id ids.ID copy(id[:], choice.Hash) return id, nil From e876f52fa2df8a5129b31bce679bd559fc897ed6 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:04:54 +0800 Subject: [PATCH 39/85] update log time format with ms display --- common/log/log15/format.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/log/log15/format.go b/common/log/log15/format.go index 16e51f3cc..735c05b8e 100644 --- a/common/log/log15/format.go +++ b/common/log/log15/format.go @@ -16,7 +16,7 @@ import ( ) const ( - timeFormat = "2006-01-02T15:04:05-0700" + timeFormat = "2006-01-02T15:04:05.000-0700" termTimeFormat = "01-02|15:04:05" floatFormat = 'f' termMsgJust = 40 @@ -43,12 +43,11 @@ func (f formatFunc) Format(r *Record) []byte { // a terminal with color-coded level output and terser human friendly timestamp. // This format should only be used for interactive programs or while developing. // -// [TIME] [LEVEL] MESAGE key=value key=value ... +// [TIME] [LEVEL] MESAGE key=value key=value ... // // Example: // -// [May 16 20:58:45] [DBUG] remove route ns=haproxy addr=127.0.0.1:50002 -// +// [May 16 20:58:45] [DBUG] remove route ns=haproxy addr=127.0.0.1:50002 func TerminalFormat() Format { return FormatFunc(func(r *Record) []byte { var color = 0 @@ -88,7 +87,6 @@ func TerminalFormat() Format { // format for key/value pairs. // // For more details see: http://godoc.org/github.com/kr/logfmt -// func LogfmtFormat() Format { return FormatFunc(func(r *Record) []byte { common := []interface{}{r.KeyNames.Time, r.Time, r.KeyNames.Lvl, r.Lvl, r.KeyNames.Msg, r.Msg} From 591abaa06f5e0a52938d7b5de9d9b41facff7c46 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:35:10 +0800 Subject: [PATCH 40/85] fix accept block disorder --- blockchain/blockfinalize.go | 6 +++++- system/consensus/snowman/snowman.go | 4 ++-- system/consensus/snowman/vm.go | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 28c1b74ce..e64f75914 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -62,8 +62,12 @@ func (f *finalizer) snowmanPreferBlock(msg *queue.Message) { func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { req := (msg.Data).(*types.SnowChoice) - chainlog.Debug("snowmanAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) + height, _ := f.getFinalizedBlock() + if req.GetHeight() <= height { + chainlog.Debug("snowmanAcceptBlock disorder", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) + return + } detail, err := f.chain.LoadBlockByHash(req.GetHash()) if err != nil { chainlog.Error("snowmanAcceptBlock", "height", req.Height, diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 406537a6c..370ee6d1f 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -77,8 +77,8 @@ func (s *snowman) Initialize(ctx *consensus.Context) { } s.engine = engine - s.inMsg = make(chan *queue.Message, 32) - s.engineNotify = make(chan struct{}, 32) + s.inMsg = make(chan *queue.Message, 1024) + s.engineNotify = make(chan struct{}, 1024) go s.startRoutine() } diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 1c751e026..b615fbc49 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -268,6 +268,11 @@ func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids func (vm *chain33VM) acceptBlock(height int64, blkID ids.ID) error { + ah := atomic.LoadInt64(&vm.acceptedHeight) + if height <= ah { + snowLog.Debug("acceptBlock disorder", "height", height, "accept", ah) + return nil + } atomic.StoreInt64(&vm.acceptedHeight, height) vm.decidedHashes.Add(blkID, true) From f746f8ee0a373fbd45a0d9f0c99345cdc9705870 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:01:28 +0800 Subject: [PATCH 41/85] fix set finalize block info to db --- blockchain/blockfinalize.go | 19 +++++++++++-------- system/consensus/snowman/snowman.go | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index e64f75914..ed8a3bbc7 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -15,7 +15,7 @@ var ( type finalizer struct { chain *BlockChain - header types.Header + choice types.SnowChoice lock sync.RWMutex } @@ -26,7 +26,11 @@ func newFinalizer(chain *BlockChain) *finalizer { raw, err := chain.blockStore.db.Get(blkFinalizeLastChoiceKey) if err == nil { - types.Decode(raw, &f.header) + err = types.Decode(raw, &f.choice) + if err != nil { + chainlog.Error("newFinalizer", "height", blockFinalizeStartHeight, "decode err", err) + panic(err) + } } else if chain.blockStore.Height() >= blockFinalizeStartHeight { detail, err := chain.GetBlock(blockFinalizeStartHeight) @@ -37,7 +41,7 @@ func newFinalizer(chain *BlockChain) *finalizer { _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(chain.client.GetConfig())) } - chainlog.Debug("newFinalizer", "height", f.header.Height, "hash", hex.EncodeToString(f.header.Hash)) + chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) return f } @@ -93,21 +97,20 @@ func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { f.lock.Lock() defer f.lock.Unlock() - err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&f.header)) - + choice := types.SnowChoice{Height: height, Hash: hash} + err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&choice)) if err != nil { chainlog.Error("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash), "err", err) return err } - f.header.Height = height - f.header.Hash = hash + f.choice = choice return nil } func (f *finalizer) getFinalizedBlock() (int64, []byte) { f.lock.RLock() defer f.lock.RUnlock() - return f.header.Height, f.header.Hash + return f.choice.Height, f.choice.Hash } func (f *finalizer) snowmanLastChoice(msg *queue.Message) { diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 370ee6d1f..594b3ae65 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -124,7 +124,7 @@ func (s *snowman) startRoutine() { // check chain sync status for !s.getChainSyncStatus() { - snowLog.Info("startRoutine wait chain state syncing...") + snowLog.Debug("startRoutine wait chain state syncing...") time.Sleep(5 * time.Second) } @@ -135,7 +135,7 @@ func (s *snowman) startRoutine() { if err == nil && len(peers) >= s.params.K { break } - snowLog.Info("startRoutine wait more snowman peer connected...", + snowLog.Debug("startRoutine wait more snowman peer connected...", "currConnected", len(peers), "minRequiredNum", s.params.K, "err", err) time.Sleep(5 * time.Second) } From 943fadbc050fee62f35b4ff88d42d0c0ef3ec9e8 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:44:41 +0800 Subject: [PATCH 42/85] update blockchain peer list * use rw lock * add snow choice manage --- blockchain/blocksyn.go | 154 ++++++++++++++++++++++------------------- blockchain/chain.go | 50 ++++++------- 2 files changed, 107 insertions(+), 97 deletions(-) diff --git a/blockchain/blocksyn.go b/blockchain/blocksyn.go index 493970ae2..c037be4cd 100644 --- a/blockchain/blocksyn.go +++ b/blockchain/blocksyn.go @@ -16,7 +16,7 @@ import ( "github.com/33cn/chain33/types" ) -//var +// var var ( BackBlockNum int64 = 128 //节点高度不增加时向后取blocks的个数 BackwardBlockNum int64 = 16 //本节点高度不增加时并且落后peer的高度数 @@ -32,23 +32,24 @@ var ( synlog = chainlog.New("submodule", "syn") ) -//PeerInfo blockchain模块需要保存的peerinfo +// PeerInfo blockchain模块需要保存的peerinfo type PeerInfo struct { Name string ParentHash []byte Height int64 Hash []byte + choice *types.SnowChoice } -//PeerInfoList 节点列表 +// PeerInfoList 节点列表 type PeerInfoList []*PeerInfo -//Len 长度 +// Len 长度 func (list PeerInfoList) Len() int { return len(list) } -//Less 小于 +// Less 小于 func (list PeerInfoList) Less(i, j int) bool { if list[i].Height < list[j].Height { return true @@ -59,14 +60,14 @@ func (list PeerInfoList) Less(i, j int) bool { } } -//Swap 交换 +// Swap 交换 func (list PeerInfoList) Swap(i, j int) { temp := list[i] list[i] = list[j] list[j] = temp } -//FaultPeerInfo 可疑故障节点信息 +// FaultPeerInfo 可疑故障节点信息 type FaultPeerInfo struct { Peer *PeerInfo FaultHeight int64 @@ -75,7 +76,7 @@ type FaultPeerInfo struct { ReqFlag bool } -//BestPeerInfo 用于记录最优链的信息 +// BestPeerInfo 用于记录最优链的信息 type BestPeerInfo struct { Peer *PeerInfo Height int64 @@ -85,18 +86,18 @@ type BestPeerInfo struct { IsBestChain bool } -//BlockOnChain ... -//记录最新区块上链的时间,长时间没有更新需要做对应的超时处理 -//主要是处理联盟链区块高度相差一个区块 -//整个网络长时间不出块时需要主动去获取最新的区块 -//BlockOnChain struct +// BlockOnChain ... +// 记录最新区块上链的时间,长时间没有更新需要做对应的超时处理 +// 主要是处理联盟链区块高度相差一个区块 +// 整个网络长时间不出块时需要主动去获取最新的区块 +// BlockOnChain struct type BlockOnChain struct { sync.RWMutex Height int64 OnChainTime int64 } -//initOnChainTimeout 初始化 +// initOnChainTimeout 初始化 func (chain *BlockChain) initOnChainTimeout() { chain.blockOnChain.Lock() defer chain.blockOnChain.Unlock() @@ -105,7 +106,7 @@ func (chain *BlockChain) initOnChainTimeout() { chain.blockOnChain.OnChainTime = types.Now().Unix() } -//OnChainTimeout 最新区块长时间没有更新并超过设置的超时时间 +// OnChainTimeout 最新区块长时间没有更新并超过设置的超时时间 func (chain *BlockChain) OnChainTimeout(height int64) bool { chain.blockOnChain.Lock() defer chain.blockOnChain.Unlock() @@ -127,7 +128,7 @@ func (chain *BlockChain) OnChainTimeout(height int64) bool { return false } -//SynRoutine 同步事务 +// SynRoutine 同步事务 func (chain *BlockChain) SynRoutine() { //获取peerlist的定时器,默认1分钟 fetchPeerListTicker := time.NewTicker(time.Duration(fetchPeerListSeconds) * time.Second) @@ -226,7 +227,8 @@ P2P区块收到这个消息后,会向blockchain 模块回复, EventReply。 会发送送EventAddBlocks(types.Blocks) 给 blockchain 模块, blockchain 模块回复 EventReply syncOrfork:true fork分叉处理,不需要处理请求block的个数 - :fasle 区块同步处理,一次请求128个block + + :fasle 区块同步处理,一次请求128个block */ func (chain *BlockChain) FetchBlock(start int64, end int64, pid []string, syncOrfork bool) (err error) { if chain.client == nil { @@ -300,8 +302,8 @@ func (chain *BlockChain) FetchBlock(start int64, end int64, pid []string, syncOr return resp.Err() } -//FetchPeerList 从p2p模块获取peerlist,用于获取active链上最新的高度。 -//如果没有收到广播block就主动向p2p模块发送请求 +// FetchPeerList 从p2p模块获取peerlist,用于获取active链上最新的高度。 +// 如果没有收到广播block就主动向p2p模块发送请求 func (chain *BlockChain) FetchPeerList() { defer chain.tickerwg.Done() err := chain.fetchPeerList() @@ -345,6 +347,7 @@ func (chain *BlockChain) fetchPeerList() error { peerInfo.ParentHash = peer.Header.ParentHash peerInfo.Height = peer.Header.Height peerInfo.Hash = peer.Header.Hash + peerInfo.choice = peer.Finalized peerInfoList = append(peerInfoList, &peerInfo) } //peerlist中没有比自己节点高的就不做处理直接返回 @@ -368,38 +371,38 @@ func (chain *BlockChain) fetchPeerList() error { return nil } -//GetRcvLastCastBlkHeight 存储广播的block最新高度 +// GetRcvLastCastBlkHeight 存储广播的block最新高度 func (chain *BlockChain) GetRcvLastCastBlkHeight() int64 { chain.castlock.Lock() defer chain.castlock.Unlock() return chain.rcvLastBlockHeight } -//UpdateRcvCastBlkHeight 更新广播的block最新高度 +// UpdateRcvCastBlkHeight 更新广播的block最新高度 func (chain *BlockChain) UpdateRcvCastBlkHeight(height int64) { chain.castlock.Lock() defer chain.castlock.Unlock() chain.rcvLastBlockHeight = height } -//GetsynBlkHeight 存储已经同步到db的block高度 +// GetsynBlkHeight 存储已经同步到db的block高度 func (chain *BlockChain) GetsynBlkHeight() int64 { chain.synBlocklock.Lock() defer chain.synBlocklock.Unlock() return chain.synBlockHeight } -//UpdatesynBlkHeight 更新已经同步到db的block高度 +// UpdatesynBlkHeight 更新已经同步到db的block高度 func (chain *BlockChain) UpdatesynBlkHeight(height int64) { chain.synBlocklock.Lock() defer chain.synBlocklock.Unlock() chain.synBlockHeight = height } -//GetPeerMaxBlkHeight 获取peerlist中合法的最新block高度 +// GetPeerMaxBlkHeight 获取peerlist中合法的最新block高度 func (chain *BlockChain) GetPeerMaxBlkHeight() int64 { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() //获取peerlist中最高的高度,peerlist是已经按照高度排序了的。 if chain.peerList != nil { @@ -422,10 +425,10 @@ func (chain *BlockChain) GetPeerMaxBlkHeight() int64 { return -1 } -//GetPeerInfo 通过peerid获取peerinfo +// GetPeerInfo 通过peerid获取peerinfo func (chain *BlockChain) GetPeerInfo(pid string) *PeerInfo { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() //获取peerinfo if chain.peerList != nil { @@ -441,8 +444,8 @@ func (chain *BlockChain) GetPeerInfo(pid string) *PeerInfo { // getForkDetectPeer 区块高度次大节点 func (chain *BlockChain) getForkComparePeer() PeerInfo { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() if chain.peerList.Len() == 0 { return PeerInfo{} @@ -454,8 +457,8 @@ func (chain *BlockChain) getForkComparePeer() PeerInfo { } func (chain *BlockChain) getActivePeersByHeight(height int64) []string { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() peers := make([]string, 0, 8) for _, peer := range chain.peerList { if peer.Height >= height { @@ -465,10 +468,10 @@ func (chain *BlockChain) getActivePeersByHeight(height int64) []string { return peers } -//GetMaxPeerInfo 获取peerlist中最高节点的peerinfo +// GetMaxPeerInfo 获取peerlist中最高节点的peerinfo func (chain *BlockChain) GetMaxPeerInfo() *PeerInfo { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() //获取peerlist中高度最高的peer,peerlist是已经按照高度排序了的。 if chain.peerList != nil { @@ -491,10 +494,17 @@ func (chain *BlockChain) GetMaxPeerInfo() *PeerInfo { return nil } -//GetPeers 获取所有peers +// GetPeerCount get peer count +func (chain *BlockChain) GetPeerCount() int { + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() + return chain.peerList.Len() +} + +// GetPeers 获取所有peers func (chain *BlockChain) GetPeers() PeerInfoList { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() //获取peerinfo var peers PeerInfoList @@ -505,10 +515,10 @@ func (chain *BlockChain) GetPeers() PeerInfoList { return peers } -//GetPeersMap 获取peers的map列表方便查找 +// GetPeersMap 获取peers的map列表方便查找 func (chain *BlockChain) GetPeersMap() map[string]bool { - chain.peerMaxBlklock.Lock() - defer chain.peerMaxBlklock.Unlock() + chain.peerMaxBlklock.RLock() + defer chain.peerMaxBlklock.RUnlock() peersmap := make(map[string]bool) if chain.peerList != nil { @@ -519,7 +529,7 @@ func (chain *BlockChain) GetPeersMap() map[string]bool { return peersmap } -//IsFaultPeer 判断指定pid是否在故障faultPeerList中 +// IsFaultPeer 判断指定pid是否在故障faultPeerList中 func (chain *BlockChain) IsFaultPeer(pid string) bool { chain.faultpeerlock.Lock() defer chain.faultpeerlock.Unlock() @@ -527,7 +537,7 @@ func (chain *BlockChain) IsFaultPeer(pid string) bool { return chain.faultPeerList[pid] != nil } -//GetFaultPeer 获取指定pid是否在故障faultPeerList中 +// GetFaultPeer 获取指定pid是否在故障faultPeerList中 func (chain *BlockChain) GetFaultPeer(pid string) *FaultPeerInfo { chain.faultpeerlock.Lock() defer chain.faultpeerlock.Unlock() @@ -535,8 +545,8 @@ func (chain *BlockChain) GetFaultPeer(pid string) *FaultPeerInfo { return chain.faultPeerList[pid] } -//RecoveryFaultPeer 尝试恢复故障peer节点,定时从出错的peer获取出错block的头信息。 -//看对应的block是否有更新。有更新就说明故障peer节点已经恢复ok +// RecoveryFaultPeer 尝试恢复故障peer节点,定时从出错的peer获取出错block的头信息。 +// 看对应的block是否有更新。有更新就说明故障peer节点已经恢复ok func (chain *BlockChain) RecoveryFaultPeer() { chain.faultpeerlock.Lock() defer chain.faultpeerlock.Unlock() @@ -564,7 +574,7 @@ func (chain *BlockChain) RecoveryFaultPeer() { } } -//AddFaultPeer 添加故障节点到故障FaultPeerList中 +// AddFaultPeer 添加故障节点到故障FaultPeerList中 func (chain *BlockChain) AddFaultPeer(faultpeer *FaultPeerInfo) { chain.faultpeerlock.Lock() defer chain.faultpeerlock.Unlock() @@ -578,7 +588,7 @@ func (chain *BlockChain) AddFaultPeer(faultpeer *FaultPeerInfo) { synlog.Debug("AddFaultPeer new", "pid", faultpeer.Peer.Name, "FaultHeight", faultpeer.FaultHeight, "FaultHash", common.ToHex(faultpeer.FaultHash), "Err", faultpeer.ErrInfo) } -//RemoveFaultPeer 此pid对应的故障已经修复,将此pid从故障列表中移除 +// RemoveFaultPeer 此pid对应的故障已经修复,将此pid从故障列表中移除 func (chain *BlockChain) RemoveFaultPeer(pid string) { chain.faultpeerlock.Lock() defer chain.faultpeerlock.Unlock() @@ -587,7 +597,7 @@ func (chain *BlockChain) RemoveFaultPeer(pid string) { delete(chain.faultPeerList, pid) } -//UpdateFaultPeer 更新此故障peer的请求标志位 +// UpdateFaultPeer 更新此故障peer的请求标志位 func (chain *BlockChain) UpdateFaultPeer(pid string, reqFlag bool) { chain.faultpeerlock.Lock() defer chain.faultpeerlock.Unlock() @@ -598,7 +608,7 @@ func (chain *BlockChain) UpdateFaultPeer(pid string, reqFlag bool) { } } -//RecordFaultPeer 当blcok执行出错时,记录出错block高度,hash值,以及出错信息和对应的peerid +// RecordFaultPeer 当blcok执行出错时,记录出错block高度,hash值,以及出错信息和对应的peerid func (chain *BlockChain) RecordFaultPeer(pid string, height int64, hash []byte, err error) { var faultnode FaultPeerInfo @@ -617,7 +627,7 @@ func (chain *BlockChain) RecordFaultPeer(pid string, height int64, hash []byte, chain.AddFaultPeer(&faultnode) } -//SynBlocksFromPeers blockSynSeconds时间检测一次本节点的height是否有增长,没有增长就需要通过对端peerlist获取最新高度,发起同步 +// SynBlocksFromPeers blockSynSeconds时间检测一次本节点的height是否有增长,没有增长就需要通过对端peerlist获取最新高度,发起同步 func (chain *BlockChain) SynBlocksFromPeers() { curheight := chain.GetBlockHeight() @@ -739,10 +749,10 @@ func (chain *BlockChain) forkChainDetection(prevMode int) { } -//CheckHeightNoIncrease 在规定时间本链的高度没有增长,但peerlist中最新高度远远高于本节点高度, -//可能当前链是在分支链上,需从指定最长链的peer向后请求指定数量的blockheader -//请求bestchain.Height -BackBlockNum -- bestchain.Height的header -//需要考虑收不到分叉之后的第一个广播block,这样就会导致后面的广播block都在孤儿节点中了。 +// CheckHeightNoIncrease 在规定时间本链的高度没有增长,但peerlist中最新高度远远高于本节点高度, +// 可能当前链是在分支链上,需从指定最长链的peer向后请求指定数量的blockheader +// 请求bestchain.Height -BackBlockNum -- bestchain.Height的header +// 需要考虑收不到分叉之后的第一个广播block,这样就会导致后面的广播block都在孤儿节点中了。 func (chain *BlockChain) CheckHeightNoIncrease() { defer chain.tickerwg.Done() @@ -764,7 +774,7 @@ func (chain *BlockChain) CheckHeightNoIncrease() { } } -//FetchBlockHeaders 从指定pid获取start到end之间的headers +// FetchBlockHeaders 从指定pid获取start到end之间的headers func (chain *BlockChain) FetchBlockHeaders(start int64, end int64, pid string) (err error) { if start < 0 { start = 0 @@ -796,7 +806,7 @@ func (chain *BlockChain) FetchBlockHeaders(start int64, end int64, pid string) ( return resp.Err() } -//ProcBlockHeader 一个block header消息的处理,分tiphash的校验,故障peer的故障block是否恢复的校验 +// ProcBlockHeader 一个block header消息的处理,分tiphash的校验,故障peer的故障block是否恢复的校验 func (chain *BlockChain) ProcBlockHeader(headers *types.Headers, peerid string) error { //判断是否是用于检测故障peer而请求的block header @@ -837,7 +847,7 @@ func (chain *BlockChain) ProcBlockHeader(headers *types.Headers, peerid string) return nil } -//ProcBlockHeaders 多个headers消息的处理,主要用于寻找分叉节点 +// ProcBlockHeaders 多个headers消息的处理,主要用于寻找分叉节点 func (chain *BlockChain) ProcBlockHeaders(headers *types.Headers, pid string) error { var ForkHeight int64 = -1 var forkhash []byte @@ -917,7 +927,7 @@ func (chain *BlockChain) ProcBlockHeaders(headers *types.Headers, pid string) er return nil } -//ProcAddBlockHeadersMsg 处理从peer获取的headers消息 +// ProcAddBlockHeadersMsg 处理从peer获取的headers消息 func (chain *BlockChain) ProcAddBlockHeadersMsg(headers *types.Headers, pid string) error { if headers == nil { return types.ErrInvalidParam @@ -931,10 +941,10 @@ func (chain *BlockChain) ProcAddBlockHeadersMsg(headers *types.Headers, pid stri } -//CheckTipBlockHash 在规定时间本链的高度没有增长,但peerlist中最新高度远远高于本节点高度, -//可能当前链是在分支链上,需从指定最长链的peer向后请求指定数量的blockheader -//请求bestchain.Height -BackBlockNum -- bestchain.Height的header -//需要考虑收不到分叉之后的第一个广播block,这样就会导致后面的广播block都在孤儿节点中了。 +// CheckTipBlockHash 在规定时间本链的高度没有增长,但peerlist中最新高度远远高于本节点高度, +// 可能当前链是在分支链上,需从指定最长链的peer向后请求指定数量的blockheader +// 请求bestchain.Height -BackBlockNum -- bestchain.Height的header +// 需要考虑收不到分叉之后的第一个广播block,这样就会导致后面的广播block都在孤儿节点中了。 func (chain *BlockChain) CheckTipBlockHash() { synlog.Debug("CheckTipBlockHash") defer chain.tickerwg.Done() @@ -985,7 +995,7 @@ func (chain *BlockChain) CheckTipBlockHash() { } } -//IsCaughtUp 本节点是否已经追赶上主链高度,追赶上之后通知本节点的共识模块开始挖矿 +// IsCaughtUp 本节点是否已经追赶上主链高度,追赶上之后通知本节点的共识模块开始挖矿 func (chain *BlockChain) IsCaughtUp() bool { height := chain.GetBlockHeight() @@ -1017,21 +1027,21 @@ func (chain *BlockChain) IsCaughtUp() bool { return isCaughtUp } -//GetNtpClockSyncStatus 获取ntp时间是否同步状态 +// GetNtpClockSyncStatus 获取ntp时间是否同步状态 func (chain *BlockChain) GetNtpClockSyncStatus() bool { chain.ntpClockSynclock.Lock() defer chain.ntpClockSynclock.Unlock() return chain.isNtpClockSync } -//UpdateNtpClockSyncStatus 定时更新ntp时间同步状态 +// UpdateNtpClockSyncStatus 定时更新ntp时间同步状态 func (chain *BlockChain) UpdateNtpClockSyncStatus(Sync bool) { chain.ntpClockSynclock.Lock() defer chain.ntpClockSynclock.Unlock() chain.isNtpClockSync = Sync } -//CheckBestChain 定时确保本节点在最优链上,定时向peer请求指定高度的header +// CheckBestChain 定时确保本节点在最优链上,定时向peer请求指定高度的header func (chain *BlockChain) CheckBestChain(isFirst bool) { if !isFirst { defer chain.tickerwg.Done() @@ -1080,14 +1090,14 @@ func (chain *BlockChain) CheckBestChain(isFirst bool) { } } -//GetBestChainPeer 获取最优节点 +// GetBestChainPeer 获取最优节点 func (chain *BlockChain) GetBestChainPeer(pid string) *BestPeerInfo { chain.bestpeerlock.Lock() defer chain.bestpeerlock.Unlock() return chain.bestChainPeerList[pid] } -//isBestChainPeer 指定peer是不是最优链 +// isBestChainPeer 指定peer是不是最优链 func (chain *BlockChain) isBestChainPeer(pid string) bool { chain.bestpeerlock.Lock() defer chain.bestpeerlock.Unlock() @@ -1098,7 +1108,7 @@ func (chain *BlockChain) isBestChainPeer(pid string) bool { return false } -//GetBestChainPids 定时确保本节点在最优链上,定时向peer请求指定高度的header +// GetBestChainPids 定时确保本节点在最优链上,定时向peer请求指定高度的header func (chain *BlockChain) GetBestChainPids() []string { var PeerPids []string chain.bestpeerlock.Lock() @@ -1122,7 +1132,7 @@ func (chain *BlockChain) GetBestChainPids() []string { return PeerPids } -//CheckBestChainProc 检查最优链 +// CheckBestChainProc 检查最优链 func (chain *BlockChain) CheckBestChainProc(headers *types.Headers, pid string) { //获取本节点指定高度的blockhash @@ -1204,7 +1214,7 @@ func (chain *BlockChain) ChunkRecordSync() { } } -//FetchChunkRecords 从指定pid获取start到end之间的ChunkRecord,只需要获取存储归档索引 blockHeight--->chunkhash +// FetchChunkRecords 从指定pid获取start到end之间的ChunkRecord,只需要获取存储归档索引 blockHeight--->chunkhash func (chain *BlockChain) FetchChunkRecords(start int64, end int64, pid []string) (err error) { if chain.client == nil { synlog.Error("FetchChunkRecords chain client not bind message queue.") diff --git a/blockchain/chain.go b/blockchain/chain.go index b68765f93..07a06f132 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -21,7 +21,7 @@ import ( lru "github.com/hashicorp/golang-lru" ) -//var +// var var ( //cache 存贮的block个数 zeroHash [32]byte @@ -41,7 +41,7 @@ const ( defaultChunkBlockNum = 1 ) -//BlockChain 区块链结构体 +// BlockChain 区块链结构体 type BlockChain struct { client queue.Client blockCache *BlockCache @@ -49,7 +49,7 @@ type BlockChain struct { // 永久存储数据到db中 blockStore *BlockStore - finalizer *finalizer + finalizer *finalizer push *Push //cache 缓存block方便快速查询 cfg *types.BlockChain @@ -115,7 +115,7 @@ type BlockChain struct { isStrongConsistency bool //lock synBlocklock sync.Mutex - peerMaxBlklock sync.Mutex + peerMaxBlklock sync.RWMutex castlock sync.Mutex ntpClockSynclock sync.Mutex faultpeerlock sync.Mutex @@ -152,7 +152,7 @@ type BlockChain struct { forkPointChan chan int64 } -//New new +// New new func New(cfg *types.Chain33Config) *BlockChain { mcfg := cfg.GetModuleConfig().BlockChain futureBlocks, err := lru.New(maxFutureBlocks) @@ -235,7 +235,7 @@ func (chain *BlockChain) initConfig(cfg *types.Chain33Config) { initAllowPackHeight(chain.cfg) } -//Close 关闭区块链 +// Close 关闭区块链 func (chain *BlockChain) Close() { //等待所有的写线程退出,防止数据库写到一半被暂停 atomic.StoreInt32(&chain.isclosed, 1) @@ -270,7 +270,7 @@ func (chain *BlockChain) Close() { chainlog.Info("blockchain module closed") } -//SetQueueClient 设置队列 +// SetQueueClient 设置队列 func (chain *BlockChain) SetQueueClient(client queue.Client) { chain.client = client chain.client.Sub("blockchain") @@ -298,20 +298,20 @@ func (chain *BlockChain) SetQueueClient(client queue.Client) { go chain.ProcRecvMsg() } -//Wait for ready +// Wait for ready func (chain *BlockChain) Wait() {} -//GetStore only used for test +// GetStore only used for test func (chain *BlockChain) GetStore() *BlockStore { return chain.blockStore } -//GetOrphanPool 获取孤儿链 +// GetOrphanPool 获取孤儿链 func (chain *BlockChain) GetOrphanPool() *OrphanPool { return chain.orphanPool } -//InitBlockChain 区块链初始化 +// InitBlockChain 区块链初始化 func (chain *BlockChain) InitBlockChain() { //isRecordBlockSequence配置的合法性检测 seqStatus := chain.blockStore.CheckSequenceStatus(chain.isRecordBlockSequence) @@ -371,7 +371,7 @@ func (chain *BlockChain) getStateHash() []byte { return zeroHash[:] } -//SendAddBlockEvent blockchain 模块add block到db之后通知mempool 和consense模块做相应的更新 +// SendAddBlockEvent blockchain 模块add block到db之后通知mempool 和consense模块做相应的更新 func (chain *BlockChain) SendAddBlockEvent(block *types.BlockDetail) (err error) { if chain.client == nil { chainlog.Error("SendAddBlockEvent: chain client not bind message queue.") @@ -405,7 +405,7 @@ func (chain *BlockChain) sendAddBlockEvent(topic string, data interface{}, heigh } } -//SendBlockBroadcast blockchain模块广播此block到网络中 +// SendBlockBroadcast blockchain模块广播此block到网络中 func (chain *BlockChain) SendBlockBroadcast(block *types.BlockDetail) { cfg := chain.client.GetConfig() if chain.client == nil { @@ -426,12 +426,12 @@ func (chain *BlockChain) SendBlockBroadcast(block *types.BlockDetail) { } } -//GetBlockHeight 获取区块高度 +// GetBlockHeight 获取区块高度 func (chain *BlockChain) GetBlockHeight() int64 { return chain.blockStore.Height() } -//GetBlock 用于获取指定高度的block,首先在缓存中获取,如果不存在就从db中获取 +// GetBlock 用于获取指定高度的block,首先在缓存中获取,如果不存在就从db中获取 func (chain *BlockChain) GetBlock(height int64) (detail *types.BlockDetail, err error) { cfg := chain.client.GetConfig() @@ -468,7 +468,7 @@ func (chain *BlockChain) GetBlock(height int64) (detail *types.BlockDetail, err } -//SendDelBlockEvent blockchain 模块 del block从db之后通知mempool 和consense以及wallet模块做相应的更新 +// SendDelBlockEvent blockchain 模块 del block从db之后通知mempool 和consense以及wallet模块做相应的更新 func (chain *BlockChain) SendDelBlockEvent(block *types.BlockDetail) (err error) { if chain.client == nil { chainlog.Error("SendDelBlockEvent: chain client not bind message queue.") @@ -500,12 +500,12 @@ func (chain *BlockChain) SendDelBlockEvent(block *types.BlockDetail) (err error) return nil } -//GetDB 获取DB +// GetDB 获取DB func (chain *BlockChain) GetDB() dbm.DB { return chain.blockStore.db } -//InitCache 初始化缓存 +// InitCache 初始化缓存 func (chain *BlockChain) InitCache(currHeight int64) { if !chain.client.GetConfig().IsEnable("TxHeight") { @@ -541,7 +541,7 @@ func (chain *BlockChain) InitCache(currHeight int64) { } } -//InitIndexAndBestView 第一次启动之后需要将数据库中最新的128个block的node添加到index和bestchain中 +// InitIndexAndBestView 第一次启动之后需要将数据库中最新的128个block的node添加到index和bestchain中 // 主要是为了接下来分叉时的block处理,.........todo func (chain *BlockChain) InitIndexAndBestView() { //获取lastblocks从数据库,创建bestviewtip节点 @@ -589,7 +589,7 @@ func (chain *BlockChain) InitIndexAndBestView() { } -//UpdateRoutine 定时延时广播futureblock +// UpdateRoutine 定时延时广播futureblock func (chain *BlockChain) UpdateRoutine() { //1秒尝试检测一次futureblock,futureblock的time小于当前系统时间就广播此block futureblockTicker := time.NewTicker(1 * time.Second) @@ -606,7 +606,7 @@ func (chain *BlockChain) UpdateRoutine() { } } -//ProcFutureBlocks 循环遍历所有futureblocks,当futureblock的block生成time小于当前系统时间就将此block广播出去 +// ProcFutureBlocks 循环遍历所有futureblocks,当futureblock的block生成time小于当前系统时间就将此block广播出去 func (chain *BlockChain) ProcFutureBlocks() { cfg := chain.client.GetConfig() for _, hash := range chain.futureBlocks.Keys() { @@ -624,12 +624,12 @@ func (chain *BlockChain) ProcFutureBlocks() { } } -//SetValueByKey 设置kv对到blockchain数据库 +// SetValueByKey 设置kv对到blockchain数据库 func (chain *BlockChain) SetValueByKey(kvs *types.LocalDBSet) error { return chain.blockStore.SetConsensusPara(kvs) } -//GetValueByKey 通过key值从blockchain数据库中获取value值 +// GetValueByKey 通过key值从blockchain数据库中获取value值 func (chain *BlockChain) GetValueByKey(keys *types.LocalDBGet) *types.LocalReplyValue { return chain.blockStore.Get(keys) } @@ -641,7 +641,7 @@ func (chain *BlockChain) AddCacheBlock(detail *types.BlockDetail) { chain.blockCache.AddBlock(detail) } -//DelCacheBlock 删除缓存的中对应的区块 +// DelCacheBlock 删除缓存的中对应的区块 func (chain *BlockChain) DelCacheBlock(height int64, hash []byte) { //txHeight缓存先删除 chain.txHeightCache.Del(height) @@ -649,7 +649,7 @@ func (chain *BlockChain) DelCacheBlock(height int64, hash []byte) { chain.blockStore.RemoveActiveBlock(string(hash)) } -//initAllowPackHeight 根据配置修改LowAllowPackHeight和值HighAllowPackHeight +// initAllowPackHeight 根据配置修改LowAllowPackHeight和值HighAllowPackHeight func initAllowPackHeight(mcfg *types.BlockChain) { if mcfg.HighAllowPackHeight > 0 && mcfg.LowAllowPackHeight > 0 { if mcfg.HighAllowPackHeight+mcfg.LowAllowPackHeight > types.MaxAllowPackInterval { From 9fad7ec31cff81c1b22723178a92e56350975254 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 2 Feb 2024 19:35:06 +0800 Subject: [PATCH 43/85] replace atomic with rwlock --- system/consensus/snowman/snowman.go | 31 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 594b3ae65..2ca035010 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -8,7 +8,7 @@ package snowman import ( "encoding/hex" "runtime" - "sync/atomic" + "sync" "time" sncom "github.com/ava-labs/avalanchego/snow/engine/common" @@ -44,14 +44,15 @@ type Config struct { } type snowman struct { - engine smeng.Engine - vm *chain33VM - vs *vdrSet - ctx *consensus.Context - inMsg chan *queue.Message - engineNotify chan struct{} - params snowball.Parameters - engineStarted atomic.Bool + engine smeng.Engine + vm *chain33VM + vs *vdrSet + ctx *consensus.Context + inMsg chan *queue.Message + engineNotify chan struct{} + params snowball.Parameters + initDone bool + lock sync.RWMutex } func (s *snowman) Initialize(ctx *consensus.Context) { @@ -147,14 +148,18 @@ func (s *snowman) startRoutine() { go s.dispatchSyncMsg() go s.handleNotifyAddBlock() - s.engineStarted.Store(true) + s.lock.Lock() + s.initDone = true + s.lock.Unlock() snowLog.Debug("snowman startRoutine done") } func (s *snowman) AddBlock(blk *types.Block) { - if !s.engineStarted.Load() { + s.lock.RLock() + defer s.lock.RUnlock() + if !s.initDone { return } s.vm.addNewBlock(blk) @@ -164,7 +169,9 @@ func (s *snowman) AddBlock(blk *types.Block) { func (s *snowman) SubMsg(msg *queue.Message) { - if !s.engineStarted.Load() { + s.lock.RLock() + defer s.lock.RUnlock() + if !s.initDone { snowLog.Debug("snowman SubMsg ignore", "id", msg.ID, "name", types.GetEventName(int(msg.ID))) return } From 93fc21be1a30bcf29b96cc34bd97cee747943373 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:51:48 +0800 Subject: [PATCH 44/85] wait finalize start block when boot --- blockchain/blockfinalize.go | 104 +++++++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index ed8a3bbc7..36ffd3e52 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -2,10 +2,10 @@ package blockchain import ( "encoding/hex" - "sync" - "github.com/33cn/chain33/queue" "github.com/33cn/chain33/types" + "sync" + "time" ) var ( @@ -17,6 +17,7 @@ type finalizer struct { chain *BlockChain choice types.SnowChoice lock sync.RWMutex + isSync bool } func newFinalizer(chain *BlockChain) *finalizer { @@ -28,25 +29,31 @@ func newFinalizer(chain *BlockChain) *finalizer { if err == nil { err = types.Decode(raw, &f.choice) if err != nil { - chainlog.Error("newFinalizer", "height", blockFinalizeStartHeight, "decode err", err) + chainlog.Error("newFinalizer", "decode err", err) panic(err) } - } else if chain.blockStore.Height() >= blockFinalizeStartHeight { - - detail, err := chain.GetBlock(blockFinalizeStartHeight) - if err != nil { - chainlog.Error("newFinalizer", "height", blockFinalizeStartHeight, "get block err", err) - panic(err) - } - _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(chain.client.GetConfig())) + } else { + go f.waitFinalizeStartBlock() } chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) + //go f.finalizedStateSync() return f } -func (f *finalizer) syncNeighborsFinalizedHeader(selfHeight int64) { +func (f *finalizer) waitFinalizeStartBlock() { + + startHeight := blockFinalizeStartHeight + for f.chain.blockStore.Height() < startHeight { + time.Sleep(time.Second * 5) + } + detail, err := f.chain.GetBlock(startHeight) + if err != nil { + chainlog.Error("setFinalizedStartHeight", "height", startHeight, "get block err", err) + panic(err) + } + _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig())) } func (f *finalizer) snowmanPreferBlock(msg *queue.Message) { @@ -67,7 +74,7 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { req := (msg.Data).(*types.SnowChoice) chainlog.Debug("snowmanAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) - height, _ := f.getFinalizedBlock() + height, _ := f.getLastFinalized() if req.GetHeight() <= height { chainlog.Debug("snowmanAcceptBlock disorder", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) return @@ -95,19 +102,20 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { + chainlog.Debug("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash)) f.lock.Lock() defer f.lock.Unlock() - choice := types.SnowChoice{Height: height, Hash: hash} - err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&choice)) + f.choice.Height = height + f.choice.Hash = hash + err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&f.choice)) if err != nil { chainlog.Error("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash), "err", err) return err } - f.choice = choice return nil } -func (f *finalizer) getFinalizedBlock() (int64, []byte) { +func (f *finalizer) getLastFinalized() (int64, []byte) { f.lock.RLock() defer f.lock.RUnlock() return f.choice.Height, f.choice.Hash @@ -115,8 +123,68 @@ func (f *finalizer) getFinalizedBlock() (int64, []byte) { func (f *finalizer) snowmanLastChoice(msg *queue.Message) { - height, hash := f.getFinalizedBlock() + height, hash := f.getLastFinalized() chainlog.Debug("snowmanLastChoice", "height", height, "hash", hex.EncodeToString(hash)) msg.Reply(f.chain.client.NewMessage(msg.Topic, types.EventSnowmanLastChoice, &types.SnowChoice{Height: height, Hash: hash})) } + +func (f *finalizer) setSyncStatus(status bool) { + f.lock.Lock() + defer f.lock.Unlock() + f.isSync = status +} + +func (f *finalizer) getSyncStatus() bool { + f.lock.RLock() + defer f.lock.RUnlock() + return f.isSync +} + +const finlizeChoiceMaxInterval = 128 + +func (f *finalizer) finalizedStateSync() { + + //for !f.chain.IsCaughtUp() { + // chainlog.Debug("finalizedStateSync wait chain sync") + // time.Sleep(time.Second * 3) + //} + // + //minPeerCount := snowball.DefaultParameters.K + // + //for count := f.chain.GetPeerCount(); count < minPeerCount; { + // chainlog.Debug("finalizedStateSync wait more peers", "count", count) + // time.Sleep(time.Second * 3) + //} + //currHeight := f.chain.blockStore.Height() + //finalized, _ := f.getLastFinalized() + //if finalized >= currHeight-finlizeChoiceMaxInterval { + // f.setSyncStatus(true) + // return + //} + // + //detail, err := f.chain.GetBlock(currHeight - finlizeChoiceMaxInterval/2) + //if err != nil { + // chainlog.Error("finalizedStateSync", "GetBlock err:", err) + // return + //} + //// query snow choice + //req := &types.SnowChoice{ + // Height: detail.Block.Height, + // Hash: detail.Block.Hash(f.chain.client.GetConfig()), + //} + // + //msg := f.chain.client.NewMessage("p2p", types.EventSnowmanQueryChoice, req) + //err = f.chain.client.Send(msg, true) + //if err != nil { + // chainlog.Error("finalizedStateSync", "client.Send err:", err) + // return + //} + // + //replyMsg, err := f.chain.client.Wait(msg) + //if err != nil { + // chainlog.Error("finalizedStateSync", "client.Wait err:", err) + // return + //} + +} From 799dc466e89ac60e1a8d114f3c901ac5ff0f8439 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:46:33 +0800 Subject: [PATCH 45/85] update snowman start routine --- blockchain/blockfinalize.go | 2 +- blockchain/process.go | 4 -- system/consensus/snowman/snowman.go | 63 ++++++++++++++++------------- system/consensus/snowman/vm.go | 35 +++++++++++----- types/event.go | 2 + 5 files changed, 62 insertions(+), 44 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 36ffd3e52..0229e7e55 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -61,7 +61,7 @@ func (f *finalizer) snowmanPreferBlock(msg *queue.Message) { detail, err := f.chain.LoadBlockByHash(req.GetData()) if err != nil { - chainlog.Error("snowmanPreferBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) + chainlog.Warn("snowmanPreferBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) return } chainlog.Debug("snowmanPreferBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) diff --git a/blockchain/process.go b/blockchain/process.go index e0b0f5ed0..219f64fff 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -378,10 +378,6 @@ func (chain *BlockChain) connectBlock(node *blockNode, blockdetail *types.BlockD chain.blockStore.UpdateHeight2(blockdetail.GetBlock().GetHeight()) chain.blockStore.UpdateLastBlock2(blockdetail.Block) - if block.Height == blockFinalizeStartHeight { - chain.finalizer.setFinalizedBlock(block.Height, blkHash) - } - // 更新 best chain的tip节点 chain.bestChain.SetTip(node) diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 2ca035010..0d391f097 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -7,12 +7,11 @@ package snowman import ( "encoding/hex" + sncom "github.com/ava-labs/avalanchego/snow/engine/common" "runtime" "sync" "time" - sncom "github.com/ava-labs/avalanchego/snow/engine/common" - "github.com/33cn/chain33/common/log/log15" "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" @@ -124,21 +123,29 @@ func (s *snowman) getChainSyncStatus() bool { func (s *snowman) startRoutine() { // check chain sync status - for !s.getChainSyncStatus() { - snowLog.Debug("startRoutine wait chain state syncing...") - time.Sleep(5 * time.Second) - } + //for !s.getChainSyncStatus() { + // snowLog.Debug("startRoutine wait chain state syncing...") + // time.Sleep(5 * time.Second) + //} // check connected peers - for { + //for { + // + // peers, err := s.vs.getConnectedPeers() + // if err == nil && len(peers) >= s.params.K { + // break + // } + // snowLog.Debug("startRoutine wait more snowman peer connected...", + // "currConnected", len(peers), "minRequiredNum", s.params.K, "err", err) + // time.Sleep(5 * time.Second) + //} - peers, err := s.vs.getConnectedPeers() - if err == nil && len(peers) >= s.params.K { + for { + c, err := getLastChoice(s.ctx.Base.GetQueueClient()) + if err == nil && len(c.Hash) > 0 { break } - snowLog.Debug("startRoutine wait more snowman peer connected...", - "currConnected", len(peers), "minRequiredNum", s.params.K, "err", err) - time.Sleep(5 * time.Second) + time.Sleep(time.Second * 2) } err := s.engine.Start(s.ctx.Base.Context, 0) @@ -148,33 +155,33 @@ func (s *snowman) startRoutine() { go s.dispatchSyncMsg() go s.handleNotifyAddBlock() - s.lock.Lock() - s.initDone = true - s.lock.Unlock() + //s.lock.Lock() + //s.initDone = true + //s.lock.Unlock() snowLog.Debug("snowman startRoutine done") } func (s *snowman) AddBlock(blk *types.Block) { - s.lock.RLock() - defer s.lock.RUnlock() - if !s.initDone { - return + //s.lock.RLock() + //defer s.lock.RUnlock() + //if !s.initDone { + // return + //} + if s.vm.addNewBlock(blk) { + s.engineNotify <- struct{}{} } - s.vm.addNewBlock(blk) - s.engineNotify <- struct{}{} - } func (s *snowman) SubMsg(msg *queue.Message) { - s.lock.RLock() - defer s.lock.RUnlock() - if !s.initDone { - snowLog.Debug("snowman SubMsg ignore", "id", msg.ID, "name", types.GetEventName(int(msg.ID))) - return - } + //s.lock.RLock() + //defer s.lock.RUnlock() + //if !s.initDone { + // snowLog.Debug("snowman SubMsg ignore", "id", msg.ID, "name", types.GetEventName(int(msg.ID))) + // return + //} s.inMsg <- msg } diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index b615fbc49..690c6d1c2 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -157,11 +157,16 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err return sb, nil } -func (vm *chain33VM) addNewBlock(blk *types.Block) { +func (vm *chain33VM) addNewBlock(blk *types.Block) bool { + ah := atomic.LoadInt64(&vm.acceptedHeight) vm.lock.Lock() defer vm.lock.Unlock() - vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) + if blk.Height > ah { + vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) + return true + } + return false //key := string(blk.ParentHash) //exist, ok := vm.pendingBlock[key] @@ -211,6 +216,21 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { return nil } +func getLastChoice(cli queue.Client) (*types.SnowChoice, error) { + + msg := cli.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) + err := cli.Send(msg, true) + if err != nil { + return nil, err + } + + reply, err := cli.Wait(msg) + if err != nil { + return nil, err + } + return reply.GetData().(*types.SnowChoice), nil +} + // LastAccepted returns the ID of the last accepted block. // // If no blocks have been accepted by consensus yet, it is assumed there is @@ -218,19 +238,12 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { // returned. func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { - msg := vm.qclient.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) - err := vm.qclient.Send(msg, true) + choice, err := getLastChoice(vm.qclient) if err != nil { - snowLog.Error("LastAccepted", "send msg err", err) + snowLog.Error("LastAccepted", "getLastChoice err", err) return ids.Empty, err } - reply, err := vm.qclient.Wait(msg) - if err != nil { - snowLog.Error("LastAccepted", "wait msg err", err) - return ids.Empty, err - } - choice := reply.GetData().(*types.SnowChoice) atomic.StoreInt64(&vm.acceptedHeight, choice.Height) var id ids.ID copy(id[:], choice.Hash) diff --git a/types/event.go b/types/event.go index 4968ac7b3..659e0a8c8 100644 --- a/types/event.go +++ b/types/event.go @@ -222,6 +222,7 @@ const ( EventSnowmanPushQuery = 380 EventSnowmanGetFailed = 381 EventSnowmanQueryFailed = 382 + EventSnowmanQueryChoice = 383 ) var eventName = map[int]string{ @@ -403,4 +404,5 @@ var eventName = map[int]string{ EventSnowmanPushQuery: "EventSnowmanPushQuery", EventSnowmanGetFailed: "EventSnowmanGetFailed", EventSnowmanQueryFailed: "EventSnowmanQueryFailed", + EventSnowmanQueryChoice: "EventSnowmanQueryChoice", } From 1414f042c6d809543051aa786eef553ee5b1928b Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:37:13 +0800 Subject: [PATCH 46/85] add block finalize fork --- blockchain/blockfinalize.go | 17 ++++---- system/consensus/snowman/vm.go | 19 ++++++--- types/const.go | 71 +++++++++++++++++++--------------- types/fork.go | 17 ++++---- 4 files changed, 69 insertions(+), 55 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 0229e7e55..537148e72 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -9,7 +9,6 @@ import ( ) var ( - blockFinalizeStartHeight int64 blkFinalizeLastChoiceKey = []byte("chain-blockfinalize-lastchoice") ) @@ -32,25 +31,25 @@ func newFinalizer(chain *BlockChain) *finalizer { chainlog.Error("newFinalizer", "decode err", err) panic(err) } + chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) } else { - go f.waitFinalizeStartBlock() + f.choice.Height = chain.client.GetConfig().GetFork(types.ForkBlockFinalize) + chainlog.Debug("newFinalizer", "forkHeight", f.choice.Height) + go f.waitFinalizeStartBlock(f.choice.Height) } - chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) - //go f.finalizedStateSync() return f } -func (f *finalizer) waitFinalizeStartBlock() { +func (f *finalizer) waitFinalizeStartBlock(forkHeight int64) { - startHeight := blockFinalizeStartHeight - for f.chain.blockStore.Height() < startHeight { + for f.chain.blockStore.Height() < forkHeight+12 { time.Sleep(time.Second * 5) } - detail, err := f.chain.GetBlock(startHeight) + detail, err := f.chain.GetBlock(forkHeight) if err != nil { - chainlog.Error("setFinalizedStartHeight", "height", startHeight, "get block err", err) + chainlog.Error("setFinalizedStartHeight", "height", forkHeight, "get block err", err) panic(err) } _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig())) diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 690c6d1c2..e372df244 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -69,7 +69,12 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { } vm.decidedHashes = c vm.pendingBlocks = list.New() - + choice, err := getLastChoice(vm.qclient) + if err != nil { + snowLog.Error("vm Init", "getLastChoice err", err) + panic(err) + } + vm.acceptedHeight = choice.Height go vm.handleNotifyNewBlock(ctx.Base.Context) } @@ -160,13 +165,15 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err func (vm *chain33VM) addNewBlock(blk *types.Block) bool { ah := atomic.LoadInt64(&vm.acceptedHeight) + if blk.GetHeight() <= ah { + return false + } + vm.lock.Lock() defer vm.lock.Unlock() - if blk.Height > ah { - vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) - return true - } - return false + vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) + snowLog.Debug("addNewBlock", "ah", ah, "bh", blk.GetHeight(), "pendingNum", vm.pendingBlocks.Len()) + return true //key := string(blk.ParentHash) //exist, ok := vm.pendingBlock[key] diff --git a/types/const.go b/types/const.go index 3d82e89ab..a6d59ea7a 100644 --- a/types/const.go +++ b/types/const.go @@ -16,43 +16,43 @@ import ( var slash = []byte("-") var sharp = []byte("#") -//Debug 调试开关 +// Debug 调试开关 var Debug = false -//LogErr log错误信息 +// LogErr log错误信息 type LogErr []byte -//LogReserved LogReserved信息 +// LogReserved LogReserved信息 type LogReserved []byte -//LogInfo loginfo信息 +// LogInfo loginfo信息 type LogInfo struct { Ty reflect.Type Name string } -//UserKeyX 用户自定义执行器前缀字符串 +// UserKeyX 用户自定义执行器前缀字符串 const ( UserKeyX = "user." ParaKeyX = "user.p." NoneX = "none" ) -//DefaultCoinsSymbol 默认的主币名称 +// DefaultCoinsSymbol 默认的主币名称 const ( DefaultCoinsExec = "coins" DefaultCoinsSymbol = "bty" DefaultCoinPrecision = int64(1e8) ) -//UserKeyX 用户自定义执行器前缀byte类型 +// UserKeyX 用户自定义执行器前缀byte类型 var ( UserKey = []byte(UserKeyX) ParaKey = []byte(ParaKeyX) ExecerNone = []byte(NoneX) ) -//基本全局常量定义 +// 基本全局常量定义 const ( BTY = "BTY" MinerAction = "miner" @@ -67,15 +67,15 @@ const ( AutonomyCfgKey = "autonomyExec" ) -//ty = 1 -> secp256k1 -//ty = 2 -> ed25519 -//ty = 3 -> sm2 -//ty = 4 -> onetimeed25519 -//ty = 5 -> RingBaseonED25519 -//ty = 1+offset(1<<8) -> secp256r1 -//ty = 2+offset(1<<8) -> sm2 -//ty= 3+offset(1<<8) -> bls -//ty = 4+offset(1<<8) -> secp256k1eth +// ty = 1 -> secp256k1 +// ty = 2 -> ed25519 +// ty = 3 -> sm2 +// ty = 4 -> onetimeed25519 +// ty = 5 -> RingBaseonED25519 +// ty = 1+offset(1<<8) -> secp256r1 +// ty = 2+offset(1<<8) -> sm2 +// ty= 3+offset(1<<8) -> bls +// ty = 4+offset(1<<8) -> secp256k1eth const ( Invalid = 0 SECP256K1 = secp256k1.ID @@ -84,7 +84,7 @@ const ( SECP256K1ETH = secp256k1eth.ID ) -//log type +// log type const ( TyLogReserved = 0 TyLogErr = 1 @@ -105,7 +105,7 @@ const ( TyLogBurn = 15 ) -//SystemLog 系统log日志 +// SystemLog 系统log日志 var SystemLog = map[int64]*LogInfo{ TyLogReserved: {reflect.TypeOf(LogReserved{}), "LogReserved"}, TyLogErr: {reflect.TypeOf(LogErr{}), "LogErr"}, @@ -124,7 +124,7 @@ var SystemLog = map[int64]*LogInfo{ TyLogBurn: {reflect.TypeOf(ReceiptAccountBurn{}), "LogBurn"}, } -//exec type +// exec type const ( ExecErr = 0 ExecPack = 1 @@ -143,22 +143,29 @@ const ( //提供一种可以快速查重的交易类型,和原来的交易完全兼容 //并且可以通过开关控制是否开启这样的交易 -//TxHeightFlag 标记是一个时间还是一个 TxHeight +// TxHeightFlag 标记是一个时间还是一个 TxHeight var TxHeightFlag int64 = 1 << 62 -//HighAllowPackHeight txHeight打包上限高度 -//eg: currentHeight = 10000 -//某交易的expire=TxHeightFlag+ currentHeight + 10, 则TxHeight=10010 -//打包的区块高度必须满足, Height >= TxHeight - LowAllowPackHeight && Height <= TxHeight + HighAllowPackHeight -//那么交易可以打包的范围是: 10010 - 100 = 9910 , 10010 + 200 = 10210 (9910,10210) -//注意,这两个条件必须同时满足. -//关于交易查重: -//也就是说,两笔相同的交易必然有相同的expire,即TxHeight相同,以及对应的打包区间一致,只能被打包在这个区间(9910,10210)。 -//那么检查交易重复的时候,我只要检查 9910 - currentHeight 这个区间的交易是否有重复 +// HighAllowPackHeight txHeight打包上限高度 +// eg: currentHeight = 10000 +// 某交易的expire=TxHeightFlag+ currentHeight + 10, 则TxHeight=10010 +// 打包的区块高度必须满足, Height >= TxHeight - LowAllowPackHeight && Height <= TxHeight + HighAllowPackHeight +// 那么交易可以打包的范围是: 10010 - 100 = 9910 , 10010 + 200 = 10210 (9910,10210) +// 注意,这两个条件必须同时满足. +// 关于交易查重: +// 也就是说,两笔相同的交易必然有相同的expire,即TxHeight相同,以及对应的打包区间一致,只能被打包在这个区间(9910,10210)。 +// 那么检查交易重复的时候,我只要检查 9910 - currentHeight 这个区间的交易是否有重复 var HighAllowPackHeight int64 = 600 -//LowAllowPackHeight 允许打包的low区块高度 +// LowAllowPackHeight 允许打包的low区块高度 var LowAllowPackHeight int64 = 200 -//MaxAllowPackInterval 允许打包的最大区间值 +// MaxAllowPackInterval 允许打包的最大区间值 var MaxAllowPackInterval int64 = 5000 + +// system fork name + +const ( + // ForkBlockFinalize 区块最终化fork + ForkBlockFinalize = "ForkBlockFinalize" +) diff --git a/types/fork.go b/types/fork.go index a2bdf29f4..14ced873a 100644 --- a/types/fork.go +++ b/types/fork.go @@ -16,7 +16,7 @@ MaxHeight 出于forks 过程安全的考虑,比如代码更新,出现了新 */ const MaxHeight = 10000000000000000 -//Forks fork分叉结构体 +// Forks fork分叉结构体 type Forks struct { forks map[string]int64 } @@ -27,25 +27,25 @@ func checkKey(key string) { } } -//SetFork 设置fork信息 +// SetFork 设置fork信息 func (f *Forks) SetFork(key string, height int64) { checkKey(key) f.setFork(key, height) } -//ReplaceFork 替换fork信息 +// ReplaceFork 替换fork信息 func (f *Forks) ReplaceFork(key string, height int64) { checkKey(key) f.replaceFork(key, height) } -//SetDappFork 设置dapp的fork信息 +// SetDappFork 设置dapp的fork信息 func (f *Forks) SetDappFork(dapp, key string, height int64) { checkKey(key) f.setFork(dapp+"."+key, height) } -//ReplaceDappFork 替换dapp的fork信息 +// ReplaceDappFork 替换dapp的fork信息 func (f *Forks) ReplaceDappFork(dapp, key string, height int64) { checkKey(key) f.replaceFork(dapp+"."+key, height) @@ -144,6 +144,7 @@ func (f *Forks) SetTestNetFork() { f.SetFork(address.ForkFormatAddressKey, 0) f.setFork("ForkCheckEthTxSort", 0) f.setFork("ForkProxyExec", 0) + f.setFork(ForkBlockFinalize, 0) } func (f *Forks) setLocalFork() { @@ -152,7 +153,7 @@ func (f *Forks) setLocalFork() { f.ReplaceFork("ForkRootHash", 1) } -//paraName not used currently +// paraName not used currently func (f *Forks) setForkForParaZero() { f.SetAllFork(0) f.ReplaceFork("ForkBlockHash", 1) @@ -214,8 +215,8 @@ func (c *Chain33Config) IsEnableFork(height int64, fork string, enable bool) boo return c.IsFork(height, fork) } -//fork 设置规则: -//所有的fork都需要有明确的配置,不开启fork 配置为 -1; forks即为从toml中读入文件 +// fork 设置规则: +// 所有的fork都需要有明确的配置,不开启fork 配置为 -1; forks即为从toml中读入文件 func (c *Chain33Config) initForkConfig(forks *ForkList) { chain33fork := c.forks.GetAll() if chain33fork == nil { From bb121610f708251030ac268b972af6e1ce1cde38 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:13:04 +0800 Subject: [PATCH 47/85] handle add block event synchronously --- go.mod | 4 ++++ system/consensus/snowman/snowman.go | 20 +++----------------- system/consensus/snowman/vm.go | 3 ++- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index fafe3c244..5a9132348 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,10 @@ module github.com/33cn/chain33 go 1.19 +replace ( + github.com/ava-labs/avalanchego => ../../ava-labs/avalanchego +) + require ( github.com/BurntSushi/toml v1.2.1 github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 0d391f097..5ee405af5 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -7,11 +7,12 @@ package snowman import ( "encoding/hex" - sncom "github.com/ava-labs/avalanchego/snow/engine/common" "runtime" "sync" "time" + sncom "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/33cn/chain33/common/log/log15" "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" @@ -154,7 +155,6 @@ func (s *snowman) startRoutine() { } go s.dispatchSyncMsg() - go s.handleNotifyAddBlock() //s.lock.Lock() //s.initDone = true //s.lock.Unlock() @@ -185,8 +185,7 @@ func (s *snowman) SubMsg(msg *queue.Message) { s.inMsg <- msg } -// 通知新区快事件 -func (s *snowman) handleNotifyAddBlock() { +func (s *snowman) dispatchSyncMsg() { for { @@ -201,19 +200,6 @@ func (s *snowman) handleNotifyAddBlock() { snowLog.Error("snowman NotifyAddBlock", "err", err) } - } - } -} - -func (s *snowman) dispatchSyncMsg() { - - for { - - select { - - case <-s.ctx.Base.Context.Done(): - return - case msg := <-s.inMsg: s.handleSyncMsg(msg) snowLog.Debug("handleInMsg Done", "event", types.GetEventName(int(msg.ID))) diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index e372df244..5eec2ca66 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -192,12 +192,13 @@ func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { vm.lock.Lock() defer vm.lock.Unlock() - snowLog.Debug("BuildBlock", "pendingNum", vm.pendingBlocks.Len()) + if vm.pendingBlocks.Len() <= 0 { return nil, utils.ErrBlockNotReady } sb := vm.pendingBlocks.Remove(vm.pendingBlocks.Front()).(*snowBlock) + snowLog.Debug("BuildBlock", "pendingNum", vm.pendingBlocks.Len(), "height", sb.Height(), "hash", sb.id.Hex()) return sb, nil } From ca7e0538b232fea9f03da8fc0c17b0464eae1a37 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:07:22 +0800 Subject: [PATCH 48/85] filter out peers with height less than finalized --- system/consensus/snowman/validators.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index cc8b609d4..38cd09c38 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -102,7 +102,7 @@ func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { peers := make([]*types.Peer, 0, count) for _, p := range peerlist.GetPeers() { - if p.Self || p.Blocked || p.Header.GetHeight() < s.self.Header.GetHeight()-128 { + if p.Self || p.Blocked || p.Header.GetHeight() < s.self.Finalized.GetHeight() { continue } peers = append(peers, p) From 1aee9ac12eb32d4e1e3541d834f949c6f052e656 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:15:45 +0800 Subject: [PATCH 49/85] fix handle get block from peer event --- system/p2p/dht/protocol/snowman/handler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/p2p/dht/protocol/snowman/handler.go b/system/p2p/dht/protocol/snowman/handler.go index 2dea32da5..d2e4a61c4 100644 --- a/system/p2p/dht/protocol/snowman/handler.go +++ b/system/p2p/dht/protocol/snowman/handler.go @@ -1,6 +1,7 @@ package snowman import ( + "encoding/hex" "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/p2p/dht/protocol" "github.com/33cn/chain33/types" @@ -59,6 +60,7 @@ func (s *snowman) handleEventGetBlock(msg *queue.Message) { if err != nil { log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) s.sendQueryFailedMsg(types.EventSnowmanGetFailed, req.RequestID, req.PeerName) + return } rep := &types.SnowPutBlock{} @@ -67,6 +69,7 @@ func (s *snowman) handleEventGetBlock(msg *queue.Message) { if err != nil || len(rep.GetBlockData()) == 0 { log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "readStream err", err) s.sendQueryFailedMsg(types.EventSnowmanGetFailed, req.RequestID, req.PeerName) + return } rep.PeerName = req.PeerName @@ -173,7 +176,8 @@ func (s *snowman) handleStreamGetBlock(stream network.Stream) { blk, err := s.getBlock(req.GetBlockHash()) if blk == nil { - log.Error("handleStreamGetBlock", "reqID", req.RequestID, "peer", peerName, "getBlock err", err) + log.Error("handleStreamGetBlock", "reqID", req.RequestID, "hash", hex.EncodeToString(req.GetBlockHash()), + "peer", peerName, "getBlock err", err) } else { reply.BlockData = types.Encode(blk) } From 29e4dffa51fe3ce541a1d4c1bc91eac186503798 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 13 Mar 2024 11:23:16 +0800 Subject: [PATCH 50/85] update package name to snow --- .../dht/protocol/{snowman => snow}/handler.go | 2 +- .../{snowman/snowman.go => snow/snow.go} | 19 +++++-------------- .../dht/protocol/{snowman => snow}/util.go | 11 +++-------- 3 files changed, 9 insertions(+), 23 deletions(-) rename system/p2p/dht/protocol/{snowman => snow}/handler.go (99%) rename system/p2p/dht/protocol/{snowman/snowman.go => snow/snow.go} (86%) rename system/p2p/dht/protocol/{snowman => snow}/util.go (87%) diff --git a/system/p2p/dht/protocol/snowman/handler.go b/system/p2p/dht/protocol/snow/handler.go similarity index 99% rename from system/p2p/dht/protocol/snowman/handler.go rename to system/p2p/dht/protocol/snow/handler.go index d2e4a61c4..de24e83bf 100644 --- a/system/p2p/dht/protocol/snowman/handler.go +++ b/system/p2p/dht/protocol/snow/handler.go @@ -1,4 +1,4 @@ -package snowman +package snow import ( "encoding/hex" diff --git a/system/p2p/dht/protocol/snowman/snowman.go b/system/p2p/dht/protocol/snow/snow.go similarity index 86% rename from system/p2p/dht/protocol/snowman/snowman.go rename to system/p2p/dht/protocol/snow/snow.go index d3c80f9fd..9af81b8d5 100644 --- a/system/p2p/dht/protocol/snowman/snowman.go +++ b/system/p2p/dht/protocol/snow/snow.go @@ -1,4 +1,4 @@ -package snowman +package snow import ( "github.com/33cn/chain33/common/log/log15" @@ -6,31 +6,24 @@ import ( "github.com/33cn/chain33/types" ) - const ( - - snowChitsID = "/chain33/snowman/chits/1.0" - snowGetBlock = "/chain33/snowman/get/1.0" - snowPutBlock = "/chain33/snowman/put/1.0" + snowChitsID = "/chain33/snowman/chits/1.0" + snowGetBlock = "/chain33/snowman/get/1.0" + snowPutBlock = "/chain33/snowman/put/1.0" snowPullQuery = "/chain33/snowman/pullq/1.0" - snowPushQuery= "/chain33/snowman/pushq/1.0" + snowPushQuery = "/chain33/snowman/pushq/1.0" ) - - var log = log15.New("module", "dht.snowman") func init() { protocol.RegisterProtocolInitializer(InitProtocol) } - type snowman struct { *protocol.P2PEnv } - - // InitProtocol init protocol func InitProtocol(env *protocol.P2PEnv) { new(snowman).init(env) @@ -38,7 +31,6 @@ func InitProtocol(env *protocol.P2PEnv) { func (s *snowman) init(env *protocol.P2PEnv) { - s.P2PEnv = env protocol.RegisterEventHandler(types.EventSnowmanChits, s.handleEventChits) protocol.RegisterEventHandler(types.EventSnowmanGetBlock, s.handleEventGetBlock) @@ -46,7 +38,6 @@ func (s *snowman) init(env *protocol.P2PEnv) { protocol.RegisterEventHandler(types.EventSnowmanPullQuery, s.handleEventPullQuery) protocol.RegisterEventHandler(types.EventSnowmanPushQuery, s.handleEventPushQuery) - protocol.RegisterStreamHandler(s.Host, snowChitsID, s.handleStreamChits) protocol.RegisterStreamHandler(s.Host, snowGetBlock, s.handleStreamGetBlock) protocol.RegisterStreamHandler(s.Host, snowPullQuery, s.handleStreamPullQuery) diff --git a/system/p2p/dht/protocol/snowman/util.go b/system/p2p/dht/protocol/snow/util.go similarity index 87% rename from system/p2p/dht/protocol/snowman/util.go rename to system/p2p/dht/protocol/snow/util.go index 19eb3ccff..671ecc662 100644 --- a/system/p2p/dht/protocol/snowman/util.go +++ b/system/p2p/dht/protocol/snow/util.go @@ -1,4 +1,4 @@ -package snowman +package snow import ( "github.com/33cn/chain33/queue" @@ -6,23 +6,19 @@ import ( ) const ( - consensusTopic = "consensus" ) - - func consensusMsg(msgID int64, data interface{}) *queue.Message { return queue.NewMessage(msgID, consensusTopic, types.EventForFinalizer, data) } - func (s *snowman) sendQueryFailedMsg(msgID int64, reqID uint32, peerName string) { msg := &types.SnowFailedQuery{ RequestID: reqID, - PeerName: peerName, + PeerName: peerName, } err := s.P2PManager.Client.Send(consensusMsg(msgID, msg), false) @@ -33,8 +29,7 @@ func (s *snowman) sendQueryFailedMsg(msgID int64, reqID uint32, peerName string) } } - -func (s *snowman) getBlock(hash []byte) (*types.Block, error) { +func (s *snowman) getBlock(hash []byte) (*types.Block, error) { details, err := s.API.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{hash}}) if err != nil || len(details.GetItems()) < 1 { From 3084c9becbbace65b4f1530296f34fb9d88a7758 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:39:41 +0800 Subject: [PATCH 51/85] add more log details --- system/consensus/snowman/snowman.go | 9 ++- system/consensus/snowman/vm.go | 28 +++++---- system/p2p/dht/load.go | 2 +- system/p2p/dht/protocol/snow/handler.go | 4 +- types/proto/snowman.proto | 3 +- types/snowman.pb.go | 76 ++++++++++++++----------- 6 files changed, 70 insertions(+), 52 deletions(-) diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 5ee405af5..2564d7f78 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -259,16 +259,19 @@ func (s *snowman) handleSyncMsg(msg *queue.Message) { case types.EventSnowmanPutBlock: req := msg.Data.(*types.SnowPutBlock) - snowLog.Debug("handleInMsg putBlock", "reqID", req.GetRequestID(), "peerName", req.GetPeerName()) + snowLog.Debug("handleInMsg putBlock", "reqID", req.GetRequestID(), + "hash", hex.EncodeToString(req.BlockHash), "peerName", req.GetPeerName()) nodeID, err := s.vs.toNodeID(req.PeerName) if err != nil { - snowLog.Error("handleInMsg putBlock", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + snowLog.Error("handleInMsg putBlock", "reqID", req.RequestID, "hash", hex.EncodeToString(req.BlockHash), + "peerName", req.PeerName, "toNodeID err", err) return } err = s.engine.Put(s.ctx.Base.Context, nodeID, req.RequestID, req.BlockData) if err != nil { - snowLog.Error("handleInMsg putBlock", "reqID", req.RequestID, "peerName", req.PeerName, "Put err", err) + snowLog.Error("handleInMsg putBlock", "reqID", req.RequestID, "hash", hex.EncodeToString(req.BlockHash), + "peerName", req.PeerName, "Put err", err) } case types.EventSnowmanPullQuery: diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 5eec2ca66..65cc4653f 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -129,7 +129,7 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { - snowLog.Error("GetBlock", "hash", blkID.Hex(), "GetBlockByHashes err", err) + snowLog.Error("vmGetBlock", "hash", blkID.Hex(), "GetBlockByHashes err", err) return nil, database.ErrNotFound } sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) @@ -147,7 +147,7 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err blk := &types.Block{} err := types.Decode(b, blk) if err != nil { - snowLog.Error("ParseBlock", "decode err", err) + snowLog.Error("vmParseBlock", "decode err", err) return nil, err } sb := vm.newSnowBlock(blk, choices.Unknown) @@ -172,7 +172,7 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { vm.lock.Lock() defer vm.lock.Unlock() vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) - snowLog.Debug("addNewBlock", "ah", ah, "bh", blk.GetHeight(), "pendingNum", vm.pendingBlocks.Len()) + snowLog.Debug("vm addNewBlock", "ah", ah, "bh", blk.GetHeight(), "pendingNum", vm.pendingBlocks.Len()) return true //key := string(blk.ParentHash) @@ -190,16 +190,20 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { // returned. func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { + ah := atomic.LoadInt64(&vm.acceptedHeight) vm.lock.Lock() defer vm.lock.Unlock() - if vm.pendingBlocks.Len() <= 0 { - return nil, utils.ErrBlockNotReady + for vm.pendingBlocks.Len() > 0 { + sb := vm.pendingBlocks.Remove(vm.pendingBlocks.Front()).(*snowBlock) + if sb.Height() <= uint64(ah) { + continue + } + snowLog.Debug("vmBuildBlock", "pendingNum", vm.pendingBlocks.Len(), "height", sb.Height(), "hash", sb.id.Hex()) + return sb, nil } - sb := vm.pendingBlocks.Remove(vm.pendingBlocks.Front()).(*snowBlock) - snowLog.Debug("BuildBlock", "pendingNum", vm.pendingBlocks.Len(), "height", sb.Height(), "hash", sb.id.Hex()) - return sb, nil + return nil, utils.ErrBlockNotReady } // SetPreference Notify the VM of the currently preferred block. @@ -211,13 +215,13 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { vm.preferenceID = blkID vm.lock.Unlock() - snowLog.Debug("SetPreference", "blkHash", blkID.Hex()) + snowLog.Debug("vmSetPreference", "blkHash", blkID.Hex()) err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", types.EventSnowmanPreferBlk, &types.ReqBytes{Data: blkID[:]}), false) if err != nil { - snowLog.Error("SetPreference", "blkHash", blkID.Hex(), "send queue err", err) + snowLog.Error("vmSetPreference", "blkHash", blkID.Hex(), "send queue err", err) return err } @@ -248,7 +252,7 @@ func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { choice, err := getLastChoice(vm.qclient) if err != nil { - snowLog.Error("LastAccepted", "getLastChoice err", err) + snowLog.Error("vmLastAccepted", "getLastChoice err", err) return ids.Empty, err } @@ -281,7 +285,7 @@ func (vm *chain33VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids reply, err := vm.api.GetBlockHash(&types.ReqInt{Height: int64(height)}) if err != nil { - snowLog.Error("GetBlock", "height", height, "GetBlockHash err", err) + snowLog.Error("vmGetBlockIDAtHeight", "height", height, "GetBlockHash err", err) return ids.Empty, database.ErrNotFound } return toSnowID(reply.Hash), nil diff --git a/system/p2p/dht/load.go b/system/p2p/dht/load.go index fe187a8bb..f4eaaf1e6 100644 --- a/system/p2p/dht/load.go +++ b/system/p2p/dht/load.go @@ -5,5 +5,5 @@ import ( _ "github.com/33cn/chain33/system/p2p/dht/protocol/download" //register init package _ "github.com/33cn/chain33/system/p2p/dht/protocol/p2pstore" //register init package _ "github.com/33cn/chain33/system/p2p/dht/protocol/peer" //register init package - _ "github.com/33cn/chain33/system/p2p/dht/protocol/snowman" // load package + _ "github.com/33cn/chain33/system/p2p/dht/protocol/snow" // load package ) diff --git a/system/p2p/dht/protocol/snow/handler.go b/system/p2p/dht/protocol/snow/handler.go index de24e83bf..f02c72189 100644 --- a/system/p2p/dht/protocol/snow/handler.go +++ b/system/p2p/dht/protocol/snow/handler.go @@ -167,11 +167,11 @@ func (s *snowman) handleStreamGetBlock(stream network.Stream) { err := protocol.ReadStream(req, stream) peerName := stream.Conn().RemotePeer().String() if err != nil { - log.Error("handleStreamGetBlock", "reqID", req.RequestID, "peer", peerName, "readStream err", err) + log.Error("handleStreamGetBlock", "peer", peerName, "readStream err", err) return } - reply := &types.SnowPutBlock{RequestID: req.RequestID, PeerName: req.GetPeerName()} + reply := &types.SnowPutBlock{RequestID: req.RequestID, PeerName: req.GetPeerName(), BlockHash: req.GetBlockHash()} blk, err := s.getBlock(req.GetBlockHash()) diff --git a/types/proto/snowman.proto b/types/proto/snowman.proto index 9906e8dfc..f789a6f09 100644 --- a/types/proto/snowman.proto +++ b/types/proto/snowman.proto @@ -25,7 +25,8 @@ message snowPutBlock { uint32 requestID = 1; string peerName = 2; - bytes blockData = 3; + bytes blockHash = 3; + bytes blockData = 4; } diff --git a/types/snowman.pb.go b/types/snowman.pb.go index daf0275a0..4bca34c3d 100644 --- a/types/snowman.pb.go +++ b/types/snowman.pb.go @@ -161,7 +161,8 @@ type SnowPutBlock struct { RequestID uint32 `protobuf:"varint,1,opt,name=requestID,proto3" json:"requestID,omitempty"` PeerName string `protobuf:"bytes,2,opt,name=peerName,proto3" json:"peerName,omitempty"` - BlockData []byte `protobuf:"bytes,3,opt,name=blockData,proto3" json:"blockData,omitempty"` + BlockHash []byte `protobuf:"bytes,3,opt,name=blockHash,proto3" json:"blockHash,omitempty"` + BlockData []byte `protobuf:"bytes,4,opt,name=blockData,proto3" json:"blockData,omitempty"` } func (x *SnowPutBlock) Reset() { @@ -210,6 +211,13 @@ func (x *SnowPutBlock) GetPeerName() string { return "" } +func (x *SnowPutBlock) GetBlockHash() []byte { + if x != nil { + return x.BlockHash + } + return nil +} + func (x *SnowPutBlock) GetBlockData() []byte { if x != nil { return x.BlockData @@ -473,38 +481,40 @@ var file_snowman_proto_rawDesc = []byte{ 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x66, 0x0a, 0x0c, - 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x09, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, - 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, - 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x44, - 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x44, 0x61, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x6c, 0x6c, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x67, 0x0a, - 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, - 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, - 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x22, 0x4b, 0x0a, 0x0f, 0x73, 0x6e, 0x6f, 0x77, 0x46, 0x61, - 0x69, 0x6c, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, - 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x0a, 0x73, 0x6e, 0x6f, 0x77, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x42, 0x1f, 0x5a, - 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x33, 0x33, 0x63, 0x6e, - 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x84, 0x01, 0x0a, + 0x0c, 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x61, + 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x44, + 0x61, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x6c, 0x6c, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x22, 0x67, 0x0a, 0x0d, + 0x73, 0x6e, 0x6f, 0x77, 0x50, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x44, 0x61, 0x74, 0x61, 0x22, 0x4b, 0x0a, 0x0f, 0x73, 0x6e, 0x6f, 0x77, 0x46, 0x61, 0x69, + 0x6c, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x0a, 0x73, 0x6e, 0x6f, 0x77, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x42, 0x1f, 0x5a, 0x1d, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x33, 0x33, 0x63, 0x6e, 0x2f, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 7c4a3537ccf5e400ee2ff01c7bc408da3ad7febb Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:29:52 +0800 Subject: [PATCH 52/85] fix config MinLtBlockSize unit conversion --- system/p2p/dht/protocol/broadcast/broadcast.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/p2p/dht/protocol/broadcast/broadcast.go b/system/p2p/dht/protocol/broadcast/broadcast.go index fca336a2d..af6e2fd8b 100644 --- a/system/p2p/dht/protocol/broadcast/broadcast.go +++ b/system/p2p/dht/protocol/broadcast/broadcast.go @@ -30,7 +30,6 @@ func init() { protocol.RegisterProtocolInitializer(InitProtocol) } -// type broadcastProtocol struct { *protocol.P2PEnv txFilter *utils.Filterdata @@ -302,8 +301,9 @@ func (p *broadcastProtocol) setDefaultConfig() { p.cfg.BlockFilterLen = blockRecvFilterCacheNum } if p.cfg.MinLtBlockSize <= 0 { - p.cfg.MinLtBlockSize = defaultMinLtBlockSize * 1024 + p.cfg.MinLtBlockSize = defaultMinLtBlockSize } + p.cfg.MinLtBlockSize *= 1024 if p.cfg.LtBlockPendTimeout <= 0 { p.cfg.LtBlockPendTimeout = defaultLtBlockTimeout From 33267a203e296d8317f3b04ca1dfbe067087acae Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:23:19 +0800 Subject: [PATCH 53/85] update log --- system/consensus/solo/solo.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/system/consensus/solo/solo.go b/system/consensus/solo/solo.go index e138668ad..0153b02b6 100644 --- a/system/consensus/solo/solo.go +++ b/system/consensus/solo/solo.go @@ -6,6 +6,7 @@ package solo import ( + "encoding/hex" "time" log "github.com/33cn/chain33/common/log/log15" @@ -17,7 +18,7 @@ import ( var slog = log.New("module", "solo") -//Client 客户端 +// Client 客户端 type Client struct { *drivers.BaseClient subcfg *subConfig @@ -36,7 +37,7 @@ type subConfig struct { BenchMode bool `json:"benchMode"` } -//New new +// New new func New(cfg *types.Consensus, sub []byte) queue.Module { c := drivers.NewBaseClient(cfg) var subcfg subConfig @@ -61,17 +62,17 @@ func New(cfg *types.Consensus, sub []byte) queue.Module { return solo } -//Close close +// Close close func (client *Client) Close() { slog.Info("consensus solo closed") } -//GetGenesisBlockTime 获取创世区块时间 +// GetGenesisBlockTime 获取创世区块时间 func (client *Client) GetGenesisBlockTime() int64 { return client.subcfg.GenesisBlockTime } -//CreateGenesisTx 创建创世交易 +// CreateGenesisTx 创建创世交易 func (client *Client) CreateGenesisTx() (ret []*types.Transaction) { var tx types.Transaction cfg := client.GetAPI().GetConfig() @@ -86,12 +87,12 @@ func (client *Client) CreateGenesisTx() (ret []*types.Transaction) { return } -//ProcEvent false +// ProcEvent false func (client *Client) ProcEvent(msg *queue.Message) bool { return false } -//CheckBlock solo没有交易时返回错误 +// CheckBlock solo没有交易时返回错误 func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail) error { if len(current.Block.Txs) == 0 { return types.ErrEmptyTx @@ -99,7 +100,7 @@ func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail return nil } -//CreateBlock 创建区块 +// CreateBlock 创建区块 func (client *Client) CreateBlock() { issleep := true types.AssertConfig(client.GetAPI()) @@ -146,18 +147,18 @@ func (client *Client) CreateBlock() { newblock.BlockTime = types.Now().Unix() err := client.WriteBlock(lastBlock.StateHash, &newblock) - log.Info("SoloNewBlock", "height", newblock.Height, "txs", len(txs), "waitTxs", waitTxCost) - log.Info("SoloNewBlock", "height", newblock.Height, "txs", len(txs), "writeBlock", types.Since(beg)) + log.Info("SoloNewBlock", "height", newblock.Height, "txs", len(txs), "waitTxs", waitTxCost, "writeBlock", types.Since(beg)) beg = types.Now() //判断有没有交易是被删除的,这类交易要从mempool 中删除 if err != nil { + log.Error("SoloNewBlock", "height", newblock.Height, "hash", hex.EncodeToString(newblock.Hash(cfg)), "err", err) issleep = true continue } } } -//CmpBestBlock 比较newBlock是不是最优区块 +// CmpBestBlock 比较newBlock是不是最优区块 func (client *Client) CmpBestBlock(newBlock *types.Block, cmpBlock *types.Block) bool { return false } From 85327f3277488e72344c5017d7838ddf4e9c2f8e Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:27:25 +0800 Subject: [PATCH 54/85] handle add block error return --- system/consensus/base.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/consensus/base.go b/system/consensus/base.go index b89d63b32..de3e39a6f 100644 --- a/system/consensus/base.go +++ b/system/consensus/base.go @@ -470,7 +470,12 @@ func (bc *BaseClient) WriteBlock(prev []byte, block *types.Block) error { if err != nil { return err } - blockdetail = resp.GetData().(*types.BlockDetail) + blockdetail, ok := resp.GetData().(*types.BlockDetail) + if !ok { + err = resp.GetData().(error) + tlog.Error("WriteBlock", "height", block.Height, "hash", block.Hash(bc.client.GetConfig()), "addBlock err", err) + return err + } //从mempool 中删除错误的交易 beg := types.Now() // 执行后交易数只会减少, 如果交易数相等,则不需要进行diff操作 From 46b12ac100bda1647001ad960f9e86bb8c30d61f Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:53:07 +0800 Subject: [PATCH 55/85] add snowman engine reset function --- system/consensus/snowman/config.go | 26 +++++++ system/consensus/snowman/snowman.go | 96 ++++++-------------------- system/consensus/snowman/validators.go | 4 +- system/consensus/snowman/vm.go | 76 +++++--------------- 4 files changed, 69 insertions(+), 133 deletions(-) diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index 160f12640..2a4dcb0e8 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -71,3 +71,29 @@ func newSnowContext(cfg *types.Chain33Config) *snow.ConsensusContext { return ctx } + +func (s *snowman) applyConfig(subCfg *types.ConfigSubModule) { + + cfg := &Config{} + types.MustDecode(subCfg.Consensus["snowman"], cfg) + + if cfg.K > 0 { + s.params.K = cfg.K + } + + if cfg.Alpha > 0 { + s.params.Alpha = cfg.Alpha + } + + if cfg.BetaVirtuous > 0 { + s.params.BetaVirtuous = cfg.BetaVirtuous + } + + if cfg.BetaRogue > 0 { + s.params.BetaRogue = cfg.BetaRogue + } + + if cfg.ConcurrentRepolls > 0 { + s.params.ConcurrentRepolls = cfg.ConcurrentRepolls + } +} diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 2564d7f78..c4c131622 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -70,77 +70,35 @@ func (s *snowman) Initialize(ctx *consensus.Context) { s.vs = &vdrSet{} s.vs.init(ctx) - - engineConfig := newSnowmanConfig(s, s.params, newSnowContext(ctx.Base.GetAPI().GetConfig())) - engine, err := smeng.New(engineConfig) - if err != nil { - panic("Initialize snowman engine err:" + err.Error()) - } - s.engine = engine + s.initSnowEngine() s.inMsg = make(chan *queue.Message, 1024) s.engineNotify = make(chan struct{}, 1024) go s.startRoutine() } -func (s *snowman) applyConfig(subCfg *types.ConfigSubModule) { - - cfg := &Config{} - types.MustDecode(subCfg.Consensus["snowman"], cfg) +func (s *snowman) initSnowEngine() { - if cfg.K > 0 { - s.params.K = cfg.K - } - - if cfg.Alpha > 0 { - s.params.Alpha = cfg.Alpha - } - - if cfg.BetaVirtuous > 0 { - s.params.BetaVirtuous = cfg.BetaVirtuous - } - - if cfg.BetaRogue > 0 { - s.params.BetaRogue = cfg.BetaRogue - } - - if cfg.ConcurrentRepolls > 0 { - s.params.ConcurrentRepolls = cfg.ConcurrentRepolls + engineConfig := newSnowmanConfig(s, s.params, newSnowContext(s.ctx.Base.GetAPI().GetConfig())) + engine, err := smeng.New(engineConfig) + if err != nil { + panic("Initialize snowman engine err:" + err.Error()) } + s.engine = engine } -func (s *snowman) getChainSyncStatus() bool { - - reply, err := s.ctx.Base.GetAPI().IsSync() +func (s *snowman) resetEngine() { - if err != nil { - snowLog.Error("getChainSyncStatus", "err", err) - return false + snowLog.Debug("reset snowman engine") + s.initSnowEngine() + s.vm.reset() + if err := s.engine.Start(s.ctx.Base.Context, 0); err != nil { + snowLog.Error("resetEngine", "start engine err", err) } - - return reply.GetIsOk() } func (s *snowman) startRoutine() { - // check chain sync status - //for !s.getChainSyncStatus() { - // snowLog.Debug("startRoutine wait chain state syncing...") - // time.Sleep(5 * time.Second) - //} - - // check connected peers - //for { - // - // peers, err := s.vs.getConnectedPeers() - // if err == nil && len(peers) >= s.params.K { - // break - // } - // snowLog.Debug("startRoutine wait more snowman peer connected...", - // "currConnected", len(peers), "minRequiredNum", s.params.K, "err", err) - // time.Sleep(5 * time.Second) - //} - for { c, err := getLastChoice(s.ctx.Base.GetQueueClient()) if err == nil && len(c.Hash) > 0 { @@ -155,33 +113,18 @@ func (s *snowman) startRoutine() { } go s.dispatchSyncMsg() - //s.lock.Lock() - //s.initDone = true - //s.lock.Unlock() snowLog.Debug("snowman startRoutine done") } func (s *snowman) AddBlock(blk *types.Block) { - //s.lock.RLock() - //defer s.lock.RUnlock() - //if !s.initDone { - // return - //} if s.vm.addNewBlock(blk) { s.engineNotify <- struct{}{} } } func (s *snowman) SubMsg(msg *queue.Message) { - - //s.lock.RLock() - //defer s.lock.RUnlock() - //if !s.initDone { - // snowLog.Debug("snowman SubMsg ignore", "id", msg.ID, "name", types.GetEventName(int(msg.ID))) - // return - //} s.inMsg <- msg } @@ -212,14 +155,15 @@ func (s *snowman) handleSyncMsg(msg *queue.Message) { defer func() { if r := recover(); r != nil { - var buf [4048]byte - n := runtime.Stack(buf[:], false) - snowLog.Error("handleInMsg", "err", r, "stack", buf[:n]) + snowLog.Error("handleInMsg panic", "err", r, "stack", getStack()) } }() switch msg.ID { + case types.EventSnowmanResetEngine: + s.resetEngine() + case types.EventSnowmanChits: req := msg.Data.(*types.SnowChits) @@ -341,3 +285,9 @@ func (s *snowman) handleSyncMsg(msg *queue.Message) { } } + +func getStack() string { + var buf [4048]byte + n := runtime.Stack(buf[:], false) + return string(buf[:n]) +} diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validators.go index 38cd09c38..08403d68a 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validators.go @@ -102,7 +102,9 @@ func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { peers := make([]*types.Peer, 0, count) for _, p := range peerlist.GetPeers() { - if p.Self || p.Blocked || p.Header.GetHeight() < s.self.Finalized.GetHeight() { + if p.Self || p.Blocked || + p.Header.GetHeight() < s.self.Finalized.GetHeight() || + p.GetFinalized().GetHeight() < s.self.Finalized.GetHeight()-128 { continue } peers = append(peers, p) diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 65cc4653f..d71c14de9 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -2,7 +2,6 @@ package snowman import ( "container/list" - "encoding/hex" "sync" "sync/atomic" @@ -34,18 +33,14 @@ var ( // implements the snowman.ChainVM interface type chain33VM struct { blankVM - api client.QueueProtocolAPI - cfg *types.Chain33Config - qclient queue.Client - pendingBlock map[string]*types.Block + api client.QueueProtocolAPI + cfg *types.Chain33Config + qclient queue.Client pendingBlocks *list.List lock sync.RWMutex - preferenceID ids.ID acceptedHeight int64 - preferChan chan ids.ID - - decidedHashes *lru.Cache + decidedHashes *lru.Cache } func (vm *chain33VM) newSnowBlock(blk *types.Block, status choices.Status) *snowBlock { @@ -61,8 +56,7 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { vm.api = ctx.Base.GetAPI() vm.cfg = vm.api.GetConfig() vm.qclient = ctx.Base.GetQueueClient() - vm.pendingBlock = make(map[string]*types.Block, 8) - vm.preferChan = make(chan ids.ID, 32) + c, err := lru.New(1024) if err != nil { panic("chain33VM Init New lru err" + err.Error()) @@ -75,7 +69,6 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { panic(err) } vm.acceptedHeight = choice.Height - go vm.handleNotifyNewBlock(ctx.Base.Context) } // Initialize implements the snowman.ChainVM interface @@ -95,21 +88,8 @@ func (vm *chain33VM) Initialize( } -func (vm *chain33VM) handleNotifyNewBlock(ctx context.Context) { - - for { - - select { - - case <-ctx.Done(): - return - - case preferID := <-vm.preferChan: - - snowLog.Debug("handleNotifyNewBlock", "hash", hex.EncodeToString(preferID[:])) - } - - } +func (vm *chain33VM) reset() { + vm.decidedHashes.Purge() } // SetState communicates to VM its next state it starts @@ -129,7 +109,7 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { - snowLog.Error("vmGetBlock", "hash", blkID.Hex(), "GetBlockByHashes err", err) + snowLog.Error("vmGetBlock", "hash", blkID.Hex(), "stack", getStack()) return nil, database.ErrNotFound } sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) @@ -172,16 +152,9 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { vm.lock.Lock() defer vm.lock.Unlock() vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) - snowLog.Debug("vm addNewBlock", "ah", ah, "bh", blk.GetHeight(), "pendingNum", vm.pendingBlocks.Len()) + snowLog.Debug("vm addNewBlock", "height", blk.GetHeight(), "hash", blk.Hash(vm.cfg), + "acceptedHeight", ah, "pendingNum", vm.pendingBlocks.Len()) return true - - //key := string(blk.ParentHash) - //exist, ok := vm.pendingBlock[key] - //if ok { - // snowLog.Debug("addNewBlock replace block", "height", blk.Height, "old", hex.EncodeToString(exist.Hash(vm.cfg)), - // "new", hex.EncodeToString(blk.Hash(vm.cfg))) - //} - //vm.pendingBlock[key] = blk } // BuildBlock Attempt to create a new block from data contained in the VM. @@ -211,19 +184,14 @@ func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { // This should always be a block that has no children known to consensus. func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { - vm.lock.Lock() - vm.preferenceID = blkID - vm.lock.Unlock() - snowLog.Debug("vmSetPreference", "blkHash", blkID.Hex()) - - err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", - types.EventSnowmanPreferBlk, &types.ReqBytes{Data: blkID[:]}), false) - - if err != nil { - snowLog.Error("vmSetPreference", "blkHash", blkID.Hex(), "send queue err", err) - return err - } + //err := vm.qclient.Send(vm.qclient.NewMessage("blockchain", + // types.EventSnowmanPreferBlk, &types.ReqBytes{Data: blkID[:]}), false) + // + //if err != nil { + // snowLog.Error("vmSetPreference", "blkHash", blkID.Hex(), "send queue err", err) + // return err + //} return nil } @@ -311,13 +279,3 @@ func (vm *chain33VM) rejectBlock(height int64, blkID ids.ID) { vm.decidedHashes.Add(blkID, false) } - -func (vm *chain33VM) removeExpireBlock() { - - for key, blk := range vm.pendingBlock { - - if blk.Height <= vm.acceptedHeight { - delete(vm.pendingBlock, key) - } - } -} From 7c751c910ccc634bafa37037c9d2e9b8ad77fef7 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:19:50 +0800 Subject: [PATCH 56/85] * make sure connected block height higher than finalized height * add finalizer height stuck checking * reset finalizer engine when chain is stuck --- blockchain/blockfinalize.go | 117 +++++------------- blockchain/blocksyn.go | 17 ++- blockchain/process.go | 16 ++- system/p2p/dht/protocol/broadcast/validate.go | 5 +- types/error.go | 1 + types/event.go | 1 + 6 files changed, 66 insertions(+), 91 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 537148e72..f88b32de6 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -9,21 +9,20 @@ import ( ) var ( - blkFinalizeLastChoiceKey = []byte("chain-blockfinalize-lastchoice") + snowChoiceKey = []byte("blockchain-snowchoice") ) type finalizer struct { chain *BlockChain choice types.SnowChoice lock sync.RWMutex - isSync bool } func newFinalizer(chain *BlockChain) *finalizer { f := &finalizer{chain: chain} - raw, err := chain.blockStore.db.Get(blkFinalizeLastChoiceKey) + raw, err := chain.blockStore.db.Get(snowChoiceKey) if err == nil { err = types.Decode(raw, &f.choice) @@ -41,6 +40,30 @@ func newFinalizer(chain *BlockChain) *finalizer { return f } +func (f *finalizer) healthCheck(finalizedHeight int64) { + + ticker := time.NewTicker(time.Minute * 3) + for { + + select { + + case <-f.chain.quit: + return + + case <-ticker.C: + + height, _ := f.getLastFinalized() + if height > finalizedHeight { + finalizedHeight = height + continue + } + chainlog.Warn("finalizer healthCheck", "height", height) + _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), false) + } + } + +} + func (f *finalizer) waitFinalizeStartBlock(forkHeight int64) { for f.chain.blockStore.Height() < forkHeight+12 { @@ -53,18 +76,11 @@ func (f *finalizer) waitFinalizeStartBlock(forkHeight int64) { panic(err) } _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig())) + go f.healthCheck(detail.GetBlock().Height) } func (f *finalizer) snowmanPreferBlock(msg *queue.Message) { - req := (msg.Data).(*types.ReqBytes) - - detail, err := f.chain.LoadBlockByHash(req.GetData()) - if err != nil { - chainlog.Warn("snowmanPreferBlock", "hash", hex.EncodeToString(req.GetData()), "load block err", err.Error()) - return - } - chainlog.Debug("snowmanPreferBlock", "height", detail.GetBlock().GetHeight(), "hash", hex.EncodeToString(req.GetData())) - + //req := (msg.Data).(*types.ReqBytes) return } @@ -78,21 +94,14 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { chainlog.Debug("snowmanAcceptBlock disorder", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) return } - detail, err := f.chain.LoadBlockByHash(req.GetHash()) - if err != nil { - chainlog.Error("snowmanAcceptBlock", "height", req.Height, - "hash", hex.EncodeToString(req.GetHash()), "load block err", err.Error()) - return - } - - if detail.GetBlock().GetHeight() != req.GetHeight() { - - chainlog.Error("snowmanAcceptBlock height not equal", "expect", req.Height, "actual", detail.GetBlock().GetHeight(), + // 已经最终化区块不在当前最佳链中, 即当前节点在侧链上, 最终化记录不更新 + if !f.chain.bestChain.HaveBlock(req.GetHash(), req.GetHeight()) { + chainlog.Debug("snowmanAcceptBlock not in bestChain", "height", req.Height, "hash", hex.EncodeToString(req.GetHash())) return } - err = f.setFinalizedBlock(detail.GetBlock().GetHeight(), req.GetHash()) + err := f.setFinalizedBlock(req.GetHeight(), req.GetHash()) if err != nil { chainlog.Error("snowmanAcceptBlock", "setFinalizedBlock err", err.Error()) @@ -106,7 +115,7 @@ func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { defer f.lock.Unlock() f.choice.Height = height f.choice.Hash = hash - err := f.chain.blockStore.db.Set(blkFinalizeLastChoiceKey, types.Encode(&f.choice)) + err := f.chain.blockStore.db.Set(snowChoiceKey, types.Encode(&f.choice)) if err != nil { chainlog.Error("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash), "err", err) return err @@ -127,63 +136,3 @@ func (f *finalizer) snowmanLastChoice(msg *queue.Message) { msg.Reply(f.chain.client.NewMessage(msg.Topic, types.EventSnowmanLastChoice, &types.SnowChoice{Height: height, Hash: hash})) } - -func (f *finalizer) setSyncStatus(status bool) { - f.lock.Lock() - defer f.lock.Unlock() - f.isSync = status -} - -func (f *finalizer) getSyncStatus() bool { - f.lock.RLock() - defer f.lock.RUnlock() - return f.isSync -} - -const finlizeChoiceMaxInterval = 128 - -func (f *finalizer) finalizedStateSync() { - - //for !f.chain.IsCaughtUp() { - // chainlog.Debug("finalizedStateSync wait chain sync") - // time.Sleep(time.Second * 3) - //} - // - //minPeerCount := snowball.DefaultParameters.K - // - //for count := f.chain.GetPeerCount(); count < minPeerCount; { - // chainlog.Debug("finalizedStateSync wait more peers", "count", count) - // time.Sleep(time.Second * 3) - //} - //currHeight := f.chain.blockStore.Height() - //finalized, _ := f.getLastFinalized() - //if finalized >= currHeight-finlizeChoiceMaxInterval { - // f.setSyncStatus(true) - // return - //} - // - //detail, err := f.chain.GetBlock(currHeight - finlizeChoiceMaxInterval/2) - //if err != nil { - // chainlog.Error("finalizedStateSync", "GetBlock err:", err) - // return - //} - //// query snow choice - //req := &types.SnowChoice{ - // Height: detail.Block.Height, - // Hash: detail.Block.Hash(f.chain.client.GetConfig()), - //} - // - //msg := f.chain.client.NewMessage("p2p", types.EventSnowmanQueryChoice, req) - //err = f.chain.client.Send(msg, true) - //if err != nil { - // chainlog.Error("finalizedStateSync", "client.Send err:", err) - // return - //} - // - //replyMsg, err := f.chain.client.Wait(msg) - //if err != nil { - // chainlog.Error("finalizedStateSync", "client.Wait err:", err) - // return - //} - -} diff --git a/blockchain/blocksyn.go b/blockchain/blocksyn.go index c037be4cd..ba1939a2a 100644 --- a/blockchain/blocksyn.go +++ b/blockchain/blocksyn.go @@ -6,6 +6,7 @@ package blockchain import ( "bytes" + "github.com/33cn/chain33/queue" "math/big" "sort" "sync" @@ -742,6 +743,20 @@ func (chain *BlockChain) forkChainDetection(prevMode int) { chainlog.Info("forkDetectBlkHeightIncreased", "prev", localHeight, "curr", chain.GetBlockHeight()) return } + + // 分叉点在最终化记录之前, 需要重置最终化引擎 + finalized, _ := chain.finalizer.getLastFinalized() + if forkHeight < finalized { + chainlog.Debug("forkChainDetection reset finalize engine", "fork", forkHeight, "finalized", finalized) + forkHash, err := chain.blockStore.GetBlockHashByHeight(forkHeight) + if err != nil { + chainlog.Error("forkChainDetection", "height", forkHeight, "GetBlockHashByHeight err", err) + return + } + chain.finalizer.setFinalizedBlock(forkHeight, forkHash) + _ = chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), false) + } + // 检测到存在分叉后, 以最近高度作为结束高度 endHeight := cmpPeer.Height - BackBlockNum + 1 chainlog.Info("forkDetectDownBlk", "localHeight", localHeight, "endHeight", endHeight, "peers", len(activePeers)) @@ -886,7 +901,7 @@ func (chain *BlockChain) ProcBlockHeaders(headers *types.Headers, pid string) er synlog.Info("ProcBlockHeaders find fork point", "height", ForkHeight, "hash", common.ToHex(forkhash)) if chain.GetDownloadSyncStatus() == forkChainDetectMode { - synlog.Error("ProcBlockHeaders forkDetect", "forkHeight", ForkHeight) + synlog.Debug("ProcBlockHeaders forkDetect", "forkHeight", ForkHeight) select { case chain.forkPointChan <- ForkHeight: default: diff --git a/blockchain/process.go b/blockchain/process.go index 219f64fff..26bcbcade 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -210,6 +210,15 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet return block, true, nil } chainlog.Debug("connectBestChain", "parentHash", common.ToHex(parentHash), "bestChain.Tip().hash", common.ToHex(tip.hash)) + // 区块侧链分叉重组处理高度不能小于最终化高度 + fork := chain.bestChain.FindFork(node) + finalized, _ := chain.finalizer.getLastFinalized() + if fork != nil && fork.height < finalized { + chainlog.Debug("connectBestChain alreadyFinalized", + "finalized", finalized, "forkHeight", fork.height, "chainHeight", tip.height, + "addHeight", node.height, "addHash", common.ToHex(node.hash)) + return nil, false, types.ErrHeightAlreadyFinalized + } // 获取tip节点的block总难度tipid tiptd, Err := chain.blockStore.GetTdByBlockHash(tip.hash) @@ -234,7 +243,6 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet iSideChain = false } if iSideChain { - fork := chain.bestChain.FindFork(node) if fork != nil && bytes.Equal(parentHash, fork.hash) { chainlog.Info("connectBestChain FORK:", "Block hash", common.ToHex(node.hash), "fork.height", fork.height, "fork.hash", common.ToHex(fork.hash)) } else { @@ -249,7 +257,7 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet chainlog.Debug("connectBestChain block", "height", block.Block.Height, "hash", common.ToHex(block.Block.Hash(cfg))) // 获取需要重组的block node - detachNodes, attachNodes := chain.getReorganizeNodes(node) + detachNodes, attachNodes := chain.getReorganizeNodes(node, fork) // Reorganize the chain. err := chain.reorganizeChain(detachNodes, attachNodes) @@ -479,12 +487,12 @@ func (chain *BlockChain) disconnectBlock(node *blockNode, blockdetail *types.Blo } // 获取重组blockchain需要删除和添加节点 -func (chain *BlockChain) getReorganizeNodes(node *blockNode) (*list.List, *list.List) { +func (chain *BlockChain) getReorganizeNodes(node, forkNode *blockNode) (*list.List, *list.List) { attachNodes := list.New() detachNodes := list.New() // 查找到分叉的节点,并将分叉之后的block从index链push到attachNodes中 - forkNode := chain.bestChain.FindFork(node) + //forkNode := chain.bestChain.FindFork(node) for n := node; n != nil && n != forkNode; n = n.parent { attachNodes.PushFront(n) } diff --git a/system/p2p/dht/protocol/broadcast/validate.go b/system/p2p/dht/protocol/broadcast/validate.go index b681501d5..e97708204 100644 --- a/system/p2p/dht/protocol/broadcast/validate.go +++ b/system/p2p/dht/protocol/broadcast/validate.go @@ -14,8 +14,8 @@ import ( "time" "github.com/33cn/chain33/types" - "github.com/libp2p/go-libp2p/core/peer" ps "github.com/libp2p/go-libp2p-pubsub" + "github.com/libp2p/go-libp2p/core/peer" ) type deniedInfo struct { @@ -111,7 +111,8 @@ func (v *validator) handleBroadcastReply(reply *types.Reply, msg *broadcastMsg) // 忽略系统性错误, 区块存在错误可能是广播和下载不协调导致, 可能误判, 暂不做处理 if errMsg == types.ErrMemFull.Error() || errMsg == types.ErrNotSync.Error() || - errMsg == types.ErrBlockExist.Error() { + errMsg == types.ErrBlockExist.Error() || + errMsg == types.ErrHeightAlreadyFinalized.Error() { return } denyTime := int64(errBlockDenyTime) diff --git a/types/error.go b/types/error.go index 382f764c2..494eb05c5 100644 --- a/types/error.go +++ b/types/error.go @@ -101,6 +101,7 @@ var ( ErrUnmarshal = errors.New("ErrUnmarshal") ErrMarshal = errors.New("ErrMarshal") ErrBlockExist = errors.New("ErrBlockExist") + ErrHeightAlreadyFinalized = errors.New("ErrHeightAlreadyFinalized") ErrParentBlockNoExist = errors.New("ErrParentBlockNoExist") ErrBlockHeightNoMatch = errors.New("ErrBlockHeightNoEqual") ErrParentTdNoExist = errors.New("ErrParentTdNoExist") diff --git a/types/event.go b/types/event.go index 659e0a8c8..4eb97e82a 100644 --- a/types/event.go +++ b/types/event.go @@ -223,6 +223,7 @@ const ( EventSnowmanGetFailed = 381 EventSnowmanQueryFailed = 382 EventSnowmanQueryChoice = 383 + EventSnowmanResetEngine = 384 ) var eventName = map[int]string{ From a2692e85566b15395b504cbfebf08e84cac5c2cc Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:28:51 +0800 Subject: [PATCH 57/85] add finalize config for blockchain --- blockchain/blockfinalize.go | 14 ++++++++------ blockchain/chain.go | 3 +++ types/cfg.go | 4 ++++ types/const.go | 6 ------ types/fork.go | 1 - 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index f88b32de6..345c0a0fb 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -32,8 +32,8 @@ func newFinalizer(chain *BlockChain) *finalizer { } chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) } else { - f.choice.Height = chain.client.GetConfig().GetFork(types.ForkBlockFinalize) - chainlog.Debug("newFinalizer", "forkHeight", f.choice.Height) + f.choice.Height = chain.cfg.BlockFinalizeEnableHeight + chainlog.Debug("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight) go f.waitFinalizeStartBlock(f.choice.Height) } @@ -64,15 +64,17 @@ func (f *finalizer) healthCheck(finalizedHeight int64) { } -func (f *finalizer) waitFinalizeStartBlock(forkHeight int64) { +const defaultFinalizeGapHeight = 128 - for f.chain.blockStore.Height() < forkHeight+12 { +func (f *finalizer) waitFinalizeStartBlock(beginHeight int64) { + + for f.chain.blockStore.Height() < beginHeight+f.chain.cfg.BlockFinalizeGapHeight { time.Sleep(time.Second * 5) } - detail, err := f.chain.GetBlock(forkHeight) + detail, err := f.chain.GetBlock(beginHeight) if err != nil { - chainlog.Error("setFinalizedStartHeight", "height", forkHeight, "get block err", err) + chainlog.Error("setFinalizedStartHeight", "height", beginHeight, "get block err", err) panic(err) } _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig())) diff --git a/blockchain/chain.go b/blockchain/chain.go index 07a06f132..4a9667f4c 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -233,6 +233,9 @@ func (chain *BlockChain) initConfig(cfg *types.Chain33Config) { chain.initOnChainTimeout() // 初始化AllowPackHeight initAllowPackHeight(chain.cfg) + if mcfg.BlockFinalizeGapHeight <= 0 { + mcfg.BlockFinalizeGapHeight = defaultFinalizeGapHeight + } } // Close 关闭区块链 diff --git a/types/cfg.go b/types/cfg.go index 485c779c8..eebedaf62 100644 --- a/types/cfg.go +++ b/types/cfg.go @@ -240,6 +240,10 @@ type BlockChain struct { DisableClockDriftCheck bool `json:"disableClockDriftCheck,omitempty"` //保存每个区块的block kvs EnableSaveBlockKVs bool `json:"enableSaveBlockKVs,omitempty"` + // 区块最终化机制启动高度 + BlockFinalizeEnableHeight int64 `json:"blockFinalizeEnableHeight,omitempty"` + // 区块最终化启动高度间隔, 等待高度差 + BlockFinalizeGapHeight int64 `json:"blockFinalizeGapHeight,omitempty"` } // P2P 配置 diff --git a/types/const.go b/types/const.go index a6d59ea7a..f9a993a6e 100644 --- a/types/const.go +++ b/types/const.go @@ -163,9 +163,3 @@ var LowAllowPackHeight int64 = 200 // MaxAllowPackInterval 允许打包的最大区间值 var MaxAllowPackInterval int64 = 5000 -// system fork name - -const ( - // ForkBlockFinalize 区块最终化fork - ForkBlockFinalize = "ForkBlockFinalize" -) diff --git a/types/fork.go b/types/fork.go index 14ced873a..3094d3aa8 100644 --- a/types/fork.go +++ b/types/fork.go @@ -144,7 +144,6 @@ func (f *Forks) SetTestNetFork() { f.SetFork(address.ForkFormatAddressKey, 0) f.setFork("ForkCheckEthTxSort", 0) f.setFork("ForkProxyExec", 0) - f.setFork(ForkBlockFinalize, 0) } func (f *Forks) setLocalFork() { From 93e31f69a1864e8435b2895233f36e4dd2367329 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:05:08 +0800 Subject: [PATCH 58/85] use libp2p peer id as snow engine node id --- .../consensus/snowman/{validators.go => validator.go} | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) rename system/consensus/snowman/{validators.go => validator.go} (94%) diff --git a/system/consensus/snowman/validators.go b/system/consensus/snowman/validator.go similarity index 94% rename from system/consensus/snowman/validators.go rename to system/consensus/snowman/validator.go index 08403d68a..8a642598d 100644 --- a/system/consensus/snowman/validators.go +++ b/system/consensus/snowman/validator.go @@ -11,8 +11,6 @@ import ( "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/validators" - - libpeer "github.com/libp2p/go-libp2p/core/peer" ) type vdrSet struct { @@ -125,12 +123,8 @@ func (s *vdrSet) toLibp2pID(id ids.NodeID) string { func (s *vdrSet) toNodeID(id string) (ids.NodeID, error) { - pid, err := libpeer.Decode(id) - if err != nil { - return ids.EmptyNodeID, err - } - - nid, err := ids.ToNodeID([]byte(pid)[:20]) + shortID := id[:10] + id[len(id)-10:] + nid, err := ids.ToNodeID([]byte(shortID)) if err != nil { return ids.EmptyNodeID, err } From 25b1b0c911be9a71266b7977c2a8f98f013d6c30 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:17:01 +0800 Subject: [PATCH 59/85] [[FEAT]] import avalanche snowman engine --- go.mod | 6 ++---- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 5a9132348..1e4d01b4a 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,6 @@ module github.com/33cn/chain33 go 1.19 -replace ( - github.com/ava-labs/avalanchego => ../../ava-labs/avalanchego -) - require ( github.com/BurntSushi/toml v1.2.1 github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b @@ -231,3 +227,5 @@ require ( ) replace github.com/btcsuite/btcd/btcec => github.com/btcsuite/btcd v0.22.3 + +replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240425071419-8fa889e91c4d diff --git a/go.sum b/go.sum index 3f744e7d2..d1018acea 100644 --- a/go.sum +++ b/go.sum @@ -158,8 +158,6 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= -github.com/ava-labs/avalanchego v1.10.9 h1:qxhp3YoD2Wm/iIKP6Wb1isbkUPWmIrJxWgivDoL0obM= -github.com/ava-labs/avalanchego v1.10.9/go.mod h1:C8R5uiltpc8MQ62ixxgODR+15mesWF0aAw3H+Qrl9Iw= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.29.16/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= @@ -216,6 +214,8 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/bysomeone/avalanchego v0.0.0-20240425071419-8fa889e91c4d h1:7kiPBbovd/xxPh84vmEZA+ZgwMUECF0KDIwkGmfzMUg= +github.com/bysomeone/avalanchego v0.0.0-20240425071419-8fa889e91c4d/go.mod h1:C8R5uiltpc8MQ62ixxgODR+15mesWF0aAw3H+Qrl9Iw= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= From 945997c6d2a25b9d5aa9994d5344ead77e429020 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 8 May 2024 13:32:52 +0800 Subject: [PATCH 60/85] add block finalizer unit test --- blockchain/blockfinalize.go | 10 +++--- blockchain/blockfinalize_test.go | 58 ++++++++++++++++++++++++++++++++ blockchain/chain.go | 4 +-- 3 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 blockchain/blockfinalize_test.go diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 345c0a0fb..ee327968b 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -18,10 +18,9 @@ type finalizer struct { lock sync.RWMutex } -func newFinalizer(chain *BlockChain) *finalizer { - - f := &finalizer{chain: chain} +func (f *finalizer) Init(chain *BlockChain) { + f.chain = chain raw, err := chain.blockStore.db.Get(snowChoiceKey) if err == nil { @@ -36,8 +35,6 @@ func newFinalizer(chain *BlockChain) *finalizer { chainlog.Debug("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight) go f.waitFinalizeStartBlock(f.choice.Height) } - - return f } func (f *finalizer) healthCheck(finalizedHeight int64) { @@ -68,7 +65,8 @@ const defaultFinalizeGapHeight = 128 func (f *finalizer) waitFinalizeStartBlock(beginHeight int64) { - for f.chain.blockStore.Height() < beginHeight+f.chain.cfg.BlockFinalizeGapHeight { + waitHeight := f.chain.cfg.BlockFinalizeGapHeight + for f.chain.blockStore.Height() < beginHeight+waitHeight { time.Sleep(time.Second * 5) } diff --git a/blockchain/blockfinalize_test.go b/blockchain/blockfinalize_test.go new file mode 100644 index 000000000..a5af27d0d --- /dev/null +++ b/blockchain/blockfinalize_test.go @@ -0,0 +1,58 @@ +package blockchain + +import ( + dbm "github.com/33cn/chain33/common/db" + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" + "github.com/stretchr/testify/require" + "os" + "testing" +) + +func newTestChain(t *testing.T) (*BlockChain, string) { + + chain := InitEnv() + dir, err := os.MkdirTemp("", "finalize") + require.Nil(t, err) + blockStoreDB := dbm.NewDB("blockchain", "leveldb", dir, 64) + chain.blockStore = NewBlockStore(chain, blockStoreDB, nil) + node := newPreGenBlockNode() + node.parent = nil + chain.bestChain = newChainView(node) + return chain, dir +} + +func TestFinalizer(t *testing.T) { + + chain, dir := newTestChain(t) + defer os.RemoveAll(dir) + + f := &finalizer{} + f.Init(chain) + + hash := []byte("testhash") + choice := &types.SnowChoice{Height: 1, Hash: hash} + msg := queue.NewMessage(0, "test", 0, choice) + + f.snowmanPreferBlock(msg) + f.snowmanAcceptBlock(msg) + height, hash1 := f.getLastFinalized() + require.Equal(t, 0, int(height)) + require.Equal(t, 0, len(hash1)) + node := &blockNode{ + parent: chain.bestChain.Tip(), + height: 1, + hash: hash, + } + chain.bestChain.SetTip(node) + f.snowmanAcceptBlock(msg) + height, hash1 = f.getLastFinalized() + require.Equal(t, 1, int(height)) + require.Equal(t, hash, hash1) + + f.snowmanLastChoice(msg) + msg1, err := chain.client.Wait(msg) + require.Nil(t, err) + require.Equal(t, msg1.Data, choice) + f.Init(chain) +} diff --git a/blockchain/chain.go b/blockchain/chain.go index 4a9667f4c..ff2c71690 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -292,8 +292,8 @@ func (chain *BlockChain) SetQueueClient(client queue.Client) { // 获取当前最大chunk连续高度 chain.maxSerialChunkNum = chain.blockStore.GetMaxSerialChunkNum() - chain.finalizer = newFinalizer(chain) - + chain.finalizer = &finalizer{} + chain.finalizer.Init(chain) //recv 消息的处理,共识模块需要获取lastblock从数据库中 chain.recvwg.Add(1) //初始化blockchian模块 From feabc26935e864c73a7d22074eddd02a3c7b609b Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 8 May 2024 19:11:06 +0800 Subject: [PATCH 61/85] add unit test --- system/consensus/snowman/blankvm.go | 3 +- system/consensus/snowman/config.go | 2 +- system/consensus/snowman/sender.go | 29 +++-- system/consensus/snowman/sender_test.go | 72 +++++++++++ system/consensus/snowman/snowman.go | 13 +- system/consensus/snowman/validator.go | 26 ++-- system/consensus/snowman/validator_test.go | 93 ++++++++++++++ system/consensus/snowman/vm.go | 17 ++- system/consensus/snowman/vm_test.go | 133 +++++++++++++++++++++ 9 files changed, 352 insertions(+), 36 deletions(-) create mode 100644 system/consensus/snowman/sender_test.go create mode 100644 system/consensus/snowman/validator_test.go create mode 100644 system/consensus/snowman/vm_test.go diff --git a/system/consensus/snowman/blankvm.go b/system/consensus/snowman/blankvm.go index 46b37c2ee..48ce5c9cb 100644 --- a/system/consensus/snowman/blankvm.go +++ b/system/consensus/snowman/blankvm.go @@ -114,6 +114,5 @@ func (*blankVM) Version(context.Context) (string, error) { func recordUnimplementedError(funcName string) { - snowLog.Error("Call unimplemented function", "func", funcName) - panic("") + snowLog.Error("Call unimplemented function", "func", funcName, "stack", getStack()) } diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index 2a4dcb0e8..be2816d86 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -21,7 +21,7 @@ import ( func newSnowmanConfig(sm *snowman, params snowball.Parameters, snowCtx *snow.ConsensusContext) smeng.Config { - sender := newMsgSender(sm, snowCtx) + sender := newMsgSender(sm.vs, sm.ctx.Base.GetQueueClient(), snowCtx) engineConfig := smeng.Config{ Ctx: snowCtx, VM: sm.vm, diff --git a/system/consensus/snowman/sender.go b/system/consensus/snowman/sender.go index 2cda6bf30..2079bdfbb 100644 --- a/system/consensus/snowman/sender.go +++ b/system/consensus/snowman/sender.go @@ -21,14 +21,13 @@ import ( // 向外部模块发送请求, blockchain/p2p等 type msgSender struct { common.Sender - cli client.Client - sm *snowman + cli client.Client + vdrs *vdrSet } -func newMsgSender(sm *snowman, snowCtx *snow.ConsensusContext) *msgSender { +func newMsgSender(vdrs *vdrSet, cli client.Client, snowCtx *snow.ConsensusContext) *msgSender { - s := &msgSender{sm: sm} - s.cli = sm.ctx.Base.GetQueueClient() + s := &msgSender{vdrs: vdrs, cli: cli} sd, err := sender.New(snowCtx, nil, nil, nil, nil, p2p.EngineType_ENGINE_TYPE_SNOWMAN, nil) if err != nil { @@ -40,9 +39,9 @@ func newMsgSender(sm *snowman, snowCtx *snow.ConsensusContext) *msgSender { } // SendChits send chits to the specified node -func (s *msgSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) { +func (s *msgSender) SendChits(_ context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) { - peerName := s.sm.vs.toLibp2pID(nodeID) + peerName := s.vdrs.toLibp2pID(nodeID) snowLog.Debug("msgSender SendChits", "reqID", requestID, "peer", peerName, "preferHash", hex.EncodeToString(preferredID[:]), "acceptHash", hex.EncodeToString(acceptedID[:])) @@ -64,9 +63,9 @@ func (s *msgSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID } // SendGet Request that the specified node send the specified container to this node. -func (s *msgSender) SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockID ids.ID) { +func (s *msgSender) SendGet(_ context.Context, nodeID ids.NodeID, requestID uint32, blockID ids.ID) { - peerName := s.sm.vs.toLibp2pID(nodeID) + peerName := s.vdrs.toLibp2pID(nodeID) snowLog.Debug("msgSender SendGet", "reqID", requestID, "peer", peerName, "blkHash", hex.EncodeToString(blockID[:])) req := &types.SnowGetBlock{ RequestID: requestID, @@ -83,9 +82,9 @@ func (s *msgSender) SendGet(ctx context.Context, nodeID ids.NodeID, requestID ui } // SendPut Tell the specified node about [container]. -func (s *msgSender) SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, blkData []byte) { +func (s *msgSender) SendPut(_ context.Context, nodeID ids.NodeID, requestID uint32, blkData []byte) { - peerName := s.sm.vs.toLibp2pID(nodeID) + peerName := s.vdrs.toLibp2pID(nodeID) snowLog.Debug("msgSender SendPut", "reqID", requestID, "peer", peerName) req := &types.SnowPutBlock{ RequestID: requestID, @@ -101,7 +100,7 @@ func (s *msgSender) SendPut(ctx context.Context, nodeID ids.NodeID, requestID ui } // SendPullQuery Request from the specified nodes their preferred frontier, given the existence of the specified container. -func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, blockID ids.ID) { +func (s *msgSender) SendPullQuery(_ context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, blockID ids.ID) { snowLog.Debug("msgSender SendPullQuery", "reqID", requestID, "peerLen", nodeIDs.Len(), "blkHash", hex.EncodeToString(blockID[:])) @@ -111,7 +110,7 @@ func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeI req := &types.SnowPullQuery{ RequestID: requestID, BlockHash: blockID[:], - PeerName: s.sm.vs.toLibp2pID(nodeID), + PeerName: s.vdrs.toLibp2pID(nodeID), } msg := s.cli.NewMessage("p2p", types.EventSnowmanPullQuery, req) @@ -128,7 +127,7 @@ func (s *msgSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeI // existence of the specified container. // This is the same as PullQuery, except that this message includes the body // of the container rather than its ID. -func (s *msgSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, blockData []byte) { +func (s *msgSender) SendPushQuery(_ context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, blockData []byte) { snowLog.Debug("msgSender SendPushQuery", "reqID", requestID, "peerLen", nodeIDs.Len()) @@ -137,7 +136,7 @@ func (s *msgSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeI req := &types.SnowPushQuery{ RequestID: requestID, BlockData: blockData, - PeerName: s.sm.vs.toLibp2pID(nodeID), + PeerName: s.vdrs.toLibp2pID(nodeID), } msg := s.cli.NewMessage("p2p", types.EventSnowmanPushQuery, req) diff --git a/system/consensus/snowman/sender_test.go b/system/consensus/snowman/sender_test.go new file mode 100644 index 000000000..3ae5545cd --- /dev/null +++ b/system/consensus/snowman/sender_test.go @@ -0,0 +1,72 @@ +package snowman + +import ( + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/utils/bag" + "github.com/ava-labs/avalanchego/utils/set" + "github.com/stretchr/testify/require" + "testing" +) + +func TestMsgSender(t *testing.T) { + + q := queue.New("test") + cli := q.Client() + v := &vdrSet{} + v.init(nil, cli) + s := newMsgSender(v, cli, newSnowContext(types.NewChain33Config(types.GetDefaultCfgstring()))) + defer cli.Close() + peer := "testpeer" + nodeID, err := v.toNodeID(peer) + require.Nil(t, err) + + go func() { + cli.Sub("p2p") + var reqID, checkID uint32 + var checkName string + for msg := range cli.Recv() { + reqID++ + if msg.Ty == types.EventSnowmanChits { + req := msg.Data.(*types.SnowChits) + checkID = req.GetRequestID() + checkName = req.GetPeerName() + }else if msg.Ty == types.EventSnowmanPutBlock { + req := msg.Data.(*types.SnowPutBlock) + checkID = req.GetRequestID() + checkName = req.GetPeerName() + }else if msg.Ty == types.EventSnowmanGetBlock{ + req := msg.Data.(*types.SnowGetBlock) + checkID = req.GetRequestID() + checkName = req.GetPeerName() + }else if msg.Ty == types.EventSnowmanPullQuery { + req := msg.Data.(*types.SnowPullQuery) + checkID = req.GetRequestID() + checkName = req.GetPeerName() + + }else if msg.Ty == types.EventSnowmanPushQuery { + req := msg.Data.(*types.SnowPushQuery) + checkID = req.GetRequestID() + checkName = req.GetPeerName() + } + + require.Equal(t, peer, checkName) + require.Equal(t, reqID, checkID) + } + }() + + s.SendChits(nil, nodeID, 1, ids.Empty, ids.Empty) + s.SendGet(nil, nodeID, 2, ids.Empty) + s.SendPut(nil, nodeID, 3, nil) + vdrBag := bag.Bag[ids.NodeID]{} + vdrBag.Add(nodeID) + nodeIDs := set.Of(vdrBag.List()...) + s.SendPullQuery(nil, nodeIDs, 4, ids.Empty) + s.SendPushQuery(nil, nodeIDs, 5, nil) + + // test unimplented method + s.SendGossip(nil, nil) + s.SendGetAncestors(nil, ids.EmptyNodeID, 0, ids.Empty) + s.SendAncestors(nil, ids.EmptyNodeID, 0, nil) +} diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index c4c131622..fb6c34094 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -69,7 +69,7 @@ func (s *snowman) Initialize(ctx *consensus.Context) { s.vm.Init(ctx) s.vs = &vdrSet{} - s.vs.init(ctx) + s.vs.init(ctx, ctx.Base.GetQueueClient()) s.initSnowEngine() s.inMsg = make(chan *queue.Message, 1024) @@ -119,9 +119,16 @@ func (s *snowman) startRoutine() { func (s *snowman) AddBlock(blk *types.Block) { - if s.vm.addNewBlock(blk) { - s.engineNotify <- struct{}{} + if !s.vm.addNewBlock(blk) { + return } + + select { + case s.engineNotify <- struct{}{}: + default: + + } + } func (s *snowman) SubMsg(msg *queue.Message) { diff --git a/system/consensus/snowman/validator.go b/system/consensus/snowman/validator.go index 8a642598d..c26dcbc28 100644 --- a/system/consensus/snowman/validator.go +++ b/system/consensus/snowman/validator.go @@ -2,6 +2,7 @@ package snowman import ( "fmt" + "github.com/33cn/chain33/queue" "math/rand" "sync" "time" @@ -16,16 +17,18 @@ import ( type vdrSet struct { validators.Set ctx *consensus.Context + qclient queue.Client self *types.Peer peerIDs map[ids.NodeID]string lock sync.RWMutex rand *rand.Rand } -func (s *vdrSet) init(ctx *consensus.Context) { +func (s *vdrSet) init(ctx *consensus.Context, cli queue.Client) { s.Set = validators.NewSet() s.ctx = ctx + s.qclient = cli s.rand = rand.New(rand.NewSource(types.Now().Unix())) s.peerIDs = make(map[ids.NodeID]string) } @@ -46,7 +49,7 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { snowLog.Debug("vdrSet Sample", "require", size) peers, err := s.getConnectedPeers() - if err != nil || len(peers) < size { + if err != nil || len(peers) < size || size <= 0 { snowLog.Error("vdrSet Sample", "connected", len(peers), "require", size, "err", err) return nil, utils.ErrValidatorSample } @@ -78,13 +81,13 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { snowLog.Debug("vdrSet getConnectedPeers") - msg := s.ctx.Base.GetQueueClient().NewMessage("p2p", types.EventPeerInfo, nil) - err := s.ctx.Base.GetQueueClient().Send(msg, true) + msg := s.qclient.NewMessage("p2p", types.EventPeerInfo, nil) + err := s.qclient.Send(msg, true) if err != nil { snowLog.Error("getConnectedPeers", "client.Send err:", err) return nil, err } - resp, err := s.ctx.Base.GetQueueClient().WaitTimeout(msg, 5*time.Second) + resp, err := s.qclient.WaitTimeout(msg, 5*time.Second) if err != nil { snowLog.Error("getConnectedPeers", "client.Wait err:", err) return nil, err @@ -101,8 +104,7 @@ func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { for _, p := range peerlist.GetPeers() { if p.Self || p.Blocked || - p.Header.GetHeight() < s.self.Finalized.GetHeight() || - p.GetFinalized().GetHeight() < s.self.Finalized.GetHeight()-128 { + p.GetFinalized().GetHeight() < s.self.GetHeader().GetHeight()-128 { continue } peers = append(peers, p) @@ -123,8 +125,14 @@ func (s *vdrSet) toLibp2pID(id ids.NodeID) string { func (s *vdrSet) toNodeID(id string) (ids.NodeID, error) { - shortID := id[:10] + id[len(id)-10:] - nid, err := ids.ToNodeID([]byte(shortID)) + if id == "" { + return ids.EmptyNodeID, types.ErrInvalidParam + } + tempID := id + for len(tempID) < 20 { + tempID += tempID + } + nid, err := ids.ToNodeID([]byte(tempID[len(tempID)-20:])) if err != nil { return ids.EmptyNodeID, err } diff --git a/system/consensus/snowman/validator_test.go b/system/consensus/snowman/validator_test.go new file mode 100644 index 000000000..1498ece86 --- /dev/null +++ b/system/consensus/snowman/validator_test.go @@ -0,0 +1,93 @@ +package snowman + +import ( + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/system/consensus/snowman/utils" + "github.com/33cn/chain33/types" + "github.com/stretchr/testify/require" + "strings" + "testing" +) + +func TestNodeID(t *testing.T) { + + v := &vdrSet{} + v.init(nil, nil) + peer := "16Uiu2HAmVXKApGkrdWMvJPKx8QQzcnLafETiHefzGxjBS163LD1k" + + id, err := v.toNodeID(peer) + require.Nil(t, err) + ids := id.String() + require.True(t, strings.Contains(ids, peer[len(peer)-20:])) + + ps := v.toLibp2pID(id) + require.Equal(t, peer, ps) + require.Equal(t, 1, v.Len()) + _, err = v.toNodeID("") + require.Equal(t, types.ErrInvalidParam, err) + _, err = v.toNodeID("1") + require.Nil(t, err) +} + +func Test_getConnectedPeers(t *testing.T) { + + v := &vdrSet{} + + q := queue.New("test") + cli := q.Client() + v.init(nil, cli) + defer cli.Close() + list := &types.PeerList{} + go func() { + cli.Sub("p2p") + + for msg := range cli.Recv() { + + if msg.Ty == types.EventPeerInfo { + msg.Reply(cli.NewMessage("", 0, list)) + } + } + }() + + self := &types.Peer{Self: true, Header: &types.Header{Height: 129}} + + + list.Peers = []*types.Peer{self} + peers, err := v.getConnectedPeers() + require.Nil(t, err) + require.Nil(t, peers) + peer := &types.Peer{Name: "peer", Header: &types.Header{}, Finalized: &types.SnowChoice{}, Blocked: true} + + list.Peers = []*types.Peer{peer, self} + peers, err = v.getConnectedPeers() + require.Nil(t, err) + require.Equal(t, 0, len(peers)) + peer.Blocked = false + peers, err = v.getConnectedPeers() + require.Nil(t, err) + require.Equal(t, 0, len(peers)) + peer.Finalized.Height = 1 + + peers, err = v.getConnectedPeers() + require.Nil(t, err) + require.Equal(t, 1, len(peers)) + require.Equal(t, peer, peers[0]) + + // test sample + _, err = v.Sample(2) + require.Equal(t, utils.ErrValidatorSample, err) + _, err = v.Sample(0) + require.Equal(t, utils.ErrValidatorSample, err) + peer1 := *peer + peer1.Name = "peer1" + list.Peers = []*types.Peer{peer,&peer1, self} + ids, err := v.Sample(2) + require.Nil(t, err) + require.Equal(t, 2, len(ids)) +} + +func TestVdrSetUnimplented(t *testing.T) { + v := &vdrSet{} + _ = v.String() + v.RegisterCallbackListener(nil) +} diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index d71c14de9..4ecaf1d63 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -90,6 +90,8 @@ func (vm *chain33VM) Initialize( func (vm *chain33VM) reset() { vm.decidedHashes.Purge() + vm.pendingBlocks.Init() + atomic.StoreInt64(&vm.acceptedHeight, 0) } // SetState communicates to VM its next state it starts @@ -109,13 +111,16 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { - snowLog.Error("vmGetBlock", "hash", blkID.Hex(), "stack", getStack()) + snowLog.Debug("vmGetBlock", "hash", blkID.Hex()) return nil, database.ErrNotFound } sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) - acceptHeight := atomic.LoadInt64(&vm.acceptedHeight) - if sb.block.Height <= acceptHeight { - sb.status = choices.Accepted + accepted, ok := vm.decidedHashes.Get(sb.ID()) + if ok { + sb.status = choices.Rejected + if accepted.(bool) { + sb.status = choices.Accepted + } } return sb, nil @@ -161,7 +166,7 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { // // If the VM doesn't want to issue a new block, an error should be // returned. -func (vm *chain33VM) BuildBlock(context.Context) (snowcon.Block, error) { +func (vm *chain33VM) BuildBlock(_ context.Context) (snowcon.Block, error) { ah := atomic.LoadInt64(&vm.acceptedHeight) vm.lock.Lock() @@ -216,7 +221,7 @@ func getLastChoice(cli queue.Client) (*types.SnowChoice, error) { // If no blocks have been accepted by consensus yet, it is assumed there is // a definitionally accepted block, the Genesis block, that will be // returned. -func (vm *chain33VM) LastAccepted(context.Context) (ids.ID, error) { +func (vm *chain33VM) LastAccepted(_ context.Context) (ids.ID, error) { choice, err := getLastChoice(vm.qclient) if err != nil { diff --git a/system/consensus/snowman/vm_test.go b/system/consensus/snowman/vm_test.go new file mode 100644 index 000000000..869d4417c --- /dev/null +++ b/system/consensus/snowman/vm_test.go @@ -0,0 +1,133 @@ +package snowman + +import ( + "encoding/hex" + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/system/consensus" + "github.com/33cn/chain33/system/consensus/snowman/utils" + "github.com/33cn/chain33/types" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow/choices" + "github.com/stretchr/testify/require" + "testing" + "time" +) + +func newTestCtx() *consensus.Context { + + q := queue.New("test") + cfg := types.NewChain33Config(types.GetDefaultCfgstring()) + q.SetConfig(cfg) + base := consensus.NewBaseClient(cfg.GetModuleConfig().Consensus) + base.InitClient(q.Client(), func(){}) + ctx := &consensus.Context{Base: base} + return ctx +} + + +func mockHandleChainMsg(cli queue.Client) { + + cli.Sub("blockchain") + + for msg := range cli.Recv() { + + if msg.Ty == types.EventSnowmanLastChoice { + msg.Reply(cli.NewMessage("", 0, &types.SnowChoice{Height: 1, Hash: []byte("test")})) + }else if msg.Ty == types.EventGetBlockByHashes { + msg.Reply(cli.NewMessage("", 0, &types.BlockDetails{Items: []*types.BlockDetail{{Block: &types.Block{Height: 1}}}})) + }else if msg.Ty == types.EventGetBlockHash { + msg.Reply(cli.NewMessage("", 0, &types.ReplyHash{Hash: []byte("test")})) + } + } +} + + +func TestChain33VM(t *testing.T) { + + ctx := newTestCtx() + cli := ctx.Base.GetQueueClient() + defer cli.Close() + go mockHandleChainMsg(cli) + + vm := &chain33VM{} + + // test init + vm.Init(ctx) + _, err := vm.LastAccepted(nil) + require.Nil(t, err) + require.Equal(t, 1, int(vm.acceptedHeight)) + + // test get/parse block + sb, err := vm.GetBlock(nil, ids.Empty) + require.Nil(t, err) + require.Equal(t, 1, int(sb.Height())) + require.Equal(t, choices.Processing, sb.Status()) + blk := sb.(*snowBlock).block + require.Equal(t, hex.EncodeToString(blk.Hash(vm.cfg)), sb.ID().Hex()) + vm.decidedHashes.Add(sb.ID(), true) + sb1, err := vm.ParseBlock(nil, sb.Bytes()) + require.Equal(t, choices.Accepted, sb1.Status()) + + // test and and build new block + require.False(t, vm.addNewBlock(blk)) + _, err = vm.BuildBlock(nil) + require.Equal(t, utils.ErrBlockNotReady, err) + blk.Height= vm.acceptedHeight+1 + require.True(t, vm.addNewBlock(blk)) + sb1, err = vm.BuildBlock(nil) + require.Equal(t, blk.Height, int64(sb1.Height())) + + // test GetBlockIDAtHeight + id, _ := vm.GetBlockIDAtHeight(nil, 0) + require.Equal(t, "test", string(id[:4])) + + // test accept or reject block + require.Nil(t, sb1.Accept(nil)) + val, _ := vm.decidedHashes.Get(sb1.ID()) + require.Equal(t, blk.Height, vm.acceptedHeight) + require.True(t, val.(bool)) + require.Nil(t, sb1.Reject(nil)) + val, _ = vm.decidedHashes.Get(sb1.ID()) + require.False(t, val.(bool)) + + // test reset vm + blk.Height = vm.acceptedHeight + 1 + require.True(t, vm.addNewBlock(blk)) + vm.reset() + require.Equal(t, 0, vm.decidedHashes.Len()) + require.Equal(t, 0, int(vm.acceptedHeight)) + require.Equal(t, 0, vm.pendingBlocks.Len()) +} + + +func TestVmUnimplementMethod(t *testing.T) { + + vm := &chain33VM{} + require.Nil(t, vm.Initialize(nil, nil, nil, nil, nil,nil,nil,nil,nil)) + require.Nil(t, vm.SetState(nil, 0)) + require.Nil(t, vm.SetPreference(nil, ids.Empty)) + require.Nil(t, vm.Shutdown(nil)) + require.Nil(t, vm.VerifyHeightIndex(nil)) + + require.Nil(t, vm.CrossChainAppRequestFailed(nil, ids.Empty, 0)) + require.Nil(t, vm.CrossChainAppRequest(nil, ids.Empty, 0, types.Now(), nil)) + require.Nil(t, vm.CrossChainAppResponse(nil, ids.Empty, 0, nil) ) + require.Nil(t, vm.AppRequest(nil, ids.EmptyNodeID, 0, time.Now(), nil)) + require.Nil(t, vm.AppRequestFailed(nil, ids.EmptyNodeID, 0)) + require.Nil(t, vm.AppResponse(nil, ids.EmptyNodeID, 0,nil)) + require.Nil(t, vm.AppGossip(nil, ids.EmptyNodeID,nil)) + require.Nil(t, vm.GossipTx(nil)) + _, err := vm.HealthCheck(nil) + require.Nil(t, err) + require.Nil(t, vm.Connected(nil, ids.EmptyNodeID, nil)) + require.Nil(t, vm.Disconnected(nil, ids.EmptyNodeID)) + _, err = vm.CreateHandlers(nil) + require.Nil(t, err) + _, err = vm.CreateStaticHandlers(nil) + require.Nil(t, err) + _, err = vm.Version(nil) + require.Nil(t, err) +} + + + From d66f10d562e405936c6a1fd2a1ed6f2eeb77ce6a Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 9 May 2024 15:01:05 +0800 Subject: [PATCH 62/85] rpc:add get finalized block interface --- client/mocks/api.go | 618 ++++++++++++++++++++--- client/queueprotocol.go | 17 + client/queueprotocol_test.go | 21 + client/queueprotocolapi.go | 2 + rpc/grpchandler.go | 11 + rpc/grpchandler_test.go | 11 + rpc/jrpchandler.go | 12 + rpc/jrpchandler_test.go | 15 + types/proto/rpc.proto | 4 + types/rpc.pb.go | 945 ++++++++++++++++++----------------- 10 files changed, 1146 insertions(+), 510 deletions(-) diff --git a/client/mocks/api.go b/client/mocks/api.go index f1cad82d5..65c5a1149 100644 --- a/client/mocks/api.go +++ b/client/mocks/api.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -18,7 +18,15 @@ type QueueProtocolAPI struct { func (_m *QueueProtocolAPI) AddBlacklist(req *types.BlackPeer) (*types.Reply, error) { ret := _m.Called(req) + if len(ret) == 0 { + panic("no return value specified for AddBlacklist") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(*types.BlackPeer) (*types.Reply, error)); ok { + return rf(req) + } if rf, ok := ret.Get(0).(func(*types.BlackPeer) *types.Reply); ok { r0 = rf(req) } else { @@ -27,7 +35,6 @@ func (_m *QueueProtocolAPI) AddBlacklist(req *types.BlackPeer) (*types.Reply, er } } - var r1 error if rf, ok := ret.Get(1).(func(*types.BlackPeer) error); ok { r1 = rf(req) } else { @@ -41,7 +48,15 @@ func (_m *QueueProtocolAPI) AddBlacklist(req *types.BlackPeer) (*types.Reply, er func (_m *QueueProtocolAPI) AddPushSubscribe(param *types.PushSubscribeReq) (*types.ReplySubscribePush, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for AddPushSubscribe") + } + var r0 *types.ReplySubscribePush + var r1 error + if rf, ok := ret.Get(0).(func(*types.PushSubscribeReq) (*types.ReplySubscribePush, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.PushSubscribeReq) *types.ReplySubscribePush); ok { r0 = rf(param) } else { @@ -50,7 +65,6 @@ func (_m *QueueProtocolAPI) AddPushSubscribe(param *types.PushSubscribeReq) (*ty } } - var r1 error if rf, ok := ret.Get(1).(func(*types.PushSubscribeReq) error); ok { r1 = rf(param) } else { @@ -69,7 +83,15 @@ func (_m *QueueProtocolAPI) Close() { func (_m *QueueProtocolAPI) ClosePeer(in *types.SetPeer) (*types.Reply, error) { ret := _m.Called(in) + if len(ret) == 0 { + panic("no return value specified for ClosePeer") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(*types.SetPeer) (*types.Reply, error)); ok { + return rf(in) + } if rf, ok := ret.Get(0).(func(*types.SetPeer) *types.Reply); ok { r0 = rf(in) } else { @@ -78,7 +100,6 @@ func (_m *QueueProtocolAPI) ClosePeer(in *types.SetPeer) (*types.Reply, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(*types.SetPeer) error); ok { r1 = rf(in) } else { @@ -92,7 +113,15 @@ func (_m *QueueProtocolAPI) ClosePeer(in *types.SetPeer) (*types.Reply, error) { func (_m *QueueProtocolAPI) CloseQueue() (*types.Reply, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CloseQueue") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Reply, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.Reply); ok { r0 = rf() } else { @@ -101,7 +130,6 @@ func (_m *QueueProtocolAPI) CloseQueue() (*types.Reply, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -115,7 +143,15 @@ func (_m *QueueProtocolAPI) CloseQueue() (*types.Reply, error) { func (_m *QueueProtocolAPI) DelBlacklist(req *types.BlackPeer) (*types.Reply, error) { ret := _m.Called(req) + if len(ret) == 0 { + panic("no return value specified for DelBlacklist") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(*types.BlackPeer) (*types.Reply, error)); ok { + return rf(req) + } if rf, ok := ret.Get(0).(func(*types.BlackPeer) *types.Reply); ok { r0 = rf(req) } else { @@ -124,7 +160,6 @@ func (_m *QueueProtocolAPI) DelBlacklist(req *types.BlackPeer) (*types.Reply, er } } - var r1 error if rf, ok := ret.Get(1).(func(*types.BlackPeer) error); ok { r1 = rf(req) } else { @@ -138,7 +173,15 @@ func (_m *QueueProtocolAPI) DelBlacklist(req *types.BlackPeer) (*types.Reply, er func (_m *QueueProtocolAPI) DialPeer(in *types.SetPeer) (*types.Reply, error) { ret := _m.Called(in) + if len(ret) == 0 { + panic("no return value specified for DialPeer") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(*types.SetPeer) (*types.Reply, error)); ok { + return rf(in) + } if rf, ok := ret.Get(0).(func(*types.SetPeer) *types.Reply); ok { r0 = rf(in) } else { @@ -147,7 +190,6 @@ func (_m *QueueProtocolAPI) DialPeer(in *types.SetPeer) (*types.Reply, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(*types.SetPeer) error); ok { r1 = rf(in) } else { @@ -161,7 +203,15 @@ func (_m *QueueProtocolAPI) DialPeer(in *types.SetPeer) (*types.Reply, error) { func (_m *QueueProtocolAPI) ExecWallet(param *types.ChainExecutor) (types.Message, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for ExecWallet") + } + var r0 types.Message + var r1 error + if rf, ok := ret.Get(0).(func(*types.ChainExecutor) (types.Message, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ChainExecutor) types.Message); ok { r0 = rf(param) } else { @@ -170,7 +220,6 @@ func (_m *QueueProtocolAPI) ExecWallet(param *types.ChainExecutor) (types.Messag } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ChainExecutor) error); ok { r1 = rf(param) } else { @@ -184,7 +233,15 @@ func (_m *QueueProtocolAPI) ExecWallet(param *types.ChainExecutor) (types.Messag func (_m *QueueProtocolAPI) ExecWalletFunc(driver string, funcname string, param types.Message) (types.Message, error) { ret := _m.Called(driver, funcname, param) + if len(ret) == 0 { + panic("no return value specified for ExecWalletFunc") + } + var r0 types.Message + var r1 error + if rf, ok := ret.Get(0).(func(string, string, types.Message) (types.Message, error)); ok { + return rf(driver, funcname, param) + } if rf, ok := ret.Get(0).(func(string, string, types.Message) types.Message); ok { r0 = rf(driver, funcname, param) } else { @@ -193,7 +250,6 @@ func (_m *QueueProtocolAPI) ExecWalletFunc(driver string, funcname string, param } } - var r1 error if rf, ok := ret.Get(1).(func(string, string, types.Message) error); ok { r1 = rf(driver, funcname, param) } else { @@ -207,7 +263,15 @@ func (_m *QueueProtocolAPI) ExecWalletFunc(driver string, funcname string, param func (_m *QueueProtocolAPI) GetAddrOverview(param *types.ReqAddr) (*types.AddrOverview, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetAddrOverview") + } + var r0 *types.AddrOverview + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqAddr) (*types.AddrOverview, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqAddr) *types.AddrOverview); ok { r0 = rf(param) } else { @@ -216,7 +280,6 @@ func (_m *QueueProtocolAPI) GetAddrOverview(param *types.ReqAddr) (*types.AddrOv } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqAddr) error); ok { r1 = rf(param) } else { @@ -230,7 +293,15 @@ func (_m *QueueProtocolAPI) GetAddrOverview(param *types.ReqAddr) (*types.AddrOv func (_m *QueueProtocolAPI) GetBlockByHashes(param *types.ReqHashes) (*types.BlockDetails, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetBlockByHashes") + } + var r0 *types.BlockDetails + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHashes) (*types.BlockDetails, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHashes) *types.BlockDetails); ok { r0 = rf(param) } else { @@ -239,7 +310,6 @@ func (_m *QueueProtocolAPI) GetBlockByHashes(param *types.ReqHashes) (*types.Blo } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHashes) error); ok { r1 = rf(param) } else { @@ -253,7 +323,15 @@ func (_m *QueueProtocolAPI) GetBlockByHashes(param *types.ReqHashes) (*types.Blo func (_m *QueueProtocolAPI) GetBlockBySeq(param *types.Int64) (*types.BlockSeq, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetBlockBySeq") + } + var r0 *types.BlockSeq + var r1 error + if rf, ok := ret.Get(0).(func(*types.Int64) (*types.BlockSeq, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.Int64) *types.BlockSeq); ok { r0 = rf(param) } else { @@ -262,7 +340,6 @@ func (_m *QueueProtocolAPI) GetBlockBySeq(param *types.Int64) (*types.BlockSeq, } } - var r1 error if rf, ok := ret.Get(1).(func(*types.Int64) error); ok { r1 = rf(param) } else { @@ -276,7 +353,15 @@ func (_m *QueueProtocolAPI) GetBlockBySeq(param *types.Int64) (*types.BlockSeq, func (_m *QueueProtocolAPI) GetBlockHash(param *types.ReqInt) (*types.ReplyHash, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetBlockHash") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqInt) (*types.ReplyHash, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqInt) *types.ReplyHash); ok { r0 = rf(param) } else { @@ -285,7 +370,6 @@ func (_m *QueueProtocolAPI) GetBlockHash(param *types.ReqInt) (*types.ReplyHash, } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqInt) error); ok { r1 = rf(param) } else { @@ -299,7 +383,15 @@ func (_m *QueueProtocolAPI) GetBlockHash(param *types.ReqInt) (*types.ReplyHash, func (_m *QueueProtocolAPI) GetBlockOverview(param *types.ReqHash) (*types.BlockOverview, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetBlockOverview") + } + var r0 *types.BlockOverview + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHash) (*types.BlockOverview, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.BlockOverview); ok { r0 = rf(param) } else { @@ -308,7 +400,6 @@ func (_m *QueueProtocolAPI) GetBlockOverview(param *types.ReqHash) (*types.Block } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok { r1 = rf(param) } else { @@ -322,7 +413,15 @@ func (_m *QueueProtocolAPI) GetBlockOverview(param *types.ReqHash) (*types.Block func (_m *QueueProtocolAPI) GetBlockSequences(param *types.ReqBlocks) (*types.BlockSequences, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetBlockSequences") + } + var r0 *types.BlockSequences + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqBlocks) (*types.BlockSequences, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqBlocks) *types.BlockSequences); ok { r0 = rf(param) } else { @@ -331,7 +430,6 @@ func (_m *QueueProtocolAPI) GetBlockSequences(param *types.ReqBlocks) (*types.Bl } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqBlocks) error); ok { r1 = rf(param) } else { @@ -345,7 +443,15 @@ func (_m *QueueProtocolAPI) GetBlockSequences(param *types.ReqBlocks) (*types.Bl func (_m *QueueProtocolAPI) GetBlocks(param *types.ReqBlocks) (*types.BlockDetails, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetBlocks") + } + var r0 *types.BlockDetails + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqBlocks) (*types.BlockDetails, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqBlocks) *types.BlockDetails); ok { r0 = rf(param) } else { @@ -354,7 +460,6 @@ func (_m *QueueProtocolAPI) GetBlocks(param *types.ReqBlocks) (*types.BlockDetai } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqBlocks) error); ok { r1 = rf(param) } else { @@ -368,6 +473,10 @@ func (_m *QueueProtocolAPI) GetBlocks(param *types.ReqBlocks) (*types.BlockDetai func (_m *QueueProtocolAPI) GetConfig() *types.Chain33Config { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetConfig") + } + var r0 *types.Chain33Config if rf, ok := ret.Get(0).(func() *types.Chain33Config); ok { r0 = rf() @@ -380,11 +489,49 @@ func (_m *QueueProtocolAPI) GetConfig() *types.Chain33Config { return r0 } +// GetFinalizedBlock provides a mock function with given fields: +func (_m *QueueProtocolAPI) GetFinalizedBlock() (*types.SnowChoice, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetFinalizedBlock") + } + + var r0 *types.SnowChoice + var r1 error + if rf, ok := ret.Get(0).(func() (*types.SnowChoice, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *types.SnowChoice); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.SnowChoice) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetHeaders provides a mock function with given fields: param func (_m *QueueProtocolAPI) GetHeaders(param *types.ReqBlocks) (*types.Headers, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetHeaders") + } + var r0 *types.Headers + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqBlocks) (*types.Headers, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqBlocks) *types.Headers); ok { r0 = rf(param) } else { @@ -393,7 +540,6 @@ func (_m *QueueProtocolAPI) GetHeaders(param *types.ReqBlocks) (*types.Headers, } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqBlocks) error); ok { r1 = rf(param) } else { @@ -407,7 +553,15 @@ func (_m *QueueProtocolAPI) GetHeaders(param *types.ReqBlocks) (*types.Headers, func (_m *QueueProtocolAPI) GetHighestBlockNum(param *types.ReqNil) (*types.ReplyBlockHeight, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetHighestBlockNum") + } + var r0 *types.ReplyBlockHeight + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqNil) (*types.ReplyBlockHeight, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqNil) *types.ReplyBlockHeight); ok { r0 = rf(param) } else { @@ -416,7 +570,6 @@ func (_m *QueueProtocolAPI) GetHighestBlockNum(param *types.ReqNil) (*types.Repl } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqNil) error); ok { r1 = rf(param) } else { @@ -430,7 +583,15 @@ func (_m *QueueProtocolAPI) GetHighestBlockNum(param *types.ReqNil) (*types.Repl func (_m *QueueProtocolAPI) GetLastBlockMainSequence() (*types.Int64, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLastBlockMainSequence") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Int64, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.Int64); ok { r0 = rf() } else { @@ -439,7 +600,6 @@ func (_m *QueueProtocolAPI) GetLastBlockMainSequence() (*types.Int64, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -453,7 +613,15 @@ func (_m *QueueProtocolAPI) GetLastBlockMainSequence() (*types.Int64, error) { func (_m *QueueProtocolAPI) GetLastBlockSequence() (*types.Int64, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLastBlockSequence") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Int64, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.Int64); ok { r0 = rf() } else { @@ -462,7 +630,6 @@ func (_m *QueueProtocolAPI) GetLastBlockSequence() (*types.Int64, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -476,7 +643,15 @@ func (_m *QueueProtocolAPI) GetLastBlockSequence() (*types.Int64, error) { func (_m *QueueProtocolAPI) GetLastHeader() (*types.Header, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLastHeader") + } + var r0 *types.Header + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Header, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.Header); ok { r0 = rf() } else { @@ -485,7 +660,6 @@ func (_m *QueueProtocolAPI) GetLastHeader() (*types.Header, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -499,7 +673,15 @@ func (_m *QueueProtocolAPI) GetLastHeader() (*types.Header, error) { func (_m *QueueProtocolAPI) GetLastMempool() (*types.ReplyTxList, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLastMempool") + } + var r0 *types.ReplyTxList + var r1 error + if rf, ok := ret.Get(0).(func() (*types.ReplyTxList, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.ReplyTxList); ok { r0 = rf() } else { @@ -508,7 +690,6 @@ func (_m *QueueProtocolAPI) GetLastMempool() (*types.ReplyTxList, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -522,7 +703,15 @@ func (_m *QueueProtocolAPI) GetLastMempool() (*types.ReplyTxList, error) { func (_m *QueueProtocolAPI) GetMainSequenceByHash(param *types.ReqHash) (*types.Int64, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetMainSequenceByHash") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHash) (*types.Int64, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.Int64); ok { r0 = rf(param) } else { @@ -531,7 +720,6 @@ func (_m *QueueProtocolAPI) GetMainSequenceByHash(param *types.ReqHash) (*types. } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok { r1 = rf(param) } else { @@ -545,7 +733,15 @@ func (_m *QueueProtocolAPI) GetMainSequenceByHash(param *types.ReqHash) (*types. func (_m *QueueProtocolAPI) GetMempool(req *types.ReqGetMempool) (*types.ReplyTxList, error) { ret := _m.Called(req) + if len(ret) == 0 { + panic("no return value specified for GetMempool") + } + var r0 *types.ReplyTxList + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqGetMempool) (*types.ReplyTxList, error)); ok { + return rf(req) + } if rf, ok := ret.Get(0).(func(*types.ReqGetMempool) *types.ReplyTxList); ok { r0 = rf(req) } else { @@ -554,7 +750,6 @@ func (_m *QueueProtocolAPI) GetMempool(req *types.ReqGetMempool) (*types.ReplyTx } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqGetMempool) error); ok { r1 = rf(req) } else { @@ -568,7 +763,15 @@ func (_m *QueueProtocolAPI) GetMempool(req *types.ReqGetMempool) (*types.ReplyTx func (_m *QueueProtocolAPI) GetNetInfo(param *types.P2PGetNetInfoReq) (*types.NodeNetInfo, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetNetInfo") + } + var r0 *types.NodeNetInfo + var r1 error + if rf, ok := ret.Get(0).(func(*types.P2PGetNetInfoReq) (*types.NodeNetInfo, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.P2PGetNetInfoReq) *types.NodeNetInfo); ok { r0 = rf(param) } else { @@ -577,7 +780,6 @@ func (_m *QueueProtocolAPI) GetNetInfo(param *types.P2PGetNetInfoReq) (*types.No } } - var r1 error if rf, ok := ret.Get(1).(func(*types.P2PGetNetInfoReq) error); ok { r1 = rf(param) } else { @@ -591,7 +793,15 @@ func (_m *QueueProtocolAPI) GetNetInfo(param *types.P2PGetNetInfoReq) (*types.No func (_m *QueueProtocolAPI) GetParaTxByHeight(param *types.ReqParaTxByHeight) (*types.ParaTxDetails, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetParaTxByHeight") + } + var r0 *types.ParaTxDetails + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqParaTxByHeight) (*types.ParaTxDetails, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqParaTxByHeight) *types.ParaTxDetails); ok { r0 = rf(param) } else { @@ -600,7 +810,6 @@ func (_m *QueueProtocolAPI) GetParaTxByHeight(param *types.ReqParaTxByHeight) (* } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqParaTxByHeight) error); ok { r1 = rf(param) } else { @@ -614,7 +823,15 @@ func (_m *QueueProtocolAPI) GetParaTxByHeight(param *types.ReqParaTxByHeight) (* func (_m *QueueProtocolAPI) GetParaTxByTitle(param *types.ReqParaTxByTitle) (*types.ParaTxDetails, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetParaTxByTitle") + } + var r0 *types.ParaTxDetails + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqParaTxByTitle) (*types.ParaTxDetails, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqParaTxByTitle) *types.ParaTxDetails); ok { r0 = rf(param) } else { @@ -623,7 +840,6 @@ func (_m *QueueProtocolAPI) GetParaTxByTitle(param *types.ReqParaTxByTitle) (*ty } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqParaTxByTitle) error); ok { r1 = rf(param) } else { @@ -637,7 +853,15 @@ func (_m *QueueProtocolAPI) GetParaTxByTitle(param *types.ReqParaTxByTitle) (*ty func (_m *QueueProtocolAPI) GetProperFee(req *types.ReqProperFee) (*types.ReplyProperFee, error) { ret := _m.Called(req) + if len(ret) == 0 { + panic("no return value specified for GetProperFee") + } + var r0 *types.ReplyProperFee + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqProperFee) (*types.ReplyProperFee, error)); ok { + return rf(req) + } if rf, ok := ret.Get(0).(func(*types.ReqProperFee) *types.ReplyProperFee); ok { r0 = rf(req) } else { @@ -646,7 +870,6 @@ func (_m *QueueProtocolAPI) GetProperFee(req *types.ReqProperFee) (*types.ReplyP } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqProperFee) error); ok { r1 = rf(req) } else { @@ -660,7 +883,15 @@ func (_m *QueueProtocolAPI) GetProperFee(req *types.ReqProperFee) (*types.ReplyP func (_m *QueueProtocolAPI) GetPushSeqLastNum(param *types.ReqString) (*types.Int64, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetPushSeqLastNum") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqString) (*types.Int64, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqString) *types.Int64); ok { r0 = rf(param) } else { @@ -669,7 +900,6 @@ func (_m *QueueProtocolAPI) GetPushSeqLastNum(param *types.ReqString) (*types.In } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqString) error); ok { r1 = rf(param) } else { @@ -683,7 +913,15 @@ func (_m *QueueProtocolAPI) GetPushSeqLastNum(param *types.ReqString) (*types.In func (_m *QueueProtocolAPI) GetSequenceByHash(param *types.ReqHash) (*types.Int64, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetSequenceByHash") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHash) (*types.Int64, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.Int64); ok { r0 = rf(param) } else { @@ -692,7 +930,6 @@ func (_m *QueueProtocolAPI) GetSequenceByHash(param *types.ReqHash) (*types.Int6 } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok { r1 = rf(param) } else { @@ -706,7 +943,15 @@ func (_m *QueueProtocolAPI) GetSequenceByHash(param *types.ReqHash) (*types.Int6 func (_m *QueueProtocolAPI) GetTransactionByAddr(param *types.ReqAddr) (*types.ReplyTxInfos, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetTransactionByAddr") + } + var r0 *types.ReplyTxInfos + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqAddr) (*types.ReplyTxInfos, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqAddr) *types.ReplyTxInfos); ok { r0 = rf(param) } else { @@ -715,7 +960,6 @@ func (_m *QueueProtocolAPI) GetTransactionByAddr(param *types.ReqAddr) (*types.R } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqAddr) error); ok { r1 = rf(param) } else { @@ -729,7 +973,15 @@ func (_m *QueueProtocolAPI) GetTransactionByAddr(param *types.ReqAddr) (*types.R func (_m *QueueProtocolAPI) GetTransactionByHash(param *types.ReqHashes) (*types.TransactionDetails, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetTransactionByHash") + } + var r0 *types.TransactionDetails + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHashes) (*types.TransactionDetails, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHashes) *types.TransactionDetails); ok { r0 = rf(param) } else { @@ -738,7 +990,6 @@ func (_m *QueueProtocolAPI) GetTransactionByHash(param *types.ReqHashes) (*types } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHashes) error); ok { r1 = rf(param) } else { @@ -752,7 +1003,15 @@ func (_m *QueueProtocolAPI) GetTransactionByHash(param *types.ReqHashes) (*types func (_m *QueueProtocolAPI) GetTxList(param *types.TxHashList) (*types.ReplyTxList, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetTxList") + } + var r0 *types.ReplyTxList + var r1 error + if rf, ok := ret.Get(0).(func(*types.TxHashList) (*types.ReplyTxList, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.TxHashList) *types.ReplyTxList); ok { r0 = rf(param) } else { @@ -761,7 +1020,6 @@ func (_m *QueueProtocolAPI) GetTxList(param *types.TxHashList) (*types.ReplyTxLi } } - var r1 error if rf, ok := ret.Get(1).(func(*types.TxHashList) error); ok { r1 = rf(param) } else { @@ -775,7 +1033,15 @@ func (_m *QueueProtocolAPI) GetTxList(param *types.TxHashList) (*types.ReplyTxLi func (_m *QueueProtocolAPI) GetTxListByAddr(param *types.ReqAddrs) (*types.TransactionDetails, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for GetTxListByAddr") + } + var r0 *types.TransactionDetails + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqAddrs) (*types.TransactionDetails, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqAddrs) *types.TransactionDetails); ok { r0 = rf(param) } else { @@ -784,7 +1050,6 @@ func (_m *QueueProtocolAPI) GetTxListByAddr(param *types.ReqAddrs) (*types.Trans } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqAddrs) error); ok { r1 = rf(param) } else { @@ -798,7 +1063,15 @@ func (_m *QueueProtocolAPI) GetTxListByAddr(param *types.ReqAddrs) (*types.Trans func (_m *QueueProtocolAPI) IsNtpClockSync() (*types.Reply, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsNtpClockSync") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Reply, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.Reply); ok { r0 = rf() } else { @@ -807,7 +1080,6 @@ func (_m *QueueProtocolAPI) IsNtpClockSync() (*types.Reply, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -821,7 +1093,15 @@ func (_m *QueueProtocolAPI) IsNtpClockSync() (*types.Reply, error) { func (_m *QueueProtocolAPI) IsSync() (*types.Reply, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsSync") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func() (*types.Reply, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.Reply); ok { r0 = rf() } else { @@ -830,7 +1110,6 @@ func (_m *QueueProtocolAPI) IsSync() (*types.Reply, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -844,7 +1123,15 @@ func (_m *QueueProtocolAPI) IsSync() (*types.Reply, error) { func (_m *QueueProtocolAPI) ListPushes() (*types.PushSubscribes, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ListPushes") + } + var r0 *types.PushSubscribes + var r1 error + if rf, ok := ret.Get(0).(func() (*types.PushSubscribes, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.PushSubscribes); ok { r0 = rf() } else { @@ -853,7 +1140,6 @@ func (_m *QueueProtocolAPI) ListPushes() (*types.PushSubscribes, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -867,7 +1153,15 @@ func (_m *QueueProtocolAPI) ListPushes() (*types.PushSubscribes, error) { func (_m *QueueProtocolAPI) LoadParaTxByTitle(param *types.ReqHeightByTitle) (*types.ReplyHeightByTitle, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LoadParaTxByTitle") + } + var r0 *types.ReplyHeightByTitle + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHeightByTitle) (*types.ReplyHeightByTitle, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHeightByTitle) *types.ReplyHeightByTitle); ok { r0 = rf(param) } else { @@ -876,7 +1170,6 @@ func (_m *QueueProtocolAPI) LoadParaTxByTitle(param *types.ReqHeightByTitle) (*t } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHeightByTitle) error); ok { r1 = rf(param) } else { @@ -890,6 +1183,10 @@ func (_m *QueueProtocolAPI) LoadParaTxByTitle(param *types.ReqHeightByTitle) (*t func (_m *QueueProtocolAPI) LocalBegin(param *types.Int64) error { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalBegin") + } + var r0 error if rf, ok := ret.Get(0).(func(*types.Int64) error); ok { r0 = rf(param) @@ -904,6 +1201,10 @@ func (_m *QueueProtocolAPI) LocalBegin(param *types.Int64) error { func (_m *QueueProtocolAPI) LocalClose(param *types.Int64) error { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalClose") + } + var r0 error if rf, ok := ret.Get(0).(func(*types.Int64) error); ok { r0 = rf(param) @@ -918,6 +1219,10 @@ func (_m *QueueProtocolAPI) LocalClose(param *types.Int64) error { func (_m *QueueProtocolAPI) LocalCommit(param *types.Int64) error { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalCommit") + } + var r0 error if rf, ok := ret.Get(0).(func(*types.Int64) error); ok { r0 = rf(param) @@ -932,7 +1237,15 @@ func (_m *QueueProtocolAPI) LocalCommit(param *types.Int64) error { func (_m *QueueProtocolAPI) LocalGet(param *types.LocalDBGet) (*types.LocalReplyValue, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalGet") + } + var r0 *types.LocalReplyValue + var r1 error + if rf, ok := ret.Get(0).(func(*types.LocalDBGet) (*types.LocalReplyValue, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.LocalDBGet) *types.LocalReplyValue); ok { r0 = rf(param) } else { @@ -941,7 +1254,6 @@ func (_m *QueueProtocolAPI) LocalGet(param *types.LocalDBGet) (*types.LocalReply } } - var r1 error if rf, ok := ret.Get(1).(func(*types.LocalDBGet) error); ok { r1 = rf(param) } else { @@ -955,7 +1267,15 @@ func (_m *QueueProtocolAPI) LocalGet(param *types.LocalDBGet) (*types.LocalReply func (_m *QueueProtocolAPI) LocalList(param *types.LocalDBList) (*types.LocalReplyValue, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalList") + } + var r0 *types.LocalReplyValue + var r1 error + if rf, ok := ret.Get(0).(func(*types.LocalDBList) (*types.LocalReplyValue, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.LocalDBList) *types.LocalReplyValue); ok { r0 = rf(param) } else { @@ -964,7 +1284,6 @@ func (_m *QueueProtocolAPI) LocalList(param *types.LocalDBList) (*types.LocalRep } } - var r1 error if rf, ok := ret.Get(1).(func(*types.LocalDBList) error); ok { r1 = rf(param) } else { @@ -978,7 +1297,15 @@ func (_m *QueueProtocolAPI) LocalList(param *types.LocalDBList) (*types.LocalRep func (_m *QueueProtocolAPI) LocalNew(readOnly bool) (*types.Int64, error) { ret := _m.Called(readOnly) + if len(ret) == 0 { + panic("no return value specified for LocalNew") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(bool) (*types.Int64, error)); ok { + return rf(readOnly) + } if rf, ok := ret.Get(0).(func(bool) *types.Int64); ok { r0 = rf(readOnly) } else { @@ -987,7 +1314,6 @@ func (_m *QueueProtocolAPI) LocalNew(readOnly bool) (*types.Int64, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(bool) error); ok { r1 = rf(readOnly) } else { @@ -1001,6 +1327,10 @@ func (_m *QueueProtocolAPI) LocalNew(readOnly bool) (*types.Int64, error) { func (_m *QueueProtocolAPI) LocalRollback(param *types.Int64) error { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalRollback") + } + var r0 error if rf, ok := ret.Get(0).(func(*types.Int64) error); ok { r0 = rf(param) @@ -1015,6 +1345,10 @@ func (_m *QueueProtocolAPI) LocalRollback(param *types.Int64) error { func (_m *QueueProtocolAPI) LocalSet(param *types.LocalDBSet) error { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for LocalSet") + } + var r0 error if rf, ok := ret.Get(0).(func(*types.LocalDBSet) error); ok { r0 = rf(param) @@ -1029,7 +1363,15 @@ func (_m *QueueProtocolAPI) LocalSet(param *types.LocalDBSet) error { func (_m *QueueProtocolAPI) NetProtocols(_a0 *types.ReqNil) (*types.NetProtocolInfos, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for NetProtocols") + } + var r0 *types.NetProtocolInfos + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqNil) (*types.NetProtocolInfos, error)); ok { + return rf(_a0) + } if rf, ok := ret.Get(0).(func(*types.ReqNil) *types.NetProtocolInfos); ok { r0 = rf(_a0) } else { @@ -1038,7 +1380,6 @@ func (_m *QueueProtocolAPI) NetProtocols(_a0 *types.ReqNil) (*types.NetProtocolI } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqNil) error); ok { r1 = rf(_a0) } else { @@ -1052,6 +1393,10 @@ func (_m *QueueProtocolAPI) NetProtocols(_a0 *types.ReqNil) (*types.NetProtocolI func (_m *QueueProtocolAPI) NewMessage(topic string, msgid int64, data interface{}) *queue.Message { ret := _m.Called(topic, msgid, data) + if len(ret) == 0 { + panic("no return value specified for NewMessage") + } + var r0 *queue.Message if rf, ok := ret.Get(0).(func(string, int64, interface{}) *queue.Message); ok { r0 = rf(topic, msgid, data) @@ -1068,7 +1413,15 @@ func (_m *QueueProtocolAPI) NewMessage(topic string, msgid int64, data interface func (_m *QueueProtocolAPI) Notify(topic string, ty int64, data interface{}) (*queue.Message, error) { ret := _m.Called(topic, ty, data) + if len(ret) == 0 { + panic("no return value specified for Notify") + } + var r0 *queue.Message + var r1 error + if rf, ok := ret.Get(0).(func(string, int64, interface{}) (*queue.Message, error)); ok { + return rf(topic, ty, data) + } if rf, ok := ret.Get(0).(func(string, int64, interface{}) *queue.Message); ok { r0 = rf(topic, ty, data) } else { @@ -1077,7 +1430,6 @@ func (_m *QueueProtocolAPI) Notify(topic string, ty int64, data interface{}) (*q } } - var r1 error if rf, ok := ret.Get(1).(func(string, int64, interface{}) error); ok { r1 = rf(topic, ty, data) } else { @@ -1091,7 +1443,15 @@ func (_m *QueueProtocolAPI) Notify(topic string, ty int64, data interface{}) (*q func (_m *QueueProtocolAPI) PeerInfo(param *types.P2PGetPeerReq) (*types.PeerList, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for PeerInfo") + } + var r0 *types.PeerList + var r1 error + if rf, ok := ret.Get(0).(func(*types.P2PGetPeerReq) (*types.PeerList, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.P2PGetPeerReq) *types.PeerList); ok { r0 = rf(param) } else { @@ -1100,7 +1460,6 @@ func (_m *QueueProtocolAPI) PeerInfo(param *types.P2PGetPeerReq) (*types.PeerLis } } - var r1 error if rf, ok := ret.Get(1).(func(*types.P2PGetPeerReq) error); ok { r1 = rf(param) } else { @@ -1114,7 +1473,15 @@ func (_m *QueueProtocolAPI) PeerInfo(param *types.P2PGetPeerReq) (*types.PeerLis func (_m *QueueProtocolAPI) Query(driver string, funcname string, param types.Message) (types.Message, error) { ret := _m.Called(driver, funcname, param) + if len(ret) == 0 { + panic("no return value specified for Query") + } + var r0 types.Message + var r1 error + if rf, ok := ret.Get(0).(func(string, string, types.Message) (types.Message, error)); ok { + return rf(driver, funcname, param) + } if rf, ok := ret.Get(0).(func(string, string, types.Message) types.Message); ok { r0 = rf(driver, funcname, param) } else { @@ -1123,7 +1490,6 @@ func (_m *QueueProtocolAPI) Query(driver string, funcname string, param types.Me } } - var r1 error if rf, ok := ret.Get(1).(func(string, string, types.Message) error); ok { r1 = rf(driver, funcname, param) } else { @@ -1137,7 +1503,15 @@ func (_m *QueueProtocolAPI) Query(driver string, funcname string, param types.Me func (_m *QueueProtocolAPI) QueryChain(param *types.ChainExecutor) (types.Message, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for QueryChain") + } + var r0 types.Message + var r1 error + if rf, ok := ret.Get(0).(func(*types.ChainExecutor) (types.Message, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ChainExecutor) types.Message); ok { r0 = rf(param) } else { @@ -1146,7 +1520,6 @@ func (_m *QueueProtocolAPI) QueryChain(param *types.ChainExecutor) (types.Messag } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ChainExecutor) error); ok { r1 = rf(param) } else { @@ -1160,7 +1533,15 @@ func (_m *QueueProtocolAPI) QueryChain(param *types.ChainExecutor) (types.Messag func (_m *QueueProtocolAPI) QueryConsensus(param *types.ChainExecutor) (types.Message, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for QueryConsensus") + } + var r0 types.Message + var r1 error + if rf, ok := ret.Get(0).(func(*types.ChainExecutor) (types.Message, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ChainExecutor) types.Message); ok { r0 = rf(param) } else { @@ -1169,7 +1550,6 @@ func (_m *QueueProtocolAPI) QueryConsensus(param *types.ChainExecutor) (types.Me } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ChainExecutor) error); ok { r1 = rf(param) } else { @@ -1183,7 +1563,15 @@ func (_m *QueueProtocolAPI) QueryConsensus(param *types.ChainExecutor) (types.Me func (_m *QueueProtocolAPI) QueryConsensusFunc(driver string, funcname string, param types.Message) (types.Message, error) { ret := _m.Called(driver, funcname, param) + if len(ret) == 0 { + panic("no return value specified for QueryConsensusFunc") + } + var r0 types.Message + var r1 error + if rf, ok := ret.Get(0).(func(string, string, types.Message) (types.Message, error)); ok { + return rf(driver, funcname, param) + } if rf, ok := ret.Get(0).(func(string, string, types.Message) types.Message); ok { r0 = rf(driver, funcname, param) } else { @@ -1192,7 +1580,6 @@ func (_m *QueueProtocolAPI) QueryConsensusFunc(driver string, funcname string, p } } - var r1 error if rf, ok := ret.Get(1).(func(string, string, types.Message) error); ok { r1 = rf(driver, funcname, param) } else { @@ -1206,7 +1593,15 @@ func (_m *QueueProtocolAPI) QueryConsensusFunc(driver string, funcname string, p func (_m *QueueProtocolAPI) QueryTx(param *types.ReqHash) (*types.TransactionDetail, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for QueryTx") + } + var r0 *types.TransactionDetail + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHash) (*types.TransactionDetail, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.TransactionDetail); ok { r0 = rf(param) } else { @@ -1215,7 +1610,6 @@ func (_m *QueueProtocolAPI) QueryTx(param *types.ReqHash) (*types.TransactionDet } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok { r1 = rf(param) } else { @@ -1229,6 +1623,10 @@ func (_m *QueueProtocolAPI) QueryTx(param *types.ReqHash) (*types.TransactionDet func (_m *QueueProtocolAPI) RemoveTxsByHashList(hashList *types.TxHashList) error { ret := _m.Called(hashList) + if len(ret) == 0 { + panic("no return value specified for RemoveTxsByHashList") + } + var r0 error if rf, ok := ret.Get(0).(func(*types.TxHashList) error); ok { r0 = rf(hashList) @@ -1243,7 +1641,15 @@ func (_m *QueueProtocolAPI) RemoveTxsByHashList(hashList *types.TxHashList) erro func (_m *QueueProtocolAPI) SendDelayTx(param *types.DelayTx, waitReply bool) (*types.Reply, error) { ret := _m.Called(param, waitReply) + if len(ret) == 0 { + panic("no return value specified for SendDelayTx") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(*types.DelayTx, bool) (*types.Reply, error)); ok { + return rf(param, waitReply) + } if rf, ok := ret.Get(0).(func(*types.DelayTx, bool) *types.Reply); ok { r0 = rf(param, waitReply) } else { @@ -1252,7 +1658,6 @@ func (_m *QueueProtocolAPI) SendDelayTx(param *types.DelayTx, waitReply bool) (* } } - var r1 error if rf, ok := ret.Get(1).(func(*types.DelayTx, bool) error); ok { r1 = rf(param, waitReply) } else { @@ -1266,7 +1671,15 @@ func (_m *QueueProtocolAPI) SendDelayTx(param *types.DelayTx, waitReply bool) (* func (_m *QueueProtocolAPI) SendTx(param *types.Transaction) (*types.Reply, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for SendTx") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(*types.Transaction) (*types.Reply, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.Transaction) *types.Reply); ok { r0 = rf(param) } else { @@ -1275,7 +1688,6 @@ func (_m *QueueProtocolAPI) SendTx(param *types.Transaction) (*types.Reply, erro } } - var r1 error if rf, ok := ret.Get(1).(func(*types.Transaction) error); ok { r1 = rf(param) } else { @@ -1289,7 +1701,15 @@ func (_m *QueueProtocolAPI) SendTx(param *types.Transaction) (*types.Reply, erro func (_m *QueueProtocolAPI) ShowBlacklist(req *types.ReqNil) (*types.Blacklist, error) { ret := _m.Called(req) + if len(ret) == 0 { + panic("no return value specified for ShowBlacklist") + } + var r0 *types.Blacklist + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqNil) (*types.Blacklist, error)); ok { + return rf(req) + } if rf, ok := ret.Get(0).(func(*types.ReqNil) *types.Blacklist); ok { r0 = rf(req) } else { @@ -1298,7 +1718,6 @@ func (_m *QueueProtocolAPI) ShowBlacklist(req *types.ReqNil) (*types.Blacklist, } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqNil) error); ok { r1 = rf(req) } else { @@ -1312,7 +1731,15 @@ func (_m *QueueProtocolAPI) ShowBlacklist(req *types.ReqNil) (*types.Blacklist, func (_m *QueueProtocolAPI) StoreCommit(param *types.ReqHash) (*types.ReplyHash, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for StoreCommit") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHash) (*types.ReplyHash, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.ReplyHash); ok { r0 = rf(param) } else { @@ -1321,7 +1748,6 @@ func (_m *QueueProtocolAPI) StoreCommit(param *types.ReqHash) (*types.ReplyHash, } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok { r1 = rf(param) } else { @@ -1335,7 +1761,15 @@ func (_m *QueueProtocolAPI) StoreCommit(param *types.ReqHash) (*types.ReplyHash, func (_m *QueueProtocolAPI) StoreDel(param *types.StoreDel) (*types.ReplyHash, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for StoreDel") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(*types.StoreDel) (*types.ReplyHash, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.StoreDel) *types.ReplyHash); ok { r0 = rf(param) } else { @@ -1344,7 +1778,6 @@ func (_m *QueueProtocolAPI) StoreDel(param *types.StoreDel) (*types.ReplyHash, e } } - var r1 error if rf, ok := ret.Get(1).(func(*types.StoreDel) error); ok { r1 = rf(param) } else { @@ -1358,7 +1791,15 @@ func (_m *QueueProtocolAPI) StoreDel(param *types.StoreDel) (*types.ReplyHash, e func (_m *QueueProtocolAPI) StoreGet(_a0 *types.StoreGet) (*types.StoreReplyValue, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for StoreGet") + } + var r0 *types.StoreReplyValue + var r1 error + if rf, ok := ret.Get(0).(func(*types.StoreGet) (*types.StoreReplyValue, error)); ok { + return rf(_a0) + } if rf, ok := ret.Get(0).(func(*types.StoreGet) *types.StoreReplyValue); ok { r0 = rf(_a0) } else { @@ -1367,7 +1808,6 @@ func (_m *QueueProtocolAPI) StoreGet(_a0 *types.StoreGet) (*types.StoreReplyValu } } - var r1 error if rf, ok := ret.Get(1).(func(*types.StoreGet) error); ok { r1 = rf(_a0) } else { @@ -1381,7 +1821,15 @@ func (_m *QueueProtocolAPI) StoreGet(_a0 *types.StoreGet) (*types.StoreReplyValu func (_m *QueueProtocolAPI) StoreGetTotalCoins(_a0 *types.IterateRangeByStateHash) (*types.ReplyGetTotalCoins, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for StoreGetTotalCoins") + } + var r0 *types.ReplyGetTotalCoins + var r1 error + if rf, ok := ret.Get(0).(func(*types.IterateRangeByStateHash) (*types.ReplyGetTotalCoins, error)); ok { + return rf(_a0) + } if rf, ok := ret.Get(0).(func(*types.IterateRangeByStateHash) *types.ReplyGetTotalCoins); ok { r0 = rf(_a0) } else { @@ -1390,7 +1838,6 @@ func (_m *QueueProtocolAPI) StoreGetTotalCoins(_a0 *types.IterateRangeByStateHas } } - var r1 error if rf, ok := ret.Get(1).(func(*types.IterateRangeByStateHash) error); ok { r1 = rf(_a0) } else { @@ -1404,7 +1851,15 @@ func (_m *QueueProtocolAPI) StoreGetTotalCoins(_a0 *types.IterateRangeByStateHas func (_m *QueueProtocolAPI) StoreList(param *types.StoreList) (*types.StoreListReply, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for StoreList") + } + var r0 *types.StoreListReply + var r1 error + if rf, ok := ret.Get(0).(func(*types.StoreList) (*types.StoreListReply, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.StoreList) *types.StoreListReply); ok { r0 = rf(param) } else { @@ -1413,7 +1868,6 @@ func (_m *QueueProtocolAPI) StoreList(param *types.StoreList) (*types.StoreListR } } - var r1 error if rf, ok := ret.Get(1).(func(*types.StoreList) error); ok { r1 = rf(param) } else { @@ -1427,7 +1881,15 @@ func (_m *QueueProtocolAPI) StoreList(param *types.StoreList) (*types.StoreListR func (_m *QueueProtocolAPI) StoreMemSet(param *types.StoreSetWithSync) (*types.ReplyHash, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for StoreMemSet") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(*types.StoreSetWithSync) (*types.ReplyHash, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.StoreSetWithSync) *types.ReplyHash); ok { r0 = rf(param) } else { @@ -1436,7 +1898,6 @@ func (_m *QueueProtocolAPI) StoreMemSet(param *types.StoreSetWithSync) (*types.R } } - var r1 error if rf, ok := ret.Get(1).(func(*types.StoreSetWithSync) error); ok { r1 = rf(param) } else { @@ -1450,7 +1911,15 @@ func (_m *QueueProtocolAPI) StoreMemSet(param *types.StoreSetWithSync) (*types.R func (_m *QueueProtocolAPI) StoreRollback(param *types.ReqHash) (*types.ReplyHash, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for StoreRollback") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(*types.ReqHash) (*types.ReplyHash, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.ReplyHash); ok { r0 = rf(param) } else { @@ -1459,7 +1928,6 @@ func (_m *QueueProtocolAPI) StoreRollback(param *types.ReqHash) (*types.ReplyHas } } - var r1 error if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok { r1 = rf(param) } else { @@ -1473,7 +1941,15 @@ func (_m *QueueProtocolAPI) StoreRollback(param *types.ReqHash) (*types.ReplyHas func (_m *QueueProtocolAPI) StoreSet(param *types.StoreSetWithSync) (*types.ReplyHash, error) { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for StoreSet") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(*types.StoreSetWithSync) (*types.ReplyHash, error)); ok { + return rf(param) + } if rf, ok := ret.Get(0).(func(*types.StoreSetWithSync) *types.ReplyHash); ok { r0 = rf(param) } else { @@ -1482,7 +1958,6 @@ func (_m *QueueProtocolAPI) StoreSet(param *types.StoreSetWithSync) (*types.Repl } } - var r1 error if rf, ok := ret.Get(1).(func(*types.StoreSetWithSync) error); ok { r1 = rf(param) } else { @@ -1496,7 +1971,15 @@ func (_m *QueueProtocolAPI) StoreSet(param *types.StoreSetWithSync) (*types.Repl func (_m *QueueProtocolAPI) Version() (*types.VersionInfo, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Version") + } + var r0 *types.VersionInfo + var r1 error + if rf, ok := ret.Get(0).(func() (*types.VersionInfo, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *types.VersionInfo); ok { r0 = rf() } else { @@ -1505,7 +1988,6 @@ func (_m *QueueProtocolAPI) Version() (*types.VersionInfo, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -1514,3 +1996,17 @@ func (_m *QueueProtocolAPI) Version() (*types.VersionInfo, error) { return r0, r1 } + +// NewQueueProtocolAPI creates a new instance of QueueProtocolAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewQueueProtocolAPI(t interface { + mock.TestingT + Cleanup(func()) +}) *QueueProtocolAPI { + mock := &QueueProtocolAPI{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/client/queueprotocol.go b/client/queueprotocol.go index 7a70c12b3..1885b7ab6 100644 --- a/client/queueprotocol.go +++ b/client/queueprotocol.go @@ -1235,3 +1235,20 @@ func (q *QueueProtocol) GetHighestBlockNum(param *types.ReqNil) (*types.ReplyBlo } return nil, types.ErrInvalidParam } + +// GetFinalizedBlock get finalized block choice +func (q *QueueProtocol) GetFinalizedBlock() (*types.SnowChoice, error) { + + cli := q.client + msg := cli.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) + err := cli.Send(msg, true) + if err != nil { + return nil, err + } + + reply, err := cli.Wait(msg) + if err != nil { + return nil, err + } + return reply.GetData().(*types.SnowChoice), nil +} diff --git a/client/queueprotocol_test.go b/client/queueprotocol_test.go index dabac2d9d..3284eec23 100644 --- a/client/queueprotocol_test.go +++ b/client/queueprotocol_test.go @@ -1347,3 +1347,24 @@ func testClosePeer(t *testing.T, api client.QueueProtocolAPI) { assert.Equal(t, "success", string(reply.GetMsg())) } + +func TestQueueProtocol_GetFinalizedBlock(t *testing.T) { + + q := queue.New("test") + + cli := q.Client() + api, err := client.New(cli, nil) + require.Nil(t, err) + defer cli.Close() + go func() { + + cli.Sub("blockchain") + for msg := range cli.Recv() { + msg.Reply(cli.NewMessage("", 0, &types.SnowChoice{Height: 1})) + } + }() + + sc, err := api.GetFinalizedBlock() + require.Nil(t, err) + require.Equal(t, 1, int(sc.GetHeight())) +} diff --git a/client/queueprotocolapi.go b/client/queueprotocolapi.go index 420b573e3..099458c18 100644 --- a/client/queueprotocolapi.go +++ b/client/queueprotocolapi.go @@ -148,4 +148,6 @@ type QueueProtocolAPI interface { DialPeer(in *types.SetPeer) (*types.Reply, error) //ClosePeer close specified peer ClosePeer(in *types.SetPeer) (*types.Reply, error) + //GetFinalizedBlock get finalized block choice + GetFinalizedBlock() (*types.SnowChoice, error) } diff --git a/rpc/grpchandler.go b/rpc/grpchandler.go index d3cd7a821..da19e5d0d 100755 --- a/rpc/grpchandler.go +++ b/rpc/grpchandler.go @@ -594,6 +594,17 @@ func (g *Grpc) SignWalletRecoverTx(ctx context.Context, in *pb.ReqSignWalletReco return g.cli.SignWalletRecoverTx(in) } +// GetFinalizedBlock get finalized block choice +func (g *Grpc) GetFinalizedBlock(ctx context.Context, in *pb.ReqNil) (*pb.SnowChoice, error) { + + choice, err := g.cli.GetFinalizedBlock() + if err != nil { + return nil, err + } + + return choice, nil +} + // GetChainConfig 获取chain config 参数 func (g *Grpc) GetChainConfig(ctx context.Context, in *pb.ReqNil) (*pb.ChainConfigInfo, error) { cfg := g.cli.GetConfig() diff --git a/rpc/grpchandler_test.go b/rpc/grpchandler_test.go index ea15ecb9e..33a27e77a 100644 --- a/rpc/grpchandler_test.go +++ b/rpc/grpchandler_test.go @@ -823,6 +823,17 @@ func TestGrpc_ConvertExectoAddr(t *testing.T) { assert.Equal(t, "1GaHYpWmqAJsqRwrpoNcB8VvgKtSwjcHqt", replyStr.GetData()) } +func TestGrpc_GetFinalizedBlock(t *testing.T) { + g := Grpc{} + qapi = new(mocks.QueueProtocolAPI) + qapi.On("GetFinalizedBlock", mock.Anything).Return(&types.SnowChoice{Height: 1}, nil) + g.cli.QueueProtocolAPI = qapi + sc, err := g.GetFinalizedBlock(nil, nil) + + require.Nil(t, err) + require.Equal(t, 1, int(sc.Height)) +} + func TestGrpc_GetCoinSymbol(t *testing.T) { reply, err := g.GetCoinSymbol(context.Background(), &types.ReqNil{}) diff --git a/rpc/jrpchandler.go b/rpc/jrpchandler.go index 97a92d2ca..f31b3d237 100644 --- a/rpc/jrpchandler.go +++ b/rpc/jrpchandler.go @@ -1704,3 +1704,15 @@ func (c *Chain33) ClosePeer(in *types.SetPeer, result *interface{}) error { *result = &resp return nil } + +// GetFinalizedBlock get finalized block choice +func (c *Chain33) GetFinalizedBlock(in *types.ReqNil, result *interface{}) error { + + choice, err := c.cli.GetFinalizedBlock() + if err != nil { + return err + } + + *result = choice + return nil +} diff --git a/rpc/jrpchandler_test.go b/rpc/jrpchandler_test.go index f919531da..765a4888c 100644 --- a/rpc/jrpchandler_test.go +++ b/rpc/jrpchandler_test.go @@ -1967,3 +1967,18 @@ func TestChain33_ClosePeer(t *testing.T) { _, ok := testResult.(*rpctypes.Reply) assert.True(t, ok) } + +func TestChain33_GetFinalizedBlock(t *testing.T) { + cfg := types.NewChain33Config(types.GetDefaultCfgstring()) + api := new(mocks.QueueProtocolAPI) + api.On("GetConfig", mock.Anything).Return(cfg) + api.On("GetFinalizedBlock", mock.Anything).Return(&types.SnowChoice{Height: 1}, nil) + + chain33 := newTestChain33(api) + var testResult interface{} + err := chain33.GetFinalizedBlock(nil, &testResult) + require.Nil(t, err) + sc, ok := testResult.(*types.SnowChoice) + require.True(t, ok) + require.Equal(t, 1, int(sc.GetHeight())) +} diff --git a/types/proto/rpc.proto b/types/proto/rpc.proto index d1d7e318d..3e06329ad 100644 --- a/types/proto/rpc.proto +++ b/types/proto/rpc.proto @@ -8,6 +8,7 @@ import "p2p.proto"; import "account.proto"; import "executor.proto"; import "push_tx_receipt.proto"; +import "snowman.proto"; package types; option go_package = "github.com/33cn/chain33/types"; @@ -256,6 +257,9 @@ service chain33 { // 钱包找回交易签名 rpc SignWalletRecoverTx(ReqSignWalletRecoverTx) returns (ReplySignRawTx) {} + // 获取最终化区块 + rpc GetFinalizedBlock(ReqNil) returns(snowChoice) {} + // 获取节点配置信息 rpc GetChainConfig(ReqNil) returns (ChainConfigInfo) {} diff --git a/types/rpc.pb.go b/types/rpc.pb.go index 26a3009ab..cb7acfb33 100644 --- a/types/rpc.pb.go +++ b/types/rpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc v3.9.1 // source: rpc.proto package types @@ -655,364 +655,369 @@ var file_rpc_proto_rawDesc = []byte{ 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x70, 0x75, 0x73, 0x68, 0x5f, 0x74, 0x78, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x34, - 0x0a, 0x06, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x74, 0x79, 0x70, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x79, - 0x70, 0x65, 0x49, 0x44, 0x22, 0x35, 0x0a, 0x0a, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x72, 0x79, 0x70, - 0x74, 0x6f, 0x52, 0x07, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x44, 0x22, 0x40, 0x0a, 0x0e, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x72, - 0x69, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, - 0x72, 0x52, 0x07, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73, 0x22, 0x51, 0x0a, 0x07, 0x64, 0x65, - 0x6c, 0x61, 0x79, 0x54, 0x78, 0x12, 0x22, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x74, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x64, - 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0c, 0x65, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x8d, 0x01, - 0x0a, 0x17, 0x52, 0x65, 0x71, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x74, 0x72, - 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x74, - 0x72, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x73, 0x12, - 0x2c, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x61, 0x79, - 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x61, - 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xb4, 0x01, - 0x0a, 0x16, 0x52, 0x65, 0x71, 0x53, 0x69, 0x67, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, - 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x54, 0x78, 0x12, 0x4e, 0x0a, 0x12, 0x77, 0x61, 0x6c, 0x6c, - 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x52, 0x12, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e, - 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e, - 0x41, 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x76, 0x4b, 0x65, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, 0x4b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x72, 0x61, 0x77, 0x54, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, - 0x61, 0x77, 0x54, 0x78, 0x22, 0xf3, 0x02, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, - 0x69, 0x6e, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x63, 0x6f, 0x69, 0x6e, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, - 0x69, 0x6e, 0x50, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x69, 0x6e, 0x50, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x26, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x50, - 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, 0x65, 0x12, 0x22, - 0x0a, 0x0c, 0x6d, 0x69, 0x6e, 0x54, 0x78, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x69, 0x6e, 0x54, 0x78, 0x46, 0x65, 0x65, 0x52, 0x61, - 0x74, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, 0x65, 0x52, 0x61, - 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, - 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x72, 0x61, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x72, 0x61, 0x12, 0x2a, - 0x0a, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x49, 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x44, 0x22, 0x35, 0x0a, 0x07, 0x52, 0x65, - 0x70, 0x6c, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, - 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, - 0x74, 0x32, 0xbe, 0x23, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x12, 0x2d, 0x0a, - 0x09, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x1a, 0x0c, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x0d, - 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x0d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0d, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x3a, 0x0a, - 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x54, 0x78, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, - 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x10, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x52, 0x61, 0x77, 0x54, 0x78, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x0f, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, - 0x3e, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, - 0x61, 0x73, 0x68, 0x1a, 0x18, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x12, - 0x39, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x0f, 0x53, 0x65, - 0x6e, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x39, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x0e, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x14, - 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, - 0x41, 0x64, 0x64, 0x72, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x41, 0x64, 0x64, 0x72, 0x1a, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x54, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x16, 0x47, - 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x48, - 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, - 0x71, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x1a, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x50, 0x6f, - 0x6f, 0x6c, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, 0x65, - 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x78, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x35, - 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x0d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x15, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, - 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x65, 0x77, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, - 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x52, 0x0a, - 0x15, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, - 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x78, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, - 0x00, 0x12, 0x46, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x76, 0x6b, - 0x65, 0x79, 0x12, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, - 0x6c, 0x6c, 0x65, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, - 0x79, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0d, 0x53, 0x65, 0x6e, - 0x64, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, - 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0x00, 0x12, 0x32, 0x0a, - 0x08, 0x53, 0x65, 0x74, 0x54, 0x78, 0x46, 0x65, 0x65, 0x12, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x74, 0x46, 0x65, - 0x65, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x3b, 0x0a, 0x07, 0x53, 0x65, 0x74, 0x4c, 0x61, 0x62, 0x6c, 0x12, 0x18, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, - 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, - 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x42, - 0x0a, 0x0c, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, - 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x12, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, - 0x22, 0x00, 0x12, 0x36, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x64, 0x12, - 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, - 0x74, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x64, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x04, 0x4c, 0x6f, - 0x63, 0x6b, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, - 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x2d, 0x0a, 0x06, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x13, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x73, 0x6e, 0x6f, 0x77, 0x6d, 0x61, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x34, 0x0a, + 0x06, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, + 0x79, 0x70, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x79, 0x70, + 0x65, 0x49, 0x44, 0x22, 0x35, 0x0a, 0x0a, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, + 0x6f, 0x52, 0x07, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x44, 0x22, 0x40, 0x0a, 0x0e, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x72, 0x69, + 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x52, 0x07, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73, 0x22, 0x51, 0x0a, 0x07, 0x64, 0x65, 0x6c, + 0x61, 0x79, 0x54, 0x78, 0x12, 0x22, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x74, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x64, 0x44, + 0x65, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, + 0x65, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x8d, 0x01, 0x0a, + 0x17, 0x52, 0x65, 0x71, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x74, 0x72, 0x50, + 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x74, 0x72, + 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, + 0x72, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, + 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x2c, + 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, + 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xb4, 0x01, 0x0a, + 0x16, 0x52, 0x65, 0x71, 0x53, 0x69, 0x67, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x54, 0x78, 0x12, 0x4e, 0x0a, 0x12, 0x77, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, + 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x52, 0x12, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x41, + 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x41, + 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x76, 0x4b, 0x65, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x72, 0x61, 0x77, 0x54, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x61, + 0x77, 0x54, 0x78, 0x22, 0xf3, 0x02, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x69, + 0x6e, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x69, 0x6e, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x69, + 0x6e, 0x50, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x0d, 0x63, 0x6f, 0x69, 0x6e, 0x50, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x26, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, + 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, 0x65, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, 0x65, 0x12, 0x22, 0x0a, + 0x0c, 0x6d, 0x69, 0x6e, 0x54, 0x78, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x69, 0x6e, 0x54, 0x78, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, + 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, + 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x54, 0x78, 0x46, 0x65, + 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x72, 0x61, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x72, 0x61, 0x12, 0x2a, 0x0a, + 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, + 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x44, 0x22, 0x35, 0x0a, 0x07, 0x52, 0x65, 0x70, + 0x6c, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, + 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, + 0x32, 0xf7, 0x23, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x12, 0x2d, 0x0a, 0x09, + 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x1a, 0x0c, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x0d, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0d, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x14, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x54, 0x78, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, 0x6e, + 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x52, 0x61, 0x77, 0x54, 0x78, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1d, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x0f, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x3e, + 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, + 0x73, 0x68, 0x1a, 0x18, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x12, 0x39, + 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x0f, 0x53, 0x65, 0x6e, + 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x35, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x50, 0x6f, - 0x6f, 0x6c, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, - 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, - 0x78, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x46, 0x65, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x52, 0x65, 0x71, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x46, 0x65, 0x65, 0x1a, 0x15, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x46, 0x65, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, - 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x3a, - 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, - 0x65, 0x77, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, - 0x73, 0x68, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, 0x77, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0f, 0x47, 0x65, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, 0x77, 0x12, 0x0e, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x41, 0x64, 0x64, 0x72, 0x1a, 0x13, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, - 0x65, 0x77, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x48, 0x61, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x49, 0x6e, 0x74, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x53, 0x65, - 0x65, 0x64, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x6e, 0x53, 0x65, - 0x65, 0x64, 0x4c, 0x61, 0x6e, 0x67, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x53, 0x65, 0x65, 0x64, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x07, 0x47, 0x65, - 0x74, 0x53, 0x65, 0x65, 0x64, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x47, 0x65, - 0x74, 0x53, 0x65, 0x65, 0x64, 0x42, 0x79, 0x50, 0x77, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x65, 0x65, 0x64, 0x22, 0x00, 0x12, 0x2f, 0x0a, - 0x08, 0x53, 0x61, 0x76, 0x65, 0x53, 0x65, 0x65, 0x64, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x53, 0x65, 0x65, 0x64, 0x42, 0x79, 0x50, 0x77, 0x1a, 0x0c, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x32, - 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x1a, - 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, - 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x78, - 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, 0x57, 0x61, - 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x12, 0x14, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, - 0x6f, 0x72, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x39, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x78, 0x49, 0x6e, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x30, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x48, 0x65, 0x78, 0x54, 0x78, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, 0x68, 0x1a, - 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x78, 0x54, 0x78, 0x22, 0x00, 0x12, - 0x35, 0x0a, 0x0b, 0x44, 0x75, 0x6d, 0x70, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x12, 0x10, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x10, 0x44, 0x75, 0x6d, 0x70, 0x50, 0x72, - 0x69, 0x76, 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, - 0x6c, 0x65, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x12, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x76, - 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x71, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, 0x65, + 0x12, 0x39, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x65, 0x73, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x14, 0x47, + 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x41, + 0x64, 0x64, 0x72, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x41, + 0x64, 0x64, 0x72, 0x1a, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x54, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x16, 0x47, 0x65, + 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x48, 0x61, + 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, + 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x1a, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x50, 0x6f, 0x6f, + 0x6c, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x78, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x35, 0x0a, + 0x0b, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x0d, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x15, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, 0x65, + 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, + 0x12, 0x3a, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x65, 0x77, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x15, + 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, + 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x54, 0x78, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x00, + 0x12, 0x46, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, + 0x79, 0x12, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, + 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x64, + 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x54, + 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x08, + 0x53, 0x65, 0x74, 0x54, 0x78, 0x46, 0x65, 0x65, 0x12, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x74, 0x46, 0x65, 0x65, + 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x12, 0x3b, 0x0a, 0x07, 0x53, 0x65, 0x74, 0x4c, 0x61, 0x62, 0x6c, 0x12, 0x18, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x74, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, 0x61, + 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x42, 0x0a, + 0x0c, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x4d, + 0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x12, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, + 0x00, 0x12, 0x36, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x64, 0x12, 0x19, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, + 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x64, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x04, 0x4c, 0x6f, 0x63, + 0x6b, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x2e, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, - 0x12, 0x27, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0b, 0x47, 0x65, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0f, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x22, - 0x00, 0x12, 0x38, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, 0x6f, - 0x64, 0x65, 0x4e, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x0e, 0x49, - 0x73, 0x4e, 0x74, 0x70, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x0d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x46, 0x61, 0x74, 0x61, 0x6c, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x12, - 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x22, 0x00, 0x12, 0x35, - 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, - 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, - 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, - 0x74, 0x36, 0x34, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x65, 0x71, 0x75, - 0x65, 0x6e, 0x63, 0x65, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, 0x68, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x10, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, - 0x1a, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x53, 0x65, 0x71, 0x12, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x71, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, - 0x73, 0x65, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, - 0x45, 0x78, 0x65, 0x63, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x41, 0x6c, 0x6c, 0x45, 0x78, 0x65, 0x63, 0x42, 0x61, - 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x6c, - 0x6c, 0x45, 0x78, 0x65, 0x63, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x00, 0x12, 0x39, - 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x12, 0x13, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, + 0x12, 0x2d, 0x0a, 0x06, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x1a, + 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x35, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x50, 0x6f, 0x6f, + 0x6c, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, + 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x78, + 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x46, 0x65, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, + 0x65, 0x71, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x46, 0x65, 0x65, 0x1a, 0x15, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x46, + 0x65, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x57, + 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x3a, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, + 0x77, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, + 0x68, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4f, + 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, 0x77, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0f, 0x47, 0x65, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, 0x77, 0x12, 0x0e, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x41, 0x64, 0x64, 0x72, 0x1a, 0x13, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x4f, 0x76, 0x65, 0x72, 0x76, 0x69, 0x65, + 0x77, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x49, + 0x6e, 0x74, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x48, 0x61, 0x73, 0x68, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x53, 0x65, 0x65, + 0x64, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x6e, 0x53, 0x65, 0x65, + 0x64, 0x4c, 0x61, 0x6e, 0x67, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x53, 0x65, 0x65, 0x64, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x07, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x65, 0x64, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x65, 0x64, 0x42, 0x79, 0x50, 0x77, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x65, 0x65, 0x64, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x08, + 0x53, 0x61, 0x76, 0x65, 0x53, 0x65, 0x65, 0x64, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x53, 0x61, 0x76, 0x65, 0x53, 0x65, 0x65, 0x64, 0x42, 0x79, 0x50, 0x77, 0x1a, 0x0c, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, + 0x0a, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x0f, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, + 0x00, 0x12, 0x32, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x6f, 0x72, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, 0x57, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x12, 0x14, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, + 0x72, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x12, 0x39, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x78, 0x49, 0x6e, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x48, 0x65, 0x78, 0x54, 0x78, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, 0x0e, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, 0x68, 0x1a, 0x0c, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x78, 0x54, 0x78, 0x22, 0x00, 0x12, 0x35, + 0x0a, 0x0b, 0x44, 0x75, 0x6d, 0x70, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x12, 0x10, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, + 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x10, 0x44, 0x75, 0x6d, 0x70, 0x50, 0x72, 0x69, + 0x76, 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, + 0x65, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x12, 0x3c, 0x0a, 0x12, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x76, 0x6b, + 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x71, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x1a, + 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x2e, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, + 0x27, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, + 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, + 0x12, 0x38, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x50, 0x32, 0x50, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x4e, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x0e, 0x49, 0x73, + 0x4e, 0x74, 0x70, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x0d, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x46, 0x61, 0x74, 0x61, 0x6c, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x12, 0x0d, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x22, 0x00, 0x12, 0x35, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, 0x68, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x10, 0x47, 0x65, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x1a, + 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x42, 0x79, 0x53, 0x65, 0x71, 0x12, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x49, 0x6e, 0x74, 0x36, 0x34, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x71, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x73, + 0x65, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, + 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x45, + 0x78, 0x65, 0x63, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x41, 0x6c, 0x6c, 0x45, 0x78, 0x65, 0x63, 0x42, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x41, 0x6c, 0x6c, + 0x45, 0x78, 0x65, 0x63, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, + 0x09, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x1a, + 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x69, 0x67, + 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4e, 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, + 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x78, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, + 0x78, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x61, 0x6e, 0x64, + 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x52, + 0x61, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x07, 0x47, + 0x65, 0x74, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, + 0x65, 0x71, 0x4b, 0x65, 0x79, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, + 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x78, 0x73, 0x12, 0x13, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x78, 0x73, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x69, - 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x1a, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x4e, 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x78, 0x1a, 0x15, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, - 0x54, 0x78, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x61, 0x6e, - 0x64, 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x52, 0x61, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x1a, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x61, 0x73, 0x68, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x52, 0x65, 0x71, 0x4b, 0x65, 0x79, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x4e, 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x78, 0x73, 0x12, 0x13, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x78, - 0x73, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, - 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x10, 0x47, 0x65, - 0x74, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x17, + 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x10, 0x47, 0x65, 0x74, + 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x17, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, + 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x54, 0x78, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x00, 0x12, 0x49, + 0x0a, 0x11, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, 0x79, 0x54, 0x69, + 0x74, 0x6c, 0x65, 0x12, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x48, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x1a, 0x19, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x11, 0x47, 0x65, 0x74, + 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x18, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, - 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x00, 0x12, - 0x49, 0x0a, 0x11, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, 0x79, 0x54, - 0x69, 0x74, 0x6c, 0x65, 0x12, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x1a, 0x19, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x42, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x11, 0x47, 0x65, - 0x74, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x42, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, - 0x18, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x50, 0x61, 0x72, 0x61, 0x54, - 0x78, 0x42, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, - 0x00, 0x12, 0x30, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, - 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x73, 0x1a, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x54, 0x69, 0x6d, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x4e, 0x69, 0x6c, 0x1a, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, - 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x3b, 0x0a, - 0x11, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, - 0x72, 0x73, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, - 0x6c, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x14, 0x53, 0x65, - 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x6c, 0x61, 0x79, - 0x54, 0x78, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, - 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1e, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, - 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x1a, 0x12, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x13, 0x53, 0x69, 0x67, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, - 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x54, 0x78, 0x12, 0x1d, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x69, 0x67, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, - 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x54, 0x78, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, - 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x4e, 0x69, 0x6c, 0x1a, 0x16, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x3b, 0x0a, - 0x11, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x45, 0x78, 0x65, 0x63, 0x74, 0x6f, 0x41, 0x64, - 0x64, 0x72, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0d, 0x47, 0x65, - 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x0d, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x00, - 0x12, 0x33, 0x0a, 0x09, 0x52, 0x65, 0x57, 0x72, 0x69, 0x74, 0x65, 0x54, 0x78, 0x12, 0x13, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x61, 0x77, - 0x54, 0x78, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, 0x6e, 0x73, 0x69, 0x67, - 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x1a, 0x15, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x75, 0x73, 0x68, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, - 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x50, 0x75, 0x73, 0x68, 0x22, 0x00, 0x12, - 0x34, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x75, 0x73, 0x68, 0x65, 0x73, 0x12, 0x0d, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x15, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x62, 0x65, 0x73, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x75, 0x73, 0x68, - 0x53, 0x65, 0x71, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x0c, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x08, - 0x53, 0x75, 0x62, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x52, 0x65, 0x71, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x1a, 0x0f, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x44, 0x61, 0x74, 0x61, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x2e, 0x0a, 0x0a, 0x55, 0x6e, 0x53, 0x75, 0x62, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x42, 0x1f, 0x5a, 0x1d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x33, 0x33, 0x63, 0x6e, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x54, 0x78, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x00, + 0x12, 0x30, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x10, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, + 0x1a, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x22, 0x00, 0x12, 0x33, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, + 0x69, 0x6c, 0x1a, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x72, + 0x79, 0x70, 0x74, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x73, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, + 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x73, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x14, 0x53, 0x65, 0x6e, + 0x64, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x0e, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x54, + 0x78, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x12, 0x4f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1e, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x1a, 0x12, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x13, 0x53, 0x69, 0x67, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, + 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x54, 0x78, 0x12, 0x1d, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x69, 0x67, 0x6e, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, + 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x54, 0x78, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x78, 0x22, + 0x00, 0x12, 0x37, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, + 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, + 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x73, 0x6e, + 0x6f, 0x77, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x0d, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x16, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, + 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, + 0x45, 0x78, 0x65, 0x63, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x12, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x79, 0x6d, + 0x62, 0x6f, 0x6c, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x4e, + 0x69, 0x6c, 0x1a, 0x12, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x09, 0x52, 0x65, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x54, 0x78, 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x61, 0x77, 0x54, 0x78, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x78, 0x22, 0x00, 0x12, 0x3e, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x73, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x73, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x00, 0x12, 0x48, 0x0a, + 0x10, 0x41, 0x64, 0x64, 0x50, 0x75, 0x73, 0x68, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x12, 0x17, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x50, 0x75, 0x73, 0x68, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x50, + 0x75, 0x73, 0x68, 0x65, 0x73, 0x12, 0x0d, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, + 0x71, 0x4e, 0x69, 0x6c, 0x1a, 0x15, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x75, 0x73, + 0x68, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x73, 0x22, 0x00, 0x12, 0x35, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x50, 0x75, 0x73, 0x68, 0x53, 0x65, 0x71, 0x4c, 0x61, 0x73, 0x74, 0x4e, + 0x75, 0x6d, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, + 0x36, 0x34, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x13, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x1a, 0x0f, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x75, + 0x73, 0x68, 0x44, 0x61, 0x74, 0x61, 0x22, 0x00, 0x30, 0x01, 0x12, 0x2e, 0x0a, 0x0a, 0x55, 0x6e, + 0x53, 0x75, 0x62, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x71, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x0c, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x1f, 0x5a, 0x1d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x33, 0x33, 0x63, 0x6e, 0x2f, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x33, 0x33, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1115,10 +1120,11 @@ var file_rpc_proto_goTypes = []interface{}{ (*ParaTxDetails)(nil), // 83: types.ParaTxDetails (*ReplyHeightByTitle)(nil), // 84: types.ReplyHeightByTitle (*Headers)(nil), // 85: types.Headers - (*BlockSequences)(nil), // 86: types.BlockSequences - (*ReplySubscribePush)(nil), // 87: types.ReplySubscribePush - (*PushSubscribes)(nil), // 88: types.PushSubscribes - (*PushData)(nil), // 89: types.PushData + (*SnowChoice)(nil), // 86: types.snowChoice + (*BlockSequences)(nil), // 87: types.BlockSequences + (*ReplySubscribePush)(nil), // 88: types.ReplySubscribePush + (*PushSubscribes)(nil), // 89: types.PushSubscribes + (*PushData)(nil), // 90: types.PushData } var file_rpc_proto_depIdxs = []int32{ 1, // 0: types.cryptoList.cryptos:type_name -> types.crypto @@ -1194,96 +1200,98 @@ var file_rpc_proto_depIdxs = []int32{ 5, // 70: types.chain33.SendDelayTransaction:input_type -> types.delayTx 6, // 71: types.chain33.GetWalletRecoverAddress:input_type -> types.ReqGetWalletRecoverAddr 7, // 72: types.chain33.SignWalletRecoverTx:input_type -> types.ReqSignWalletRecoverTx - 13, // 73: types.chain33.GetChainConfig:input_type -> types.ReqNil - 39, // 74: types.chain33.ConvertExectoAddr:input_type -> types.ReqString - 13, // 75: types.chain33.GetCoinSymbol:input_type -> types.ReqNil - 53, // 76: types.chain33.ReWriteTx:input_type -> types.ReWriteRawTx - 12, // 77: types.chain33.GetBlockSequences:input_type -> types.ReqBlocks - 54, // 78: types.chain33.AddPushSubscribe:input_type -> types.PushSubscribeReq - 13, // 79: types.chain33.ListPushes:input_type -> types.ReqNil - 39, // 80: types.chain33.GetPushSeqLastNum:input_type -> types.ReqString - 55, // 81: types.chain33.SubEvent:input_type -> types.ReqSubscribe - 39, // 82: types.chain33.UnSubEvent:input_type -> types.ReqString - 11, // 83: types.chain33.GetBlocks:output_type -> types.Reply - 56, // 84: types.chain33.GetLastHeader:output_type -> types.Header - 57, // 85: types.chain33.CreateRawTransaction:output_type -> types.UnsignTx - 57, // 86: types.chain33.CreateRawTxGroup:output_type -> types.UnsignTx - 58, // 87: types.chain33.QueryTransaction:output_type -> types.TransactionDetail - 11, // 88: types.chain33.SendTransactionSync:output_type -> types.Reply - 11, // 89: types.chain33.SendTransaction:output_type -> types.Reply - 9, // 90: types.chain33.SendTransactions:output_type -> types.Replies - 59, // 91: types.chain33.GetTransactionByAddr:output_type -> types.ReplyTxInfos - 60, // 92: types.chain33.GetTransactionByHashes:output_type -> types.TransactionDetails - 61, // 93: types.chain33.GetMemPool:output_type -> types.ReplyTxList - 62, // 94: types.chain33.GetAccounts:output_type -> types.WalletAccounts - 63, // 95: types.chain33.GetAccount:output_type -> types.WalletAccount - 63, // 96: types.chain33.NewAccount:output_type -> types.WalletAccount - 64, // 97: types.chain33.WalletTransactionList:output_type -> types.WalletTxDetails - 63, // 98: types.chain33.ImportPrivkey:output_type -> types.WalletAccount - 65, // 99: types.chain33.SendToAddress:output_type -> types.ReplyHash - 11, // 100: types.chain33.SetTxFee:output_type -> types.Reply - 63, // 101: types.chain33.SetLabl:output_type -> types.WalletAccount - 66, // 102: types.chain33.MergeBalance:output_type -> types.ReplyHashes - 11, // 103: types.chain33.SetPasswd:output_type -> types.Reply - 11, // 104: types.chain33.Lock:output_type -> types.Reply - 11, // 105: types.chain33.UnLock:output_type -> types.Reply - 61, // 106: types.chain33.GetLastMemPool:output_type -> types.ReplyTxList - 67, // 107: types.chain33.GetProperFee:output_type -> types.ReplyProperFee - 68, // 108: types.chain33.GetWalletStatus:output_type -> types.WalletStatus - 69, // 109: types.chain33.GetBlockOverview:output_type -> types.BlockOverview - 70, // 110: types.chain33.GetAddrOverview:output_type -> types.AddrOverview - 65, // 111: types.chain33.GetBlockHash:output_type -> types.ReplyHash - 71, // 112: types.chain33.GenSeed:output_type -> types.ReplySeed - 71, // 113: types.chain33.GetSeed:output_type -> types.ReplySeed - 11, // 114: types.chain33.SaveSeed:output_type -> types.Reply - 72, // 115: types.chain33.GetBalance:output_type -> types.Accounts - 11, // 116: types.chain33.QueryChain:output_type -> types.Reply - 11, // 117: types.chain33.ExecWallet:output_type -> types.Reply - 11, // 118: types.chain33.QueryConsensus:output_type -> types.Reply - 57, // 119: types.chain33.CreateTransaction:output_type -> types.UnsignTx - 73, // 120: types.chain33.GetHexTxByHash:output_type -> types.HexTx - 74, // 121: types.chain33.DumpPrivkey:output_type -> types.ReplyString - 11, // 122: types.chain33.DumpPrivkeysFile:output_type -> types.Reply - 11, // 123: types.chain33.ImportPrivkeysFile:output_type -> types.Reply - 75, // 124: types.chain33.Version:output_type -> types.VersionInfo - 11, // 125: types.chain33.IsSync:output_type -> types.Reply - 76, // 126: types.chain33.GetPeerInfo:output_type -> types.PeerList - 77, // 127: types.chain33.NetInfo:output_type -> types.NodeNetInfo - 11, // 128: types.chain33.IsNtpClockSync:output_type -> types.Reply - 78, // 129: types.chain33.GetFatalFailure:output_type -> types.Int32 - 43, // 130: types.chain33.GetLastBlockSequence:output_type -> types.Int64 - 43, // 131: types.chain33.GetSequenceByHash:output_type -> types.Int64 - 79, // 132: types.chain33.GetBlockByHashes:output_type -> types.BlockDetails - 80, // 133: types.chain33.GetBlockBySeq:output_type -> types.BlockSeq - 11, // 134: types.chain33.CloseQueue:output_type -> types.Reply - 81, // 135: types.chain33.GetAllExecBalance:output_type -> types.AllExecBalance - 82, // 136: types.chain33.SignRawTx:output_type -> types.ReplySignRawTx - 82, // 137: types.chain33.CreateNoBalanceTransaction:output_type -> types.ReplySignRawTx - 65, // 138: types.chain33.QueryRandNum:output_type -> types.ReplyHash - 43, // 139: types.chain33.GetFork:output_type -> types.Int64 - 82, // 140: types.chain33.CreateNoBalanceTxs:output_type -> types.ReplySignRawTx - 83, // 141: types.chain33.GetParaTxByTitle:output_type -> types.ParaTxDetails - 84, // 142: types.chain33.LoadParaTxByTitle:output_type -> types.ReplyHeightByTitle - 83, // 143: types.chain33.GetParaTxByHeight:output_type -> types.ParaTxDetails - 85, // 144: types.chain33.GetHeaders:output_type -> types.Headers - 0, // 145: types.chain33.GetServerTime:output_type -> types.serverTime - 2, // 146: types.chain33.GetCryptoList:output_type -> types.cryptoList - 4, // 147: types.chain33.GetAddressDrivers:output_type -> types.addressDrivers - 11, // 148: types.chain33.SendDelayTransaction:output_type -> types.Reply - 74, // 149: types.chain33.GetWalletRecoverAddress:output_type -> types.ReplyString - 82, // 150: types.chain33.SignWalletRecoverTx:output_type -> types.ReplySignRawTx - 8, // 151: types.chain33.GetChainConfig:output_type -> types.ChainConfigInfo - 74, // 152: types.chain33.ConvertExectoAddr:output_type -> types.ReplyString - 74, // 153: types.chain33.GetCoinSymbol:output_type -> types.ReplyString - 57, // 154: types.chain33.ReWriteTx:output_type -> types.UnsignTx - 86, // 155: types.chain33.GetBlockSequences:output_type -> types.BlockSequences - 87, // 156: types.chain33.AddPushSubscribe:output_type -> types.ReplySubscribePush - 88, // 157: types.chain33.ListPushes:output_type -> types.PushSubscribes - 43, // 158: types.chain33.GetPushSeqLastNum:output_type -> types.Int64 - 89, // 159: types.chain33.SubEvent:output_type -> types.PushData - 11, // 160: types.chain33.UnSubEvent:output_type -> types.Reply - 83, // [83:161] is the sub-list for method output_type - 5, // [5:83] is the sub-list for method input_type + 13, // 73: types.chain33.GetFinalizedBlock:input_type -> types.ReqNil + 13, // 74: types.chain33.GetChainConfig:input_type -> types.ReqNil + 39, // 75: types.chain33.ConvertExectoAddr:input_type -> types.ReqString + 13, // 76: types.chain33.GetCoinSymbol:input_type -> types.ReqNil + 53, // 77: types.chain33.ReWriteTx:input_type -> types.ReWriteRawTx + 12, // 78: types.chain33.GetBlockSequences:input_type -> types.ReqBlocks + 54, // 79: types.chain33.AddPushSubscribe:input_type -> types.PushSubscribeReq + 13, // 80: types.chain33.ListPushes:input_type -> types.ReqNil + 39, // 81: types.chain33.GetPushSeqLastNum:input_type -> types.ReqString + 55, // 82: types.chain33.SubEvent:input_type -> types.ReqSubscribe + 39, // 83: types.chain33.UnSubEvent:input_type -> types.ReqString + 11, // 84: types.chain33.GetBlocks:output_type -> types.Reply + 56, // 85: types.chain33.GetLastHeader:output_type -> types.Header + 57, // 86: types.chain33.CreateRawTransaction:output_type -> types.UnsignTx + 57, // 87: types.chain33.CreateRawTxGroup:output_type -> types.UnsignTx + 58, // 88: types.chain33.QueryTransaction:output_type -> types.TransactionDetail + 11, // 89: types.chain33.SendTransactionSync:output_type -> types.Reply + 11, // 90: types.chain33.SendTransaction:output_type -> types.Reply + 9, // 91: types.chain33.SendTransactions:output_type -> types.Replies + 59, // 92: types.chain33.GetTransactionByAddr:output_type -> types.ReplyTxInfos + 60, // 93: types.chain33.GetTransactionByHashes:output_type -> types.TransactionDetails + 61, // 94: types.chain33.GetMemPool:output_type -> types.ReplyTxList + 62, // 95: types.chain33.GetAccounts:output_type -> types.WalletAccounts + 63, // 96: types.chain33.GetAccount:output_type -> types.WalletAccount + 63, // 97: types.chain33.NewAccount:output_type -> types.WalletAccount + 64, // 98: types.chain33.WalletTransactionList:output_type -> types.WalletTxDetails + 63, // 99: types.chain33.ImportPrivkey:output_type -> types.WalletAccount + 65, // 100: types.chain33.SendToAddress:output_type -> types.ReplyHash + 11, // 101: types.chain33.SetTxFee:output_type -> types.Reply + 63, // 102: types.chain33.SetLabl:output_type -> types.WalletAccount + 66, // 103: types.chain33.MergeBalance:output_type -> types.ReplyHashes + 11, // 104: types.chain33.SetPasswd:output_type -> types.Reply + 11, // 105: types.chain33.Lock:output_type -> types.Reply + 11, // 106: types.chain33.UnLock:output_type -> types.Reply + 61, // 107: types.chain33.GetLastMemPool:output_type -> types.ReplyTxList + 67, // 108: types.chain33.GetProperFee:output_type -> types.ReplyProperFee + 68, // 109: types.chain33.GetWalletStatus:output_type -> types.WalletStatus + 69, // 110: types.chain33.GetBlockOverview:output_type -> types.BlockOverview + 70, // 111: types.chain33.GetAddrOverview:output_type -> types.AddrOverview + 65, // 112: types.chain33.GetBlockHash:output_type -> types.ReplyHash + 71, // 113: types.chain33.GenSeed:output_type -> types.ReplySeed + 71, // 114: types.chain33.GetSeed:output_type -> types.ReplySeed + 11, // 115: types.chain33.SaveSeed:output_type -> types.Reply + 72, // 116: types.chain33.GetBalance:output_type -> types.Accounts + 11, // 117: types.chain33.QueryChain:output_type -> types.Reply + 11, // 118: types.chain33.ExecWallet:output_type -> types.Reply + 11, // 119: types.chain33.QueryConsensus:output_type -> types.Reply + 57, // 120: types.chain33.CreateTransaction:output_type -> types.UnsignTx + 73, // 121: types.chain33.GetHexTxByHash:output_type -> types.HexTx + 74, // 122: types.chain33.DumpPrivkey:output_type -> types.ReplyString + 11, // 123: types.chain33.DumpPrivkeysFile:output_type -> types.Reply + 11, // 124: types.chain33.ImportPrivkeysFile:output_type -> types.Reply + 75, // 125: types.chain33.Version:output_type -> types.VersionInfo + 11, // 126: types.chain33.IsSync:output_type -> types.Reply + 76, // 127: types.chain33.GetPeerInfo:output_type -> types.PeerList + 77, // 128: types.chain33.NetInfo:output_type -> types.NodeNetInfo + 11, // 129: types.chain33.IsNtpClockSync:output_type -> types.Reply + 78, // 130: types.chain33.GetFatalFailure:output_type -> types.Int32 + 43, // 131: types.chain33.GetLastBlockSequence:output_type -> types.Int64 + 43, // 132: types.chain33.GetSequenceByHash:output_type -> types.Int64 + 79, // 133: types.chain33.GetBlockByHashes:output_type -> types.BlockDetails + 80, // 134: types.chain33.GetBlockBySeq:output_type -> types.BlockSeq + 11, // 135: types.chain33.CloseQueue:output_type -> types.Reply + 81, // 136: types.chain33.GetAllExecBalance:output_type -> types.AllExecBalance + 82, // 137: types.chain33.SignRawTx:output_type -> types.ReplySignRawTx + 82, // 138: types.chain33.CreateNoBalanceTransaction:output_type -> types.ReplySignRawTx + 65, // 139: types.chain33.QueryRandNum:output_type -> types.ReplyHash + 43, // 140: types.chain33.GetFork:output_type -> types.Int64 + 82, // 141: types.chain33.CreateNoBalanceTxs:output_type -> types.ReplySignRawTx + 83, // 142: types.chain33.GetParaTxByTitle:output_type -> types.ParaTxDetails + 84, // 143: types.chain33.LoadParaTxByTitle:output_type -> types.ReplyHeightByTitle + 83, // 144: types.chain33.GetParaTxByHeight:output_type -> types.ParaTxDetails + 85, // 145: types.chain33.GetHeaders:output_type -> types.Headers + 0, // 146: types.chain33.GetServerTime:output_type -> types.serverTime + 2, // 147: types.chain33.GetCryptoList:output_type -> types.cryptoList + 4, // 148: types.chain33.GetAddressDrivers:output_type -> types.addressDrivers + 11, // 149: types.chain33.SendDelayTransaction:output_type -> types.Reply + 74, // 150: types.chain33.GetWalletRecoverAddress:output_type -> types.ReplyString + 82, // 151: types.chain33.SignWalletRecoverTx:output_type -> types.ReplySignRawTx + 86, // 152: types.chain33.GetFinalizedBlock:output_type -> types.snowChoice + 8, // 153: types.chain33.GetChainConfig:output_type -> types.ChainConfigInfo + 74, // 154: types.chain33.ConvertExectoAddr:output_type -> types.ReplyString + 74, // 155: types.chain33.GetCoinSymbol:output_type -> types.ReplyString + 57, // 156: types.chain33.ReWriteTx:output_type -> types.UnsignTx + 87, // 157: types.chain33.GetBlockSequences:output_type -> types.BlockSequences + 88, // 158: types.chain33.AddPushSubscribe:output_type -> types.ReplySubscribePush + 89, // 159: types.chain33.ListPushes:output_type -> types.PushSubscribes + 43, // 160: types.chain33.GetPushSeqLastNum:output_type -> types.Int64 + 90, // 161: types.chain33.SubEvent:output_type -> types.PushData + 11, // 162: types.chain33.UnSubEvent:output_type -> types.Reply + 84, // [84:163] is the sub-list for method output_type + 5, // [5:84] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension extendee 0, // [0:5] is the sub-list for field type_name @@ -1302,6 +1310,7 @@ func file_rpc_proto_init() { file_account_proto_init() file_executor_proto_init() file_push_tx_receipt_proto_init() + file_snowman_proto_init() if !protoimpl.UnsafeEnabled { file_rpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ServerTime); i { @@ -1587,6 +1596,8 @@ type Chain33Client interface { GetWalletRecoverAddress(ctx context.Context, in *ReqGetWalletRecoverAddr, opts ...grpc.CallOption) (*ReplyString, error) // 钱包找回交易签名 SignWalletRecoverTx(ctx context.Context, in *ReqSignWalletRecoverTx, opts ...grpc.CallOption) (*ReplySignRawTx, error) + // 获取最终化区块 + GetFinalizedBlock(ctx context.Context, in *ReqNil, opts ...grpc.CallOption) (*SnowChoice, error) // 获取节点配置信息 GetChainConfig(ctx context.Context, in *ReqNil, opts ...grpc.CallOption) (*ChainConfigInfo, error) //根据执行期名称创建对应的地址 @@ -2227,6 +2238,15 @@ func (c *chain33Client) SignWalletRecoverTx(ctx context.Context, in *ReqSignWall return out, nil } +func (c *chain33Client) GetFinalizedBlock(ctx context.Context, in *ReqNil, opts ...grpc.CallOption) (*SnowChoice, error) { + out := new(SnowChoice) + err := c.cc.Invoke(ctx, "/types.chain33/GetFinalizedBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *chain33Client) GetChainConfig(ctx context.Context, in *ReqNil, opts ...grpc.CallOption) (*ChainConfigInfo, error) { out := new(ChainConfigInfo) err := c.cc.Invoke(ctx, "/types.chain33/GetChainConfig", in, out, opts...) @@ -2473,6 +2493,8 @@ type Chain33Server interface { GetWalletRecoverAddress(context.Context, *ReqGetWalletRecoverAddr) (*ReplyString, error) // 钱包找回交易签名 SignWalletRecoverTx(context.Context, *ReqSignWalletRecoverTx) (*ReplySignRawTx, error) + // 获取最终化区块 + GetFinalizedBlock(context.Context, *ReqNil) (*SnowChoice, error) // 获取节点配置信息 GetChainConfig(context.Context, *ReqNil) (*ChainConfigInfo, error) //根据执行期名称创建对应的地址 @@ -2701,6 +2723,9 @@ func (*UnimplementedChain33Server) GetWalletRecoverAddress(context.Context, *Req func (*UnimplementedChain33Server) SignWalletRecoverTx(context.Context, *ReqSignWalletRecoverTx) (*ReplySignRawTx, error) { return nil, status.Errorf(codes.Unimplemented, "method SignWalletRecoverTx not implemented") } +func (*UnimplementedChain33Server) GetFinalizedBlock(context.Context, *ReqNil) (*SnowChoice, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFinalizedBlock not implemented") +} func (*UnimplementedChain33Server) GetChainConfig(context.Context, *ReqNil) (*ChainConfigInfo, error) { return nil, status.Errorf(codes.Unimplemented, "method GetChainConfig not implemented") } @@ -3960,6 +3985,24 @@ func _Chain33_SignWalletRecoverTx_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Chain33_GetFinalizedBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReqNil) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Chain33Server).GetFinalizedBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/types.chain33/GetFinalizedBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Chain33Server).GetFinalizedBlock(ctx, req.(*ReqNil)) + } + return interceptor(ctx, in, info, handler) +} + func _Chain33_GetChainConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReqNil) if err := dec(in); err != nil { @@ -4419,6 +4462,10 @@ var _Chain33_serviceDesc = grpc.ServiceDesc{ MethodName: "SignWalletRecoverTx", Handler: _Chain33_SignWalletRecoverTx_Handler, }, + { + MethodName: "GetFinalizedBlock", + Handler: _Chain33_GetFinalizedBlock_Handler, + }, { MethodName: "GetChainConfig", Handler: _Chain33_GetChainConfig_Handler, From 288306cdb72dc08fae15e001f7fd95bf2d3c5676 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 10 May 2024 11:56:49 +0800 Subject: [PATCH 63/85] fix test --- Makefile | 1 + blockchain/blockfinalize.go | 8 ++++---- system/consensus/snowman/validator_test.go | 4 ++-- system/p2p/dht/protocol/peer/peerinfo_test.go | 4 +++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 804060f87..b57855810 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ cli: ## Build cli binary @go build $(BUILD_FLAGS) -v -o $(CLI) $(SRC_CLI) build:cli ## Build the binary file + @echo $(GOARCH) @go build $(BUILD_FLAGS) -v -o $(APP) $(SRC) @cp cmd/chain33/chain33.toml build/ @cp cmd/chain33/bityuan.toml build/ diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index ee327968b..7093d62ee 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -29,10 +29,10 @@ func (f *finalizer) Init(chain *BlockChain) { chainlog.Error("newFinalizer", "decode err", err) panic(err) } - chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) - } else { + chainlog.Info("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) + } else if chain.client.GetConfig().GetModuleConfig().Consensus.Finalizer != "" { f.choice.Height = chain.cfg.BlockFinalizeEnableHeight - chainlog.Debug("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight) + chainlog.Info("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight) go f.waitFinalizeStartBlock(f.choice.Height) } } @@ -72,7 +72,7 @@ func (f *finalizer) waitFinalizeStartBlock(beginHeight int64) { detail, err := f.chain.GetBlock(beginHeight) if err != nil { - chainlog.Error("setFinalizedStartHeight", "height", beginHeight, "get block err", err) + chainlog.Error("waitFinalizeStartBlock", "height", beginHeight, "waitHeight", waitHeight, "get block err", err) panic(err) } _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig())) diff --git a/system/consensus/snowman/validator_test.go b/system/consensus/snowman/validator_test.go index 1498ece86..4ee7114b4 100644 --- a/system/consensus/snowman/validator_test.go +++ b/system/consensus/snowman/validator_test.go @@ -78,9 +78,9 @@ func Test_getConnectedPeers(t *testing.T) { require.Equal(t, utils.ErrValidatorSample, err) _, err = v.Sample(0) require.Equal(t, utils.ErrValidatorSample, err) - peer1 := *peer + peer1 := types.Clone(peer).(*types.Peer) peer1.Name = "peer1" - list.Peers = []*types.Peer{peer,&peer1, self} + list.Peers = []*types.Peer{peer, peer1, self} ids, err := v.Sample(2) require.Nil(t, err) require.Equal(t, 2, len(ids)) diff --git a/system/p2p/dht/protocol/peer/peerinfo_test.go b/system/p2p/dht/protocol/peer/peerinfo_test.go index 6c52b7830..866dc9865 100644 --- a/system/p2p/dht/protocol/peer/peerinfo_test.go +++ b/system/p2p/dht/protocol/peer/peerinfo_test.go @@ -20,10 +20,10 @@ import ( p2pty "github.com/33cn/chain33/system/p2p/dht/types" "github.com/33cn/chain33/types" "github.com/libp2p/go-libp2p" + dht "github.com/libp2p/go-libp2p-kad-dht" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/metrics" "github.com/libp2p/go-libp2p/core/peer" - dht "github.com/libp2p/go-libp2p-kad-dht" "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/require" ) @@ -133,6 +133,8 @@ func testBlockReq(q queue.Queue) { switch msg.Ty { case types.EventGetLastHeader: msg.Reply(queue.NewMessage(0, "p2p", types.EventGetLastHeader, &types.Header{})) + case types.EventSnowmanLastChoice: + msg.Reply(queue.NewMessage(0, "p2p", 0, &types.SnowChoice{})) } } }() From 068a21453a493163f751deaf64d4aaba90544b0f Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 10 May 2024 15:42:34 +0800 Subject: [PATCH 64/85] fmt code --- system/consensus/snowman/sender_test.go | 11 ++++---- system/consensus/snowman/validator.go | 3 ++- system/consensus/snowman/validator_test.go | 8 +++--- system/consensus/snowman/vm_test.go | 31 +++++++++------------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/system/consensus/snowman/sender_test.go b/system/consensus/snowman/sender_test.go index 3ae5545cd..6082b11db 100644 --- a/system/consensus/snowman/sender_test.go +++ b/system/consensus/snowman/sender_test.go @@ -1,13 +1,14 @@ package snowman import ( + "testing" + "github.com/33cn/chain33/queue" "github.com/33cn/chain33/types" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/utils/bag" "github.com/ava-labs/avalanchego/utils/set" "github.com/stretchr/testify/require" - "testing" ) func TestMsgSender(t *testing.T) { @@ -32,20 +33,20 @@ func TestMsgSender(t *testing.T) { req := msg.Data.(*types.SnowChits) checkID = req.GetRequestID() checkName = req.GetPeerName() - }else if msg.Ty == types.EventSnowmanPutBlock { + } else if msg.Ty == types.EventSnowmanPutBlock { req := msg.Data.(*types.SnowPutBlock) checkID = req.GetRequestID() checkName = req.GetPeerName() - }else if msg.Ty == types.EventSnowmanGetBlock{ + } else if msg.Ty == types.EventSnowmanGetBlock { req := msg.Data.(*types.SnowGetBlock) checkID = req.GetRequestID() checkName = req.GetPeerName() - }else if msg.Ty == types.EventSnowmanPullQuery { + } else if msg.Ty == types.EventSnowmanPullQuery { req := msg.Data.(*types.SnowPullQuery) checkID = req.GetRequestID() checkName = req.GetPeerName() - }else if msg.Ty == types.EventSnowmanPushQuery { + } else if msg.Ty == types.EventSnowmanPushQuery { req := msg.Data.(*types.SnowPushQuery) checkID = req.GetRequestID() checkName = req.GetPeerName() diff --git a/system/consensus/snowman/validator.go b/system/consensus/snowman/validator.go index c26dcbc28..b7231d5c1 100644 --- a/system/consensus/snowman/validator.go +++ b/system/consensus/snowman/validator.go @@ -2,11 +2,12 @@ package snowman import ( "fmt" - "github.com/33cn/chain33/queue" "math/rand" "sync" "time" + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/system/consensus" "github.com/33cn/chain33/system/consensus/snowman/utils" "github.com/33cn/chain33/types" diff --git a/system/consensus/snowman/validator_test.go b/system/consensus/snowman/validator_test.go index 4ee7114b4..27a677503 100644 --- a/system/consensus/snowman/validator_test.go +++ b/system/consensus/snowman/validator_test.go @@ -1,12 +1,13 @@ package snowman import ( + "strings" + "testing" + "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus/snowman/utils" "github.com/33cn/chain33/types" "github.com/stretchr/testify/require" - "strings" - "testing" ) func TestNodeID(t *testing.T) { @@ -49,8 +50,7 @@ func Test_getConnectedPeers(t *testing.T) { } }() - self := &types.Peer{Self: true, Header: &types.Header{Height: 129}} - + self := &types.Peer{Self: true, Header: &types.Header{Height: 129}} list.Peers = []*types.Peer{self} peers, err := v.getConnectedPeers() diff --git a/system/consensus/snowman/vm_test.go b/system/consensus/snowman/vm_test.go index 869d4417c..da4aaaf93 100644 --- a/system/consensus/snowman/vm_test.go +++ b/system/consensus/snowman/vm_test.go @@ -2,6 +2,9 @@ package snowman import ( "encoding/hex" + "testing" + "time" + "github.com/33cn/chain33/queue" "github.com/33cn/chain33/system/consensus" "github.com/33cn/chain33/system/consensus/snowman/utils" @@ -9,8 +12,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/choices" "github.com/stretchr/testify/require" - "testing" - "time" ) func newTestCtx() *consensus.Context { @@ -19,12 +20,11 @@ func newTestCtx() *consensus.Context { cfg := types.NewChain33Config(types.GetDefaultCfgstring()) q.SetConfig(cfg) base := consensus.NewBaseClient(cfg.GetModuleConfig().Consensus) - base.InitClient(q.Client(), func(){}) + base.InitClient(q.Client(), func() {}) ctx := &consensus.Context{Base: base} return ctx } - func mockHandleChainMsg(cli queue.Client) { cli.Sub("blockchain") @@ -33,15 +33,14 @@ func mockHandleChainMsg(cli queue.Client) { if msg.Ty == types.EventSnowmanLastChoice { msg.Reply(cli.NewMessage("", 0, &types.SnowChoice{Height: 1, Hash: []byte("test")})) - }else if msg.Ty == types.EventGetBlockByHashes { + } else if msg.Ty == types.EventGetBlockByHashes { msg.Reply(cli.NewMessage("", 0, &types.BlockDetails{Items: []*types.BlockDetail{{Block: &types.Block{Height: 1}}}})) - }else if msg.Ty == types.EventGetBlockHash { + } else if msg.Ty == types.EventGetBlockHash { msg.Reply(cli.NewMessage("", 0, &types.ReplyHash{Hash: []byte("test")})) } } } - func TestChain33VM(t *testing.T) { ctx := newTestCtx() @@ -67,16 +66,16 @@ func TestChain33VM(t *testing.T) { vm.decidedHashes.Add(sb.ID(), true) sb1, err := vm.ParseBlock(nil, sb.Bytes()) require.Equal(t, choices.Accepted, sb1.Status()) - + require.Nil(t, err) // test and and build new block require.False(t, vm.addNewBlock(blk)) _, err = vm.BuildBlock(nil) require.Equal(t, utils.ErrBlockNotReady, err) - blk.Height= vm.acceptedHeight+1 + blk.Height = vm.acceptedHeight + 1 require.True(t, vm.addNewBlock(blk)) sb1, err = vm.BuildBlock(nil) require.Equal(t, blk.Height, int64(sb1.Height())) - + require.Nil(t, err) // test GetBlockIDAtHeight id, _ := vm.GetBlockIDAtHeight(nil, 0) require.Equal(t, "test", string(id[:4])) @@ -99,11 +98,10 @@ func TestChain33VM(t *testing.T) { require.Equal(t, 0, vm.pendingBlocks.Len()) } - func TestVmUnimplementMethod(t *testing.T) { vm := &chain33VM{} - require.Nil(t, vm.Initialize(nil, nil, nil, nil, nil,nil,nil,nil,nil)) + require.Nil(t, vm.Initialize(nil, nil, nil, nil, nil, nil, nil, nil, nil)) require.Nil(t, vm.SetState(nil, 0)) require.Nil(t, vm.SetPreference(nil, ids.Empty)) require.Nil(t, vm.Shutdown(nil)) @@ -111,11 +109,11 @@ func TestVmUnimplementMethod(t *testing.T) { require.Nil(t, vm.CrossChainAppRequestFailed(nil, ids.Empty, 0)) require.Nil(t, vm.CrossChainAppRequest(nil, ids.Empty, 0, types.Now(), nil)) - require.Nil(t, vm.CrossChainAppResponse(nil, ids.Empty, 0, nil) ) + require.Nil(t, vm.CrossChainAppResponse(nil, ids.Empty, 0, nil)) require.Nil(t, vm.AppRequest(nil, ids.EmptyNodeID, 0, time.Now(), nil)) require.Nil(t, vm.AppRequestFailed(nil, ids.EmptyNodeID, 0)) - require.Nil(t, vm.AppResponse(nil, ids.EmptyNodeID, 0,nil)) - require.Nil(t, vm.AppGossip(nil, ids.EmptyNodeID,nil)) + require.Nil(t, vm.AppResponse(nil, ids.EmptyNodeID, 0, nil)) + require.Nil(t, vm.AppGossip(nil, ids.EmptyNodeID, nil)) require.Nil(t, vm.GossipTx(nil)) _, err := vm.HealthCheck(nil) require.Nil(t, err) @@ -128,6 +126,3 @@ func TestVmUnimplementMethod(t *testing.T) { _, err = vm.Version(nil) require.Nil(t, err) } - - - From c40ab88d9863c4011aa835004efd234a60d53a6b Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 10 May 2024 22:37:57 +0800 Subject: [PATCH 65/85] fix test with json rpc 2.0 --- rpc/server_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rpc/server_test.go b/rpc/server_test.go index 80aa5700b..4da9163ec 100644 --- a/rpc/server_test.go +++ b/rpc/server_test.go @@ -7,6 +7,7 @@ package rpc import ( "encoding/json" "errors" + "github.com/stretchr/testify/require" "net/http" "testing" "time" @@ -225,7 +226,7 @@ func TestEthRpc_Subscribe(t *testing.T) { //websocket client ws, err := websocket.Dial("ws://localhost:8546", "", "http://localhost:8546") assert.Nil(t, err) - ws.Write([]byte(`{"id": 1, "method": "eth_subscribe", "params": ["newHeads"]}`)) + ws.Write([]byte(`{"jsonrpc":"2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]}`)) var data string err = websocket.Message.Receive(ws, &data) assert.Nil(t, err) @@ -234,6 +235,7 @@ func TestEthRpc_Subscribe(t *testing.T) { } err = json.Unmarshal([]byte(data), &subID) assert.Nil(t, err) + require.Truef(t, len(subID.Result) > 0, data) t.Log("subid", subID.Result) time.Sleep(time.Second) err = q.Client().Send(qcli.NewMessage("rpc", types.EventPushBlock, &types.PushData{Name: subID.Result, Value: &types.PushData_HeaderSeqs{ @@ -257,7 +259,7 @@ func TestEthRpc_Subscribe(t *testing.T) { ws, err = websocket.Dial("ws://localhost:8546", "", "http://localhost:8546") assert.Nil(t, err) - ws.Write([]byte(`{"id": 1, "method": "eth_subscribe", "params": ["logs",{"address":"1JX6b8qpVFZ4FPqP4KT2HRTjYJrzRZGw7t"}]}`)) + ws.Write([]byte(`{"jsonrpc":"2.0", "id": 1, "method": "eth_subscribe", "params": ["logs",{"address":"1JX6b8qpVFZ4FPqP4KT2HRTjYJrzRZGw7t"}]}`)) err = websocket.Message.Receive(ws, &data) assert.Nil(t, err) From 6984d8223b692d3cc6c66539bbc478ee0b73b512 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sat, 11 May 2024 15:05:48 +0800 Subject: [PATCH 66/85] update avalanche package for removing cgo dependency --- go.mod | 3 +-- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 1e4d01b4a..30dba049c 100644 --- a/go.mod +++ b/go.mod @@ -181,7 +181,6 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.0 // indirect - github.com/supranational/blst v0.3.11 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect github.com/uber/jaeger-client-go v2.28.0+incompatible // indirect @@ -228,4 +227,4 @@ require ( replace github.com/btcsuite/btcd/btcec => github.com/btcsuite/btcd v0.22.3 -replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240425071419-8fa889e91c4d +replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240511070301-a9a2aac50464 diff --git a/go.sum b/go.sum index d1018acea..447e357ab 100644 --- a/go.sum +++ b/go.sum @@ -214,8 +214,8 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bysomeone/avalanchego v0.0.0-20240425071419-8fa889e91c4d h1:7kiPBbovd/xxPh84vmEZA+ZgwMUECF0KDIwkGmfzMUg= -github.com/bysomeone/avalanchego v0.0.0-20240425071419-8fa889e91c4d/go.mod h1:C8R5uiltpc8MQ62ixxgODR+15mesWF0aAw3H+Qrl9Iw= +github.com/bysomeone/avalanchego v0.0.0-20240511070301-a9a2aac50464 h1:fjGGreFQgEMo+jTduHpxVpDOVbGd45Wata/KXu9ieWg= +github.com/bysomeone/avalanchego v0.0.0-20240511070301-a9a2aac50464/go.mod h1:SgoXVssKD3a3diOV4qaTkOEQ+2KEfErcdOASIhV6a1s= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= @@ -1336,8 +1336,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= From 6319ef3bb720e18493eb31ae37ea2ba15e73012a Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sat, 11 May 2024 21:36:42 +0800 Subject: [PATCH 67/85] add more test --- Makefile | 1 - blockchain/blockstore.go | 4 +- system/consensus/snowman/snowman.go | 34 +-- system/consensus/snowman/snowman_test.go | 81 ++++++ system/consensus/snowman/vm.go | 24 +- system/consensus/snowman/vm_test.go | 6 +- system/p2p/dht/protocol/peer/peerinfo.go | 23 +- system/p2p/dht/protocol/peer/peerinfo_test.go | 13 +- system/p2p/dht/protocol/snow/handler.go | 46 ++-- system/p2p/dht/protocol/snow/snow.go | 2 +- system/p2p/dht/protocol/snow/snow_test.go | 240 ++++++++++++++++++ system/p2p/dht/protocol/snow/util.go | 2 +- 12 files changed, 385 insertions(+), 91 deletions(-) create mode 100644 system/consensus/snowman/snowman_test.go create mode 100644 system/p2p/dht/protocol/snow/snow_test.go diff --git a/Makefile b/Makefile index b57855810..804060f87 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,6 @@ cli: ## Build cli binary @go build $(BUILD_FLAGS) -v -o $(CLI) $(SRC_CLI) build:cli ## Build the binary file - @echo $(GOARCH) @go build $(BUILD_FLAGS) -v -o $(APP) $(SRC) @cp cmd/chain33/chain33.toml build/ @cp cmd/chain33/bityuan.toml build/ diff --git a/blockchain/blockstore.go b/blockchain/blockstore.go index 15b67a2c9..3105fcfd5 100644 --- a/blockchain/blockstore.go +++ b/blockchain/blockstore.go @@ -865,7 +865,9 @@ func (bs *BlockStore) GetTdByBlockHash(hash []byte) (*big.Int, error) { blocktd, err := bs.db.Get(calcHashToTdKey(hash)) if blocktd == nil || err != nil { - storeLog.Error("GetTdByBlockHash ", "hash", hex.EncodeToString(hash), "err", err) + if err != dbm.ErrNotFoundInDb { + storeLog.Error("GetTdByBlockHash ", "hash", hex.EncodeToString(hash), "err", err) + } return nil, types.ErrHashNotExist } td := new(big.Int) diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index fb6c34094..d970b40e3 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -100,7 +100,7 @@ func (s *snowman) resetEngine() { func (s *snowman) startRoutine() { for { - c, err := getLastChoice(s.ctx.Base.GetQueueClient()) + c, err := s.ctx.Base.GetAPI().GetFinalizedBlock() if err == nil && len(c.Hash) > 0 { break } @@ -191,22 +191,22 @@ func (s *snowman) handleSyncMsg(msg *queue.Message) { "chits err", err) } - case types.EventSnowmanGetBlock: - - req := msg.Data.(*types.SnowGetBlock) - snowLog.Debug("handleInMsg getBlock", "reqID", req.GetRequestID(), "peerName", req.GetPeerName(), - "hash", hex.EncodeToString(req.BlockHash)) - nodeID, err := s.vs.toNodeID(req.PeerName) - if err != nil { - snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) - return - } - - err = s.engine.Get(s.ctx.Base.Context, nodeID, req.RequestID, toSnowID(req.BlockHash)) - if err != nil { - snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, - "hash", hex.EncodeToString(req.BlockHash), "peerName", req.PeerName, "Get err", err) - } + //case types.EventSnowmanGetBlock: + // + // req := msg.Data.(*types.SnowGetBlock) + // snowLog.Debug("handleInMsg getBlock", "reqID", req.GetRequestID(), "peerName", req.GetPeerName(), + // "hash", hex.EncodeToString(req.BlockHash)) + // nodeID, err := s.vs.toNodeID(req.PeerName) + // if err != nil { + // snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, "peerName", req.PeerName, "toNodeID err", err) + // return + // } + // + // err = s.engine.Get(s.ctx.Base.Context, nodeID, req.RequestID, toSnowID(req.BlockHash)) + // if err != nil { + // snowLog.Error("handleInMsg getBlock", "reqID", req.RequestID, + // "hash", hex.EncodeToString(req.BlockHash), "peerName", req.PeerName, "Get err", err) + // } case types.EventSnowmanPutBlock: req := msg.Data.(*types.SnowPutBlock) diff --git a/system/consensus/snowman/snowman_test.go b/system/consensus/snowman/snowman_test.go new file mode 100644 index 000000000..4c82c42ac --- /dev/null +++ b/system/consensus/snowman/snowman_test.go @@ -0,0 +1,81 @@ +package snowman + +import ( + "sync/atomic" + "testing" + "time" + + "github.com/33cn/chain33/client/mocks" + "github.com/33cn/chain33/queue" + "github.com/33cn/chain33/types" + "github.com/stretchr/testify/mock" +) + +func TestSnowman(t *testing.T) { + + api := new(mocks.QueueProtocolAPI) + q, ctx := newTestCtx() + + gblock := &types.Block{Height: 1} + sc := &types.SnowChoice{Height: 1, Hash: gblock.Hash(q.GetConfig())} + api.On("GetBlockByHashes", mock.Anything).Return(&types.BlockDetails{Items: []*types.BlockDetail{{Block: gblock}}}, nil) + api.On("GetFinalizedBlock").Return(sc, nil) + api.On("GetConfig").Return(q.GetConfig()) + + defer q.Close() + defer ctx.Base.Cancel() + ctx.Base.SetAPI(api) + cli := q.Client() + go func() { + + cli.Sub("p2p") + for msg := range cli.Recv() { + msg.Reply(cli.NewMessage("", 0, &types.Reply{})) + } + }() + + sm := &snowman{} + sm.Initialize(ctx) + + for timeout := 0; atomic.LoadInt64(&sm.vm.acceptedHeight) < 1; timeout++ { + time.Sleep(time.Second) + timeout++ + if timeout >= 3 { + t.Errorf("test timeout acceptHeight=%d", atomic.LoadInt64(&sm.vm.acceptedHeight)) + return + } + } + + blk := &types.Block{ParentHash: sc.Hash, Height: 2} + blkHash := blk.Hash(q.GetConfig()) + sm.AddBlock(blk) + peer := "peerid" + reqID := uint32(0) + + sm.SubMsg(queue.NewMessage(types.EventSnowmanChits, "", 0, + &types.SnowChits{PeerName: peer, PreferredBlkHash: blkHash, AcceptedBlkHash: blkHash})) + sm.SubMsg(queue.NewMessage(types.EventSnowmanPutBlock, "", 0, + &types.SnowPutBlock{RequestID: reqID + 1, PeerName: peer, BlockHash: blkHash, BlockData: types.Encode(blk)})) + sm.SubMsg(queue.NewMessage(types.EventSnowmanPullQuery, "", 0, + &types.SnowPullQuery{RequestID: reqID + 2, PeerName: peer, BlockHash: blkHash})) + sm.SubMsg(queue.NewMessage(types.EventSnowmanPushQuery, "", 0, + &types.SnowPushQuery{RequestID: reqID + 3, PeerName: peer, BlockData: types.Encode(blk)})) + sm.SubMsg(queue.NewMessage(types.EventSnowmanQueryFailed, "", 0, + &types.SnowFailedQuery{RequestID: reqID + 4, PeerName: peer})) + sm.SubMsg(queue.NewMessage(types.EventSnowmanGetFailed, "", 0, + &types.SnowFailedQuery{RequestID: reqID + 5, PeerName: peer})) + + gblock.Height = 2 + gblock.ParentHash = sc.Hash + sc.Height = gblock.Height + sc.Hash = gblock.Hash(q.GetConfig()) + sm.SubMsg(queue.NewMessage(types.EventSnowmanResetEngine, "", 0, nil)) + for timeout := 0; atomic.LoadInt64(&sm.vm.acceptedHeight) < 2; timeout++ { + time.Sleep(time.Second) + timeout++ + if timeout >= 3 { + t.Errorf("test timeout acceptHeight=%d", atomic.LoadInt64(&sm.vm.acceptedHeight)) + return + } + } +} diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 4ecaf1d63..d5a0047ef 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -2,6 +2,7 @@ package snowman import ( "container/list" + "encoding/hex" "sync" "sync/atomic" @@ -63,7 +64,7 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { } vm.decidedHashes = c vm.pendingBlocks = list.New() - choice, err := getLastChoice(vm.qclient) + choice, err := vm.api.GetFinalizedBlock() if err != nil { snowLog.Error("vm Init", "getLastChoice err", err) panic(err) @@ -111,7 +112,7 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { - snowLog.Debug("vmGetBlock", "hash", blkID.Hex()) + snowLog.Debug("vmGetBlock", "hash", blkID.Hex(), "err", err) return nil, database.ErrNotFound } sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) @@ -157,7 +158,7 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { vm.lock.Lock() defer vm.lock.Unlock() vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) - snowLog.Debug("vm addNewBlock", "height", blk.GetHeight(), "hash", blk.Hash(vm.cfg), + snowLog.Debug("vm addNewBlock", "height", blk.GetHeight(), "hash", hex.EncodeToString(blk.Hash(vm.cfg)), "acceptedHeight", ah, "pendingNum", vm.pendingBlocks.Len()) return true } @@ -201,21 +202,6 @@ func (vm *chain33VM) SetPreference(ctx context.Context, blkID ids.ID) error { return nil } -func getLastChoice(cli queue.Client) (*types.SnowChoice, error) { - - msg := cli.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) - err := cli.Send(msg, true) - if err != nil { - return nil, err - } - - reply, err := cli.Wait(msg) - if err != nil { - return nil, err - } - return reply.GetData().(*types.SnowChoice), nil -} - // LastAccepted returns the ID of the last accepted block. // // If no blocks have been accepted by consensus yet, it is assumed there is @@ -223,7 +209,7 @@ func getLastChoice(cli queue.Client) (*types.SnowChoice, error) { // returned. func (vm *chain33VM) LastAccepted(_ context.Context) (ids.ID, error) { - choice, err := getLastChoice(vm.qclient) + choice, err := vm.api.GetFinalizedBlock() if err != nil { snowLog.Error("vmLastAccepted", "getLastChoice err", err) return ids.Empty, err diff --git a/system/consensus/snowman/vm_test.go b/system/consensus/snowman/vm_test.go index da4aaaf93..de3d10f2f 100644 --- a/system/consensus/snowman/vm_test.go +++ b/system/consensus/snowman/vm_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" ) -func newTestCtx() *consensus.Context { +func newTestCtx() (queue.Queue, *consensus.Context) { q := queue.New("test") cfg := types.NewChain33Config(types.GetDefaultCfgstring()) @@ -22,7 +22,7 @@ func newTestCtx() *consensus.Context { base := consensus.NewBaseClient(cfg.GetModuleConfig().Consensus) base.InitClient(q.Client(), func() {}) ctx := &consensus.Context{Base: base} - return ctx + return q, ctx } func mockHandleChainMsg(cli queue.Client) { @@ -43,7 +43,7 @@ func mockHandleChainMsg(cli queue.Client) { func TestChain33VM(t *testing.T) { - ctx := newTestCtx() + _, ctx := newTestCtx() cli := ctx.Base.GetQueueClient() defer cli.Close() go mockHandleChainMsg(cli) diff --git a/system/p2p/dht/protocol/peer/peerinfo.go b/system/p2p/dht/protocol/peer/peerinfo.go index 3a86bd8e7..da3d29b6f 100644 --- a/system/p2p/dht/protocol/peer/peerinfo.go +++ b/system/p2p/dht/protocol/peer/peerinfo.go @@ -3,7 +3,6 @@ package peer import ( "context" "fmt" - "github.com/33cn/chain33/queue" "strconv" "strings" "sync" @@ -70,26 +69,12 @@ func (p *Protocol) getLocalPeerInfo() *types.Peer { localPeer.FullNode = p.SubConfig.IsFullNode //增加节点高度增长是否是阻塞状态监测 localPeer.Blocked = p.getBlocked() - localPeer.Finalized = getFinalizedChoice(p.QueueClient) - return &localPeer -} - -func getFinalizedChoice(qclient queue.Client) (choice *types.SnowChoice) { - - choice = &types.SnowChoice{} - msg := qclient.NewMessage("blockchain", types.EventSnowmanLastChoice, &types.ReqNil{}) - err := qclient.Send(msg, true) + localPeer.Finalized, err = p.API.GetFinalizedBlock() if err != nil { - log.Error("getFinalizedChoice", "send msg err", err) - return - } - - reply, err := qclient.Wait(msg) - if err != nil { - log.Error("getFinalizedChoice", "wait msg err", err) - return + log.Error("getLocalPeerInfo", "GetFinalizedBlock err", err) + return nil } - return reply.GetData().(*types.SnowChoice) + return &localPeer } func caculteRunningTime() string { diff --git a/system/p2p/dht/protocol/peer/peerinfo_test.go b/system/p2p/dht/protocol/peer/peerinfo_test.go index 866dc9865..3b0848ede 100644 --- a/system/p2p/dht/protocol/peer/peerinfo_test.go +++ b/system/p2p/dht/protocol/peer/peerinfo_test.go @@ -8,6 +8,7 @@ import ( "context" "encoding/hex" "fmt" + "github.com/33cn/chain33/client/mocks" "sync" "testing" "time" @@ -66,12 +67,14 @@ func initEnv(t *testing.T, q queue.Queue) (*Protocol, context.CancelFunc) { if err != nil { t.Fatal(err) } - + api := new(mocks.QueueProtocolAPI) + api.On("GetFinalizedBlock").Return(&types.SnowChoice{}, nil) env1 := protocol.P2PEnv{ Ctx: ctx, ChainCfg: cfg, QueueClient: client1, Host: host1, + API: api, SubConfig: mcfg, RoutingTable: kademliaDHT1.RoutingTable(), PeerInfoManager: &peerInfoManager{}, @@ -87,9 +90,7 @@ func initEnv(t *testing.T, q queue.Queue) (*Protocol, context.CancelFunc) { addr, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/13806/p2p/%s", host1.ID().Pretty())) peerinfo, _ := peer.AddrInfoFromP2pAddr(addr) err = host2.Connect(context.Background(), *peerinfo) - if err != nil { - t.Fatal("connect error", err) - } + require.Nil(t, err) ps2, err := extension.NewPubSub(ctx, host2, &p2pty.PubSubConfig{}) if err != nil { @@ -101,6 +102,7 @@ func initEnv(t *testing.T, q queue.Queue) (*Protocol, context.CancelFunc) { ChainCfg: cfg, QueueClient: client2, Host: host2, + API: api, SubConfig: mcfg, RoutingTable: kademliaDHT2.RoutingTable(), PeerInfoManager: &peerInfoManager{}, @@ -133,8 +135,6 @@ func testBlockReq(q queue.Queue) { switch msg.Ty { case types.EventGetLastHeader: msg.Reply(queue.NewMessage(0, "p2p", types.EventGetLastHeader, &types.Header{})) - case types.EventSnowmanLastChoice: - msg.Reply(queue.NewMessage(0, "p2p", 0, &types.SnowChoice{})) } } }() @@ -183,6 +183,7 @@ func TestPeerInfoHandler(t *testing.T) { testMempoolReq(q) testBlockReq(q) + require.Equal(t, 1, len(p.Host.Network().Conns())) remotePid := p.Host.Network().Conns()[0].RemotePeer() stream, err := p.Host.NewStream(p.Ctx, remotePid, peerInfo) require.Nil(t, err) diff --git a/system/p2p/dht/protocol/snow/handler.go b/system/p2p/dht/protocol/snow/handler.go index f02c72189..314e4decf 100644 --- a/system/p2p/dht/protocol/snow/handler.go +++ b/system/p2p/dht/protocol/snow/handler.go @@ -73,32 +73,32 @@ func (s *snowman) handleEventGetBlock(msg *queue.Message) { } rep.PeerName = req.PeerName - err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanPutBlock, rep), false) + err = s.QueueClient.Send(consensusMsg(types.EventSnowmanPutBlock, rep), false) if err != nil { log.Error("handleEventGetBlock", "reqID", req.RequestID, "peer", req.PeerName, "send queue err", err) } } -func (s *snowman) handleEventPutBlock(msg *queue.Message) { - - req := msg.GetData().(*types.SnowPutBlock) - - pid, _ := peer.Decode(req.PeerName) - stream, err := s.Host.NewStream(s.Ctx, pid, snowPutBlock) - if err != nil { - log.Error("handleEventPutBlock", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) - return - } - - _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) - defer protocol.CloseStream(stream) - - err = protocol.WriteStream(req, stream) - if err != nil { - log.Error("handleEventPutBlock", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) - } -} +//func (s *snowman) handleEventPutBlock(msg *queue.Message) { +// +// req := msg.GetData().(*types.SnowPutBlock) +// +// pid, _ := peer.Decode(req.PeerName) +// stream, err := s.Host.NewStream(s.Ctx, pid, snowPutBlock) +// if err != nil { +// log.Error("handleEventPutBlock", "reqID", req.RequestID, "peer", req.PeerName, "newStream err", err) +// return +// } +// +// _ = stream.SetDeadline(time.Now().Add(time.Second * 5)) +// defer protocol.CloseStream(stream) +// +// err = protocol.WriteStream(req, stream) +// if err != nil { +// log.Error("handleEventPutBlock", "reqID", req.RequestID, "peer", req.PeerName, "writeStream err", err) +// } +//} func (s *snowman) handleEventPullQuery(msg *queue.Message) { @@ -154,7 +154,7 @@ func (s *snowman) handleStreamChits(stream network.Stream) { return } req.PeerName = peerName - err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanChits, req), false) + err = s.QueueClient.Send(consensusMsg(types.EventSnowmanChits, req), false) if err != nil { log.Error("handleStreamChits", "reqID", req.RequestID, "peer", peerName, "send queue err", err) @@ -198,7 +198,7 @@ func (s *snowman) handleStreamPullQuery(stream network.Stream) { return } req.PeerName = peerName - err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanPullQuery, req), false) + err = s.QueueClient.Send(consensusMsg(types.EventSnowmanPullQuery, req), false) if err != nil { log.Error("handleStreamPullQuery", "reqID", req.RequestID, "peer", req.PeerName, "send queue err", err) @@ -215,7 +215,7 @@ func (s *snowman) handleStreamPushQuery(stream network.Stream) { return } req.PeerName = peerName - err = s.P2PManager.Client.Send(consensusMsg(types.EventSnowmanPushQuery, req), false) + err = s.QueueClient.Send(consensusMsg(types.EventSnowmanPushQuery, req), false) if err != nil { log.Error("handleStreamPushQuery", "reqID", req.RequestID, "peer", req.PeerName, "send queue err", err) diff --git a/system/p2p/dht/protocol/snow/snow.go b/system/p2p/dht/protocol/snow/snow.go index 9af81b8d5..e845f7ae1 100644 --- a/system/p2p/dht/protocol/snow/snow.go +++ b/system/p2p/dht/protocol/snow/snow.go @@ -34,7 +34,7 @@ func (s *snowman) init(env *protocol.P2PEnv) { s.P2PEnv = env protocol.RegisterEventHandler(types.EventSnowmanChits, s.handleEventChits) protocol.RegisterEventHandler(types.EventSnowmanGetBlock, s.handleEventGetBlock) - protocol.RegisterEventHandler(types.EventSnowmanPutBlock, s.handleEventPutBlock) + //protocol.RegisterEventHandler(types.EventSnowmanPutBlock, s.handleEventPutBlock) protocol.RegisterEventHandler(types.EventSnowmanPullQuery, s.handleEventPullQuery) protocol.RegisterEventHandler(types.EventSnowmanPushQuery, s.handleEventPushQuery) diff --git a/system/p2p/dht/protocol/snow/snow_test.go b/system/p2p/dht/protocol/snow/snow_test.go new file mode 100644 index 000000000..0edd751d3 --- /dev/null +++ b/system/p2p/dht/protocol/snow/snow_test.go @@ -0,0 +1,240 @@ +package snow + +import ( + "context" + "github.com/33cn/chain33/client/mocks" + commlog "github.com/33cn/chain33/common/log" + "github.com/33cn/chain33/queue" + prototypes "github.com/33cn/chain33/system/p2p/dht/protocol" + "github.com/33cn/chain33/types" + "github.com/libp2p/go-libp2p" + "github.com/libp2p/go-libp2p/core" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/p2p/transport/tcp" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "testing" + "time" +) + +func init() { + commlog.SetLogLevel("error") +} + +func newHost(t *testing.T) core.Host { + + host, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"), libp2p.Transport(tcp.NewTCPTransport)) + require.Nil(t, err) + + return host +} + +func newTestEnv(q queue.Queue, t *testing.T) (*prototypes.P2PEnv, context.CancelFunc) { + cfg := types.NewChain33Config(types.ReadFile("../../../../../cmd/chain33/chain33.test.toml")) + env := &prototypes.P2PEnv{ + ChainCfg: cfg, + QueueClient: q.Client(), + Host: newHost(t), + API: new(mocks.QueueProtocolAPI), + Ctx: context.Background(), + } + ctx, cancel := context.WithCancel(context.Background()) + env.Ctx = ctx + return env, cancel +} + +func newSnowWithQueue(q queue.Queue, t *testing.T) (*snowman, context.CancelFunc) { + env, cancel := newTestEnv(q, t) + prototypes.ClearEventHandler() + p := &snowman{} + p.init(env) + return p, cancel +} + +func handleSub(q queue.Queue, topic string, handler func(*queue.Message)) { + cli := q.Client() + cli.Sub(topic) + for msg := range cli.Recv() { + handler(msg) + } +} + +func checkDone(done chan struct{}, t *testing.T) { + select { + case <-done: + case <-time.After(time.Second * 3): + t.Error("test timeout") + } +} + +func TestSnowmanChits(t *testing.T) { + + q := queue.New("test") + sm, cancel := newSnowWithQueue(q, t) + sm2, cancel2 := newSnowWithQueue(q, t) + q.SetConfig(sm.ChainCfg) + defer func() { + q.Close() + cancel2() + cancel() + sm.Host.Close() + sm2.Host.Close() + }() + + addrInfo := peer.AddrInfo{ + ID: sm2.Host.ID(), + Addrs: sm2.Host.Addrs(), + } + + hash := []byte("testhash") + chits := &types.SnowChits{ + RequestID: 1, + PeerName: sm2.Host.ID().String(), + PreferredBlkHash: hash, + } + + done := make(chan struct{}) + go handleSub(q, "consensus", func(msg *queue.Message) { + + if msg.ID == types.EventSnowmanQueryFailed { + rep, ok := msg.Data.(*types.SnowFailedQuery) + require.True(t, ok) + require.Equal(t, chits.RequestID, rep.RequestID) + return + } + defer close(done) + req, ok := msg.Data.(*types.SnowChits) + require.True(t, ok) + require.Equal(t, chits.RequestID, req.RequestID) + require.Equal(t, sm.Host.ID().String(), req.PeerName) + require.Equal(t, string(hash), string(req.GetPreferredBlkHash())) + + }) + + sm.handleEventChits(sm.QueueClient.NewMessage("", 0, chits)) + err := sm.Host.Connect(sm.Ctx, addrInfo) + require.Nil(t, err) + sm.handleEventChits(sm.QueueClient.NewMessage("", 0, chits)) + checkDone(done, t) +} + +func TestSnowmanGetBlock(t *testing.T) { + + q := queue.New("test") + sm, cancel := newSnowWithQueue(q, t) + sm2, cancel2 := newSnowWithQueue(q, t) + q.SetConfig(sm.ChainCfg) + go q.Start() + defer func() { + q.Close() + cancel2() + cancel() + sm.Host.Close() + sm2.Host.Close() + }() + + addrInfo := peer.AddrInfo{ + ID: sm2.Host.ID(), + Addrs: sm2.Host.Addrs(), + } + err := sm.Host.Connect(sm.Ctx, addrInfo) + require.Nil(t, err) + blk := &types.Block{Height: 1} + req := &types.SnowGetBlock{ + RequestID: 1, + PeerName: sm2.Host.ID().String(), + } + api := sm2.API.(*mocks.QueueProtocolAPI) + api.On("GetBlockByHashes", mock.Anything).Return(&types.BlockDetails{Items: []*types.BlockDetail{{Block: blk}}}, nil) + done := make(chan struct{}) + go handleSub(q, "consensus", func(msg *queue.Message) { + defer close(done) + require.Equal(t, types.EventSnowmanPutBlock, int(msg.ID)) + require.Equal(t, types.EventForFinalizer, int(msg.Ty)) + reply, ok := msg.Data.(*types.SnowPutBlock) + require.True(t, ok) + require.Equal(t, req.RequestID, reply.RequestID) + require.Equal(t, req.PeerName, reply.PeerName) + }) + sm.handleEventGetBlock(sm.QueueClient.NewMessage("", 0, req)) + checkDone(done, t) +} + +func TestSnowmanPullQuery(t *testing.T) { + + q := queue.New("test") + sm, cancel := newSnowWithQueue(q, t) + sm2, cancel2 := newSnowWithQueue(q, t) + q.SetConfig(sm.ChainCfg) + go q.Start() + defer func() { + q.Close() + cancel2() + cancel() + sm.Host.Close() + sm2.Host.Close() + }() + + addrInfo := peer.AddrInfo{ + ID: sm2.Host.ID(), + Addrs: sm2.Host.Addrs(), + } + err := sm.Host.Connect(sm.Ctx, addrInfo) + require.Nil(t, err) + hash := []byte("testhash") + req := &types.SnowPullQuery{ + RequestID: 1, + PeerName: sm2.Host.ID().String(), + BlockHash: hash, + } + done := make(chan struct{}) + go handleSub(q, "consensus", func(msg *queue.Message) { + defer close(done) + reply, ok := msg.Data.(*types.SnowPullQuery) + require.True(t, ok) + require.Equal(t, req.RequestID, req.RequestID) + require.Equal(t, sm.Host.ID().String(), reply.PeerName) + require.Equal(t, string(hash), string(reply.GetBlockHash())) + + }) + sm.handleEventPullQuery(sm.QueueClient.NewMessage("", 0, req)) + checkDone(done, t) +} + +func TestSnowmanPushQuery(t *testing.T) { + + q := queue.New("test") + sm, cancel := newSnowWithQueue(q, t) + sm2, cancel2 := newSnowWithQueue(q, t) + q.SetConfig(sm.ChainCfg) + go q.Start() + defer func() { + q.Close() + cancel2() + cancel() + sm.Host.Close() + sm2.Host.Close() + }() + + addrInfo := peer.AddrInfo{ + ID: sm2.Host.ID(), + Addrs: sm2.Host.Addrs(), + } + err := sm.Host.Connect(sm.Ctx, addrInfo) + require.Nil(t, err) + req := &types.SnowPushQuery{ + RequestID: 1, + PeerName: sm2.Host.ID().String(), + } + done := make(chan struct{}) + go handleSub(q, "consensus", func(msg *queue.Message) { + defer close(done) + reply, ok := msg.Data.(*types.SnowPushQuery) + require.True(t, ok) + require.Equal(t, req.RequestID, req.RequestID) + require.Equal(t, sm.Host.ID().String(), reply.PeerName) + + }) + sm.handleEventPushQuery(sm.QueueClient.NewMessage("", 0, req)) + checkDone(done, t) +} diff --git a/system/p2p/dht/protocol/snow/util.go b/system/p2p/dht/protocol/snow/util.go index 671ecc662..888a6f356 100644 --- a/system/p2p/dht/protocol/snow/util.go +++ b/system/p2p/dht/protocol/snow/util.go @@ -21,7 +21,7 @@ func (s *snowman) sendQueryFailedMsg(msgID int64, reqID uint32, peerName string) PeerName: peerName, } - err := s.P2PManager.Client.Send(consensusMsg(msgID, msg), false) + err := s.QueueClient.Send(consensusMsg(msgID, msg), false) if err != nil { From 55d7dc44896aff19cccbe5ec9b137d91464a1238 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sun, 12 May 2024 10:50:03 +0800 Subject: [PATCH 68/85] test:fix datarace --- .github/workflows/build.yml | 21 --------------------- system/consensus/snowman/snowman.go | 4 +++- system/consensus/snowman/snowman_test.go | 10 ++++------ 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fd08c2d4..bd542b77f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,24 +100,3 @@ jobs: make build_ci make autotest dapp=all make docker-compose && make docker-compose-down - - test-goarch-386: - name: Run test cases with GOARCH=386 - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: 'go.mod' - - - name: Build - run: make build - env: - GOARCH: 386 - - - name: Run test in 386 - run: go test ./... -covermode=atomic - env: - GOARCH: 386 - diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index d970b40e3..6dce2f8ad 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -9,6 +9,7 @@ import ( "encoding/hex" "runtime" "sync" + "sync/atomic" "time" sncom "github.com/ava-labs/avalanchego/snow/engine/common" @@ -51,7 +52,7 @@ type snowman struct { inMsg chan *queue.Message engineNotify chan struct{} params snowball.Parameters - initDone bool + initDone atomic.Bool lock sync.RWMutex } @@ -113,6 +114,7 @@ func (s *snowman) startRoutine() { } go s.dispatchSyncMsg() + s.initDone.Store(true) snowLog.Debug("snowman startRoutine done") } diff --git a/system/consensus/snowman/snowman_test.go b/system/consensus/snowman/snowman_test.go index 4c82c42ac..a86f21522 100644 --- a/system/consensus/snowman/snowman_test.go +++ b/system/consensus/snowman/snowman_test.go @@ -37,11 +37,11 @@ func TestSnowman(t *testing.T) { sm := &snowman{} sm.Initialize(ctx) - for timeout := 0; atomic.LoadInt64(&sm.vm.acceptedHeight) < 1; timeout++ { + for timeout := 0; sm.initDone.Load() == false; timeout++ { time.Sleep(time.Second) timeout++ if timeout >= 3 { - t.Errorf("test timeout acceptHeight=%d", atomic.LoadInt64(&sm.vm.acceptedHeight)) + t.Errorf("wait snowman init timeout") return } } @@ -65,10 +65,8 @@ func TestSnowman(t *testing.T) { sm.SubMsg(queue.NewMessage(types.EventSnowmanGetFailed, "", 0, &types.SnowFailedQuery{RequestID: reqID + 5, PeerName: peer})) - gblock.Height = 2 - gblock.ParentHash = sc.Hash - sc.Height = gblock.Height - sc.Hash = gblock.Hash(q.GetConfig()) + sc.Height = 2 + sc.Hash = blk.Hash(q.GetConfig()) sm.SubMsg(queue.NewMessage(types.EventSnowmanResetEngine, "", 0, nil)) for timeout := 0; atomic.LoadInt64(&sm.vm.acceptedHeight) < 2; timeout++ { time.Sleep(time.Second) From 48ac9075e4fe841b07debb77383139a7d95fa1b1 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 16 May 2024 21:41:24 +0800 Subject: [PATCH 69/85] handle accept finalized block inorder --- blockchain/blockfinalize.go | 31 +++++++++++++++++++------------ blockchain/blocksyn.go | 2 +- system/consensus/snowman/vm.go | 1 + 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 7093d62ee..201faaf4c 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -30,6 +30,7 @@ func (f *finalizer) Init(chain *BlockChain) { panic(err) } chainlog.Info("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) + go f.healthCheck(f.choice.Height) } else if chain.client.GetConfig().GetModuleConfig().Consensus.Finalizer != "" { f.choice.Height = chain.cfg.BlockFinalizeEnableHeight chainlog.Info("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight) @@ -49,12 +50,19 @@ func (f *finalizer) healthCheck(finalizedHeight int64) { case <-ticker.C: + chainHeight := f.chain.bestChain.Height() height, _ := f.getLastFinalized() - if height > finalizedHeight { + chainlog.Debug("finalizer healthCheck", "lastFinalize", finalizedHeight, "currFinalize", height, "chainHeight", chainHeight) + if height > finalizedHeight || chainHeight <= height { finalizedHeight = height continue } - chainlog.Warn("finalizer healthCheck", "height", height) + detail, err := f.chain.GetBlock(height) + if err != nil { + chainlog.Error("finalizer healthCheck", "height", height, "get block err", err) + continue + } + _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig()), false) _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), false) } } @@ -75,7 +83,7 @@ func (f *finalizer) waitFinalizeStartBlock(beginHeight int64) { chainlog.Error("waitFinalizeStartBlock", "height", beginHeight, "waitHeight", waitHeight, "get block err", err) panic(err) } - _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig())) + _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig()), false) go f.healthCheck(detail.GetBlock().Height) } @@ -89,30 +97,29 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { req := (msg.Data).(*types.SnowChoice) chainlog.Debug("snowmanAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) - height, _ := f.getLastFinalized() - if req.GetHeight() <= height { - chainlog.Debug("snowmanAcceptBlock disorder", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) - return - } + // 已经最终化区块不在当前最佳链中, 即当前节点在侧链上, 最终化记录不更新 if !f.chain.bestChain.HaveBlock(req.GetHash(), req.GetHeight()) { chainlog.Debug("snowmanAcceptBlock not in bestChain", "height", req.Height, - "hash", hex.EncodeToString(req.GetHash())) + "hash", hex.EncodeToString(req.GetHash()), "chainHeight", f.chain.bestChain.height()) return } - err := f.setFinalizedBlock(req.GetHeight(), req.GetHash()) - + err := f.setFinalizedBlock(req.GetHeight(), req.GetHash(), true) if err != nil { chainlog.Error("snowmanAcceptBlock", "setFinalizedBlock err", err.Error()) } } -func (f *finalizer) setFinalizedBlock(height int64, hash []byte) error { +func (f *finalizer) setFinalizedBlock(height int64, hash []byte, mustInorder bool) error { chainlog.Debug("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash)) f.lock.Lock() defer f.lock.Unlock() + if mustInorder && height <= f.choice.Height { + chainlog.Debug("setFinalizedBlock disorder", "height", height, "currHeight", f.choice.Height) + return nil + } f.choice.Height = height f.choice.Hash = hash err := f.chain.blockStore.db.Set(snowChoiceKey, types.Encode(&f.choice)) diff --git a/blockchain/blocksyn.go b/blockchain/blocksyn.go index ba1939a2a..c70aa7f4d 100644 --- a/blockchain/blocksyn.go +++ b/blockchain/blocksyn.go @@ -753,7 +753,7 @@ func (chain *BlockChain) forkChainDetection(prevMode int) { chainlog.Error("forkChainDetection", "height", forkHeight, "GetBlockHashByHeight err", err) return } - chain.finalizer.setFinalizedBlock(forkHeight, forkHash) + chain.finalizer.setFinalizedBlock(forkHeight, forkHash, false) _ = chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), false) } diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index d5a0047ef..3cc3d7643 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -218,6 +218,7 @@ func (vm *chain33VM) LastAccepted(_ context.Context) (ids.ID, error) { atomic.StoreInt64(&vm.acceptedHeight, choice.Height) var id ids.ID copy(id[:], choice.Hash) + vm.decidedHashes.Add(id, true) return id, nil } From d67a164b9eec7e1f4ce131a1fad14bc25fd57a5e Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 16 May 2024 22:15:46 +0800 Subject: [PATCH 70/85] add parent id for snow block --- system/consensus/snowman/block.go | 7 ++++--- system/consensus/snowman/vm.go | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index 4361c6d9f..c99a41f09 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -13,6 +13,7 @@ import ( // wrap chain33 block for implementing the snowman.Block interface type snowBlock struct { id ids.ID + parent ids.ID block *types.Block status choices.Status vm *chain33VM @@ -25,7 +26,7 @@ func (b *snowBlock) ID() ids.ID { return b.id } func (b *snowBlock) Accept(ctx context.Context) error { b.status = choices.Accepted - snowLog.Debug("snowBlock accept", "hash", b.id.Hex(), "height", b.Height()) + snowLog.Debug("snowBlock accept", "hash", b.id.Hex(), "height", b.Height(), "parent", b.Parent().Hex()) err := b.vm.acceptBlock(b.block.Height, b.id) if err != nil { snowLog.Error("Accepting block error", "hash", b.id.Hex(), "height", b.Height()) @@ -37,7 +38,7 @@ func (b *snowBlock) Accept(ctx context.Context) error { // This element will not be accepted by any correct node in the network. func (b *snowBlock) Reject(ctx context.Context) error { b.status = choices.Rejected - snowLog.Debug("snowBlock reject", "hash", b.ID().Hex(), "height", b.Height()) + snowLog.Debug("snowBlock reject", "hash", b.ID().Hex(), "height", b.Height(), "parent", b.Parent().Hex()) b.vm.rejectBlock(b.block.Height, b.ID()) return nil } @@ -53,7 +54,7 @@ func (b *snowBlock) Status() choices.Status { // Parent implements the snowman.Block interface func (b *snowBlock) Parent() ids.ID { - return toSnowID(b.block.ParentHash) + return b.parent } // Height implements the snowman.Block interface diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index 3cc3d7643..ef2fd7079 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -48,6 +48,7 @@ func (vm *chain33VM) newSnowBlock(blk *types.Block, status choices.Status) *snow sb := &snowBlock{block: blk, vm: vm, status: status} sb.id = toSnowID(blk.Hash(vm.cfg)) + sb.parent = toSnowID(blk.GetParentHash()) return sb } @@ -159,7 +160,7 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { defer vm.lock.Unlock() vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) snowLog.Debug("vm addNewBlock", "height", blk.GetHeight(), "hash", hex.EncodeToString(blk.Hash(vm.cfg)), - "acceptedHeight", ah, "pendingNum", vm.pendingBlocks.Len()) + "parent", hex.EncodeToString(blk.ParentHash), "acceptedHeight", ah, "pendingNum", vm.pendingBlocks.Len()) return true } @@ -178,7 +179,8 @@ func (vm *chain33VM) BuildBlock(_ context.Context) (snowcon.Block, error) { if sb.Height() <= uint64(ah) { continue } - snowLog.Debug("vmBuildBlock", "pendingNum", vm.pendingBlocks.Len(), "height", sb.Height(), "hash", sb.id.Hex()) + snowLog.Debug("vmBuildBlock", "pendingNum", vm.pendingBlocks.Len(), "height", sb.Height(), + "hash", sb.id.Hex(), "parent", sb.Parent().Hex()) return sb, nil } From 1128d9028e913cc1309bf1fc1876b835189cc794 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Thu, 16 May 2024 22:49:56 +0800 Subject: [PATCH 71/85] increase refresh peer info interval --- system/p2p/dht/protocol/peer/peer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/p2p/dht/protocol/peer/peer.go b/system/p2p/dht/protocol/peer/peer.go index 3da292053..0d68c6ec9 100644 --- a/system/p2p/dht/protocol/peer/peer.go +++ b/system/p2p/dht/protocol/peer/peer.go @@ -132,7 +132,7 @@ func InitProtocol(env *protocol.P2PEnv) { go p.detectNodeAddr() go p.checkBlocked() go func() { - ticker := time.NewTicker(time.Second) + ticker := time.NewTicker(time.Second * 3) defer ticker.Stop() ticker2 := time.NewTicker(time.Minute * 5) defer ticker2.Stop() From 293e0a0643a7f99acac2dbde08de19e95df181e0 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sat, 18 May 2024 23:49:40 +0800 Subject: [PATCH 72/85] add finalizer reset method --- blockchain/blockfinalize.go | 75 +++++++++++++++++++++++++++++++------ blockchain/blocksyn.go | 4 +- blockchain/process.go | 41 ++++++++++---------- 3 files changed, 86 insertions(+), 34 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 201faaf4c..ee37ed3b3 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -38,7 +38,7 @@ func (f *finalizer) Init(chain *BlockChain) { } } -func (f *finalizer) healthCheck(finalizedHeight int64) { +func (f *finalizer) healthCheck(lastFinalized int64) { ticker := time.NewTicker(time.Minute * 3) for { @@ -51,19 +51,19 @@ func (f *finalizer) healthCheck(finalizedHeight int64) { case <-ticker.C: chainHeight := f.chain.bestChain.Height() - height, _ := f.getLastFinalized() - chainlog.Debug("finalizer healthCheck", "lastFinalize", finalizedHeight, "currFinalize", height, "chainHeight", chainHeight) - if height > finalizedHeight || chainHeight <= height { - finalizedHeight = height + finalized, _ := f.getLastFinalized() + chainlog.Debug("finalizer healthCheck", "lastFinalize", lastFinalized, "finalized", finalized, "chainHeight", chainHeight) + if finalized > lastFinalized || chainHeight <= finalized { + lastFinalized = finalized continue } - detail, err := f.chain.GetBlock(height) + detail, err := f.chain.GetBlock(finalized) if err != nil { - chainlog.Error("finalizer healthCheck", "height", height, "get block err", err) + chainlog.Error("finalizer healthCheck", "height", finalized, "get block err", err) continue } - _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig()), false) - _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), false) + _ = f.reset(finalized, detail.GetBlock().Hash(f.chain.client.GetConfig())) + } } @@ -100,8 +100,10 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { // 已经最终化区块不在当前最佳链中, 即当前节点在侧链上, 最终化记录不更新 if !f.chain.bestChain.HaveBlock(req.GetHash(), req.GetHeight()) { + chainHeight := f.chain.bestChain.Height() chainlog.Debug("snowmanAcceptBlock not in bestChain", "height", req.Height, - "hash", hex.EncodeToString(req.GetHash()), "chainHeight", f.chain.bestChain.height()) + "hash", hex.EncodeToString(req.GetHash()), "chainHeight", chainHeight) + go f.acceptOrReset(chainHeight, req) return } @@ -111,6 +113,57 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { } } +func (f *finalizer) acceptOrReset(chainHeight int64, sc *types.SnowChoice) { + + ticker := time.NewTicker(time.Second * 10) + var currHeight int64 + for { + + select { + + case <-f.chain.quit: + return + + case <-ticker.C: + + if f.chain.bestChain.HaveBlock(sc.GetHash(), sc.GetHeight()) { + _ = f.setFinalizedBlock(sc.GetHeight(), sc.GetHash(), true) + return + } + // 最终化区块不在主链上且主链高度正常增长, 重置最终化引擎, 尝试对该高度重新共识 + currHeight = f.chain.bestChain.Height() + if currHeight > chainHeight && currHeight > sc.GetHeight()+12 { + chainlog.Debug("acceptOrReset reset finalizer", "chainHeight", chainHeight, + "currHeight", currHeight, "sc.height", sc.GetHeight()) + _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), true) + return + } + + case <-time.After(2 * time.Minute): + chainlog.Debug("acceptOrReset timeout", "chainHeight", chainHeight, + "currHeight", currHeight, "sc.height", sc.GetHeight()) + return + } + + } + +} + +func (f *finalizer) reset(height int64, hash []byte) error { + + chainlog.Debug("finalizer reset", "height", height, "hash", hex.EncodeToString(hash)) + err := f.setFinalizedBlock(height, hash, false) + if err != nil { + chainlog.Error("finalizer reset", "setFinalizedBlock err", err) + return err + } + err = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), true) + if err != nil { + chainlog.Error("finalizer reset", "send msg err", err) + } + return err +} + func (f *finalizer) setFinalizedBlock(height int64, hash []byte, mustInorder bool) error { chainlog.Debug("setFinalizedBlock", "height", height, "hash", hex.EncodeToString(hash)) @@ -139,7 +192,7 @@ func (f *finalizer) getLastFinalized() (int64, []byte) { func (f *finalizer) snowmanLastChoice(msg *queue.Message) { height, hash := f.getLastFinalized() - chainlog.Debug("snowmanLastChoice", "height", height, "hash", hex.EncodeToString(hash)) + //chainlog.Debug("snowmanLastChoice", "height", height, "hash", hex.EncodeToString(hash)) msg.Reply(f.chain.client.NewMessage(msg.Topic, types.EventSnowmanLastChoice, &types.SnowChoice{Height: height, Hash: hash})) } diff --git a/blockchain/blocksyn.go b/blockchain/blocksyn.go index c70aa7f4d..2341cdcec 100644 --- a/blockchain/blocksyn.go +++ b/blockchain/blocksyn.go @@ -6,7 +6,6 @@ package blockchain import ( "bytes" - "github.com/33cn/chain33/queue" "math/big" "sort" "sync" @@ -753,8 +752,7 @@ func (chain *BlockChain) forkChainDetection(prevMode int) { chainlog.Error("forkChainDetection", "height", forkHeight, "GetBlockHashByHeight err", err) return } - chain.finalizer.setFinalizedBlock(forkHeight, forkHash, false) - _ = chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), false) + _ = chain.finalizer.reset(forkHeight, forkHash) } // 检测到存在分叉后, 以最近高度作为结束高度 diff --git a/blockchain/process.go b/blockchain/process.go index 26bcbcade..3998b8b28 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -210,15 +210,6 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet return block, true, nil } chainlog.Debug("connectBestChain", "parentHash", common.ToHex(parentHash), "bestChain.Tip().hash", common.ToHex(tip.hash)) - // 区块侧链分叉重组处理高度不能小于最终化高度 - fork := chain.bestChain.FindFork(node) - finalized, _ := chain.finalizer.getLastFinalized() - if fork != nil && fork.height < finalized { - chainlog.Debug("connectBestChain alreadyFinalized", - "finalized", finalized, "forkHeight", fork.height, "chainHeight", tip.height, - "addHeight", node.height, "addHash", common.ToHex(node.hash)) - return nil, false, types.ErrHeightAlreadyFinalized - } // 获取tip节点的block总难度tipid tiptd, Err := chain.blockStore.GetTdByBlockHash(tip.hash) @@ -233,8 +224,8 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet } blocktd := new(big.Int).Add(node.Difficulty, parenttd) - chainlog.Debug("connectBestChain tip:", "hash", common.ToHex(tip.hash), "height", tip.height, "TD", difficulty.BigToCompact(tiptd)) - chainlog.Debug("connectBestChain node:", "hash", common.ToHex(node.hash), "height", node.height, "TD", difficulty.BigToCompact(blocktd)) + chainlog.Debug("connectBestChain difficulty:", "tipHash", common.ToHex(tip.hash), "tipHeight", tip.height, "tipTD", difficulty.BigToCompact(tiptd), + "nodeHash", common.ToHex(node.hash), "nodeHeight", node.height, "nodeTD", difficulty.BigToCompact(blocktd)) //优先选择总难度系数大的区块 //总难度系数,区块高度,出块时间以及父区块一致并开启最优区块比较功能时,通过共识模块来确定最优区块 @@ -242,19 +233,29 @@ func (chain *BlockChain) connectBestChain(node *blockNode, block *types.BlockDet if enBestBlockCmp && blocktd.Cmp(tiptd) == 0 && node.height == tip.height && util.CmpBestBlock(chain.client, block.Block, tip.hash) { iSideChain = false } - if iSideChain { - if fork != nil && bytes.Equal(parentHash, fork.hash) { - chainlog.Info("connectBestChain FORK:", "Block hash", common.ToHex(node.hash), "fork.height", fork.height, "fork.hash", common.ToHex(fork.hash)) - } else { - chainlog.Info("connectBestChain extends a side chain:", "Block hash", common.ToHex(node.hash), "fork.height", fork.height, "fork.hash", common.ToHex(fork.hash)) - } + fork := chain.bestChain.FindFork(node) + finalized, hash := chain.finalizer.getLastFinalized() + if iSideChain || node.height < finalized+12 { + + chainlog.Debug("connectBestChain side chain:", "nodeHeight", node.height, "nodeHash", common.ToHex(node.hash), + "fork.height", fork.height, "fork.hash", common.ToHex(fork.hash), + "finalized", finalized, "fHash", common.ToHex(hash)) return nil, false, nil } + if fork != nil && fork.height < finalized { + + chainlog.Debug("connectBestChain reset finalizer", + "finalized", finalized, "fHash", common.ToHex(hash), + "forkHeight", fork.height, "forkHash", common.ToHex(fork.hash), + "tipHeight", tip.height, "tipHash", common.ToHex(tip.hash), + "nodeHeight", node.height, "nodeHash", common.ToHex(node.hash)) + _ = chain.finalizer.reset(fork.height, fork.hash) + } + //print - chainlog.Debug("connectBestChain tip", "height", tip.height, "hash", common.ToHex(tip.hash)) - chainlog.Debug("connectBestChain node", "height", node.height, "hash", common.ToHex(node.hash), "parentHash", common.ToHex(parentHash)) - chainlog.Debug("connectBestChain block", "height", block.Block.Height, "hash", common.ToHex(block.Block.Hash(cfg))) + chainlog.Debug("connectBestChain reorganize", "tipHeight", tip.height, "tipHash", common.ToHex(tip.hash), + "nodeHeight", node.height, "nodeHash", common.ToHex(node.hash), "parentHash", common.ToHex(parentHash)) // 获取需要重组的block node detachNodes, attachNodes := chain.getReorganizeNodes(node, fork) From 14c0279b9454db486e23db705d9045a69fbf6a0e Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sun, 19 May 2024 22:34:48 +0800 Subject: [PATCH 73/85] add finalizer lazy start when node syncing state --- blockchain/blockfinalize.go | 131 ++++++++++++++++++++++--------- blockchain/blockfinalize_test.go | 42 +++++++++- 2 files changed, 136 insertions(+), 37 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index ee37ed3b3..5e2b71107 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -5,6 +5,7 @@ import ( "github.com/33cn/chain33/queue" "github.com/33cn/chain33/types" "sync" + "sync/atomic" "time" ) @@ -13,13 +14,16 @@ var ( ) type finalizer struct { - chain *BlockChain - choice types.SnowChoice - lock sync.RWMutex + chain *BlockChain + choice types.SnowChoice + lock sync.RWMutex + healthNotify chan struct{} + resetRunning atomic.Bool } func (f *finalizer) Init(chain *BlockChain) { + f.healthNotify = make(chan struct{}, 1) f.chain = chain raw, err := chain.blockStore.db.Get(snowChoiceKey) @@ -30,43 +34,100 @@ func (f *finalizer) Init(chain *BlockChain) { panic(err) } chainlog.Info("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash)) - go f.healthCheck(f.choice.Height) + go f.healthCheck() } else if chain.client.GetConfig().GetModuleConfig().Consensus.Finalizer != "" { f.choice.Height = chain.cfg.BlockFinalizeEnableHeight chainlog.Info("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight) go f.waitFinalizeStartBlock(f.choice.Height) } + go f.lazyStart(chain.cfg.BlockFinalizeGapHeight, MaxRollBlockNum) } -func (f *finalizer) healthCheck(lastFinalized int64) { +// 基于最大区块回滚深度, 快速收敛, 主要针对同步节点, 减少历史数据共识流程 +func (f *finalizer) lazyStart(gapHeight, maxRollbackNum int64) { - ticker := time.NewTicker(time.Minute * 3) + ticker := time.NewTicker(time.Minute * 2) + minPeerCount := 10 + defer ticker.Stop() for { - select { case <-f.chain.quit: return - case <-ticker.C: + finalized, _ := f.getLastFinalized() + peerNum := f.chain.GetPeerCount() + height := f.chain.GetBlockHeight() - gapHeight + // 连接节点过少||未达到使能高度, 等待连接及区块同步 + if finalized >= height || peerNum < minPeerCount { + chainlog.Debug("lazyStart wait", "peerNum", peerNum, + "finalized", finalized, "height", height) + continue + } + + maxPeerHeight := f.chain.GetPeerMaxBlkHeight() + // 已经最终化高度在回滚范围内, 无需加速 + if finalized+maxRollbackNum > maxPeerHeight { + chainlog.Debug("lazyStart return", "peerNum", peerNum, "finalized", finalized, + "maxHeight", maxPeerHeight) + return + } + + peers := f.chain.getActivePeersByHeight(height + maxRollbackNum) + chainlog.Debug("lazyStart peer", "peerNum", peerNum, "peersLen", len(peers), + "finalized", finalized, "height", height) + // 超过半数节点高度超过该高度, 说明当前链回滚最低高度大于height, 可设为已最终化高度 + if len(peers) < peerNum/2 { + continue + } + + detail, err := f.chain.GetBlock(height) + if err != nil { + chainlog.Error("lazyStart err", "height", height, "get block err", err) + continue + } + _ = f.reset(height, detail.GetBlock().Hash(f.chain.client.GetConfig())) + } + } + +} + +func (f *finalizer) healthCheck() { + ticker := time.NewTicker(time.Minute) + defer ticker.Stop() + healthy := false + for { + select { + + case <-f.chain.quit: + return + case <-f.healthNotify: + healthy = true + case <-ticker.C: + maxPeerHeight := f.chain.GetPeerMaxBlkHeight() + // 节点高度落后较多情况不处理, 等待同步 + if height := f.chain.GetBlockHeight(); height < maxPeerHeight-128 || healthy { + chainlog.Debug("finalizer timeout", "healthy", healthy, "height", height, "maxHeight", maxPeerHeight) + healthy = false + continue + } chainHeight := f.chain.bestChain.Height() - finalized, _ := f.getLastFinalized() - chainlog.Debug("finalizer healthCheck", "lastFinalize", lastFinalized, "finalized", finalized, "chainHeight", chainHeight) - if finalized > lastFinalized || chainHeight <= finalized { - lastFinalized = finalized + finalized, hash := f.getLastFinalized() + chainlog.Debug("finalizer timeout", "lastFinalize", finalized, + "hash", hex.EncodeToString(hash), "chainHeight", chainHeight) + if finalized >= chainHeight { continue } + // 重新设置高度, 哈希值 detail, err := f.chain.GetBlock(finalized) if err != nil { - chainlog.Error("finalizer healthCheck", "height", finalized, "get block err", err) + chainlog.Error("finalizer tiemout", "height", finalized, "get block err", err) continue } _ = f.reset(finalized, detail.GetBlock().Hash(f.chain.client.GetConfig())) - } } - } const defaultFinalizeGapHeight = 128 @@ -83,8 +144,9 @@ func (f *finalizer) waitFinalizeStartBlock(beginHeight int64) { chainlog.Error("waitFinalizeStartBlock", "height", beginHeight, "waitHeight", waitHeight, "get block err", err) panic(err) } + go f.healthCheck() _ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig()), false) - go f.healthCheck(detail.GetBlock().Height) + } func (f *finalizer) snowmanPreferBlock(msg *queue.Message) { @@ -98,25 +160,30 @@ func (f *finalizer) snowmanAcceptBlock(msg *queue.Message) { req := (msg.Data).(*types.SnowChoice) chainlog.Debug("snowmanAcceptBlock", "height", req.Height, "hash", hex.EncodeToString(req.Hash)) - // 已经最终化区块不在当前最佳链中, 即当前节点在侧链上, 最终化记录不更新 + // 已经最终化区块不在当前最佳链中, 即可能在侧链上, 最终化记录不更新 if !f.chain.bestChain.HaveBlock(req.GetHash(), req.GetHeight()) { chainHeight := f.chain.bestChain.Height() chainlog.Debug("snowmanAcceptBlock not in bestChain", "height", req.Height, "hash", hex.EncodeToString(req.GetHash()), "chainHeight", chainHeight) - go f.acceptOrReset(chainHeight, req) + if f.resetRunning.CompareAndSwap(false, true) { + go f.resetEngine(chainHeight, req, time.Second*10) + } return } err := f.setFinalizedBlock(req.GetHeight(), req.GetHash(), true) - if err != nil { - chainlog.Error("snowmanAcceptBlock", "setFinalizedBlock err", err.Error()) + if err == nil { + f.healthNotify <- struct{}{} } } -func (f *finalizer) acceptOrReset(chainHeight int64, sc *types.SnowChoice) { +const consensusTopic = "consensus" - ticker := time.NewTicker(time.Second * 10) - var currHeight int64 +func (f *finalizer) resetEngine(chainHeight int64, sc *types.SnowChoice, duration time.Duration) { + + defer f.resetRunning.Store(false) + ticker := time.NewTicker(duration) + defer ticker.Stop() for { select { @@ -127,26 +194,18 @@ func (f *finalizer) acceptOrReset(chainHeight int64, sc *types.SnowChoice) { case <-ticker.C: if f.chain.bestChain.HaveBlock(sc.GetHash(), sc.GetHeight()) { - _ = f.setFinalizedBlock(sc.GetHeight(), sc.GetHash(), true) return } // 最终化区块不在主链上且主链高度正常增长, 重置最终化引擎, 尝试对该高度重新共识 - currHeight = f.chain.bestChain.Height() + currHeight := f.chain.bestChain.Height() if currHeight > chainHeight && currHeight > sc.GetHeight()+12 { - chainlog.Debug("acceptOrReset reset finalizer", "chainHeight", chainHeight, + chainlog.Debug("resetEngine", "chainHeight", chainHeight, "currHeight", currHeight, "sc.height", sc.GetHeight()) - _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), true) + _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, consensusTopic, types.EventForFinalizer, nil), true) return } - - case <-time.After(2 * time.Minute): - chainlog.Debug("acceptOrReset timeout", "chainHeight", chainHeight, - "currHeight", currHeight, "sc.height", sc.GetHeight()) - return } - } - } func (f *finalizer) reset(height int64, hash []byte) error { @@ -157,7 +216,7 @@ func (f *finalizer) reset(height int64, hash []byte) error { chainlog.Error("finalizer reset", "setFinalizedBlock err", err) return err } - err = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, "consensus", types.EventForFinalizer, nil), true) + err = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, consensusTopic, types.EventForFinalizer, nil), true) if err != nil { chainlog.Error("finalizer reset", "send msg err", err) } @@ -171,7 +230,7 @@ func (f *finalizer) setFinalizedBlock(height int64, hash []byte, mustInorder boo defer f.lock.Unlock() if mustInorder && height <= f.choice.Height { chainlog.Debug("setFinalizedBlock disorder", "height", height, "currHeight", f.choice.Height) - return nil + return types.ErrInvalidParam } f.choice.Height = height f.choice.Hash = hash diff --git a/blockchain/blockfinalize_test.go b/blockchain/blockfinalize_test.go index a5af27d0d..24c4ba6be 100644 --- a/blockchain/blockfinalize_test.go +++ b/blockchain/blockfinalize_test.go @@ -7,11 +7,13 @@ import ( "github.com/stretchr/testify/require" "os" "testing" + "time" ) func newTestChain(t *testing.T) (*BlockChain, string) { chain := InitEnv() + chain.client.GetConfig().GetModuleConfig().Consensus.Finalizer = "snowman" dir, err := os.MkdirTemp("", "finalize") require.Nil(t, err) blockStoreDB := dbm.NewDB("blockchain", "leveldb", dir, 64) @@ -26,7 +28,7 @@ func TestFinalizer(t *testing.T) { chain, dir := newTestChain(t) defer os.RemoveAll(dir) - + defer chain.Close() f := &finalizer{} f.Init(chain) @@ -55,4 +57,42 @@ func TestFinalizer(t *testing.T) { require.Nil(t, err) require.Equal(t, msg1.Data, choice) f.Init(chain) + +} + +func TestResetEngine(t *testing.T) { + + chain, dir := newTestChain(t) + defer os.RemoveAll(dir) + defer chain.Close() + f := &finalizer{} + f.Init(chain) + + hash := []byte("testhash") + choice := &types.SnowChoice{Height: 1, Hash: hash} + node := &blockNode{ + parent: chain.bestChain.Tip(), + height: 14, + hash: hash, + } + chain.bestChain.SetTip(node) + chain.client.Sub(consensusTopic) + go f.resetEngine(1, choice, time.Second) + recvMsg := func() { + select { + case msg := <-chain.client.Recv(): + require.Equal(t, "consensus", msg.Topic) + require.Equal(t, int64(types.EventSnowmanResetEngine), msg.ID) + require.Equal(t, int64(types.EventForFinalizer), msg.Ty) + case <-time.After(time.Second * 5): + t.Error("resetEngine timeout") + } + } + recvMsg() + f.reset(choice.Height, choice.Hash) + recvMsg() + height, hash1 := f.getLastFinalized() + require.Equal(t, choice.Height, height) + require.Equal(t, hash, hash1) + } From c79b8d9a866cf4178a192f311a35a3b776c822ec Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sun, 19 May 2024 22:36:53 +0800 Subject: [PATCH 74/85] add cache for block fetching from snowman validator --- system/consensus/snowman/block.go | 2 +- system/consensus/snowman/snowman.go | 6 +-- system/consensus/snowman/snowman_test.go | 6 ++- system/consensus/snowman/validator.go | 19 ++++++-- system/consensus/snowman/validator_test.go | 3 +- system/consensus/snowman/vm.go | 52 +++++++++++++++------- types/event.go | 41 ++++++++--------- 7 files changed, 82 insertions(+), 47 deletions(-) diff --git a/system/consensus/snowman/block.go b/system/consensus/snowman/block.go index c99a41f09..d8175276d 100644 --- a/system/consensus/snowman/block.go +++ b/system/consensus/snowman/block.go @@ -45,7 +45,7 @@ func (b *snowBlock) Reject(ctx context.Context) error { // SetStatus implements the InternalBlock interface allowing ChainState // to set the status on an existing block -func (b *snowBlock) SetStatus(status choices.Status) { b.status = status } +//func (b *snowBlock) SetStatus(status choices.Status) { b.status = status } // Status implements the snowman.Block interface func (b *snowBlock) Status() choices.Status { diff --git a/system/consensus/snowman/snowman.go b/system/consensus/snowman/snowman.go index 6dce2f8ad..fd4ea40d5 100644 --- a/system/consensus/snowman/snowman.go +++ b/system/consensus/snowman/snowman.go @@ -90,7 +90,6 @@ func (s *snowman) initSnowEngine() { func (s *snowman) resetEngine() { - snowLog.Debug("reset snowman engine") s.initSnowEngine() s.vm.reset() if err := s.engine.Start(s.ctx.Base.Context, 0); err != nil { @@ -105,7 +104,7 @@ func (s *snowman) startRoutine() { if err == nil && len(c.Hash) > 0 { break } - time.Sleep(time.Second * 2) + time.Sleep(time.Second * 10) } err := s.engine.Start(s.ctx.Base.Context, 0) @@ -128,7 +127,7 @@ func (s *snowman) AddBlock(blk *types.Block) { select { case s.engineNotify <- struct{}{}: default: - + snowLog.Debug("snowman AddBlock max capacity") } } @@ -171,6 +170,7 @@ func (s *snowman) handleSyncMsg(msg *queue.Message) { switch msg.ID { case types.EventSnowmanResetEngine: + snowLog.Debug("handleInMsg reset engine") s.resetEngine() case types.EventSnowmanChits: diff --git a/system/consensus/snowman/snowman_test.go b/system/consensus/snowman/snowman_test.go index a86f21522..7a3d84876 100644 --- a/system/consensus/snowman/snowman_test.go +++ b/system/consensus/snowman/snowman_test.go @@ -30,7 +30,11 @@ func TestSnowman(t *testing.T) { cli.Sub("p2p") for msg := range cli.Recv() { - msg.Reply(cli.NewMessage("", 0, &types.Reply{})) + if msg.Ty == types.EventPeerInfo { + msg.Reply(cli.NewMessage("", 0, &types.PeerList{})) + } else { + msg.Reply(cli.NewMessage("", 0, &types.Reply{})) + } } }() diff --git a/system/consensus/snowman/validator.go b/system/consensus/snowman/validator.go index b7231d5c1..33bfda74a 100644 --- a/system/consensus/snowman/validator.go +++ b/system/consensus/snowman/validator.go @@ -2,6 +2,7 @@ package snowman import ( "fmt" + "math" "math/rand" "sync" "time" @@ -80,8 +81,10 @@ func (s *vdrSet) Sample(size int) ([]ids.NodeID, error) { return nodeIDS, nil } +const maxHeightDiff = 128 + func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { - snowLog.Debug("vdrSet getConnectedPeers") + msg := s.qclient.NewMessage("p2p", types.EventPeerInfo, nil) err := s.qclient.Send(msg, true) if err != nil { @@ -104,8 +107,18 @@ func (s *vdrSet) getConnectedPeers() ([]*types.Peer, error) { peers := make([]*types.Peer, 0, count) for _, p := range peerlist.GetPeers() { - if p.Self || p.Blocked || - p.GetFinalized().GetHeight() < s.self.GetHeader().GetHeight()-128 { + // 过滤未启用节点 + if p.Self || p.Blocked || len(p.GetFinalized().GetHash()) <= 0 { + continue + } + + headerDiff := math.Abs(float64(p.Header.GetHeight() - s.self.Header.GetHeight())) + finalizeDiff := math.Abs(float64(p.Finalized.GetHeight() - s.self.Finalized.GetHeight())) + // 过滤高度差较大节点 + if headerDiff > maxHeightDiff && finalizeDiff > maxHeightDiff { + snowLog.Debug("getConnectedPeers filter", "peer", p.Name, + "pHeight", p.Header.GetHeight(), "fHeight", p.Finalized.GetHeight(), + "selfHeight", s.self.Header.GetHeight(), "fHeight", s.self.Finalized.GetHeight()) continue } peers = append(peers, p) diff --git a/system/consensus/snowman/validator_test.go b/system/consensus/snowman/validator_test.go index 27a677503..da56904ec 100644 --- a/system/consensus/snowman/validator_test.go +++ b/system/consensus/snowman/validator_test.go @@ -66,8 +66,7 @@ func Test_getConnectedPeers(t *testing.T) { peers, err = v.getConnectedPeers() require.Nil(t, err) require.Equal(t, 0, len(peers)) - peer.Finalized.Height = 1 - + peer.Finalized.Hash = []byte("test") peers, err = v.getConnectedPeers() require.Nil(t, err) require.Equal(t, 1, len(peers)) diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index ef2fd7079..cb6256ce9 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -42,6 +42,7 @@ type chain33VM struct { lock sync.RWMutex acceptedHeight int64 decidedHashes *lru.Cache + cacheBlks *lru.Cache } func (vm *chain33VM) newSnowBlock(blk *types.Block, status choices.Status) *snowBlock { @@ -64,6 +65,10 @@ func (vm *chain33VM) Init(ctx *consensus.Context) { panic("chain33VM Init New lru err" + err.Error()) } vm.decidedHashes = c + vm.cacheBlks, err = lru.New(128) + if err != nil { + panic("chain33VM Init New reqBlks lru err" + err.Error()) + } vm.pendingBlocks = list.New() choice, err := vm.api.GetFinalizedBlock() if err != nil { @@ -108,15 +113,8 @@ func (vm *chain33VM) Shutdown(context.Context) error { return nil } -// GetBlock get block -func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, error) { +func (vm *chain33VM) checkDecided(sb *snowBlock) { - details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) - if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { - snowLog.Debug("vmGetBlock", "hash", blkID.Hex(), "err", err) - return nil, database.ErrNotFound - } - sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) accepted, ok := vm.decidedHashes.Get(sb.ID()) if ok { sb.status = choices.Rejected @@ -124,7 +122,26 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e sb.status = choices.Accepted } } +} + +// GetBlock get block +func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, error) { + val, ok := vm.cacheBlks.Get(blkID) + if ok { + sb := val.(*snowBlock) + snowLog.Debug("GetBlock cache", "hash", blkID.Hex(), "height", sb.Height(), "status", sb.Status().String()) + sb.status = choices.Processing + vm.checkDecided(sb) + return sb, nil + } + details, err := vm.api.GetBlockByHashes(&types.ReqHashes{Hashes: [][]byte{blkID[:]}}) + if err != nil || len(details.GetItems()) < 1 || details.GetItems()[0].GetBlock() == nil { + snowLog.Debug("vmGetBlock failed", "hash", blkID.Hex(), "err", err) + return nil, database.ErrNotFound + } + sb := vm.newSnowBlock(details.GetItems()[0].GetBlock(), choices.Processing) + vm.checkDecided(sb) return sb, nil } @@ -137,18 +154,15 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err snowLog.Error("vmParseBlock", "decode err", err) return nil, err } - sb := vm.newSnowBlock(blk, choices.Unknown) - accepted, ok := vm.decidedHashes.Get(sb.ID()) - if ok { - sb.status = choices.Rejected - if accepted.(bool) { - sb.status = choices.Accepted - } - } - + sb := vm.newSnowBlock(blk, choices.Processing) + vm.checkDecided(sb) + // add to cache + vm.cacheBlks.Add(sb.ID(), sb) return sb, nil } +const maxPendingNum = 128 + func (vm *chain33VM) addNewBlock(blk *types.Block) bool { ah := atomic.LoadInt64(&vm.acceptedHeight) @@ -158,6 +172,9 @@ func (vm *chain33VM) addNewBlock(blk *types.Block) bool { vm.lock.Lock() defer vm.lock.Unlock() + if vm.pendingBlocks.Len() > maxPendingNum { + return false + } vm.pendingBlocks.PushBack(vm.newSnowBlock(blk, choices.Processing)) snowLog.Debug("vm addNewBlock", "height", blk.GetHeight(), "hash", hex.EncodeToString(blk.Hash(vm.cfg)), "parent", hex.EncodeToString(blk.ParentHash), "acceptedHeight", ah, "pendingNum", vm.pendingBlocks.Len()) @@ -175,6 +192,7 @@ func (vm *chain33VM) BuildBlock(_ context.Context) (snowcon.Block, error) { defer vm.lock.Unlock() for vm.pendingBlocks.Len() > 0 { + sb := vm.pendingBlocks.Remove(vm.pendingBlocks.Front()).(*snowBlock) if sb.Height() <= uint64(ah) { continue diff --git a/types/event.go b/types/event.go index 4eb97e82a..afad9c0f4 100644 --- a/types/event.go +++ b/types/event.go @@ -386,24 +386,25 @@ var eventName = map[int]string{ EventDelBlacklist: "EventDelBlacklist", EventShowBlacklist: "EventShowBlacklist", EventDialPeer: "EventDialPeer", - EventClosePeer: "EventClosePeer", - EventPushEVM: "EventPushEVM", - EventPushBlock: "EventPushBlock", - EventPushBlockHeader: "EventPushBlockHeader", - EventPushTxReceipt: "EventPushTxReceipt", - EventPushTxResult: "EventPushTxResult", - EventHighestBlock: "EventHighestBlock", - EventGetEvmNonce: "EventGetEvmNonce", - EventForFinalizer: "EventForFinalizer", - EventSnowmanPreferBlk: "EventSnowmanPreferBlk", - EventSnowmanAcceptBlk: "EventSnowmanAcceptBlk", - EventSnowmanLastChoice: "EventSnowmanLastChoice", - EventSnowmanChits: "EventSnowmanChits", - EventSnowmanGetBlock: "EventSnowmanGetBlock", - EventSnowmanPutBlock: "EventSnowmanPutBlock", - EventSnowmanPullQuery: "EventSnowmanPullQuery", - EventSnowmanPushQuery: "EventSnowmanPushQuery", - EventSnowmanGetFailed: "EventSnowmanGetFailed", - EventSnowmanQueryFailed: "EventSnowmanQueryFailed", - EventSnowmanQueryChoice: "EventSnowmanQueryChoice", + EventClosePeer: "EventClosePeer", + EventPushEVM: "EventPushEVM", + EventPushBlock: "EventPushBlock", + EventPushBlockHeader: "EventPushBlockHeader", + EventPushTxReceipt: "EventPushTxReceipt", + EventPushTxResult: "EventPushTxResult", + EventHighestBlock: "EventHighestBlock", + EventGetEvmNonce: "EventGetEvmNonce", + EventForFinalizer: "EventForFinalizer", + EventSnowmanPreferBlk: "EventSnowmanPreferBlk", + EventSnowmanAcceptBlk: "EventSnowmanAcceptBlk", + EventSnowmanLastChoice: "EventSnowmanLastChoice", + EventSnowmanChits: "EventSnowmanChits", + EventSnowmanGetBlock: "EventSnowmanGetBlock", + EventSnowmanPutBlock: "EventSnowmanPutBlock", + EventSnowmanPullQuery: "EventSnowmanPullQuery", + EventSnowmanPushQuery: "EventSnowmanPushQuery", + EventSnowmanGetFailed: "EventSnowmanGetFailed", + EventSnowmanQueryFailed: "EventSnowmanQueryFailed", + EventSnowmanQueryChoice: "EventSnowmanQueryChoice", + EventSnowmanResetEngine: "EventSnowmanResetEngine", } From cd672cbc9abbdb1e6f1ba0aafc33bb030b1d081f Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Fri, 24 May 2024 23:56:24 +0800 Subject: [PATCH 75/85] test:fix datarace --- blockchain/blockfinalize_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/blockchain/blockfinalize_test.go b/blockchain/blockfinalize_test.go index 24c4ba6be..fc6c4770a 100644 --- a/blockchain/blockfinalize_test.go +++ b/blockchain/blockfinalize_test.go @@ -56,7 +56,6 @@ func TestFinalizer(t *testing.T) { msg1, err := chain.client.Wait(msg) require.Nil(t, err) require.Equal(t, msg1.Data, choice) - f.Init(chain) } From 35f6c824a374529d25a0c1c57a53ffadae82ee29 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sat, 25 May 2024 01:08:11 +0800 Subject: [PATCH 76/85] fix dht repeated closing of stream --- system/p2p/dht/protocol/wrapper.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/system/p2p/dht/protocol/wrapper.go b/system/p2p/dht/protocol/wrapper.go index 71b6dbd86..fb9895ef5 100644 --- a/system/p2p/dht/protocol/wrapper.go +++ b/system/p2p/dht/protocol/wrapper.go @@ -82,15 +82,10 @@ func CloseStream(stream network.Stream) { if stream == nil { return } - _ = stream.CloseWrite() - _ = stream.CloseRead() - go func() { - err := AwaitEOF(stream) - if err != nil { - //just log it because it dose not matter - log.Debug("CloseStream", "err", err, "protocol ID", stream.Protocol()) - } - }() + err := stream.Close() + if err != nil { + log.Debug("CloseStream", "err", err, "protocol ID", stream.Protocol()) + } } // AuthenticateMessage authenticates p2p message. @@ -384,7 +379,8 @@ func AwaitEOF(s network.Stream) error { _ = s.Reset() return err } - return s.Close() + _ = s.Close() + return nil } // migrated from github.com/multiformats/go-multicodec@v0.1.6: header.go From 54980d7b4f70fd65e8488e509dea0c3b8baa755d Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sat, 25 May 2024 23:43:25 +0800 Subject: [PATCH 77/85] mod:update avalanche dependency --- blockchain/blockfinalize.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index 5e2b71107..e8f404ab2 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -200,7 +200,7 @@ func (f *finalizer) resetEngine(chainHeight int64, sc *types.SnowChoice, duratio currHeight := f.chain.bestChain.Height() if currHeight > chainHeight && currHeight > sc.GetHeight()+12 { chainlog.Debug("resetEngine", "chainHeight", chainHeight, - "currHeight", currHeight, "sc.height", sc.GetHeight()) + "currHeight", currHeight, "sc.height", sc.GetHeight(), "sc.hash", hex.EncodeToString(sc.GetHash())) _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, consensusTopic, types.EventForFinalizer, nil), true) return } diff --git a/go.mod b/go.mod index 30dba049c..3d75cb195 100644 --- a/go.mod +++ b/go.mod @@ -227,4 +227,4 @@ require ( replace github.com/btcsuite/btcd/btcec => github.com/btcsuite/btcd v0.22.3 -replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240511070301-a9a2aac50464 +replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 diff --git a/go.sum b/go.sum index 447e357ab..647b25d62 100644 --- a/go.sum +++ b/go.sum @@ -214,8 +214,8 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bysomeone/avalanchego v0.0.0-20240511070301-a9a2aac50464 h1:fjGGreFQgEMo+jTduHpxVpDOVbGd45Wata/KXu9ieWg= -github.com/bysomeone/avalanchego v0.0.0-20240511070301-a9a2aac50464/go.mod h1:SgoXVssKD3a3diOV4qaTkOEQ+2KEfErcdOASIhV6a1s= +github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 h1:y70tfpRGONtMp0EqL+uYMTdaTR4OBpC631a97b0dTa4= +github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71/go.mod h1:SgoXVssKD3a3diOV4qaTkOEQ+2KEfErcdOASIhV6a1s= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= From 2c1f2808fb2957bc53b0d0d12a1c8cb02ec53db4 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sat, 25 May 2024 23:51:33 +0800 Subject: [PATCH 78/85] test:fix 64-bit unaligned in arch 386 --- .github/workflows/build.yml | 20 ++++++++++++++++++++ blockchain/chain.go | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd542b77f..1838ff871 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,3 +100,23 @@ jobs: make build_ci make autotest dapp=all make docker-compose && make docker-compose-down + + test-goarch-386: + name: Run test cases with GOARCH=386 + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + + - name: Build + run: make build + env: + GOARCH: 386 + + - name: Run test in 386 + run: go test ./... -covermode=atomic + env: + GOARCH: 386 diff --git a/blockchain/chain.go b/blockchain/chain.go index ff2c71690..92405a666 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -49,7 +49,6 @@ type BlockChain struct { // 永久存储数据到db中 blockStore *BlockStore - finalizer *finalizer push *Push //cache 缓存block方便快速查询 cfg *types.BlockChain @@ -150,6 +149,7 @@ type BlockChain struct { // 是否正在下载chunk chunkDownloading int32 forkPointChan chan int64 + finalizer *finalizer } // New new From c9b4079f37f69273223fc167d95b173b1a4e06e2 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Sun, 26 May 2024 23:43:33 +0800 Subject: [PATCH 79/85] test:regenerate chain33 client mock file --- types/mocks/chain33client.go | 753 +++++++++++++++++++++++++++++++---- 1 file changed, 675 insertions(+), 78 deletions(-) diff --git a/types/mocks/chain33client.go b/types/mocks/chain33client.go index 22015573f..563a87533 100644 --- a/types/mocks/chain33client.go +++ b/types/mocks/chain33client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -28,7 +28,15 @@ func (_m *Chain33Client) AddPushSubscribe(ctx context.Context, in *types.PushSub _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for AddPushSubscribe") + } + var r0 *types.ReplySubscribePush + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.PushSubscribeReq, ...grpc.CallOption) (*types.ReplySubscribePush, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.PushSubscribeReq, ...grpc.CallOption) *types.ReplySubscribePush); ok { r0 = rf(ctx, in, opts...) } else { @@ -37,7 +45,6 @@ func (_m *Chain33Client) AddPushSubscribe(ctx context.Context, in *types.PushSub } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.PushSubscribeReq, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -58,7 +65,15 @@ func (_m *Chain33Client) CloseQueue(ctx context.Context, in *types.ReqNil, opts _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CloseQueue") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -67,7 +82,6 @@ func (_m *Chain33Client) CloseQueue(ctx context.Context, in *types.ReqNil, opts } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -88,7 +102,15 @@ func (_m *Chain33Client) ConvertExectoAddr(ctx context.Context, in *types.ReqStr _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for ConvertExectoAddr") + } + var r0 *types.ReplyString + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) (*types.ReplyString, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) *types.ReplyString); ok { r0 = rf(ctx, in, opts...) } else { @@ -97,7 +119,6 @@ func (_m *Chain33Client) ConvertExectoAddr(ctx context.Context, in *types.ReqStr } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqString, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -118,7 +139,15 @@ func (_m *Chain33Client) CreateNoBalanceTransaction(ctx context.Context, in *typ _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CreateNoBalanceTransaction") + } + var r0 *types.ReplySignRawTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.NoBalanceTx, ...grpc.CallOption) (*types.ReplySignRawTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.NoBalanceTx, ...grpc.CallOption) *types.ReplySignRawTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -127,7 +156,6 @@ func (_m *Chain33Client) CreateNoBalanceTransaction(ctx context.Context, in *typ } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.NoBalanceTx, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -148,7 +176,15 @@ func (_m *Chain33Client) CreateNoBalanceTxs(ctx context.Context, in *types.NoBal _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CreateNoBalanceTxs") + } + var r0 *types.ReplySignRawTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.NoBalanceTxs, ...grpc.CallOption) (*types.ReplySignRawTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.NoBalanceTxs, ...grpc.CallOption) *types.ReplySignRawTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -157,7 +193,6 @@ func (_m *Chain33Client) CreateNoBalanceTxs(ctx context.Context, in *types.NoBal } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.NoBalanceTxs, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -178,7 +213,15 @@ func (_m *Chain33Client) CreateRawTransaction(ctx context.Context, in *types.Cre _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CreateRawTransaction") + } + var r0 *types.UnsignTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.CreateTx, ...grpc.CallOption) (*types.UnsignTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.CreateTx, ...grpc.CallOption) *types.UnsignTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -187,7 +230,6 @@ func (_m *Chain33Client) CreateRawTransaction(ctx context.Context, in *types.Cre } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.CreateTx, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -208,7 +250,15 @@ func (_m *Chain33Client) CreateRawTxGroup(ctx context.Context, in *types.CreateT _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CreateRawTxGroup") + } + var r0 *types.UnsignTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.CreateTransactionGroup, ...grpc.CallOption) (*types.UnsignTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.CreateTransactionGroup, ...grpc.CallOption) *types.UnsignTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -217,7 +267,6 @@ func (_m *Chain33Client) CreateRawTxGroup(ctx context.Context, in *types.CreateT } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.CreateTransactionGroup, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -238,7 +287,15 @@ func (_m *Chain33Client) CreateTransaction(ctx context.Context, in *types.Create _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CreateTransaction") + } + var r0 *types.UnsignTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.CreateTxIn, ...grpc.CallOption) (*types.UnsignTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.CreateTxIn, ...grpc.CallOption) *types.UnsignTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -247,7 +304,6 @@ func (_m *Chain33Client) CreateTransaction(ctx context.Context, in *types.Create } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.CreateTxIn, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -268,7 +324,15 @@ func (_m *Chain33Client) DumpPrivkey(ctx context.Context, in *types.ReqString, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for DumpPrivkey") + } + var r0 *types.ReplyString + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) (*types.ReplyString, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) *types.ReplyString); ok { r0 = rf(ctx, in, opts...) } else { @@ -277,7 +341,6 @@ func (_m *Chain33Client) DumpPrivkey(ctx context.Context, in *types.ReqString, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqString, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -298,7 +361,15 @@ func (_m *Chain33Client) DumpPrivkeysFile(ctx context.Context, in *types.ReqPriv _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for DumpPrivkeysFile") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqPrivkeysFile, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqPrivkeysFile, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -307,7 +378,6 @@ func (_m *Chain33Client) DumpPrivkeysFile(ctx context.Context, in *types.ReqPriv } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqPrivkeysFile, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -328,7 +398,15 @@ func (_m *Chain33Client) ExecWallet(ctx context.Context, in *types.ChainExecutor _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for ExecWallet") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -337,7 +415,6 @@ func (_m *Chain33Client) ExecWallet(ctx context.Context, in *types.ChainExecutor } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -358,7 +435,15 @@ func (_m *Chain33Client) GenSeed(ctx context.Context, in *types.GenSeedLang, opt _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GenSeed") + } + var r0 *types.ReplySeed + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.GenSeedLang, ...grpc.CallOption) (*types.ReplySeed, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.GenSeedLang, ...grpc.CallOption) *types.ReplySeed); ok { r0 = rf(ctx, in, opts...) } else { @@ -367,7 +452,6 @@ func (_m *Chain33Client) GenSeed(ctx context.Context, in *types.GenSeedLang, opt } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.GenSeedLang, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -388,7 +472,15 @@ func (_m *Chain33Client) GetAccount(ctx context.Context, in *types.ReqGetAccount _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetAccount") + } + var r0 *types.WalletAccount + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqGetAccount, ...grpc.CallOption) (*types.WalletAccount, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqGetAccount, ...grpc.CallOption) *types.WalletAccount); ok { r0 = rf(ctx, in, opts...) } else { @@ -397,7 +489,6 @@ func (_m *Chain33Client) GetAccount(ctx context.Context, in *types.ReqGetAccount } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqGetAccount, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -418,7 +509,15 @@ func (_m *Chain33Client) GetAccounts(ctx context.Context, in *types.ReqNil, opts _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetAccounts") + } + var r0 *types.WalletAccounts + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.WalletAccounts, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.WalletAccounts); ok { r0 = rf(ctx, in, opts...) } else { @@ -427,7 +526,6 @@ func (_m *Chain33Client) GetAccounts(ctx context.Context, in *types.ReqNil, opts } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -448,7 +546,15 @@ func (_m *Chain33Client) GetAddrOverview(ctx context.Context, in *types.ReqAddr, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetAddrOverview") + } + var r0 *types.AddrOverview + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqAddr, ...grpc.CallOption) (*types.AddrOverview, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqAddr, ...grpc.CallOption) *types.AddrOverview); ok { r0 = rf(ctx, in, opts...) } else { @@ -457,7 +563,6 @@ func (_m *Chain33Client) GetAddrOverview(ctx context.Context, in *types.ReqAddr, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqAddr, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -478,7 +583,15 @@ func (_m *Chain33Client) GetAddressDrivers(ctx context.Context, in *types.ReqNil _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetAddressDrivers") + } + var r0 *types.AddressDrivers + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.AddressDrivers, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.AddressDrivers); ok { r0 = rf(ctx, in, opts...) } else { @@ -487,7 +600,6 @@ func (_m *Chain33Client) GetAddressDrivers(ctx context.Context, in *types.ReqNil } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -508,7 +620,15 @@ func (_m *Chain33Client) GetAllExecBalance(ctx context.Context, in *types.ReqAll _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetAllExecBalance") + } + var r0 *types.AllExecBalance + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqAllExecBalance, ...grpc.CallOption) (*types.AllExecBalance, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqAllExecBalance, ...grpc.CallOption) *types.AllExecBalance); ok { r0 = rf(ctx, in, opts...) } else { @@ -517,7 +637,6 @@ func (_m *Chain33Client) GetAllExecBalance(ctx context.Context, in *types.ReqAll } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqAllExecBalance, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -538,7 +657,15 @@ func (_m *Chain33Client) GetBalance(ctx context.Context, in *types.ReqBalance, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + var r0 *types.Accounts + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBalance, ...grpc.CallOption) (*types.Accounts, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBalance, ...grpc.CallOption) *types.Accounts); ok { r0 = rf(ctx, in, opts...) } else { @@ -547,7 +674,6 @@ func (_m *Chain33Client) GetBalance(ctx context.Context, in *types.ReqBalance, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqBalance, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -568,7 +694,15 @@ func (_m *Chain33Client) GetBlockByHashes(ctx context.Context, in *types.ReqHash _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBlockByHashes") + } + var r0 *types.BlockDetails + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHashes, ...grpc.CallOption) (*types.BlockDetails, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHashes, ...grpc.CallOption) *types.BlockDetails); ok { r0 = rf(ctx, in, opts...) } else { @@ -577,7 +711,6 @@ func (_m *Chain33Client) GetBlockByHashes(ctx context.Context, in *types.ReqHash } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHashes, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -598,7 +731,15 @@ func (_m *Chain33Client) GetBlockBySeq(ctx context.Context, in *types.Int64, opt _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBlockBySeq") + } + var r0 *types.BlockSeq + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.Int64, ...grpc.CallOption) (*types.BlockSeq, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.Int64, ...grpc.CallOption) *types.BlockSeq); ok { r0 = rf(ctx, in, opts...) } else { @@ -607,7 +748,6 @@ func (_m *Chain33Client) GetBlockBySeq(ctx context.Context, in *types.Int64, opt } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.Int64, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -628,7 +768,15 @@ func (_m *Chain33Client) GetBlockHash(ctx context.Context, in *types.ReqInt, opt _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBlockHash") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqInt, ...grpc.CallOption) (*types.ReplyHash, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqInt, ...grpc.CallOption) *types.ReplyHash); ok { r0 = rf(ctx, in, opts...) } else { @@ -637,7 +785,6 @@ func (_m *Chain33Client) GetBlockHash(ctx context.Context, in *types.ReqInt, opt } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqInt, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -658,7 +805,15 @@ func (_m *Chain33Client) GetBlockOverview(ctx context.Context, in *types.ReqHash _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBlockOverview") + } + var r0 *types.BlockOverview + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) (*types.BlockOverview, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) *types.BlockOverview); ok { r0 = rf(ctx, in, opts...) } else { @@ -667,7 +822,6 @@ func (_m *Chain33Client) GetBlockOverview(ctx context.Context, in *types.ReqHash } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHash, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -688,7 +842,15 @@ func (_m *Chain33Client) GetBlockSequences(ctx context.Context, in *types.ReqBlo _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBlockSequences") + } + var r0 *types.BlockSequences + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) (*types.BlockSequences, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) *types.BlockSequences); ok { r0 = rf(ctx, in, opts...) } else { @@ -697,7 +859,6 @@ func (_m *Chain33Client) GetBlockSequences(ctx context.Context, in *types.ReqBlo } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -718,7 +879,15 @@ func (_m *Chain33Client) GetBlocks(ctx context.Context, in *types.ReqBlocks, opt _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetBlocks") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -727,7 +896,6 @@ func (_m *Chain33Client) GetBlocks(ctx context.Context, in *types.ReqBlocks, opt } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -748,7 +916,15 @@ func (_m *Chain33Client) GetChainConfig(ctx context.Context, in *types.ReqNil, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetChainConfig") + } + var r0 *types.ChainConfigInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.ChainConfigInfo, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.ChainConfigInfo); ok { r0 = rf(ctx, in, opts...) } else { @@ -757,7 +933,6 @@ func (_m *Chain33Client) GetChainConfig(ctx context.Context, in *types.ReqNil, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -778,7 +953,15 @@ func (_m *Chain33Client) GetCoinSymbol(ctx context.Context, in *types.ReqNil, op _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetCoinSymbol") + } + var r0 *types.ReplyString + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.ReplyString, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.ReplyString); ok { r0 = rf(ctx, in, opts...) } else { @@ -787,7 +970,6 @@ func (_m *Chain33Client) GetCoinSymbol(ctx context.Context, in *types.ReqNil, op } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -808,7 +990,15 @@ func (_m *Chain33Client) GetCryptoList(ctx context.Context, in *types.ReqNil, op _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetCryptoList") + } + var r0 *types.CryptoList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.CryptoList, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.CryptoList); ok { r0 = rf(ctx, in, opts...) } else { @@ -817,7 +1007,6 @@ func (_m *Chain33Client) GetCryptoList(ctx context.Context, in *types.ReqNil, op } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -838,7 +1027,15 @@ func (_m *Chain33Client) GetFatalFailure(ctx context.Context, in *types.ReqNil, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetFatalFailure") + } + var r0 *types.Int32 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Int32, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Int32); ok { r0 = rf(ctx, in, opts...) } else { @@ -847,7 +1044,43 @@ func (_m *Chain33Client) GetFatalFailure(ctx context.Context, in *types.ReqNil, } } + if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetFinalizedBlock provides a mock function with given fields: ctx, in, opts +func (_m *Chain33Client) GetFinalizedBlock(ctx context.Context, in *types.ReqNil, opts ...grpc.CallOption) (*types.SnowChoice, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetFinalizedBlock") + } + + var r0 *types.SnowChoice var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.SnowChoice, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.SnowChoice); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.SnowChoice) + } + } + if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -868,7 +1101,15 @@ func (_m *Chain33Client) GetFork(ctx context.Context, in *types.ReqKey, opts ... _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetFork") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqKey, ...grpc.CallOption) (*types.Int64, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqKey, ...grpc.CallOption) *types.Int64); ok { r0 = rf(ctx, in, opts...) } else { @@ -877,7 +1118,6 @@ func (_m *Chain33Client) GetFork(ctx context.Context, in *types.ReqKey, opts ... } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqKey, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -898,7 +1138,15 @@ func (_m *Chain33Client) GetHeaders(ctx context.Context, in *types.ReqBlocks, op _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetHeaders") + } + var r0 *types.Headers + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) (*types.Headers, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) *types.Headers); ok { r0 = rf(ctx, in, opts...) } else { @@ -907,7 +1155,6 @@ func (_m *Chain33Client) GetHeaders(ctx context.Context, in *types.ReqBlocks, op } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqBlocks, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -928,7 +1175,15 @@ func (_m *Chain33Client) GetHexTxByHash(ctx context.Context, in *types.ReqHash, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetHexTxByHash") + } + var r0 *types.HexTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) (*types.HexTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) *types.HexTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -937,7 +1192,6 @@ func (_m *Chain33Client) GetHexTxByHash(ctx context.Context, in *types.ReqHash, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHash, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -958,7 +1212,15 @@ func (_m *Chain33Client) GetLastBlockSequence(ctx context.Context, in *types.Req _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetLastBlockSequence") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Int64, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Int64); ok { r0 = rf(ctx, in, opts...) } else { @@ -967,7 +1229,6 @@ func (_m *Chain33Client) GetLastBlockSequence(ctx context.Context, in *types.Req } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -988,7 +1249,15 @@ func (_m *Chain33Client) GetLastHeader(ctx context.Context, in *types.ReqNil, op _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetLastHeader") + } + var r0 *types.Header + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Header, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Header); ok { r0 = rf(ctx, in, opts...) } else { @@ -997,7 +1266,6 @@ func (_m *Chain33Client) GetLastHeader(ctx context.Context, in *types.ReqNil, op } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1018,7 +1286,15 @@ func (_m *Chain33Client) GetLastMemPool(ctx context.Context, in *types.ReqNil, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetLastMemPool") + } + var r0 *types.ReplyTxList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.ReplyTxList, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.ReplyTxList); ok { r0 = rf(ctx, in, opts...) } else { @@ -1027,7 +1303,6 @@ func (_m *Chain33Client) GetLastMemPool(ctx context.Context, in *types.ReqNil, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1048,7 +1323,15 @@ func (_m *Chain33Client) GetMemPool(ctx context.Context, in *types.ReqGetMempool _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetMemPool") + } + var r0 *types.ReplyTxList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqGetMempool, ...grpc.CallOption) (*types.ReplyTxList, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqGetMempool, ...grpc.CallOption) *types.ReplyTxList); ok { r0 = rf(ctx, in, opts...) } else { @@ -1057,7 +1340,6 @@ func (_m *Chain33Client) GetMemPool(ctx context.Context, in *types.ReqGetMempool } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqGetMempool, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1078,7 +1360,15 @@ func (_m *Chain33Client) GetParaTxByHeight(ctx context.Context, in *types.ReqPar _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetParaTxByHeight") + } + var r0 *types.ParaTxDetails + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqParaTxByHeight, ...grpc.CallOption) (*types.ParaTxDetails, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqParaTxByHeight, ...grpc.CallOption) *types.ParaTxDetails); ok { r0 = rf(ctx, in, opts...) } else { @@ -1087,7 +1377,6 @@ func (_m *Chain33Client) GetParaTxByHeight(ctx context.Context, in *types.ReqPar } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqParaTxByHeight, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1108,7 +1397,15 @@ func (_m *Chain33Client) GetParaTxByTitle(ctx context.Context, in *types.ReqPara _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetParaTxByTitle") + } + var r0 *types.ParaTxDetails + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqParaTxByTitle, ...grpc.CallOption) (*types.ParaTxDetails, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqParaTxByTitle, ...grpc.CallOption) *types.ParaTxDetails); ok { r0 = rf(ctx, in, opts...) } else { @@ -1117,7 +1414,6 @@ func (_m *Chain33Client) GetParaTxByTitle(ctx context.Context, in *types.ReqPara } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqParaTxByTitle, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1138,7 +1434,15 @@ func (_m *Chain33Client) GetPeerInfo(ctx context.Context, in *types.P2PGetPeerRe _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetPeerInfo") + } + var r0 *types.PeerList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.P2PGetPeerReq, ...grpc.CallOption) (*types.PeerList, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.P2PGetPeerReq, ...grpc.CallOption) *types.PeerList); ok { r0 = rf(ctx, in, opts...) } else { @@ -1147,7 +1451,6 @@ func (_m *Chain33Client) GetPeerInfo(ctx context.Context, in *types.P2PGetPeerRe } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.P2PGetPeerReq, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1168,7 +1471,15 @@ func (_m *Chain33Client) GetProperFee(ctx context.Context, in *types.ReqProperFe _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetProperFee") + } + var r0 *types.ReplyProperFee + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqProperFee, ...grpc.CallOption) (*types.ReplyProperFee, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqProperFee, ...grpc.CallOption) *types.ReplyProperFee); ok { r0 = rf(ctx, in, opts...) } else { @@ -1177,7 +1488,6 @@ func (_m *Chain33Client) GetProperFee(ctx context.Context, in *types.ReqProperFe } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqProperFee, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1198,7 +1508,15 @@ func (_m *Chain33Client) GetPushSeqLastNum(ctx context.Context, in *types.ReqStr _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetPushSeqLastNum") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) (*types.Int64, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) *types.Int64); ok { r0 = rf(ctx, in, opts...) } else { @@ -1207,7 +1525,6 @@ func (_m *Chain33Client) GetPushSeqLastNum(ctx context.Context, in *types.ReqStr } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqString, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1228,7 +1545,15 @@ func (_m *Chain33Client) GetSeed(ctx context.Context, in *types.GetSeedByPw, opt _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetSeed") + } + var r0 *types.ReplySeed + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.GetSeedByPw, ...grpc.CallOption) (*types.ReplySeed, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.GetSeedByPw, ...grpc.CallOption) *types.ReplySeed); ok { r0 = rf(ctx, in, opts...) } else { @@ -1237,7 +1562,6 @@ func (_m *Chain33Client) GetSeed(ctx context.Context, in *types.GetSeedByPw, opt } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.GetSeedByPw, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1258,7 +1582,15 @@ func (_m *Chain33Client) GetSequenceByHash(ctx context.Context, in *types.ReqHas _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetSequenceByHash") + } + var r0 *types.Int64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) (*types.Int64, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) *types.Int64); ok { r0 = rf(ctx, in, opts...) } else { @@ -1267,7 +1599,6 @@ func (_m *Chain33Client) GetSequenceByHash(ctx context.Context, in *types.ReqHas } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHash, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1288,7 +1619,15 @@ func (_m *Chain33Client) GetServerTime(ctx context.Context, in *types.ReqNil, op _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetServerTime") + } + var r0 *types.ServerTime + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.ServerTime, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.ServerTime); ok { r0 = rf(ctx, in, opts...) } else { @@ -1297,7 +1636,6 @@ func (_m *Chain33Client) GetServerTime(ctx context.Context, in *types.ReqNil, op } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1318,7 +1656,15 @@ func (_m *Chain33Client) GetTransactionByAddr(ctx context.Context, in *types.Req _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetTransactionByAddr") + } + var r0 *types.ReplyTxInfos + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqAddr, ...grpc.CallOption) (*types.ReplyTxInfos, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqAddr, ...grpc.CallOption) *types.ReplyTxInfos); ok { r0 = rf(ctx, in, opts...) } else { @@ -1327,7 +1673,6 @@ func (_m *Chain33Client) GetTransactionByAddr(ctx context.Context, in *types.Req } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqAddr, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1348,7 +1693,15 @@ func (_m *Chain33Client) GetTransactionByHashes(ctx context.Context, in *types.R _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetTransactionByHashes") + } + var r0 *types.TransactionDetails + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHashes, ...grpc.CallOption) (*types.TransactionDetails, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHashes, ...grpc.CallOption) *types.TransactionDetails); ok { r0 = rf(ctx, in, opts...) } else { @@ -1357,7 +1710,6 @@ func (_m *Chain33Client) GetTransactionByHashes(ctx context.Context, in *types.R } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHashes, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1378,7 +1730,15 @@ func (_m *Chain33Client) GetWalletRecoverAddress(ctx context.Context, in *types. _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetWalletRecoverAddress") + } + var r0 *types.ReplyString + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqGetWalletRecoverAddr, ...grpc.CallOption) (*types.ReplyString, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqGetWalletRecoverAddr, ...grpc.CallOption) *types.ReplyString); ok { r0 = rf(ctx, in, opts...) } else { @@ -1387,7 +1747,6 @@ func (_m *Chain33Client) GetWalletRecoverAddress(ctx context.Context, in *types. } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqGetWalletRecoverAddr, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1408,7 +1767,15 @@ func (_m *Chain33Client) GetWalletStatus(ctx context.Context, in *types.ReqNil, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetWalletStatus") + } + var r0 *types.WalletStatus + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.WalletStatus, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.WalletStatus); ok { r0 = rf(ctx, in, opts...) } else { @@ -1417,7 +1784,6 @@ func (_m *Chain33Client) GetWalletStatus(ctx context.Context, in *types.ReqNil, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1438,7 +1804,15 @@ func (_m *Chain33Client) ImportPrivkey(ctx context.Context, in *types.ReqWalletI _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for ImportPrivkey") + } + var r0 *types.WalletAccount + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletImportPrivkey, ...grpc.CallOption) (*types.WalletAccount, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletImportPrivkey, ...grpc.CallOption) *types.WalletAccount); ok { r0 = rf(ctx, in, opts...) } else { @@ -1447,7 +1821,6 @@ func (_m *Chain33Client) ImportPrivkey(ctx context.Context, in *types.ReqWalletI } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletImportPrivkey, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1468,7 +1841,15 @@ func (_m *Chain33Client) ImportPrivkeysFile(ctx context.Context, in *types.ReqPr _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for ImportPrivkeysFile") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqPrivkeysFile, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqPrivkeysFile, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1477,7 +1858,6 @@ func (_m *Chain33Client) ImportPrivkeysFile(ctx context.Context, in *types.ReqPr } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqPrivkeysFile, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1498,7 +1878,15 @@ func (_m *Chain33Client) IsNtpClockSync(ctx context.Context, in *types.ReqNil, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for IsNtpClockSync") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1507,7 +1895,6 @@ func (_m *Chain33Client) IsNtpClockSync(ctx context.Context, in *types.ReqNil, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1528,7 +1915,15 @@ func (_m *Chain33Client) IsSync(ctx context.Context, in *types.ReqNil, opts ...g _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for IsSync") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1537,7 +1932,6 @@ func (_m *Chain33Client) IsSync(ctx context.Context, in *types.ReqNil, opts ...g } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1558,7 +1952,15 @@ func (_m *Chain33Client) ListPushes(ctx context.Context, in *types.ReqNil, opts _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for ListPushes") + } + var r0 *types.PushSubscribes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.PushSubscribes, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.PushSubscribes); ok { r0 = rf(ctx, in, opts...) } else { @@ -1567,7 +1969,6 @@ func (_m *Chain33Client) ListPushes(ctx context.Context, in *types.ReqNil, opts } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1588,7 +1989,15 @@ func (_m *Chain33Client) LoadParaTxByTitle(ctx context.Context, in *types.ReqHei _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for LoadParaTxByTitle") + } + var r0 *types.ReplyHeightByTitle + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHeightByTitle, ...grpc.CallOption) (*types.ReplyHeightByTitle, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHeightByTitle, ...grpc.CallOption) *types.ReplyHeightByTitle); ok { r0 = rf(ctx, in, opts...) } else { @@ -1597,7 +2006,6 @@ func (_m *Chain33Client) LoadParaTxByTitle(ctx context.Context, in *types.ReqHei } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHeightByTitle, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1618,7 +2026,15 @@ func (_m *Chain33Client) Lock(ctx context.Context, in *types.ReqNil, opts ...grp _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Lock") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1627,7 +2043,6 @@ func (_m *Chain33Client) Lock(ctx context.Context, in *types.ReqNil, opts ...grp } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1648,7 +2063,15 @@ func (_m *Chain33Client) MergeBalance(ctx context.Context, in *types.ReqWalletMe _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for MergeBalance") + } + var r0 *types.ReplyHashes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletMergeBalance, ...grpc.CallOption) (*types.ReplyHashes, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletMergeBalance, ...grpc.CallOption) *types.ReplyHashes); ok { r0 = rf(ctx, in, opts...) } else { @@ -1657,7 +2080,6 @@ func (_m *Chain33Client) MergeBalance(ctx context.Context, in *types.ReqWalletMe } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletMergeBalance, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1678,7 +2100,15 @@ func (_m *Chain33Client) NetInfo(ctx context.Context, in *types.P2PGetNetInfoReq _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for NetInfo") + } + var r0 *types.NodeNetInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.P2PGetNetInfoReq, ...grpc.CallOption) (*types.NodeNetInfo, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.P2PGetNetInfoReq, ...grpc.CallOption) *types.NodeNetInfo); ok { r0 = rf(ctx, in, opts...) } else { @@ -1687,7 +2117,6 @@ func (_m *Chain33Client) NetInfo(ctx context.Context, in *types.P2PGetNetInfoReq } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.P2PGetNetInfoReq, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1708,7 +2137,15 @@ func (_m *Chain33Client) NewAccount(ctx context.Context, in *types.ReqNewAccount _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for NewAccount") + } + var r0 *types.WalletAccount + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNewAccount, ...grpc.CallOption) (*types.WalletAccount, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNewAccount, ...grpc.CallOption) *types.WalletAccount); ok { r0 = rf(ctx, in, opts...) } else { @@ -1717,7 +2154,6 @@ func (_m *Chain33Client) NewAccount(ctx context.Context, in *types.ReqNewAccount } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNewAccount, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1738,7 +2174,15 @@ func (_m *Chain33Client) QueryChain(ctx context.Context, in *types.ChainExecutor _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for QueryChain") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1747,7 +2191,6 @@ func (_m *Chain33Client) QueryChain(ctx context.Context, in *types.ChainExecutor } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1768,7 +2211,15 @@ func (_m *Chain33Client) QueryConsensus(ctx context.Context, in *types.ChainExec _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for QueryConsensus") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1777,7 +2228,6 @@ func (_m *Chain33Client) QueryConsensus(ctx context.Context, in *types.ChainExec } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ChainExecutor, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1798,7 +2248,15 @@ func (_m *Chain33Client) QueryRandNum(ctx context.Context, in *types.ReqRandHash _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for QueryRandNum") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqRandHash, ...grpc.CallOption) (*types.ReplyHash, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqRandHash, ...grpc.CallOption) *types.ReplyHash); ok { r0 = rf(ctx, in, opts...) } else { @@ -1807,7 +2265,6 @@ func (_m *Chain33Client) QueryRandNum(ctx context.Context, in *types.ReqRandHash } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqRandHash, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1828,7 +2285,15 @@ func (_m *Chain33Client) QueryTransaction(ctx context.Context, in *types.ReqHash _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for QueryTransaction") + } + var r0 *types.TransactionDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) (*types.TransactionDetail, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) *types.TransactionDetail); ok { r0 = rf(ctx, in, opts...) } else { @@ -1837,7 +2302,6 @@ func (_m *Chain33Client) QueryTransaction(ctx context.Context, in *types.ReqHash } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHash, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1858,7 +2322,15 @@ func (_m *Chain33Client) ReWriteTx(ctx context.Context, in *types.ReWriteRawTx, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for ReWriteTx") + } + var r0 *types.UnsignTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReWriteRawTx, ...grpc.CallOption) (*types.UnsignTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReWriteRawTx, ...grpc.CallOption) *types.UnsignTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -1867,7 +2339,6 @@ func (_m *Chain33Client) ReWriteTx(ctx context.Context, in *types.ReWriteRawTx, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReWriteRawTx, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1888,7 +2359,15 @@ func (_m *Chain33Client) SaveSeed(ctx context.Context, in *types.SaveSeedByPw, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SaveSeed") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.SaveSeedByPw, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.SaveSeedByPw, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1897,7 +2376,6 @@ func (_m *Chain33Client) SaveSeed(ctx context.Context, in *types.SaveSeedByPw, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.SaveSeedByPw, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1918,7 +2396,15 @@ func (_m *Chain33Client) SendDelayTransaction(ctx context.Context, in *types.Del _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SendDelayTransaction") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.DelayTx, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.DelayTx, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1927,7 +2413,6 @@ func (_m *Chain33Client) SendDelayTransaction(ctx context.Context, in *types.Del } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.DelayTx, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1948,7 +2433,15 @@ func (_m *Chain33Client) SendToAddress(ctx context.Context, in *types.ReqWalletS _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SendToAddress") + } + var r0 *types.ReplyHash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSendToAddress, ...grpc.CallOption) (*types.ReplyHash, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSendToAddress, ...grpc.CallOption) *types.ReplyHash); ok { r0 = rf(ctx, in, opts...) } else { @@ -1957,7 +2450,6 @@ func (_m *Chain33Client) SendToAddress(ctx context.Context, in *types.ReqWalletS } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletSendToAddress, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -1978,7 +2470,15 @@ func (_m *Chain33Client) SendTransaction(ctx context.Context, in *types.Transact _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SendTransaction") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.Transaction, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.Transaction, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -1987,7 +2487,6 @@ func (_m *Chain33Client) SendTransaction(ctx context.Context, in *types.Transact } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.Transaction, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2008,7 +2507,15 @@ func (_m *Chain33Client) SendTransactionSync(ctx context.Context, in *types.Tran _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SendTransactionSync") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.Transaction, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.Transaction, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -2017,7 +2524,6 @@ func (_m *Chain33Client) SendTransactionSync(ctx context.Context, in *types.Tran } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.Transaction, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2038,7 +2544,15 @@ func (_m *Chain33Client) SendTransactions(ctx context.Context, in *types.Transac _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SendTransactions") + } + var r0 *types.Replies + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.Transactions, ...grpc.CallOption) (*types.Replies, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.Transactions, ...grpc.CallOption) *types.Replies); ok { r0 = rf(ctx, in, opts...) } else { @@ -2047,7 +2561,6 @@ func (_m *Chain33Client) SendTransactions(ctx context.Context, in *types.Transac } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.Transactions, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2068,7 +2581,15 @@ func (_m *Chain33Client) SetLabl(ctx context.Context, in *types.ReqWalletSetLabe _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SetLabl") + } + var r0 *types.WalletAccount + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSetLabel, ...grpc.CallOption) (*types.WalletAccount, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSetLabel, ...grpc.CallOption) *types.WalletAccount); ok { r0 = rf(ctx, in, opts...) } else { @@ -2077,7 +2598,6 @@ func (_m *Chain33Client) SetLabl(ctx context.Context, in *types.ReqWalletSetLabe } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletSetLabel, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2098,7 +2618,15 @@ func (_m *Chain33Client) SetPasswd(ctx context.Context, in *types.ReqWalletSetPa _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SetPasswd") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSetPasswd, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSetPasswd, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -2107,7 +2635,6 @@ func (_m *Chain33Client) SetPasswd(ctx context.Context, in *types.ReqWalletSetPa } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletSetPasswd, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2128,7 +2655,15 @@ func (_m *Chain33Client) SetTxFee(ctx context.Context, in *types.ReqWalletSetFee _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SetTxFee") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSetFee, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletSetFee, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -2137,7 +2672,6 @@ func (_m *Chain33Client) SetTxFee(ctx context.Context, in *types.ReqWalletSetFee } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletSetFee, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2158,7 +2692,15 @@ func (_m *Chain33Client) SignRawTx(ctx context.Context, in *types.ReqSignRawTx, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SignRawTx") + } + var r0 *types.ReplySignRawTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqSignRawTx, ...grpc.CallOption) (*types.ReplySignRawTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqSignRawTx, ...grpc.CallOption) *types.ReplySignRawTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -2167,7 +2709,6 @@ func (_m *Chain33Client) SignRawTx(ctx context.Context, in *types.ReqSignRawTx, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqSignRawTx, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2188,7 +2729,15 @@ func (_m *Chain33Client) SignWalletRecoverTx(ctx context.Context, in *types.ReqS _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SignWalletRecoverTx") + } + var r0 *types.ReplySignRawTx + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqSignWalletRecoverTx, ...grpc.CallOption) (*types.ReplySignRawTx, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqSignWalletRecoverTx, ...grpc.CallOption) *types.ReplySignRawTx); ok { r0 = rf(ctx, in, opts...) } else { @@ -2197,7 +2746,6 @@ func (_m *Chain33Client) SignWalletRecoverTx(ctx context.Context, in *types.ReqS } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqSignWalletRecoverTx, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2218,7 +2766,15 @@ func (_m *Chain33Client) SubEvent(ctx context.Context, in *types.ReqSubscribe, o _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for SubEvent") + } + var r0 types.Chain33_SubEventClient + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqSubscribe, ...grpc.CallOption) (types.Chain33_SubEventClient, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqSubscribe, ...grpc.CallOption) types.Chain33_SubEventClient); ok { r0 = rf(ctx, in, opts...) } else { @@ -2227,7 +2783,6 @@ func (_m *Chain33Client) SubEvent(ctx context.Context, in *types.ReqSubscribe, o } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqSubscribe, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2248,7 +2803,15 @@ func (_m *Chain33Client) UnLock(ctx context.Context, in *types.WalletUnLock, opt _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for UnLock") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.WalletUnLock, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.WalletUnLock, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -2257,7 +2820,6 @@ func (_m *Chain33Client) UnLock(ctx context.Context, in *types.WalletUnLock, opt } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.WalletUnLock, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2278,7 +2840,15 @@ func (_m *Chain33Client) UnSubEvent(ctx context.Context, in *types.ReqString, op _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for UnSubEvent") + } + var r0 *types.Reply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) (*types.Reply, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqString, ...grpc.CallOption) *types.Reply); ok { r0 = rf(ctx, in, opts...) } else { @@ -2287,7 +2857,6 @@ func (_m *Chain33Client) UnSubEvent(ctx context.Context, in *types.ReqString, op } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqString, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2308,7 +2877,15 @@ func (_m *Chain33Client) Version(ctx context.Context, in *types.ReqNil, opts ... _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Version") + } + var r0 *types.VersionInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) (*types.VersionInfo, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqNil, ...grpc.CallOption) *types.VersionInfo); ok { r0 = rf(ctx, in, opts...) } else { @@ -2317,7 +2894,6 @@ func (_m *Chain33Client) Version(ctx context.Context, in *types.ReqNil, opts ... } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqNil, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2338,7 +2914,15 @@ func (_m *Chain33Client) WalletTransactionList(ctx context.Context, in *types.Re _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for WalletTransactionList") + } + var r0 *types.WalletTxDetails + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletTransactionList, ...grpc.CallOption) (*types.WalletTxDetails, error)); ok { + return rf(ctx, in, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *types.ReqWalletTransactionList, ...grpc.CallOption) *types.WalletTxDetails); ok { r0 = rf(ctx, in, opts...) } else { @@ -2347,7 +2931,6 @@ func (_m *Chain33Client) WalletTransactionList(ctx context.Context, in *types.Re } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *types.ReqWalletTransactionList, ...grpc.CallOption) error); ok { r1 = rf(ctx, in, opts...) } else { @@ -2356,3 +2939,17 @@ func (_m *Chain33Client) WalletTransactionList(ctx context.Context, in *types.Re return r0, r1 } + +// NewChain33Client creates a new instance of Chain33Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewChain33Client(t interface { + mock.TestingT + Cleanup(func()) +}) *Chain33Client { + mock := &Chain33Client{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} From e9fa15cfee7742f06feaf5ea2065152abcc77b42 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 28 May 2024 00:01:03 +0800 Subject: [PATCH 80/85] snowman:reject block in side chain fetched from peers --- blockchain/blockfinalize.go | 18 +++++++++------- system/consensus/snowman/vm.go | 33 ++++++++++++++++++++++++++++- system/consensus/snowman/vm_test.go | 8 ++++--- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/blockchain/blockfinalize.go b/blockchain/blockfinalize.go index e8f404ab2..43977ac5e 100644 --- a/blockchain/blockfinalize.go +++ b/blockchain/blockfinalize.go @@ -107,16 +107,16 @@ func (f *finalizer) healthCheck() { case <-ticker.C: maxPeerHeight := f.chain.GetPeerMaxBlkHeight() // 节点高度落后较多情况不处理, 等待同步 - if height := f.chain.GetBlockHeight(); height < maxPeerHeight-128 || healthy { - chainlog.Debug("finalizer timeout", "healthy", healthy, "height", height, "maxHeight", maxPeerHeight) + height := f.chain.GetBlockHeight() + if height < maxPeerHeight-128 || healthy { + chainlog.Debug("healthCheck not sync", "healthy", healthy, "height", height, "maxHeight", maxPeerHeight) healthy = false continue } - chainHeight := f.chain.bestChain.Height() finalized, hash := f.getLastFinalized() - chainlog.Debug("finalizer timeout", "lastFinalize", finalized, - "hash", hex.EncodeToString(hash), "chainHeight", chainHeight) - if finalized >= chainHeight { + chainlog.Debug("healthCheck timeout", "lastFinalize", finalized, + "hash", hex.EncodeToString(hash), "chainHeight", height) + if finalized >= height { continue } // 重新设置高度, 哈希值 @@ -193,13 +193,15 @@ func (f *finalizer) resetEngine(chainHeight int64, sc *types.SnowChoice, duratio case <-ticker.C: + currHeight := f.chain.bestChain.Height() if f.chain.bestChain.HaveBlock(sc.GetHash(), sc.GetHeight()) { + chainlog.Debug("resetEngine accept", "chainHeight", chainHeight, + "currHeight", currHeight, "sc.height", sc.GetHeight(), "sc.hash", hex.EncodeToString(sc.GetHash())) return } // 最终化区块不在主链上且主链高度正常增长, 重置最终化引擎, 尝试对该高度重新共识 - currHeight := f.chain.bestChain.Height() if currHeight > chainHeight && currHeight > sc.GetHeight()+12 { - chainlog.Debug("resetEngine", "chainHeight", chainHeight, + chainlog.Debug("resetEngine reject", "chainHeight", chainHeight, "currHeight", currHeight, "sc.height", sc.GetHeight(), "sc.hash", hex.EncodeToString(sc.GetHash())) _ = f.chain.client.Send(queue.NewMessage(types.EventSnowmanResetEngine, consensusTopic, types.EventForFinalizer, nil), true) return diff --git a/system/consensus/snowman/vm.go b/system/consensus/snowman/vm.go index cb6256ce9..c03fb00b4 100644 --- a/system/consensus/snowman/vm.go +++ b/system/consensus/snowman/vm.go @@ -1,6 +1,7 @@ package snowman import ( + "bytes" "container/list" "encoding/hex" "sync" @@ -145,7 +146,36 @@ func (vm *chain33VM) GetBlock(_ context.Context, blkID ids.ID) (snowcon.Block, e return sb, nil } -// ParseBlock parse block +// 检测当前节点对应区块偏好 +func (vm *chain33VM) checkPreference(sb *snowBlock) { + + if sb.Status().Decided() { + return + } + header, err := vm.api.GetLastHeader() + if err != nil { + snowLog.Error("checkPreference", "height", sb.Height(), "hash", sb.ID().Hex(), "GetLastHeader err", err) + return + } + // 高度128以内不处理 + if header.GetHeight() < sb.block.Height+128 { + return + } + + hash, err := vm.api.GetBlockHash(&types.ReqInt{Height: sb.block.GetHeight()}) + if err != nil || len(hash.GetHash()) <= 0 { + snowLog.Error("checkPreference", "height", sb.Height(), "hash", sb.ID().Hex(), "GetBlockHash err", err) + return + } + // hash不一致, 为分叉区块 + if !bytes.Equal(hash.GetHash(), sb.block.Hash(vm.cfg)) { + sb.status = choices.Rejected + vm.decidedHashes.Add(sb.ID(), false) + snowLog.Debug("checkPreference reject", "height", sb.Height(), "hash", sb.ID().Hex(), "mainHash", hex.EncodeToString(hash.GetHash())) + } +} + +// ParseBlock parse block fetch from peer func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, error) { blk := &types.Block{} @@ -156,6 +186,7 @@ func (vm *chain33VM) ParseBlock(_ context.Context, b []byte) (snowcon.Block, err } sb := vm.newSnowBlock(blk, choices.Processing) vm.checkDecided(sb) + vm.checkPreference(sb) // add to cache vm.cacheBlks.Add(sb.ID(), sb) return sb, nil diff --git a/system/consensus/snowman/vm_test.go b/system/consensus/snowman/vm_test.go index de3d10f2f..3570dadb2 100644 --- a/system/consensus/snowman/vm_test.go +++ b/system/consensus/snowman/vm_test.go @@ -1,7 +1,6 @@ package snowman import ( - "encoding/hex" "testing" "time" @@ -37,6 +36,8 @@ func mockHandleChainMsg(cli queue.Client) { msg.Reply(cli.NewMessage("", 0, &types.BlockDetails{Items: []*types.BlockDetail{{Block: &types.Block{Height: 1}}}})) } else if msg.Ty == types.EventGetBlockHash { msg.Reply(cli.NewMessage("", 0, &types.ReplyHash{Hash: []byte("test")})) + } else if msg.Ty == types.EventGetLastHeader { + msg.Reply(cli.NewMessage("", 0, &types.Header{Height: 130})) } } } @@ -62,9 +63,10 @@ func TestChain33VM(t *testing.T) { require.Equal(t, 1, int(sb.Height())) require.Equal(t, choices.Processing, sb.Status()) blk := sb.(*snowBlock).block - require.Equal(t, hex.EncodeToString(blk.Hash(vm.cfg)), sb.ID().Hex()) - vm.decidedHashes.Add(sb.ID(), true) sb1, err := vm.ParseBlock(nil, sb.Bytes()) + require.Equal(t, choices.Rejected, sb1.Status()) + vm.decidedHashes.Add(sb.ID(), true) + sb1, err = vm.ParseBlock(nil, sb.Bytes()) require.Equal(t, choices.Accepted, sb1.Status()) require.Nil(t, err) // test and and build new block From b7fb6327c1a0331deef1db0deb55b74bbfde26c7 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 28 May 2024 11:54:36 +0800 Subject: [PATCH 81/85] snowman:update doc --- blockchain/chain.go | 3 ++ system/consensus/snowman/README.md | 4 -- system/consensus/snowman/config.go | 1 + system/consensus/snowman/readme.md | 60 ++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) delete mode 100644 system/consensus/snowman/README.md create mode 100644 system/consensus/snowman/readme.md diff --git a/blockchain/chain.go b/blockchain/chain.go index 92405a666..23a0eb36f 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -233,6 +233,9 @@ func (chain *BlockChain) initConfig(cfg *types.Chain33Config) { chain.initOnChainTimeout() // 初始化AllowPackHeight initAllowPackHeight(chain.cfg) + if mcfg.BlockFinalizeEnableHeight < 0 { + mcfg.BlockFinalizeEnableHeight = 0 + } if mcfg.BlockFinalizeGapHeight <= 0 { mcfg.BlockFinalizeGapHeight = defaultFinalizeGapHeight } diff --git a/system/consensus/snowman/README.md b/system/consensus/snowman/README.md deleted file mode 100644 index 14e2b6bf8..000000000 --- a/system/consensus/snowman/README.md +++ /dev/null @@ -1,4 +0,0 @@ - -## snowman - -基于avlanche snowman共识的区块最终化设计 diff --git a/system/consensus/snowman/config.go b/system/consensus/snowman/config.go index be2816d86..7902f5eb1 100644 --- a/system/consensus/snowman/config.go +++ b/system/consensus/snowman/config.go @@ -87,6 +87,7 @@ func (s *snowman) applyConfig(subCfg *types.ConfigSubModule) { if cfg.BetaVirtuous > 0 { s.params.BetaVirtuous = cfg.BetaVirtuous + s.params.BetaRogue = cfg.BetaVirtuous + 1 } if cfg.BetaRogue > 0 { diff --git a/system/consensus/snowman/readme.md b/system/consensus/snowman/readme.md new file mode 100644 index 000000000..8bd86dd3e --- /dev/null +++ b/system/consensus/snowman/readme.md @@ -0,0 +1,60 @@ + +## 区块最终性共识 + +基于avlanche snowman共识引擎实现 + +### 使用配置 +涉及blockchain, consensus 模块主要配置项 + +```toml + +[blockchain] +# 启动高度, 作为初始共识高度 +blockFinalizeEnableHeight=0 +# 区块最终化启动后等待高度差, 达到启动高度后继续等待高度值, 最低1, 默认128 +blockFinalizeGapHeight=128 + + +[consensus] +# 插件名称, 不配置则关闭最终化共识 +finalizer="snowman" + +# 共识参数, 通常无需配置, 采用默认即可 +[consensus.sub.snowman] +# 单次投票参与节点数 +k=20 +# 单次投票通过最低票数, 需大于k/2 +alpha=15 +# 达成共识所需的连续投票成功次数 +betaVirtuous=15 + +``` + + +### 底层实现 + +- 基于avalanchego v1.10.9, 并针对chain33做了简单改动适配, 主要包括整合区块哈希, 节点ID等数据格式保持一致, 移除跨平台编译不兼容依赖, 日志调整 +- replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego + +#### 模块简介 + +> blockchain/finalize.go +> +snowman共识结果信息维护, 并根据本地主链打包情况进行状态校验, 分叉重置等处理 + +> consensus/snowman +> +snowman共识引擎适配实现, 以下为主要文件介绍 + +- snowman.go 共识入口, chain33 consensus finalizer插件实现, 事件接收分发调度 +- vm.go 链相关的功能适配, 衔接底层共识和blockchain交互, 涉及区块打包, 查询, 共识 +- validator.go 验证者功能适配, 主要实现节点抽样 +- sender.go 网络发送功能适配, 衔接底层p2p通信, 涉及共识交互 +- config.go 配置, 日志等底层接口依赖适配 + +> dht/snow + +底层p2p通信交互实现 + +- EventHandler 处理本地消息事件 +- StreamHandler 处理网络消息事件 From 81055706f346f9f25b4a97ce444576a350a6d92d Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 28 May 2024 12:49:56 +0800 Subject: [PATCH 82/85] mod:specify btcd package version 0.22.3 --- common/vrf/secp256k1/secp256k1.go | 2 +- go.mod | 13 +++++----- go.sum | 29 ++-------------------- system/crypto/btcscript/script/builtin.go | 2 +- system/crypto/btcscript/script/util.go | 8 +++--- system/crypto/secp256k1/secp256k1.go | 2 +- system/crypto/secp256k1eth/secp256k1eth.go | 2 +- system/crypto/sm2/utils.go | 2 +- 8 files changed, 18 insertions(+), 42 deletions(-) diff --git a/common/vrf/secp256k1/secp256k1.go b/common/vrf/secp256k1/secp256k1.go index d809d361a..0b97b6a64 100644 --- a/common/vrf/secp256k1/secp256k1.go +++ b/common/vrf/secp256k1/secp256k1.go @@ -33,7 +33,7 @@ import ( "math/big" vrfp "github.com/33cn/chain33/common/vrf" - "github.com/btcsuite/btcd/btcec/btcec" + "github.com/btcsuite/btcd/btcec" ) var ( diff --git a/go.mod b/go.mod index 3d75cb195..6bbb1a446 100644 --- a/go.mod +++ b/go.mod @@ -2,15 +2,19 @@ module github.com/33cn/chain33 go 1.19 +replace ( + github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 + github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3 +) + require ( github.com/BurntSushi/toml v1.2.1 github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b github.com/ava-labs/avalanchego v1.10.9 github.com/btcsuite/btcd v0.23.4 - github.com/btcsuite/btcd/btcec v0.0.0-00010101000000-000000000000 - github.com/btcsuite/btcd/btcec/v2 v2.3.2 github.com/btcsuite/btcd/btcutil v1.1.3 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/decred/base58 v1.0.3 github.com/dgraph-io/badger v1.6.2 github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 @@ -59,6 +63,7 @@ require ( github.com/benbjohnson/clock v1.3.0 // indirect github.com/benbjohnson/immutable v0.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -224,7 +229,3 @@ require ( lukechampine.com/blake3 v1.1.7 // indirect nhooyr.io/websocket v1.8.7 // indirect ) - -replace github.com/btcsuite/btcd/btcec => github.com/btcsuite/btcd v0.22.3 - -replace github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 diff --git a/go.sum b/go.sum index 647b25d62..1066bce05 100644 --- a/go.sum +++ b/go.sum @@ -120,7 +120,6 @@ github.com/VictoriaMetrics/fastcache v1.10.0 h1:5hDJnLsKLpnUEToub7ETuRu8RCkb40wo github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b h1:KF7k0g1S53oeveZxGM2wfyT5PSpO82ZxBrYlA5mM0cw= github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b/go.mod h1:VrfgKISflRhFm32m3e0SXLccvNJTyG8PRywWbUuGEfY= -github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw= @@ -181,19 +180,11 @@ github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx2 github.com/bonitoo-io/go-sql-bigquery v0.3.4-1.4.0 h1:MaVh0h9+KaMnJcoDvvIGp+O3fefdWm+8MBUX6ELTJTM= github.com/bonitoo-io/go-sql-bigquery v0.3.4-1.4.0/go.mod h1:J4Y6YJm0qTWB9aFziB7cPeSyc6dOZFyJdteSeybVpXQ= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg= github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= -github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ= -github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= -github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= -github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= @@ -201,17 +192,12 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 h1:y70tfpRGONtMp0EqL+uYMTdaTR4OBpC631a97b0dTa4= @@ -286,7 +272,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -301,7 +286,6 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= -github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= @@ -802,8 +786,6 @@ github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPw github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= @@ -813,7 +795,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -845,7 +826,6 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -1084,7 +1064,6 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= @@ -1336,7 +1315,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= @@ -1484,7 +1462,6 @@ go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180505025534-4ec37c66abab/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1508,6 +1485,7 @@ golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1612,7 +1590,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -1713,11 +1690,9 @@ golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/system/crypto/btcscript/script/builtin.go b/system/crypto/btcscript/script/builtin.go index 6abde24fb..03bb7a785 100644 --- a/system/crypto/btcscript/script/builtin.go +++ b/system/crypto/btcscript/script/builtin.go @@ -3,7 +3,7 @@ package script import ( "github.com/33cn/chain33/common/log" "github.com/btcsuite/btcd/txscript" - "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcutil" ) var ( diff --git a/system/crypto/btcscript/script/util.go b/system/crypto/btcscript/script/util.go index 89d6c3e0f..3f6c84fa4 100644 --- a/system/crypto/btcscript/script/util.go +++ b/system/crypto/btcscript/script/util.go @@ -10,12 +10,12 @@ import ( "github.com/golang/protobuf/proto" "github.com/33cn/chain33/common" - "github.com/btcsuite/btcd/btcec/v2" - "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btcutil" ) const ( @@ -56,7 +56,7 @@ type BtcAddr2Script struct { // NewBtcKeyFromBytes 获取比特币公私钥 func NewBtcKeyFromBytes(priv []byte) (*btcec.PrivateKey, *btcec.PublicKey) { - return btcec.PrivKeyFromBytes(priv) + return btcec.PrivKeyFromBytes(btcec.S256(), priv) } // GetBtcLockScript 根据地址类型,生成锁定脚本 @@ -103,7 +103,7 @@ func CheckBtcScript(msg []byte, sig *Signature) error { tx := getBindBtcTx(msg) setBtcTx(tx, sig.LockTime, sig.UtxoSequence, sig.UnlockScript) - vm, err := txscript.NewEngine(sig.LockScript, tx, 0, txscript.StandardVerifyFlags, nil, nil, 0, nil) + vm, err := txscript.NewEngine(sig.LockScript, tx, 0, txscript.StandardVerifyFlags, nil, nil, 0) if err != nil { return errors.New("new Script engine err:" + err.Error()) } diff --git a/system/crypto/secp256k1/secp256k1.go b/system/crypto/secp256k1/secp256k1.go index a0b21831e..9e3183bc9 100644 --- a/system/crypto/secp256k1/secp256k1.go +++ b/system/crypto/secp256k1/secp256k1.go @@ -11,7 +11,7 @@ import ( "fmt" "github.com/33cn/chain33/common/crypto" - secp256k1 "github.com/btcsuite/btcd/btcec/btcec" + secp256k1 "github.com/btcsuite/btcd/btcec" ) //Driver 驱动 diff --git a/system/crypto/secp256k1eth/secp256k1eth.go b/system/crypto/secp256k1eth/secp256k1eth.go index 1871e405f..88fb11e0d 100644 --- a/system/crypto/secp256k1eth/secp256k1eth.go +++ b/system/crypto/secp256k1eth/secp256k1eth.go @@ -21,7 +21,7 @@ import ( "math/big" "github.com/33cn/chain33/system/crypto/secp256k1eth/types" - secp256k1 "github.com/btcsuite/btcd/btcec/btcec" + secp256k1 "github.com/btcsuite/btcd/btcec" etypes "github.com/ethereum/go-ethereum/core/types" ethcrypto "github.com/ethereum/go-ethereum/crypto" ) diff --git a/system/crypto/sm2/utils.go b/system/crypto/sm2/utils.go index ac0497f6b..07964c62c 100644 --- a/system/crypto/sm2/utils.go +++ b/system/crypto/sm2/utils.go @@ -7,7 +7,7 @@ package sm2 import ( "math/big" - "github.com/btcsuite/btcd/btcec/btcec" + "github.com/btcsuite/btcd/btcec" "github.com/tjfoc/gmsm/sm2" ) From 55607da774d1ce84e84dd827fbac5e74fb49bf21 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Tue, 28 May 2024 13:29:01 +0800 Subject: [PATCH 83/85] fix test --- client/queueprotocol_test.go | 2 +- system/consensus/snowman/vm_test.go | 3 ++- system/crypto/btcscript/btcscript_test.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/queueprotocol_test.go b/client/queueprotocol_test.go index 3284eec23..3fb98a8f4 100644 --- a/client/queueprotocol_test.go +++ b/client/queueprotocol_test.go @@ -41,7 +41,7 @@ func TestMain(m *testing.M) { func TestQueueProtocolAPI(t *testing.T) { var option client.QueueProtocolOption option.SendTimeout = time.Millisecond - option.WaitTimeout = 2 * time.Millisecond + option.WaitTimeout = 100 * time.Millisecond _, err := client.New(nil, nil) if err == nil { diff --git a/system/consensus/snowman/vm_test.go b/system/consensus/snowman/vm_test.go index 3570dadb2..282d6c128 100644 --- a/system/consensus/snowman/vm_test.go +++ b/system/consensus/snowman/vm_test.go @@ -64,9 +64,10 @@ func TestChain33VM(t *testing.T) { require.Equal(t, choices.Processing, sb.Status()) blk := sb.(*snowBlock).block sb1, err := vm.ParseBlock(nil, sb.Bytes()) + require.Nil(t, err) require.Equal(t, choices.Rejected, sb1.Status()) vm.decidedHashes.Add(sb.ID(), true) - sb1, err = vm.ParseBlock(nil, sb.Bytes()) + sb1, _ = vm.ParseBlock(nil, sb.Bytes()) require.Equal(t, choices.Accepted, sb1.Status()) require.Nil(t, err) // test and and build new block diff --git a/system/crypto/btcscript/btcscript_test.go b/system/crypto/btcscript/btcscript_test.go index 75f7c72bc..906e9010c 100644 --- a/system/crypto/btcscript/btcscript_test.go +++ b/system/crypto/btcscript/btcscript_test.go @@ -16,8 +16,8 @@ import ( cryptocli "github.com/33cn/chain33/common/crypto/client" "github.com/stretchr/testify/mock" - "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/txscript" + "github.com/btcsuite/btcutil" "github.com/33cn/chain33/system/crypto/btcscript/script" _ "github.com/33cn/chain33/system/dapp/init" From 5c2eeea1f3081d92009bfd9e2d4eb0632946fa86 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 29 May 2024 12:30:00 +0800 Subject: [PATCH 84/85] mod:update avalanche package --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 6bbb1a446..ec0042223 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/33cn/chain33 go 1.19 replace ( - github.com/ava-labs/avalanchego => github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 + github.com/ava-labs/avalanchego => github.com/33cn/avalanchego v1.10.10-0.20240529041529-ada691598153 github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3 ) @@ -12,7 +12,6 @@ require ( github.com/XiaoMi/pegasus-go-client v0.0.0-20210825081735-b8a75c1eac2b github.com/ava-labs/avalanchego v1.10.9 github.com/btcsuite/btcd v0.23.4 - github.com/btcsuite/btcd/btcutil v1.1.3 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/decred/base58 v1.0.3 @@ -64,6 +63,7 @@ require ( github.com/benbjohnson/immutable v0.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/btcsuite/btcd/btcutil v1.1.3 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect diff --git a/go.sum b/go.sum index 1066bce05..0a55aa6a4 100644 --- a/go.sum +++ b/go.sum @@ -50,6 +50,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +github.com/33cn/avalanchego v1.10.10-0.20240529041529-ada691598153 h1:fG9c8gQK312kjhHGZhiAp3QTpUU9etMnvIJQtkVcITk= +github.com/33cn/avalanchego v1.10.10-0.20240529041529-ada691598153/go.mod h1:SgoXVssKD3a3diOV4qaTkOEQ+2KEfErcdOASIhV6a1s= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -200,8 +202,6 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71 h1:y70tfpRGONtMp0EqL+uYMTdaTR4OBpC631a97b0dTa4= -github.com/bysomeone/avalanchego v0.0.0-20240525154058-c4ea5da7ec71/go.mod h1:SgoXVssKD3a3diOV4qaTkOEQ+2KEfErcdOASIhV6a1s= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= From cf859e974569072297f845a2e167e2782ecd3476 Mon Sep 17 00:00:00 2001 From: jiangpeng <11565373+bysomeone@users.noreply.github.com> Date: Wed, 29 May 2024 14:00:46 +0800 Subject: [PATCH 85/85] test:fix net address conflict, use random listen port(#1284) --- .../dht/protocol/p2pstore/p2pstore_test.go | 27 ++++++++----------- system/p2p/dht/protocol/peer/peerinfo_test.go | 24 +++++++---------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/system/p2p/dht/protocol/p2pstore/p2pstore_test.go b/system/p2p/dht/protocol/p2pstore/p2pstore_test.go index dde2e130e..a8b2afdbf 100644 --- a/system/p2p/dht/protocol/p2pstore/p2pstore_test.go +++ b/system/p2p/dht/protocol/p2pstore/p2pstore_test.go @@ -15,12 +15,11 @@ import ( types2 "github.com/33cn/chain33/system/p2p/dht/types" "github.com/33cn/chain33/types" "github.com/libp2p/go-libp2p" + kbt "github.com/libp2p/go-libp2p-kbucket" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/discovery" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" - kbt "github.com/libp2p/go-libp2p-kbucket" - "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/require" ) @@ -339,7 +338,7 @@ func makeProtocol(name string, q queue.Queue, h host.Host) *Protocol { } func initEnv(t *testing.T, q queue.Queue) (*Protocol, *Protocol) { - port1, port2 := 13806, 13807 + types2.RefreshInterval = time.Second privkey1 := "080012a709308204a30201000282010100a28d698a090b02222f97c928b45e78821a87b6382b5057ec9cf12331da3fd8a1c6c71731a8075ae41383460908b483585676f4312249de6929423c2c5d7865bb28d50c5a57e7cad3cc7ca2ddcbc486ac0260fe68e4cdff7f86e46ac65403baf6a5ef50ce7cbb9d0f5f23b02fcc6d5211e2df2bf24fc84565ba5d0777458ad82b46579cba0a16c88ff946812e7f17ad85a2b35dc1bae732a74f83262358fefcc985a632aee8129a73d1d17aaceebd5bae9ffbeab6c5505e8eafd8af8448a6dd74d76885bc71c7d85bad761680bc7cdd04a99cb90d8c27467769c500e603677469a73cec7983a7dba6d7656ab241b4446355a89a267eeb72f0fd7c89c470d93a6302030100010282010002db797f73a93de05bf5cf136818410608715a42a280470b61b6db6784ee9a603d9e424a1d2a03eefe68d0525854d3fa398addbfff5a4d0e8c2b1de3a9c0f408d62ee888ae02e50dd40a5cd289426b1b9aef1989be7be081dd5d268355f6bad29b1819d3875dc4e500472051b6c6352b1b51d0f3f17313c536016ca02c18c4b3f6dba52c616f93bf831589d0dd2fc190f875e37a4e9654bd9e63e04fc5d9cea45664cd6d26c17659ee4b8c6837c6dfe86e4e6b8e17af332a736267ee5a68ac0b0c60ced47f1aaf7ec65547f664a9f1409e7d116ca325c29b1058e5892dc04c79337a15b875e7139bca7ddfb6c5c7f822adff8cd65f1dfa84d1b0f87166604c0102818100c5694c5a55465a068075e5274ca926615632ef710917f4a2ece4b4108041ea6dc99ee244d97d1a687c5f6879a97df6685346d7fff315bb3be008c787f67ad9934563127b07511f57ac72be2f7771a9e29b67a022e12567be3591c033a0202e44742429e3266709f17e79c1caa4618f0e5c37a6d3f238f92f33539be7aa5beee502818100d2cba3ec75b664129ecdbe29324b3fde83ddc7291fe3d6073ebb2db508632f370f54affae7c7ebbc143a5c07ac8f7734eb2f537d3662e4bc05d80eed942a94d5084683dac388cfcd601c9cd59330ff021cf18fa618b25e8a5351f2036f65007a8b4162058f2242d953379d349d9a484c800e8ae539f3e3cd4c6dc9c7b455a7a70281806d790a2d61f2a483cc831473a9b077a72cbd0c493bc8bc12099a7e3c5453b963ee961c561fe19f5e67f224a6ab163e29f65c67f5f8e0893717f2e66b8084f9d91076734e246d991aee77a6fdfd97dba4dd9726979111442997dd5e9f8261b626a1dd58192e379facfafd1c397ad4db17148e8c0626e1ef557c7a160fef4a11fd028180555c679e3ab0c8678ded4d034bbd93389d77b2cde17f16cdca466c24f227901820da2f855054f20e30b6cd4bc2423a88b07072c3b2c16b55049cd0b6be985bbac4e62140f68bb172be67f7ceb9134f40e0cda559228920a5ad45f2d61746f461ab80a79c0eb15616c18f34d6f8b7606db231b167500786893d58fc2c25c7c5e302818100ad587bed92aef2dedb19766c72e5caeadf1f7226d2c3ed0c6ffd1e885b665f55df63d54f91d2fb3f2c4e608bc16bc70eec6300ec5fe61cd31dd48c19544058d1fbb3e39e09117b6e8ab0cc832c481b1c364fbce5b07bf681a0af8e554bef3017dfd53197b87bcebf080fbaef42df5f51c900148499fa7be9e05640dc79d04ad8" b1, _ := hex.DecodeString(privkey1) @@ -348,26 +347,22 @@ func initEnv(t *testing.T, q queue.Queue) (*Protocol, *Protocol) { b2, _ := hex.DecodeString(privkey2) sk2, _ := crypto.UnmarshalPrivateKey(b2) - m1, err := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", port1)) - if err != nil { - t.Fatal(err) - } - host1, err := libp2p.New(libp2p.ListenAddrs(m1), libp2p.Identity(sk1)) + listenOption := libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0") + host1, err := libp2p.New(listenOption, libp2p.Identity(sk1)) if err != nil { t.Fatal(err) } - m2, err := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", port2)) - if err != nil { - t.Fatal(err) - } - host2, err := libp2p.New(libp2p.ListenAddrs(m2), libp2p.Identity(sk2)) + + host2, err := libp2p.New(listenOption, libp2p.Identity(sk2)) if err != nil { t.Fatal(err) } - addr, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d/p2p/%s", port1, host1.ID().Pretty())) - peerinfo, _ := peer.AddrInfoFromP2pAddr(addr) - err = host2.Connect(context.Background(), *peerinfo) + addrInfo := peer.AddrInfo{ + ID: host1.ID(), + Addrs: host1.Addrs(), + } + err = host2.Connect(context.Background(), addrInfo) require.Nil(t, err) p1 := makeProtocol(p2pA, q, host1) diff --git a/system/p2p/dht/protocol/peer/peerinfo_test.go b/system/p2p/dht/protocol/peer/peerinfo_test.go index 3b0848ede..6315ad468 100644 --- a/system/p2p/dht/protocol/peer/peerinfo_test.go +++ b/system/p2p/dht/protocol/peer/peerinfo_test.go @@ -25,7 +25,6 @@ import ( "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/metrics" "github.com/libp2p/go-libp2p/core/peer" - "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/require" ) @@ -38,19 +37,13 @@ func initEnv(t *testing.T, q queue.Queue) (*Protocol, context.CancelFunc) { b2, _ := hex.DecodeString(privkey2) sk2, _ := crypto.UnmarshalPrivateKey(b2) client1, client2 := q.Client(), q.Client() - m1, err := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", 13806)) - if err != nil { - t.Fatal(err) - } - host1, err := libp2p.New(libp2p.ListenAddrs(m1), libp2p.Identity(sk1)) - if err != nil { - t.Fatal(err) - } - m2, err := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", 13807)) + + host1, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"), libp2p.Identity(sk1)) if err != nil { t.Fatal(err) } - host2, err := libp2p.New(libp2p.ListenAddrs(m2), libp2p.Identity(sk2)) + + host2, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"), libp2p.Identity(sk2)) if err != nil { t.Fatal(err) } @@ -87,9 +80,12 @@ func initEnv(t *testing.T, q queue.Queue) (*Protocol, context.CancelFunc) { if err != nil { panic(err) } - addr, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/13806/p2p/%s", host1.ID().Pretty())) - peerinfo, _ := peer.AddrInfoFromP2pAddr(addr) - err = host2.Connect(context.Background(), *peerinfo) + + addrInfo := peer.AddrInfo{ + ID: host1.ID(), + Addrs: host1.Addrs(), + } + err = host2.Connect(context.Background(), addrInfo) require.Nil(t, err) ps2, err := extension.NewPubSub(ctx, host2, &p2pty.PubSubConfig{})