Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds management command for inserting safe master copy #1785

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

peterpolman
Copy link

@peterpolman peterpolman commented Nov 30, 2023

Make sure these boxes are checked! πŸ“¦βœ…

  • You ran ./run_tests.sh
  • You ran pre-commit run -a
  • If you want to add your network to setup_service.py, provide a link to your
    safe-deployments PR and check network name
    exists in safe-eth-py

What was wrong? πŸ‘Ύ

There was no programmatic way available to easily insert a SafeMasterCopy address into the database. This made it cumbersome to run txs in an isolated CI environment using a local node and Safe contracts to test against.

Closes safe-global/safe-infrastructure#102

How was it fixed? 🎯

Added a python management command for inserting the mastercopy address into the database, allowing for programmatic insert of SafeMasterCopy objects.

Copy link

github-actions bot commented Nov 30, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ βœ…

@peterpolman
Copy link
Author

Not able to run local tests due to an issue building wheel for psycopg2 during install. Probably environment specific problem as my machine doesn't run python projects often.

Using cached pyasn1-0.5.1-py2.py3-none-any.whl (84 kB)
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py) ... error
  error: subprocess-exited-with-error

  Γ— python setup.py bdist_wheel did not run successfully.
  β”‚ exit code: 1
  ╰─> [149 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/_json.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/extras.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/errorcodes.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/tz.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/_range.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/_ipaddress.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/__init__.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/extensions.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/errors.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/sql.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/pool.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      running build_ext
      building 'psycopg2._psycopg' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/psycopg
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall "-
      ...
      ...
      ...
      ...
      ...
      ld: library not found for -lssl
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
ERROR: Could not build wheels for psycopg2, which is required to install pyproject.toml-based projects

@moisses89
Copy link
Member

Not able to run local tests due to an issue building wheel for psycopg2 during install. Probably environment specific problem as my machine doesn't run python projects often.

Using cached pyasn1-0.5.1-py2.py3-none-any.whl (84 kB)
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py) ... error
  error: subprocess-exited-with-error

  Γ— python setup.py bdist_wheel did not run successfully.
  β”‚ exit code: 1
  ╰─> [149 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/_json.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/extras.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/errorcodes.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/tz.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/_range.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/_ipaddress.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/__init__.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/extensions.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/errors.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/sql.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      copying lib/pool.py -> build/lib.macosx-13-arm64-cpython-311/psycopg2
      running build_ext
      building 'psycopg2._psycopg' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/psycopg
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall "-
      ...
      ...
      ...
      ...
      ...
      ld: library not found for -lssl
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
ERROR: Could not build wheels for psycopg2, which is required to install pyproject.toml-based projects

Hey thanks for your PR.
Taking a look to your issue you are missing system dependencies, take a look how to install them.
About your PR, I would like to have a test about the command and also could you include the proxy factories?

@peterpolman
Copy link
Author

peterpolman commented Dec 1, 2023

@moisses89 Alright alright, I managed to google and fix itπŸ˜‰ First time pythoners on MacOs Sillicon might run into this install issue as well. If so, fix it with an alias for your openssl lib. This assumes you install(ed) openssl using brew:

brew install openssl 
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/openssl/lib
pip install -r requirements.txt

and also could you include the proxy factories?

Sure! Similar command for inserting a ProxyFactory object and it's props or a single command for both addresses? It didn't seem required in my local setup, so I have not worked with it directly. Should I have?πŸ˜…

Copy link
Member

@Uxio0 Uxio0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Remember to also sign the CLA

@Uxio0
Copy link
Member

Uxio0 commented Dec 4, 2023

About your PR, I would like to have a test about the command and also could you include the proxy factories?

@moisses89 I changed my mind about that, we can accept this PR and add proxy factory support when we need it πŸ˜‰

@peterpolman peterpolman requested a review from a team as a code owner March 5, 2024 21:53
@peterpolman
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Programmatic configuration of safe master copy
3 participants