Skip to content

Commit

Permalink
feat: cairo 1 migration (#410)
Browse files Browse the repository at this point in the history
* Initial commit

* chore: repo setup with scarb + yarn

* feat: space state interface

* chore: updated package name

* feat: space constructor base

* chore: change repo structure

* feat: proposal struct

* feat: StorageAccess impl for Array<u8>

* feat: StorageAccess impl for strategy

* test: constructor base

* refactor: storage impls to not use syscalls directly

* fix: array storage impl runtime errors

* refactor: split utils and tests into dedicated files

* feat: set bit func

* feat: is bit set func

* feat: add voting strategies

* feat: derive option impl on Strategy

* chore: add bit packer to import path

* refactor: implement bit setter as a trait

* feat: add and remove authenticators

* refactor: use unwrap when adding voting strategies

* feat: updated constructor

* feat: StorageAccess impl on Proposal

* chore: use native pow func

* feat: u8 array to felt array impl

* refactor: u64 for typestamps

* feat: propose func

* feat: vanilla proposal validation strategy

* feat: IProposalValidationStrategy

* feat: call proposal validation strategy in propose

* chore: fixed typos

* test: deploy space with vanilla proposal validation

* chore: remove deps

* feat: space constructor calldata serialization

* chore: updated space interface

* chore: formatting

* chore: propose test

* feat: vanilla authenticator

* feat: vanilla execution strategy

* feat: proposals view func in space

* test: check proposal state

* feat: vanilla voting strategy

* fix: remove integer literals

* test: mock always fail proposal validation strategy

* chore: generate cairo_project.toml and use it for external deps

* chore: added OZ ownable as external lib

* feat: use OZ ownable in space

* feat: external setters with events

* chore formatting

* chore: added setters to space interface

* chore: fixed tests

* feat proposal creation event

* chore: cleaned up imports

* fix: voting strategy limit check

* chore: removed old starknet tooling

* chore: delete cairo_project.toml

* chore: add cairo_project.toml to gitignore

* feat: assert only authenticator

* fix: removed dummy values from propose func

* feat: IndexedStrategy type def and impl

* feat: move zeroable impl to math file and impl for u64

* fix: vanilla voting strategyname and return

* refactor: move module interfaces to dedicated files

* refactor: make modules implement their interfaces

* refactor: make space impl its interface

* feat(space): added missing interface implementations

* feat(space): transfer ownership

* feat(space): renounce ownership

* refactor: rename selector

* chore: formatting

* fix: bit setter

* feat: num executed getter in vanilla execution)

* fix: interface impls

* fix: add voting strategies assert

* chore: added propose selector to constants

* fix(authenticator): panic and propogate error when call fails

* feat: proper space setup in tests

* refactor: move constants out of module

