iroha icon indicating copy to clipboard operation
iroha copied to clipboard

[fix] #4311: fix pre-commit hook

Open Asem-Abdelhady opened this issue 1 year ago • 5 comments

Description

the pre-commit hook still generates the genesis in peer even though it does not exist anymore after the big change in the configuration

Linked issue

Closes #4311

Checklist

  • [X] I've read CONTRIBUTING.md
  • [X] I've used the standard signed-off commit format (or will squash just before merging)
  • [ ] All applicable CI checks pass (or I promised to make them pass later)
  • [ ] (optional) I've written unit tests for the code changes
  • [ ] I replied to all comments after code review, marking all implemented changes with thumbs up

Asem-Abdelhady avatar Feb 21 '24 07:02 Asem-Abdelhady

I think someone's working example of .git/hooks/pre-commit would help

I don't use pre-commit hook but here is

Some commands from my .vscode/tasks.json
      {
          "label": "regenerate genesis",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "command": "cargo",
          "args": [
              "run",
              "--release",
              "--bin",
              "kagami",
              "--",
              "genesis",
              "--executor-path-in-genesis=./executor.wasm",
              ">",
              "${workspaceFolder}/configs/swarm/genesis.json",
          ],
      },
      {
          "label": "regenerate executor",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "command": "cargo",
          "args": [
              "run",
              "--release",
              "--bin",
              "iroha_wasm_builder_cli",
              "--",
              "build",
              "${workspaceFolder}/default_executor",
              "--optimize",
              "--outfile",
              "${workspaceFolder}/configs/swarm/executor.wasm",
          ],
      },
      {
          "label": "regenerate schema",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "command": "cargo",
          "args": [
              "run",
              "--release",
              "--bin",
              "kagami",
              "--",
              "schema",
              ">",
              "${workspaceFolder}/docs/source/references/schema.json",
          ],
      },
      {
          "label": "regenerate docker compose single",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "command": "cargo",
          "args": [
              "run",
              "--release",
              "--bin",
              "iroha_swarm",
              "--",
              "-p",
              "1",
              "-s",
              "Iroha",
              "--force",
              "--config-dir",
              "./configs/swarm",
              "--health-check",
              "--build",
              ".",
              "--outfile",
              "configs/swarm/docker-compose.single.yml"
          ],
      },
      {
          "label": "regenerate docker compose multiple",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "command": "cargo",
          "args": [
              "run",
              "--release",
              "--bin",
              "iroha_swarm",
              "--",
              "-p",
              "4",
              "-s",
              "Iroha",
              "--force",
              "--config-dir",
              "./configs/swarm",
              "--health-check",
              "--build",
              ".",
              "--outfile",
              "configs/swarm/docker-compose.local.yml"
          ],
      },
      {
          "label": "regenerate docker compose default",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "command": "cargo",
          "args": [
              "run",
              "--release",
              "--bin",
              "iroha_swarm",
              "--",
              "-p",
              "4",
              "-s",
              "Iroha",
              "--force",
              "--config-dir",
              "./configs/swarm",
              "--health-check",
              "--image",
              "hyperledger/iroha2:dev",
              "--outfile",
              "configs/swarm/docker-compose.yml"
          ],
      },
      {
          "label": "regenerate all",
          "type": "shell",
          "problemMatcher": [],
          "presentation": {
              "clear": true
          },
          "dependsOn": [
              "regenerate genesis",
              "regenerate schema",
              "regenerate executor",
              "regenerate docker compose single",
              "regenerate docker compose multiple",
              "regenerate docker compose default",
          ]
      },

Arjentix avatar Feb 26 '24 12:02 Arjentix

Or we could just run locally as same consistency checks as CI does: https://github.com/hyperledger/iroha/blob/41c08b4310cdf3720756304360a979c378a8b6b0/.github/workflows/iroha2-dev-pr.yml#L28-L36 I basically think it's up to each developer to avoid failures on push, but as long as pre-commit.sample is referred in CONTRIBUTING.md it needs to be maintained and represent some consensus on pre-commit: https://github.com/hyperledger/iroha/blob/4de547fda8abb343d39706b021aaeca38926fb4e/CONTRIBUTING.md?plain=1#L26

s8sato avatar Feb 26 '24 14:02 s8sato

Also:

  • https://github.com/hyperledger/iroha/issues/4293

0x009922 avatar Mar 18 '24 04:03 0x009922

@Asem-Abdelhady let's finish this PR

mversic avatar Apr 15 '24 06:04 mversic

Also:

Pp till now it is not changed so we can modify it if we decided to go with the change. Unless you want me to change it in this PR of course but I suggest this should be done in a separate PR.

Asem-Abdelhady avatar Apr 15 '24 22:04 Asem-Abdelhady