Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pedro/health_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Oct 29, 2024
2 parents 19db51a + b6380d5 commit 22bc2c2
Show file tree
Hide file tree
Showing 129 changed files with 3,652 additions and 1,156 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/gosec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Gosec
on:
schedule:
# # This is meant to run every day at 8am
- cron: '0 8 * * 1-5'

jobs:
gosec:
runs-on: ubuntu-latest
env:
GO111MODULE: on
outputs:
gosec-status: ${{ steps.gosec-run.outcome }}
steps:
- name: Checkout Source
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- name: Run Gosec
id: gosec-run
continue-on-error: true
uses: securego/gosec@master
with:
args: '-exclude=G104,G115,G304,G406,G507 -exclude-dir=builtin/gen ./...'

notify-slack:
name: Notify Slack
needs:
- gosec
if: always() && needs.gosec.outputs.gosec-status == 'failure'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Notify Slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.GOSEC_SLACK_WEBHOOK }}
with:
payload: |
{
"commit-url": "${{ github.event.head_commit.url }}",
"branch": "${{ github.ref }}",
"repository": "${{ github.repository }}",
}
4 changes: 1 addition & 3 deletions .github/workflows/lint-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
version: v1.60.3
# use the default if on main branch, otherwise use the pull request config
args: --timeout=30m --config=.golangci.yml
only-new-issues: true
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
7 changes: 3 additions & 4 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
retention-days: 7

run-tests:
# https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html#sample-github-action-runners-create-project
runs-on: codebuild-ThorGHA-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large
runs-on: ubuntu-latest
needs: build-docker-image
env:
THOR_IMAGE: vechain/thor:${{ github.sha }}
Expand All @@ -44,8 +43,8 @@ jobs:
uses: actions/checkout@v4
with:
repository: vechain/thor-e2e-tests
# https://github.com/vechain/thor-e2e-tests/tree/d86b30b6409b27e841eace0f7c5b6e75c0a4e25e
ref: d86b30b6409b27e841eace0f7c5b6e75c0a4e25e
# https://github.com/vechain/thor-e2e-tests/tree/209f6ea9a81a98dc2d5e42bf036d2878c5837036
ref: 209f6ea9a81a98dc2d5e42bf036d2878c5837036

- name: Download artifact
uses: actions/download-artifact@v4
Expand Down
20 changes: 18 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run:
tests: true
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
exclude-dirs-use-default: true

linters:
disable-all: true
Expand All @@ -22,9 +22,10 @@ linters:
- staticcheck
- bidichk
- durationcheck
- exportloopref
- copyloopvar
- whitespace
- gosec
- revive

# - structcheck # lots of false positives
# - errcheck #lot of false positives
Expand All @@ -38,6 +39,21 @@ linters:
linters-settings:
gofmt:
simplify: true
gosec:
excludes:
- G115
- G406 # ignore ripe160 deprecation
- G507 # ignore ripe160 deprecation
revive:
rules:
- name: var-naming
severity: warning
disabled: false
exclude: [""]
arguments:
- [] # AllowList
- [] # DenyList
- - upperCaseConst: true # Extra parameter (upperCaseConst|skipPackageNameChecks)

issues:
max-issues-per-linter: 1000
Expand Down
4 changes: 2 additions & 2 deletions api/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (a *Accounts) handleGetCode(w http.ResponseWriter, req *http.Request) error
return err
}

return utils.WriteJSON(w, map[string]string{"code": hexutil.Encode(code)})
return utils.WriteJSON(w, &GetCodeResult{Code: hexutil.Encode(code)})
}

func (a *Accounts) getAccount(addr thor.Address, header *block.Header, state *state.State) (*Account, error) {
Expand Down Expand Up @@ -164,7 +164,7 @@ func (a *Accounts) handleGetStorage(w http.ResponseWriter, req *http.Request) er
if err != nil {
return err
}
return utils.WriteJSON(w, map[string]string{"value": storage.String()})
return utils.WriteJSON(w, &GetStorageResult{Value: storage.String()})
}

func (a *Accounts) handleCallContract(w http.ResponseWriter, req *http.Request) error {
Expand Down
Loading

0 comments on commit 22bc2c2

Please sign in to comment.