* feat: vote func (#411)

* feat: vote func base

* chore: fixed name errors

* feat: get cumulative voting power func

* feat: choice enum and its LegacyHash impl

* feat: vote func with choice enum

* chore: test vote

---------

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

* fix: casing

* feat: execute function and simple quorum strategy (#413)

* chore: added execution payload to execution strategy interface

* feat: FinalizationStatus def and PartialEq, Into, TryInto, and StorageAccess impls

* feat: space execute function

* feat: simple quorum execution strategy and impl in vanilla execution strategy

* feat: Proposal Status enum and impls for Into and PartialEq traits

* chore: added execute to space interface

* feat: execute test and combined propose + vote + execute into single test

---------

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

* feat: update proposal (#414)

* feat(space): update proposal

* chore: test update proposal:

---------

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

* feat(space): cancel proposal

* fix: proposal timestamps

* feat: ParialEq for Proposal

* test: cancel proposal

* refactor: use felt arrays for all arbitrary data arrays (#417)

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

* feat: eth relayer execution strategy (#419)

* feat: eth relayer

* refactor: eth relayer relays entire proposal state to l1

---------

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

* feat: L1 avatar execution (#420)

* chore: added foundry project for ethereum code

* feat: legacy L1 avatar execution strategy

* feat: Simple Quorum L1 avatar execution

---------

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

* feat: eth tx authenticator (#423)

* feat: starknet commit contract

* feat: eth tx authenticator

* fix: add selectors to payload hash computation

* chore: gas instructions for vote func

---------

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

* feat: storage proof based voting strategy (#425)

* feat: single slot proof lib

* chore: updated imorts

* feat: timestamp to eth block number resolver

* feat: eth balance of voting strategy

---------

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

* feat: eth sig authenticator (#412)

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

* chore: removed alexandria dep

* chore: Cairo and Solidity contracts CI

* refactor: derive copy for Choice (#434)

* fix: use type inference (#445)

* refactor: reuse into traits (#446)

* Feat add set bit false (#441)

* feat: add set bit false

* feat: implement _remove_voting_strategies

* fix: remove typo line

* fix: check there is at least one active voting strategy after removal

* fix: rename valid to is_valid (#448)

* chore: cairo v2 migration (#453)

* chore: migrate ownable

* chore: migrate simple quorum

* chore: migrate vanilla execution

* chore: migrate eth relayer

* chore: migrate eexecution strategy interface

* chore: migrate authenticators

* chore: migrate execution strategies

* chore: migrate utils

* chore: migrate voting strategies

* chore: migrate interfaces

* chore: migrate proposal validation strategies

* chore: migrate space

* chore: update tests

* chore: allow all lib funcs in config

* chore: remove timestamp resolver

* chore: formatting

* chore: cleaned up CI workflow

* feat: PartialEq impl on Strategy

* chore: updated tests to cairo v2

* fix: remove voting strats errors

* chore: use StorageAccess impl for felt arrays from starknet by example

* refactor: use read and write at offset in read and write funcs for StorageAccess impls

* chore: formatting

* fix: merge error

---------

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

---------

Co-authored-by: Orlando <[email protected]>
Co-authored-by: pscott <[email protected]>
  • Loading branch information
3 people authored Jul 14, 2023
1 parent f81bab3 commit 1fa6ac3
Show file tree
Hide file tree
Showing 159 changed files with 3,292 additions and 24,086 deletions.
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

4 changes: 0 additions & 4 deletions .env.example

This file was deleted.

22 changes: 0 additions & 22 deletions .eslintrc

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/lint.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: SX-Starknet Workflow

on:
push:
branches:
- develop
pull_request:

jobs:
solidity:
strategy:
fail-fast: true

name: Forge tests
runs-on: ubuntu-latest
steps:
- name: Step 1 - Check out main branch
uses: actions/checkout@v3
with:
submodules: recursive

- name: Step 2 - Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Step 3 - Check formatting
working-directory: ./ethereum
run: forge fmt --check

- name: Step 4 - Build Solidity contracts
working-directory: ./ethereum
run: |
forge --version
forge build --sizes
id: build

- name: Step 5 - Run Forge tests
working-directory: ./ethereum
run: |
forge test -vvv
id: test

cairo:
strategy:
fail-fast: true

name: Cairo tests
runs-on: ubuntu-latest
steps:
- name: Step 1 - Check out main branch
uses: actions/checkout@v3

- name: Step 2 - Install Scarb
uses: software-mansion/setup-scarb@v1
with:
scarb-version: 0.5.1

- name: Step 3 - Check formatting
working-directory: ./starknet
run: scarb fmt --check

- name: Step 4 - Build Cairo contracts
working-directory: ./starknet
run: scarb build --verbose

- name: Step 4 - Running Cairo tests
working-directory: ./starknet
run: scarb test --verbose
59 changes: 0 additions & 59 deletions .github/workflows/tests.yml

This file was deleted.

35 changes: 9 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
node_modules
**/__pycache__

#Hardhat files
cache
artifacts
starknet-artifacts
factories
typechain
typechain-types
abi
coverage
coverage.json

.yarn
target
node_modules/
.env
cairo_project.toml

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
cache/
out/

# Local deployments
deployed_contracts/local.json
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

*.DS_Store
docs/
23 changes: 20 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
[submodule "contracts/starknet/fossil"]
path = contracts/starknet/fossil
url = https://github.com/OilerNetwork/fossil.git
[submodule "ethereum/lib/forge-std"]
path = ethereum/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/forge-std"]
branch = v1.5.6
[submodule "ethereum/lib/openzeppelin-contracts-upgradeable"]
path = ethereum/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/openzeppelin-contracts-upgradeable"]
branch = v4.9.1
[submodule "ethereum/lib/zodiac"]
path = ethereum/lib/zodiac
url = https://github.com/gnosis/zodiac
[submodule "lib/zodiac"]
branch = v3.3.2
[submodule "ethereum/lib/safe-contracts"]
path = ethereum/lib/safe-contracts
url = https://github.com/safe-global/safe-contracts
[submodule "lib/safe-contracts"]
branch = v1.4.0
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License

Copyright (c) Snapshot Labs
Copyright (c) 2023 Snapshot Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 1fa6ac3

Please sign in to comment.