-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[R4R] publish block info for thirdpart partner #667
Conversation
a8dda8b
to
25f907a
Compare
4a83bbb
to
4f84c3c
Compare
Gopkg.lock
Outdated
@@ -499,6 +507,14 @@ | |||
revision = "9a47f48565a795472d43519dd49aac781f3034fb" | |||
version = "v1.6.0" | |||
|
|||
[[projects]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can ignore deadlock and goid depnendency, I will reorg Gopkg.lock and Gopkg.toml before merge.
common/tx/pool.go
Outdated
@@ -0,0 +1,37 @@ | |||
package tx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a pool.go
file in cosmos. Why I choose put here: 1. cosmos-sdk won't use this file. 2. the pool.go
in cosmos use sync.map, which is not suit for this scene
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name pool
is a little weird, tx.pool
looks like a tx mempool, How about name it TxResults
and put it under app/pub
package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I move it into app/pub
package, but still name it as pool.go
, for now it only store txResult, but it can store other things in the future.
1dbbe6c
to
8504592
Compare
app/config/config.go
Outdated
publishBlock = {{ .PublicationConfig.PublishBlock }} | ||
blockTopic = "{{ .PublicationConfig.BlockTopic }}" | ||
blockKafka = "{{ .PublicationConfig.BlockKafka }}" | ||
|
||
# Global setting | ||
publicationChannelSize = "{{ .PublicationConfig.PublicationChannelSize }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you help me remove the double-quote? :) Its my mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
Gopkg.toml
Outdated
@@ -42,7 +42,7 @@ | |||
[[constraint]] | |||
name = "github.com/cosmos/cosmos-sdk" | |||
source = "github.com/binance-chain/bnc-cosmos-sdk" | |||
version = "=v0.25.0-binance.19" | |||
branch = "blockhash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, after cosmos release or merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can change back to develop branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed back to develop
@@ -44,11 +47,12 @@ func (this msgType) String() string { | |||
// figure out which version of writer schema to use. | |||
// This allows consumers be deployed independently (in advance) with publisher | |||
var latestSchemaVersions = map[msgType]int{ | |||
accountsTpe: 0, | |||
accountsTpe: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please notice me and kaiqiang when this is going to deploy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
app/pub/helpers.go
Outdated
Logger.Error("tx contains no messages", "hash", txhash) | ||
return true | ||
} | ||
// Notice: if support multi message in one transaction in future, this part need change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We’d better Make a todo comment with issue number.
inputs := []Input{{Address: msg.GetSigners()[0].String()}} | ||
|
||
switch msg := msg.(type) { | ||
case orderPkg.NewOrderMsg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest if time allowed we add interface to each message which is more maintainable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need for the abstraction. Cipher trace's requirement is special, no need to change the basic interface of Msg
for them. txAsset
, inputs
, outputs
is more like bitcoin concept, most message do not have such interface.
@@ -32,6 +32,7 @@ type KafkaMarketDataPublisher struct { | |||
transfersCodec *goavro.Codec | |||
blockCodec *goavro.Codec | |||
|
|||
failFast bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for which nodes we enable this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we won't enable this, but cypher trace will.
@@ -463,15 +463,18 @@ func (app *BinanceChain) CheckTx(txBytes []byte) (res abci.ResponseCheckTx) { | |||
// Implements ABCI | |||
func (app *BinanceChain) DeliverTx(txBytes []byte) (res abci.ResponseDeliverTx) { | |||
res = app.BaseApp.DeliverTx(txBytes) | |||
txHash := cmn.HexBytes(tmhash.Sum(txBytes)).String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
txHash
have been calculated for serveral times in deliverTx. We should pass the txHash
to inner functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really an issue that bothers us long, since it is not the purpose of this pr, let us do it in . #683
app/pub/msgs.go
Outdated
Timestamp string | ||
TxTotal int64 | ||
|
||
BnbBlockMeta BlockMeta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not use bnb, use NativeToken instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a requirement from cipher trace: They will handle multi chain message, they want to us to distinguish common block message and bnb specified message. As you see, CryptoBlock
is actually totall metadata of block, while BnbBlockMeta
only hold the metadata only binance chain have.
app/pub/msgs.go
Outdated
Inputs []Input | ||
Outputs []Output | ||
|
||
BnbTransaction BnbTransaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's BnbTransaction mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message only transaction of Binance chain have.
# whether the kafka open SASL_PLAINTEXT auth | ||
auth = {{ .PublicationConfig.Auth }} | ||
kafkaUserName = "{{ .PublicationConfig.KafkaUserName }}" | ||
kafkaPassword = "{{ .PublicationConfig.KafkaPassword }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it secure to put username and password in the config file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't use this. Actually there are some offline method can solve this, decipher the password and start the node, then encrypt the password. If going to support encryption of password, have to store decryption material in some hardware or cloud service, more requirement for the hardware. Just leave it to cipher trace.
5177b28
to
aaee617
Compare
gofmt & goimports update dependent add auth to cipher publish fail fast fix review suggestion add change log fix import change back to develop branch
Description
resolve #668
Third part requires some extra info and more common info(just like other chain) to audit.
So we add a new topic to publish more block info.
related pr bnb-chain/bnc-cosmos-sdk#167
Rationale
Here is the schema
blockdata.json.zip
Notice that the metrics changed: PublishBlockTimeMs is not more the total time, rename to PublishTotalTimeMs.
Notice: Account have an new field: sequence , all downstream service need update the schema @cpzhao @erhenglu @fletcher142
Example
Changes
Notable changes:
Preflight checks
make build
)make test
)Race test-case in app/app_test package is failed. Even in master it fails, @xiangdotli @rickyyangz know about this. won't fix in thsi pr
make integration_test
)Already reviewed by
...
Related issues
resolve #668