19 Commits

Author SHA1 Message Date
web3-bot
701f9d5222 chore!: bump go.mod to Go 1.24 and run go fix (#65)
BREAKING CHANGE: Updating the Go version to 1.24
2025-08-21 08:31:50 +01:00
web3-bot
eabda15156 ci: uci/copy-templates (#64)
* chore: add or force update .github/workflows/stale.yml

* chore: add or force update .github/workflows/generated-pr.yml
2025-03-28 14:06:30 +01:00
web3-bot
766dbc86ae chore!: bump go.mod to Go 1.23 and run go fix (#63)
BREAKING CHANGE: Updating the Go version to 1.23
2025-02-16 21:01:37 +01:00
web3-bot
44b28418c8 chore: bump go.mod to Go 1.22 and run go fix (#61) 2024-08-26 11:26:41 +01:00
web3-bot
989fa114c3 ci: uci/copy-templates (#60)
* chore: add or force update .github/workflows/go-test.yml

* chore: add or force update .github/workflows/go-check.yml

* chore: add or force update .github/workflows/releaser.yml

* chore: add or force update .github/workflows/release-check.yml

* chore: add or force update .github/workflows/tagpush.yml

* chore: add or force update .github/workflows/go-test.yml

* chore: add or force update .github/workflows/go-check.yml

* chore: add or force update .github/workflows/releaser.yml

* chore: add or force update .github/workflows/release-check.yml

* chore: add or force update .github/workflows/tagpush.yml

* chore: add or force update .github/workflows/go-test.yml

* chore: add or force update .github/workflows/go-check.yml

* chore: add or force update .github/workflows/releaser.yml

* chore: add or force update .github/workflows/release-check.yml

* chore: add or force update .github/workflows/tagpush.yml
2024-03-22 07:17:09 +00:00
web3-bot
02ed95de81 ci: uci/update-go (#59)
* chore: bump go.mod to Go 1.21 and run go fix

* chore: run go mod tidy
2024-03-14 12:25:52 +01:00
web3-bot
a0303a6f45 chore: bump go.mod to Go 1.20 and run go fix (#58) 2023-08-14 15:36:12 +02:00
web3-bot
8c53981821 ci: uci/copy-templates (#57)
* chore: add or force update .github/workflows/go-test.yml

* chore: add or force update .github/workflows/go-check.yml

* chore: add or force update .github/workflows/releaser.yml

* chore: add or force update .github/workflows/release-check.yml

* chore: add or force update .github/workflows/tagpush.yml
2023-08-14 08:20:20 +02:00
web3-bot
8b61179671 chore: delete templates [skip ci] (#56) 2023-08-13 21:28:16 +02:00
Rod Vagg
58a41f7df1 chore: bump v0.2.0 2023-03-15 15:43:10 +11:00
Rod Vagg
a791fa9589 fix: math/rand -> crypto/rand 2023-03-15 15:43:10 +11:00
web3-bot
c36c36f88b update .github/workflows/release-check.yml 2023-03-15 15:43:10 +11:00
web3-bot
3bbbe822b0 update .github/workflows/go-check.yml 2023-03-15 15:43:10 +11:00
web3-bot
b85d20169d update .github/workflows/go-test.yml 2023-03-15 15:43:10 +11:00
web3-bot
8170d966f8 bump go.mod to Go 1.19 and run go fix 2023-03-15 15:43:10 +11:00
Jorropo
c442d70f87 fuzz: add Decoder fuzzing
This uses the spec tests as seeding value.
2023-01-08 22:58:38 +01:00
web3-bot
7160a7347e sync: update CI config files (#53) 2022-08-23 16:23:09 +00:00
Jorropo
c1bc15b22e chore: release version 0.1.1 2022-06-17 10:57:57 +10:00
Jorropo
801f90a945 fix: add new emoji codepoint for Base256Emoji 🐉
One of the values of base256emoji was not actually an emoji.

Here there be dragons instead !

See df5b7bc6ee (r75683795) for context.
2022-06-17 10:57:57 +10:00
14 changed files with 132 additions and 164 deletions

View File

@@ -1,11 +0,0 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.
name: Automerge
on: [ pull_request ]
jobs:
automerge:
uses: protocol/.github/.github/workflows/automerge.yml@master
with:
job: 'automerge'

14
.github/workflows/generated-pr.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Close Generated PRs
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
jobs:
stale:
uses: ipdxco/unified-github-workflows/.github/workflows/reusable-generated-pr.yml@v1

View File

@@ -1,73 +1,18 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.
on: [push, pull_request]
name: Go Checks name: Go Checks
on:
pull_request:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
jobs: jobs:
unit: go-check:
runs-on: ubuntu-latest uses: ipdxco/unified-github-workflows/.github/workflows/go-check.yml@v1.0
name: All
env:
RUNGOGENERATE: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-go@v2
with:
go-version: "1.18.x"
- name: Run repo-specific setup
uses: ./.github/actions/go-check-setup
if: hashFiles('./.github/actions/go-check-setup') != ''
- name: Read config
if: hashFiles('./.github/workflows/go-check-config.json') != ''
run: |
if jq -re .gogenerate ./.github/workflows/go-check-config.json; then
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 # 2022.1 (v0.3.0)
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.2
with:
run: |
go mod tidy
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
echo "go.sum was added by go mod tidy"
exit 1
fi
git diff --exit-code -- go.sum go.mod
- name: gofmt
if: ${{ success() || failure() }} # run this step even if the previous one failed
run: |
out=$(gofmt -s -l .)
if [[ -n "$out" ]]; then
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
exit 1
fi
- name: go vet
if: ${{ success() || failure() }} # run this step even if the previous one failed
uses: protocol/multiple-go-modules@v1.2
with:
run: go vet ./...
- name: staticcheck
if: ${{ success() || failure() }} # run this step even if the previous one failed
uses: protocol/multiple-go-modules@v1.2
with:
run: |
set -o pipefail
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
- name: go generate
uses: protocol/multiple-go-modules@v1.2
if: (success() || failure()) && env.RUNGOGENERATE == 'true'
with:
run: |
git clean -fd # make sure there aren't untracked files / directories
go generate ./...
# check if go generate modified or added any files
if ! $(git add . && git diff-index HEAD --exit-code --quiet); then
echo "go generated caused changes to the repository:"
git status --short
exit 1
fi

View File

@@ -1,68 +1,20 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.
on: [push, pull_request]
name: Go Test name: Go Test
on:
pull_request:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
jobs: jobs:
unit: go-test:
strategy: uses: ipdxco/unified-github-workflows/.github/workflows/go-test.yml@v1.0
fail-fast: false secrets:
matrix: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.17.x", "1.18.x" ]
env:
COVERAGES: ""
runs-on: ${{ format('{0}-latest', matrix.os) }}
name: ${{ matrix.os }} (go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Go information
run: |
go version
go env
- name: Use msys2 on windows
if: ${{ matrix.os == 'windows' }}
shell: bash
# The executable for msys2 is also called bash.cmd
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells
# If we prepend its location to the PATH
# subsequent 'shell: bash' steps will use msys2 instead of gitbash
run: echo "C:/msys64/usr/bin" >> $GITHUB_PATH
- name: Run repo-specific setup
uses: ./.github/actions/go-test-setup
if: hashFiles('./.github/actions/go-test-setup') != ''
- name: Run tests
uses: protocol/multiple-go-modules@v1.2
with:
# Use -coverpkg=./..., so that we include cross-package coverage.
# If package ./A imports ./B, and ./A's tests also cover ./B,
# this means ./B's coverage will be significantly higher than 0%.
run: go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./...
- name: Run tests (32 bit)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
uses: protocol/multiple-go-modules@v1.2
env:
GOARCH: 386
with:
run: |
export "PATH=${{ env.PATH_386 }}:$PATH"
go test -v ./...
- name: Run tests with race detector
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
uses: protocol/multiple-go-modules@v1.2
with:
run: go test -v -race ./...
- name: Collect coverage files
shell: bash
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
- name: Upload coverage to Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
with:
files: '${{ env.COVERAGES }}'
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

View File

@@ -1,11 +1,19 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.
name: Release Checker name: Release Checker
on: on:
pull_request: pull_request_target:
paths: [ 'version.json' ] paths: [ 'version.json' ]
types: [ opened, synchronize, reopened, labeled, unlabeled ]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
release-check: release-check:
uses: protocol/.github/.github/workflows/release-check.yml@master uses: ipdxco/unified-github-workflows/.github/workflows/release-check.yml@v1.0

View File

@@ -1,11 +1,17 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.
name: Releaser name: Releaser
on: on:
push: push:
paths: [ 'version.json' ] paths: [ 'version.json' ]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true
jobs: jobs:
releaser: releaser:
uses: protocol/.github/.github/workflows/releaser.yml@master uses: ipdxco/unified-github-workflows/.github/workflows/releaser.yml@v1.0

14
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Close Stale Issues
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
jobs:
stale:
uses: ipdxco/unified-github-workflows/.github/workflows/reusable-stale-issue.yml@v1

View File

@@ -1,12 +1,18 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.
name: Tag Push Checker name: Tag Push Checker
on: on:
push: push:
tags: tags:
- v* - v*
permissions:
contents: read
issues: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
releaser: releaser:
uses: protocol/.github/.github/workflows/tagpush.yml@master uses: ipdxco/unified-github-workflows/.github/workflows/tagpush.yml@v1.0

View File

@@ -11,7 +11,8 @@ var base256emojiTable = [256]rune{
'🚀', '🪐', '☄', '🛰', '🌌', // Space '🚀', '🪐', '☄', '🛰', '🌌', // Space
'🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘', // Moon '🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘', // Moon
'🌍', '🌏', '🌎', // Our Home, for now (earth) '🌍', '🌏', '🌎', // Our Home, for now (earth)
'', '☀', // Our Garden, for now (sol) '🐉', // Dragon!!!
'☀', // Our Garden, for now (sol)
'💻', '🖥', '💾', '💿', // Computer '💻', '🖥', '💾', '💿', // Computer
// The rest is completed from https://home.unicode.org/emoji/emoji-frequency/ at the time of creation (december 2021) (the data is from 2019), most used first until we reach 256. // The rest is completed from https://home.unicode.org/emoji/emoji-frequency/ at the time of creation (december 2021) (the data is from 2019), most used first until we reach 256.
// We exclude modifier based emojies (such as flags) as they are bigger than one single codepoint. // We exclude modifier based emojies (such as flags) as they are bigger than one single codepoint.

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/multiformats/go-multibase module github.com/multiformats/go-multibase
go 1.17 go 1.24
require ( require (
github.com/mr-tron/base58 v1.1.0 github.com/mr-tron/base58 v1.1.0

View File

@@ -2,7 +2,7 @@ package multibase
import ( import (
"bytes" "bytes"
"math/rand" "crypto/rand"
"sort" "sort"
"testing" "testing"
) )

2
spec

Submodule spec updated: cffd1aa308...4c8344e378

View File

@@ -145,3 +145,36 @@ func TestSpecVectors(t *testing.T) {
}) })
} }
} }
func FuzzDecode(f *testing.F) {
files, err := filepath.Glob("spec/tests/*.csv")
if err != nil {
f.Fatal(err)
}
for _, fname := range files {
func() {
file, err := os.Open(fname)
if err != nil {
f.Fatal(err)
}
defer file.Close()
reader := csv.NewReader(file)
reader.LazyQuotes = false
reader.FieldsPerRecord = 2
reader.TrimLeadingSpace = true
values, err := reader.ReadAll()
if err != nil {
f.Fatal(err)
}
for _, tc := range values[1:] {
f.Add(tc[1])
}
}()
}
f.Fuzz(func(_ *testing.T, data string) {
Decode(data)
})
}

View File

@@ -1,3 +1,3 @@
{ {
"version": "v0.1.0" "version": "v0.2.0"
} }