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

Upgradeable SN contract #94

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Upgradeable SN contract #94

merged 1 commit into from
Jan 24, 2024

Conversation

uri-99
Copy link
Collaborator

@uri-99 uri-99 commented Jan 16, 2024

Description

This PR implements #92 ,
It makes the SN contract (Escrow) upgradeable, by using starknet's 'upgrade' syscall, changing the smart contract's Class Hash, without the need for a proxy contract

Escrow.cairo

  • Implement Upgradeable from OZ to Escrow.cairo contract.
  • Implement Ownable from OZ to Escrow.cairo contract.
  • Add some upgradeable tests

Scripts

  • Add upgrade.sh for simple Escrow.cairo upgrading.

README

  • Add section explaining how to use the make starknet-upgrade command in the Makefile

@uri-99 uri-99 changed the title Implement #92, Upgradeable SN contract Upgradeable SN contract Jan 16, 2024
@uri-99 uri-99 linked an issue Jan 16, 2024 that may be closed by this pull request
contracts/cairo/upgrade.sh Outdated Show resolved Hide resolved
@uri-99 uri-99 self-assigned this Jan 18, 2024
contracts/cairo/src/mocks/mock_EscrowV2.cairo Outdated Show resolved Hide resolved
contracts/cairo/src/escrow.cairo Outdated Show resolved Hide resolved
@uri-99 uri-99 changed the base branch from main to upgradeables January 24, 2024 17:45
@uri-99 uri-99 merged commit e0a0882 into upgradeables Jan 24, 2024
@uri-99 uri-99 deleted the upgradeable-SN branch January 24, 2024 17:48
uri-99 added a commit that referenced this pull request Jan 30, 2024
* Upgradeable - YABTransfer (#79)

* forge install: openzeppelin-contracts

v5.0.1

* apply upgradeable to eth contract (wip)

* upgradeable with script (wip)

* forge install: openzeppelin-foundry-upgrades

* forge install: openzeppelin-contracts-upgradeable

v5.0.1

* continue test (still not working)

* upgradeable eth working

* fix upgrade.sh + env.example

* extract initialize variables to envs

* remove verbose from upgrade script

* refactor Upgrade.s.sol + YABTransfer

* fix makefile commands

* remove SN_ESCROW_ADDRESS from envs

* add upgrade eth to README

* remove hardcoded values in .env.example

* remove comment for mm-bot

* resolve comments

* revert changes

* Update .env.example

* forge install: openzeppelin-contracts

v5.0.1

* forge install: openzeppelin-contracts-upgradeable

v5.0.1

* remove unused dependencies .gitsubmodules

* forge install: openzeppelin-contracts-upgradeable

v5.0.1

* minor issues

* fix wrong env upgrade.sh

* add step for auto-update .env with proxy address

* remove ETH_PRIVATE_KEY from scripts

* read env using source

* refactor dependencies

* README - add YAB_TRANSFER_PROXY_ADDRESS to deploy section

* rm openzeppelin-contracts-upgradeable

* minor change

* Upgradeable - Escrow (#35)

* Starknet escrow script + make build, clean & test

* add ethereum escrow deploy + documentation

* rename commands Makefile

* update makefile + readme

* fix makefile clean commands

* OZ dependency + escrow impl

* fix import

* forge install: openzeppelin-contracts

v5.0.1

* fix feedback comments

* fix wrong env name (thx @uri-99)

* refactor deploy.sh + add upgrade.sh (wip)

* refactor deploy.sh & upgrade.sh

* add EscrowV2 for test upgradeable

* add upgradeable tests

* revert method name changes

* fix upgrade.sh + refactor

* rename SN_PROXY_ESCROW_ADDRESS to SN_ESCROW_ADDRESS

* fix deploy error + change upgrade log

* eof

* update readme

* revert solidity files changes

* remove "proxy" from echo

* rename starknet rpc env

* resolve comments

* remove openzeppelin-contracts

* rename and move EscrowV2

* fix feedback comments

* update README

* revert .gitmodules change

* Add openzeppelin-contracts-upgradeable submodule

* Fix automatic proxy address setting

* clean upgrade.sh

* WIP cleaning readme

* Better install libs + deploy explanation

* improve deploy script + docu

* improve upgrade test

* use forge install to get submodules

* wip fix of submodules

* WIP fix submodules

* fix submodules build

* fix: transfer test includes proxy pattern

* refactor: create contracts without herodotus (#90)

* feat: escrow contract without herodotus

* fix: change ethereum withrawer in mm_bot

* feat: upgreadable Escrow_herodotus contract

* refactor: readme with herodotus

* refactor: remove comment

* refactor: add tmp solution disclaimer on readme

* refactor: rename starknet escrow contract

* refactor: update wording README.md

Co-authored-by: urimihura <[email protected]>

* refactor: remove transfer.sh

* fix: lowercase escrow module

---------

Co-authored-by: urimihura <[email protected]>

* update deploy's grep

* fix sed?

* clean sed -i

* fix sed -i bug in mac

* remove rpc export

* set eth proxy addr in cairo/env

* refactor env var with sus name

* text clarity

* text clarity

* feat: make deploy-all

* test: upgrade contract while changing vars

* Revert "test: upgrade contract while changing vars"

This reverts commit 8e04ca6.

* refactor: cairo mock file name

* feat: restrict access to yabtransfer (#98)

* start new branch

* Add MMAddress filter

* WIP debugging _MM not initialized

* WIP debugging _MM

* fix: change transfer test to proxy format

* refactor: mm variable rename to comply with format

* prettier ACL and tests

* tidy ACL test

* more transfer tests

* test withdraw WIP

* Fix PR comments

* refactor: address creation in tests

* Test: withdraw function

* fix: remove restriction to getMMAddress

* fix: test addr creation

* fix: test names

* fix: tests

* fix: test mock value

* Update contracts/solidity/test/Transfer.sol

Co-authored-by: Santos Rosati <[email protected]>

* Update contracts/solidity/test/Transfer.sol

Co-authored-by: Santos Rosati <[email protected]>

* fix: mock call to L2

---------

Co-authored-by: Uriel Mihura <[email protected]>
Co-authored-by: rcatalan98 <[email protected]>
Co-authored-by: Santos Rosati <[email protected]>

* feat: implement pausable in escrow (#100)

* start branch

* pausable impl start

* fix + test: pausable

* test: more for pause()

* Test: upgrade when paused

* Update contracts/cairo/src/tests/test_escrow.cairo

Co-authored-by: Roberto J Catalan <[email protected]>

* test: L1 handler calling

* fix: remove unpause from constructor

* Update contracts/cairo/src/tests/test_escrow.cairo

Co-authored-by: Roberto J Catalan <[email protected]>

* Update contracts/cairo/src/tests/test_escrow.cairo

Co-authored-by: Roberto J Catalan <[email protected]>

* test: improve call_l1_from_user

* fix: test names

* fix: remove comment

---------

Co-authored-by: Uriel Mihura <[email protected]>
Co-authored-by: Roberto J Catalan <[email protected]>

* empty commit to fix PR (#94)

Co-authored-by: Uriel Mihura <[email protected]>

* empty commit to fix PR (#91)

Co-authored-by: Uriel Mihura <[email protected]>

* fix: mock cairo contract names causing compile errors

* fix: eth tests broken from merge

* style: eth test variables positions

* fix: sn tests broken from merge

* refactor: dividied SN tests in different files

* refactor: deployment scripts to avoid errors (#101)

* refactor: deployment scripts to avoid errors

* fix: add param for contract addr missing

* fix: use . instead of source

* fix: run starknet-build on starknet-deploy-and-connect

* refactor: both deploys and 'make deploy-all' , now setting envs

* style: turn off "echo command" in make

* feat: same refactor for upgrade in eth

* feat: same refactor of env usage for cairo deploy

* fix: make starknet-test import

* fix: make eth-set-escrow + eth-set-withdraw-selector

* Fix: various fixes on desc of this commit

 updated .env.example
.sh colored prints for mac
 check required var is declared on set_escrow.sh
hint to export appropriate var after ethereum-deploy

* fix: color prints, and change purple to cyan

* fix: usage of printf in .sh

* feat: add reminder to finish config after cairo deploy

* style: add \n to printed reminder

* feat: display relevant info after deploy-all

* style: remove unnecessary imports + small prints

* style: printed info after make-all

* style: remove unnecesary comments

* style: \n at EOFs

---------

Co-authored-by: Julián Arce <[email protected]>
Co-authored-by: Uriel Mihura <[email protected]>

* test: improve test_upgrade_escrow

* remove: escrow_herodotus

backup of this file is stored inside YAC

* test: new ownable tests

* docs: mark missing feat as todo for easier find

---------

Co-authored-by: Santiago Galván (Dub) <[email protected]>
Co-authored-by: Uriel Mihura <[email protected]>
Co-authored-by: rcatalan98 <[email protected]>
Co-authored-by: Santos Rosati <[email protected]>
Co-authored-by: Julián Arce <[email protected]>
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.

feat: upgradeable SN contract
3 participants