bnb-chain / tss-lib

Threshold Signature Scheme, for ECDSA and EDDSA
MIT License
759 stars 261 forks source link

copy of Mutex is not safe #269

Closed levischechter closed 10 months ago

levischechter commented 10 months ago

common.SignatureData has MessageState field which contains Mutex. when signing is done we need to get common.SignatureData from the end channel which copies the value inside the channel. this operation is not safe in terms of concurrency handling.

I suggest that the end channel will be of *common.SignatureData (pointer of common.SignatureData) this way the copy will be by reference which is safe.

I also suggest that for compatible with the keygen process, the end channel of keygen will also be of type *LocalPartySaveData (pointer of LocalPartySaveData). even though LocalPartySaveDatahas no Mutex.

yycen commented 10 months ago

Thanks. https://github.com/bnb-chain/tss-lib/pull/251 is a related PR.

levischechter commented 10 months ago

Great! when can I expect it to be published to https://pkg.go.dev ?

yycen commented 10 months ago

https://github.com/bnb-chain/tss-lib/releases/tag/v2.0.1 here is a new release. It should be updated on pkg.go.dev soon.

levischechter commented 10 months ago

thanks a lot. it also made me switch to v2. I didn't know I should.