Skip to content

Commit

Permalink
testing: tame logs about missing translations (decred#2571)
Browse files Browse the repository at this point in the history
* tame logs about missing translations
  • Loading branch information
buck54321 committed Mar 1, 2024
1 parent 523506d commit cf4248f
Show file tree
Hide file tree
Showing 29 changed files with 3,830 additions and 1,303 deletions.
630 changes: 568 additions & 62 deletions client/asset/eth/contractor.go

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions client/asset/eth/contractor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eth

import (
"bytes"
"crypto/sha256"
"fmt"
"math/big"
"testing"
Expand Down Expand Up @@ -128,7 +129,8 @@ func TestRedeemV0(t *testing.T) {
c := contractorV0{contractV0: abiContract, evmify: dexeth.GweiToWei}

secretB := encode.RandomBytes(32)
secretHashB := encode.RandomBytes(32)
secretHash := sha256.Sum256(secretB)
secretHashB := secretHash[:]

redemption := &asset.Redemption{
Secret: secretB,
Expand Down Expand Up @@ -160,12 +162,12 @@ func TestRedeemV0(t *testing.T) {
// bad secret hash length
redemption.Spends.SecretHash = encode.RandomBytes(20)
checkResult("bad secret hash length", true)
redemption.Spends.SecretHash = encode.RandomBytes(32)
redemption.Spends.SecretHash = secretHashB

// bad secret length
redemption.Secret = encode.RandomBytes(20)
checkResult("bad secret length", true)
redemption.Secret = encode.RandomBytes(32)
redemption.Secret = secretB

// Redeem error
abiContract.redeemErr = fmt.Errorf("test error")
Expand All @@ -177,9 +179,11 @@ func TestRedeemV0(t *testing.T) {
checkResult("dupe error", true)

// two OK
secretB2 := encode.RandomBytes(32)
secretHash2 := sha256.Sum256(secretB2)
redemption2 := &asset.Redemption{
Secret: encode.RandomBytes(32),
Spends: &asset.AuditInfo{SecretHash: encode.RandomBytes(32)},
Secret: secretB2,
Spends: &asset.AuditInfo{SecretHash: secretHash2[:]},
}
redemptions = []*asset.Redemption{redemption, redemption2}
checkResult("two ok", false)
Expand Down
Loading

0 comments on commit cf4248f

Please sign in to comment.