Skip to content

Implement Wallet.create_pay_to_contract_address#22

Merged
rantan merged 3 commits intomasterfrom
generate_p2c_address
Jul 29, 2024
Merged

Implement Wallet.create_pay_to_contract_address#22
rantan merged 3 commits intomasterfrom
generate_p2c_address

Conversation

@Yamaguchi
Copy link
Contributor

Description

This PR implements to generate Pay-To-Contract address.

Notes to the reviewers

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@coveralls
Copy link

coveralls commented Jul 21, 2024

Pull Request Test Coverage Report for Build 10088223499

Details

  • 59 of 67 (88.06%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 81.498%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/wallet/src/wallet/mod.rs 59 67 88.06%
Totals Coverage Status
Change from base Build 10040732938: 0.04%
Covered Lines: 9937
Relevant Lines: 12193

💛 - Coveralls

serde_json = { version = "^1.0" }
tdk_chain = { path = "../chain", version = "0.15.0", features = ["miniscript", "serde"], default-features = false }
tdk_persist = { path = "../persist", version = "0.3.0", features = ["miniscript", "serde"], default-features = false }
curv-kzen = { git = "https://github.com/Yamaguchi/curv", branch = "make_GE_public_interface_for_sec256k1" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

curvのライブラリに一部問題があるため、forkしたものを使用しています。
fork元のリポジトリにPRは投げています。
ZenGo-X/curv#185

#[cfg(feature = "std")]
impl std::error::Error for ApplyBlockError {}

const CONTRACT_MAX_SIZE: usize = 256;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Contractの最大バイト数を暫定で256としています。(アプリ側でチェックするのであれば、ここでは不要かもしれません)

@Yamaguchi Yamaguchi force-pushed the generate_p2c_address branch from a79927a to 0b7e651 Compare July 22, 2024 09:11
@Yamaguchi Yamaguchi requested a review from rantan July 22, 2024 12:12
@Yamaguchi
Copy link
Contributor Author

curvをやめて、secp256k1のメソッドを使用するように変更してます。

@Yamaguchi Yamaguchi force-pushed the generate_p2c_address branch 3 times, most recently from 9fbe7ef to d1e714b Compare July 22, 2024 14:21
@Yamaguchi Yamaguchi force-pushed the generate_p2c_address branch from 00c7faf to 4ceda75 Compare July 24, 2024 10:06
* Remove unused line
* Validate in Wallet::pay_to_contract_key
* Modify the value to ensure that the value given during initialisation of the Scalar does not exceed Scalar::MAX.
@Yamaguchi Yamaguchi force-pushed the generate_p2c_address branch from 4ceda75 to 3f748d8 Compare July 25, 2024 04:31
@Yamaguchi Yamaguchi force-pushed the generate_p2c_address branch from 9bede4c to da7cde1 Compare July 25, 2024 04:36
@rantan rantan merged commit 1de6e63 into master Jul 29, 2024
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.

3 participants