Skip to content

Commit

Permalink
test: invalid bech32 address
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Mar 22, 2024
1 parent a258319 commit a6c6a49
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gnovm/stdlibs/std/crypto_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ func TestValid(t *testing.T) {
{inputAddress: "g127jydsh6cms3lrtdenydxsckh23a8d6emqcvfa", expected: true},
{inputAddress: "g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq", expected: true},
{inputAddress: "g14da4n9hcynyzz83q607uu8keuh9hwlv42ra6fa", expected: true},

// Bech32 doesn't allow '1', 'b', 'i', 'o' for data part
//
// https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
{inputAddress: "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5", expected: true},
{inputAddress: "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf1", expected: false},
{inputAddress: "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqfb", expected: false},
{inputAddress: "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqfi", expected: false},
{inputAddress: "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqfo", expected: false},

{inputAddress: "g1u0000000000000000000000000000000000000", expected: false},
{inputAddress: "", expected: false},
{inputAddress: "000000000000", expected: false},
{inputAddress: "0000000000000000000000000000000000000000000000000000000000000000000000", expected: false},
Expand Down

0 comments on commit a6c6a49

Please sign in to comment.