Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Dgld 2 #3

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Dgld 2 #3

wants to merge 15 commits into from

Conversation

haael
Copy link

@haael haael commented May 12, 2020

Description

DGLD implementation.

Testing instructions

Tests will be executed during build.

Types of changes

Rebased to new master.
Test cases, notably signing.
Some build system fixes.

val expected = AnyAddress("__EXPECTED_RESULT_ADDRESS__", CoinType.DIGITALGOLD)

assertEquals(pubkey.data().toHex(), "0x__EXPECTED_PUBKEY_DATA__")
assertEquals(address.description(), expected.description())

Choose a reason for hiding this comment

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

Are you planning to add test cases here? Seems like you already have one working on C++ core level

//assertEquals(
// "__EXPECTED_RESULT_DATA__",
// Numeric.toHexString(output.encoded.toByteArray())
//)

Choose a reason for hiding this comment

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

And here

let addressFromString = AnyAddress(string: "__ADDRESS_DATA__", coin: .digitalgold)!

XCTAssertEqual(pubkey.data.hexString, "__EXPECTED_PUBKEY_DATA__")
XCTAssertEqual(address.description, addressFromString.description)

Choose a reason for hiding this comment

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

And on Swift level too

memset(ed25519_public_key_val, 0, 32);
curve25519_pk_to_ed25519(ed25519_public_key_val, node->public_key + 1);
ed25519_sign(msg, msg_len, node->private_key, ed25519_public_key_val, sig);
const uint8_t sign_bit = ed25519_public_key_val[31] & 0x80;

Choose a reason for hiding this comment

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

Seems like a leftover from debugging? (Because it's just variable rename)
We don't want to change the core very much, unless it's really necessary

@@ -118,7 +119,7 @@ Data Base58::decode(const char* begin, const char* end) const {
}

// Skip trailing spaces.
it = std::find_if_not(it, end, std::isspace);
it = std::find_if_not(it, end, [](unsigned char ch) -> bool { return std::isspace(ch); });
Copy link

@pavel-bc pavel-bc May 14, 2020

Choose a reason for hiding this comment

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

Is it a new requirement enforced by altered build flags?
I still see the old lines in upstream master - https://github.com/trustwallet/wallet-core/blob/master/src/Base58.cpp#L80

@pavel-bc pavel-bc mentioned this pull request May 14, 2020
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants