Skip to content

Commit

Permalink
feat: automatic update of HederaResponseCodes.sol (#1220)
Browse files Browse the repository at this point in the history
* chore: test ci

Signed-off-by: nikolay <[email protected]>

* chore: test ci

Signed-off-by: nikolay <[email protected]>

* chore: test ci

Signed-off-by: nikolay <[email protected]>

* chore: add latest hedera response codes

Signed-off-by: nikolay <[email protected]>

* chore: rename .yml

Signed-off-by: nikolay <[email protected]>

* chore: rename .yml

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

* chore: push the latest contract

Signed-off-by: nikolay <[email protected]>

* chore: resolve comments

Signed-off-by: nikolay <[email protected]>

---------

Signed-off-by: nikolay <[email protected]>
  • Loading branch information
natanasow authored Feb 6, 2025
1 parent 1feae23 commit 3aa1542
Show file tree
Hide file tree
Showing 5 changed files with 1,200 additions and 413 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/update-hedera-response-codes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Update HederaResponseCodes.sol

on:
workflow_dispatch:

jobs:
parse-and-update-hedera-response-codes:
name: Make HederaResponseCodes up-to-date with the latest protobufs
runs-on: smart-contracts-linux-large

steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- name: Use Node.js [20]
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 20

- name: Install Dependencies
run: npm install

- name: Install Foundry
uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1
with:
version: nightly

- name: Parse and update response codes
run: node scripts/hedera-response-codes-protobuf-parser.js

- name: Compile the contracts
run: npx hardhat compile

- name: Import GPG Key
id: gpg_importer
uses: step-security/ghaction-import-gpg@6c8fe4d0126a59d57c21f87c9ae5dd3451fa3cca # v6.1.0
with:
git_commit_gpgsign: true
git_tag_gpgsign: true
git_user_signingkey: true
gpg_private_key: ${{ secrets.GPG_KEY_CONTENTS }}
passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }}

- name: Install jq
run: sudo apt-get install jq

- name: Fetch and set the milestone as env variable
run: |
echo "PR_MILESTONE=$(curl -s https://api.github.com/repos/hashgraph/hedera-smart-contracts/milestones | jq '.'[0].number)" >> $GITHUB_ENV
- name: Create Pull Request Target hedera-smart-contracts Repository
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with:
branch: HederaResponseCodes-Periodical-Update/${{ github.run_id }}
commit-message: 'chore: update HederaResponseContract.sol with the latest protobufs'
committer: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
add-paths: contracts/system-contracts/HederaResponseCodes.sol
author: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
token: ${{ secrets.GH_ACCESS_TOKEN }}
delete-branch: true
signoff: true
milestone: ${{ env.PR_MILESTONE }}
title: 'chore: update HederaResponseContract.sol with the latest protobufs'
body: >
**Description**: <br><br>
This PR fetches the latest hedera response codes from [hedera-services:main/hapi/hedera-protobufs/services/response_code.proto](https://github.com/hashgraph/hedera-services/blob/main/hapi/hedera-protobufs/services/response_code.proto) and put them into `HederaResponseCodes.sol` contract.
labels: 'internal'
assignees: 'swirlds-automation'
Loading

0 comments on commit 3aa1542

Please sign in to comment.