Skip to content

Commit

Permalink
Add initial code (#1)
Browse files Browse the repository at this point in the history
* Add initial code

* Downgrade testify to match go-algorand's version (#3)

* Use `avm_abi` package name

* Revert "Use `avm_abi` package name"

This reverts commit 10a0279.

* Rename directory to abi

* Add `golangci-lint` (#4)

* Add golangci-lint

* Checkout code first

* Lint tests

* Code changes (#2)

* Make all txn types into variables

* Remove ParseArgJSONtoByteSlice

* Use '%w' for errors

* Remove no longer relevent comment

* Test VerifyMethodSignature

* Add documentation

* Make readme match docs

* Update docs package

* Update abi/doc.go

Co-authored-by: Michael Diamant <[email protected]>

Co-authored-by: Michael Diamant <[email protected]>

Co-authored-by: Michael Diamant <[email protected]>
  • Loading branch information
jasonpaulos and michaeldiamant authored Aug 10, 2022
1 parent bc82a43 commit d993539
Show file tree
Hide file tree
Showing 13 changed files with 3,576 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: golangci-lint
on:
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.41.1
- name: golangci-lint warnings
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.41.1
# Optional: golangci-lint command line arguments.
args: -c .golangci-warnings.yml
39 changes: 39 additions & 0 deletions .golangci-warnings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
run:
timeout: 5m
tests: true

linters:
disable-all: true
enable:
- staticcheck
- structcheck
- typecheck
- varcheck
- deadcode
- gosimple
- unused

severity:
default-severity: warning

issues:
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
exclude-use-default: false

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

exclude:
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
- "exported method (.*).Unwrap` should have comment or be unexported"

# Enable some golangci-lint default exception rules:
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop
38 changes: 38 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
run:
timeout: 5m
tests: true

linters:
disable-all: true
enable:
- errcheck
- gofmt
- golint
- govet
- ineffassign
- misspell

severity:
default-severity: error

issues:
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
exclude-use-default: false

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

exclude:
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
- "exported method (.*).Unwrap` should have comment or be unexported"

# Enable some golangci-lint default exception rules:
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# avm-abi

A reference implementation for the Algorand [ARC-4](https://arc.algorand.foundation/ARCs/arc-0004) ABI type system.
An implementation of the Algorand [ARC-4](https://arc.algorand.foundation/ARCs/arc-0004) ABI type system.
14 changes: 14 additions & 0 deletions abi/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Package abi provides an implementation of the Algorand ARC-4 ABI type system.
See https://arc.algorand.foundation/ARCs/arc-0004 for the corresponding specification.
Basic Operations
This package can parse ABI type names using the `abi.TypeOf()` function.
`abi.TypeOf()` returns an `abi.Type` struct. The `abi.Type` struct's `Encode` and `Decode` methods
can convert between Go values and encoded ABI byte strings.
*/
package abi
Loading

0 comments on commit d993539

Please sign in to comment.