Skip to content

Conversation

@dolgopolovwork
Copy link
Contributor

Description of the Bug

We use Iroha multisig transactions to create Bitcoin addresses. A previous source of time was a node time, meaning that multisig will never be succeeded because it will have different hash value on different nodes. Now we set time at caller level before address generation process starts. Those who starts address generation process also sets a time for a current address generation session. This time will be used by multiple nodes.

// Getting time
val time = details[ADDRESS_GENERATION_TIME_KEY]!!.toLong()
// Removing generation time. Only public keys remain
details.remove(ADDRESS_GENERATION_TIME_KEY)
Copy link
Member

@Mingela Mingela Dec 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can rewrite it without line 98 since remove: @return the previous value associated with the key, or `null` if the key was not present in the map.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds cool.

}
logger.info { "Address $msAddress was added to wallet. Current wallet state:\n${walletFile.wallet}" }
} else if (notaryKeys.size != peers) {
logger.info { "Not enough keys are collected to generate a multisig address(${notaryKeys.size} out of ${peers})" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${peers} braces are redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah. You are right. It will be fixed.

logger.info { "Address $msAddress was added to wallet. Current wallet state:\n${walletFile.wallet}" }
} else if (notaryKeys.size != peers) {
logger.info { "Not enough keys are collected to generate a multisig address(${notaryKeys.size} out of ${peers})" }
return@of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to throw something instead of just return@of ?

Copy link
Contributor Author

@dolgopolovwork dolgopolovwork Dec 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It simply means that we are in the middle of the process.

addressInfo.toJson(),
BigInteger.valueOf(generationTime)
).fold({
//TODO this save will probably corrupt the wallet file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it bad? What should we do with that in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very bad. But it also outdated)

addressInfo.toJson(),
BigInteger.valueOf(generationTime)
).fold({
//TODO this save will probably corrupt the wallet file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make a task for that?

@dolgopolovwork dolgopolovwork merged commit 336c47c into develop Dec 25, 2018
@dolgopolovwork dolgopolovwork deleted the bugfix/bitcoinAddressGenerationTime branch December 25, 2018 10:49
Alexey-N-Chernyshov added a commit that referenced this pull request Feb 6, 2019
Release v0.2.1-alpha

* Bitcoin deploy notes (#319)

* Boot repackage was disabled (#315)

* add more logs to eth registration

* add more logs to eth registration

* Bitcoin rollback (#321)

* Bitcoin rollback in case of network failures (#323)

* Bitcoin multisig address safe time source (#325)

* Ignoring failed Iroha account creation command (#324)

* Kill deposit if Iroha is not functioning (#326)

* add automatic relay deployment logic

* Separate shadow jar (#327)

* optimized import

* fix config helper

* add Sora iroha account to genesis and tests for Sora integration

* fix dogecoin precision (actual 9)

* rename getAccountAsset -> getAccountAssetBalance

* change getAccountAssets -> getIrohaAccountBalance

* Bitcoin dynamic fee rate (#329)

* Feature/healthcheck (#333)

* Add readme

* Add healthcheck endpoints

* Fix test compiler error

* Port increment

* Remove registration endpoint

* Transition to IPJ, Iroha rc2 version update (#335)

* Feature/iroha pure java (#307)

* move crypto to Iroha Pure Java library

* Transition to IPJ, Iroha rc2 version update (#330)

* Transition to IPJ

* Iroha rc1 update

* Test fixes

* Iroha rc2 update

* Updated permissions, roles, testing account

* Test fixes

* Update batches

* Fixed status streaming and batch testing

* Switched to ordered batches and to Query API of IPJ

* More queries refactoring, changed wrapper

* Unit tests fixes

* Ignored one more unit test

* Integration tests fixes

* fixup! Integration tests fixes

* fixup! Integration tests fixes

* fixup! fixup! Integration tests fixes

* Config test repaired

* Environment variables configs (#336)

* Added prioritized environment variables config loading

* Fixed working directory of eth services (#338)

* Fixed notary pub key (#340)

* Fixed notary pub key

* Deleted unused notary keys

* fix 'mkdir -p' in Jenkins build-logs (#341)

* Bitcoin services stabilization after migration to IPJ (#342)

* Automatic BTC addresses generation (#337)

* Bitcoin-cli in gradle (#344)

* Feature/tester permissions (#343)

* add permissions for tester account

* fix duplication of can_read_assets

* Fixed PeerGroup.stop()

* Fixing IPJ listener bug (#346)

* Relevant docker files (#345)

* Updated docker files, added bitcoin services

* Deleted variables

* Fixed jenkinsfile variables names

* Fixed main classes

* Fix wait for iroha bug (#348)

* Fix wait for iroha bug

* Add network to dev

* Fix typo

* Fix btc docker. Move dw and address geneartion from single to full (#349)

* Email notifications

* Added build commands to Jenkinsfile (#351)

* Feature/registration (#334)

* Fixed message

* Fixing build (#352)

* Fixed peer group close() (#354)

* SMTP dumbster integration test (#355)

Signed-off-by: Alexey Chernyshov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants