Skip to content
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

Merge upstream 1.2.0 #50

Closed
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6885841
Fix karlsend help prompt issue #34
masben-mb Jan 31, 2024
36ce697
Merge pull request #35 from masben-mb/master
lemois-1337 Jan 31, 2024
0f02b1b
Fix The karlsenminer still shows a Go trace #38
masben-mb Feb 11, 2024
8210c54
Update config.go
lemois-1337 Feb 13, 2024
28050a8
Merge pull request #39 from masben-mb/master
lemois-1337 Feb 13, 2024
a37514f
Fixed 'TestCalcDeflationaryPeriodBlockSubsidy' and added '1.4' reduct…
lemois-1337 Feb 14, 2024
cc5b33a
Fixed 'TestAddresses' and 'TestDecodeAddressErrorConditions' test cases
lemois-1337 Feb 14, 2024
88c769f
Fixed 'TestBlockWindow' test case
lemois-1337 Feb 14, 2024
423f5f8
Fixed 'TestDifficulty' test case
lemois-1337 Feb 14, 2024
1444625
Fixed 'TestPruning' test case
lemois-1337 Feb 14, 2024
9fe2fc9
Fixed 'TestCalculateSignatureHashSchnorr' and 'TestCalculateSignature…
lemois-1337 Feb 14, 2024
4f48ae8
Fixed 'TestMatrix_HeavyHash' test case
lemois-1337 Feb 14, 2024
c864cc0
Fixed 'ExamplePayToAddrScript' and 'ExampleExtractScriptPubKeyAddress…
lemois-1337 Feb 14, 2024
2229343
Fixed test cases:
lemois-1337 Feb 14, 2024
df03a6a
Fixed 'TestGetHashrateString' test case
lemois-1337 Feb 14, 2024
ccd9113
Fixed 'daa' stability test
lemois-1337 Feb 15, 2024
bd0c817
Fixed 'karlsendsanity' stability test
lemois-1337 Feb 15, 2024
c5ad5b0
Fixed network prefix in shared stability test code
lemois-1337 Feb 15, 2024
d72de6a
Fixed 'mempool-limits' stability test
lemois-1337 Feb 15, 2024
d2fee89
Fixed stability tests to be executed on local system
lemois-1337 Feb 15, 2024
62b69e3
Updated GitHub workflow to run 'stability-test-fast'
lemois-1337 Feb 15, 2024
c457e3c
Fixed 'build_and_test.sh' to run locally.
lemois-1337 Feb 16, 2024
9f5deec
Fixed formatting issues to pass tests and removed CR/LF line endings
lemois-1337 Feb 16, 2024
b4c41a0
Use 'bash' from non-standard to support non-Linux systems
lemois-1337 Feb 16, 2024
ae54f8b
Updated README.md:
lemois-1337 Feb 16, 2024
cfdab59
Added 'windows-latest' to testplan and Go v1.21 to race tests
lemois-1337 Feb 16, 2024
a863706
Updated GitHub actions from v2 to v4
lemois-1337 Feb 16, 2024
ac6772b
Removed duplicated decoded address check in 'TestAddresses'
lemois-1337 Feb 16, 2024
feb42c2
Merge pull request #41 from lemois-1337/2024-fixes-tests-and-github-w…
lemois-1337 Feb 16, 2024
7811813
Added Karlsen code of conduct and contributing description
lemois-1337 Feb 16, 2024
0112b04
Added karlsend changelog
lemois-1337 Feb 16, 2024
d2d3ddd
Split the Karlsen network from Kaspa in all stability tests
lemois-1337 Feb 16, 2024
f4d5087
Updated go modules and dependencies
lemois-1337 Feb 21, 2024
cb071c9
Workaround for go -race detected issues:
lemois-1337 Feb 21, 2024
957016e
Run scheduled race detector workflow on 'stable' and 'latest' branch
lemois-1337 Feb 21, 2024
7fe6504
Fixed a crash in karlsenminer while limiting number of blocks:
lemois-1337 Feb 22, 2024
7e93264
Merge pull request #42 from lemois-1337/2024-fixes-races
lemois-1337 Feb 22, 2024
9f16499
Updated documentation and fixed some typos and style
lemois-1337 Feb 18, 2024
755eb29
Final split of Karlsen from Kaspa:
lemois-1337 Feb 23, 2024
e20a090
Unique cointype for slip-0044 satoshilabs
lemois-1337 Feb 23, 2024
378ae4f
Added Karlsen developers copyright
lemois-1337 Feb 23, 2024
77a5967
Merge pull request #43 from lemois-1337/2024-finish-karlsen-fork
lemois-1337 Feb 23, 2024
1bcb802
Implemented wallet version 2 with unique derivation path:
lemois-1337 Mar 6, 2024
b8decf0
Show used wallet version and warning if legacy is used
lemois-1337 Mar 6, 2024
0d7b61a
Changed default listen port from 8082 to 9182 to not interfere with K…
lemois-1337 Mar 6, 2024
713d2cc
Merge pull request #45 from lemois-1337/2024-fixes-karlsen-wallet
lemois-1337 Mar 6, 2024
1c14b56
Fixed Go standard formatting
lemois-1337 Mar 6, 2024
c5c65bc
Updated version to 1.2.0
lemois-1337 Mar 6, 2024
b7eeb18
Added testutil to walk through all available derivation paths
lemois-1337 Mar 6, 2024
f93f5aa
Added transaction and split transaction test case for v1 and v2 wallet
lemois-1337 Mar 6, 2024
c31daa1
Updated for next release
lemois-1337 Mar 6, 2024
d4a936f
Fixed a typo and again, make go fmt happy
lemois-1337 Mar 6, 2024
3c63c5e
Merge pull request #44 from lemois-1337/2024-bip39-cointype-fixes
lemois-1337 Mar 6, 2024
75d1433
Merge branch 'merge-upstream-1.2.0' into merge-v1.2.0-fixed
okilisan Apr 5, 2024
47a134b
Merge pull request #6 from karlsen-network/merge-v1.2.0-fixed
okilisan Apr 5, 2024
301181d
fix some semantics to pass the coding style test
Apr 5, 2024
ae06651
coding style fixes
Apr 5, 2024
069b067
coding style fix
Apr 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed formatting issues to pass tests and removed CR/LF line endings
lemois-1337 committed Feb 16, 2024
commit 9f5deece688759c0cb7db0c9c56c65833b5535f4
180 changes: 90 additions & 90 deletions cmd/karlsenwallet/utils/format_kas_test.go
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
package utils
import "testing"
// Takes in a string representation of the Kas value to convert to Sompi
func TestKasToSompi(t *testing.T) {
type testVector struct {
originalAmount string
convertedAmount uint64
}
validCases := []testVector{
{originalAmount: "0", convertedAmount: 0},
{originalAmount: "1", convertedAmount: 100000000},
{originalAmount: "33184.1489732", convertedAmount: 3318414897320},
{originalAmount: "21.35808032", convertedAmount: 2135808032},
{originalAmount: "184467440737.09551615", convertedAmount: 18446744073709551615},
}
for _, currentTestVector := range validCases {
convertedAmount, err := KasToSompi(currentTestVector.originalAmount)
if err != nil {
t.Error(err)
} else if convertedAmount != currentTestVector.convertedAmount {
t.Errorf("Expected %s, to convert to %d. Got: %d", currentTestVector.originalAmount, currentTestVector.convertedAmount, convertedAmount)
}
}
invalidCases := []string{
"184467440737.09551616", // Bigger than max uint64
"-1",
"a",
"",
}
for _, currentTestVector := range invalidCases {
_, err := KasToSompi(currentTestVector)
if err == nil {
t.Errorf("Expected an error but succeeded validation for test case %s", currentTestVector)
}
}
}
func TestValidateAmountFormat(t *testing.T) {
validCases := []string{
"0",
"1",
"1.0",
"0.1",
"0.12345678",
"111111111111.11111111", // 12 digits to the left of decimal, 8 digits to the right
"184467440737.09551615", // Maximum input that can be represented in sompi later
"184467440737.09551616", // Cannot be represented in sompi, but we'll acccept for "correct format"
"999999999999.99999999", // Cannot be represented in sompi, but we'll acccept for "correct format"
}
for _, testCase := range validCases {
err := validateKASAmountFormat(testCase)
if err != nil {
t.Error(err)
}
}
invalidCases := []string{
"",
"a",
"-1",
"0.123456789", // 9 decimal digits
".1", // decimal but no integer component
"0a", // Extra character
"0000000000000", // 13 zeros
"012", // Int padded with zero
"00.1", // Decimal padded with zeros
"111111111111111111111", // all digits
"111111111111A11111111", // non-period/non-digit where decimal would be
"000000000000.00000000", // all zeros
"kaspa", // all text
}
for _, testCase := range invalidCases {
err := validateKASAmountFormat(testCase)
if err == nil {
t.Errorf("Expected an error but succeeded validation for test case %s", testCase)
}
}
}
package utils

import "testing"

// Takes in a string representation of the Kas value to convert to Sompi
func TestKasToSompi(t *testing.T) {
type testVector struct {
originalAmount string
convertedAmount uint64
}

validCases := []testVector{
{originalAmount: "0", convertedAmount: 0},
{originalAmount: "1", convertedAmount: 100000000},
{originalAmount: "33184.1489732", convertedAmount: 3318414897320},
{originalAmount: "21.35808032", convertedAmount: 2135808032},
{originalAmount: "184467440737.09551615", convertedAmount: 18446744073709551615},
}

for _, currentTestVector := range validCases {
convertedAmount, err := KasToSompi(currentTestVector.originalAmount)

if err != nil {
t.Error(err)
} else if convertedAmount != currentTestVector.convertedAmount {
t.Errorf("Expected %s, to convert to %d. Got: %d", currentTestVector.originalAmount, currentTestVector.convertedAmount, convertedAmount)
}
}

invalidCases := []string{
"184467440737.09551616", // Bigger than max uint64
"-1",
"a",
"",
}

for _, currentTestVector := range invalidCases {
_, err := KasToSompi(currentTestVector)

if err == nil {
t.Errorf("Expected an error but succeeded validation for test case %s", currentTestVector)
}
}
}

func TestValidateAmountFormat(t *testing.T) {
validCases := []string{
"0",
"1",
"1.0",
"0.1",
"0.12345678",
"111111111111.11111111", // 12 digits to the left of decimal, 8 digits to the right
"184467440737.09551615", // Maximum input that can be represented in sompi later
"184467440737.09551616", // Cannot be represented in sompi, but we'll acccept for "correct format"
"999999999999.99999999", // Cannot be represented in sompi, but we'll acccept for "correct format"
}

for _, testCase := range validCases {
err := validateKASAmountFormat(testCase)

if err != nil {
t.Error(err)
}
}

invalidCases := []string{
"",
"a",
"-1",
"0.123456789", // 9 decimal digits
".1", // decimal but no integer component
"0a", // Extra character
"0000000000000", // 13 zeros
"012", // Int padded with zero
"00.1", // Decimal padded with zeros
"111111111111111111111", // all digits
"111111111111A11111111", // non-period/non-digit where decimal would be
"000000000000.00000000", // all zeros
"kaspa", // all text
}

for _, testCase := range invalidCases {
err := validateKASAmountFormat(testCase)

if err == nil {
t.Errorf("Expected an error but succeeded validation for test case %s", testCase)
}
}
}
Original file line number Diff line number Diff line change
@@ -49,32 +49,32 @@ func TestCalcDeflationaryPeriodBlockSubsidy(t *testing.T) {
},
{
name: "after 2 years",
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving * 2,
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving*2,
expectedBlockSubsidy: uint64(math.Trunc(deflationaryPhaseBaseSubsidy / math.Pow(1.4, 2))),
},
{
name: "after 5 years",
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving * 5,
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving*5,
expectedBlockSubsidy: uint64(math.Trunc(deflationaryPhaseBaseSubsidy / math.Pow(1.4, 5))),
},
{
name: "after 32 years",
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving * 32,
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving*32,
expectedBlockSubsidy: uint64(math.Trunc(deflationaryPhaseBaseSubsidy / math.Pow(1.4, 32))),
},
{
name: "after 64 years",
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving * 64,
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving*64,
expectedBlockSubsidy: uint64(math.Trunc(deflationaryPhaseBaseSubsidy / math.Pow(1.4, 64))),
},
{
name: "just before subsidy depleted",
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving * 65,
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving*65,
expectedBlockSubsidy: 1,
},
{
name: "after subsidy depleted",
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving * 66,
blockDaaScore: deflationaryPhaseDaaScore + secondsPerHalving*66,
expectedBlockSubsidy: 0,
},
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.