Skip to content

Commit

Permalink
Merge pull request #128 from argentlabs/update
Browse files Browse the repository at this point in the history
Update 2024Q2
  • Loading branch information
sgc-code authored Jun 21, 2024
2 parents d9f5220 + 5b61ee2 commit 1352198
Show file tree
Hide file tree
Showing 217 changed files with 415,242 additions and 69,813 deletions.
1 change: 0 additions & 1 deletion .cairofmtignore

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/cairo-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
uses: actions/checkout@v3
- name: Step 2 - Getting scarb
uses: software-mansion/[email protected]
- name: Step 3 - Testing
- name: Step 3 - Setting up snfoundry
uses: foundry-rs/setup-snfoundry@v3
- name: Step 4 - Running tests
run: scarb test

format:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ dist
target
node_modules
node.json
snfoundry_cache

cairo
account.json
dump
package-lock.json
.snfoundry_cache

/.svelte-kit
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
yarn-error.log
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"trailingComma": "all",
"singleQuote": false,
"semi": true,
"printWidth": 120
"printWidth": 120,
"plugins": ["prettier-plugin-organize-imports"]
}
3 changes: 2 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
scarb 2.4.3
scarb 2.6.3
starknet-foundry 0.20.0
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

See here for the [Argent Account](./docs/CHANGELOG_argent_account.md)
See here for the [Argent Multisig](./docs/CHANGELOG_multisig.md)

# Deployments

See deployed class hashes can be found here for the [Argent Account](./deployments/account.txt), and here for the [Argent Multisig](./deployments/multisig.txt)

Other deployment artifacts are located in [/deployments/](./deployments/)
53 changes: 39 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

## Specification

See [Argent Account](src/account/README.md) and [Argent Multisig](src/multisig/README.md) for more details.
See [Argent Account](./docs/argent_account.md) and [Argent Multisig](./docs/multisig.md) for more details.

## Development
## Deployments

See deployed class hashes can be found here for the [Argent Account](./deployments/account.txt), and here for the [Argent Multisig](./deployments/multisig.txt)

### Setup Rust
Other deployment artifacts are located in [/deployments/](./deployments/)

Please refer to [these instructions](https://docs.cairo-lang.org/getting_started/prerequisits.html).
You can skip cloning the Cairo repository, as this will be done automatically through the Makefile.
If you are a developer, we recommend that you install the Cairo extension. You can find it in the vscode Extensions Marketplace by looking for "Cairo 1.0".
Find the release notes for all versions in [CHANGELOG](./CHANGELOG.md)

## Development

### Setup scarb
### Setup

Refer to this documentation: https://docs.swmansion.com/scarb/download.html#install-via-asdf
Thanks to the [.tool-versions file](./.tool-versions), you don't need to install a specific scarb version. The correct one will be automatically downloaded and installed.
We recommend you to install scarb through ASDF. Please refer to [these instructions](https://docs.swmansion.com/scarb/download.html#install-via-asdf).
Thanks to the [.tool-versions file](./.tool-versions), you don't need to install a specific scarb or starknet foundry version. The correct one will be automatically downloaded and installed.

## Test the contracts (Cairo)

Expand Down Expand Up @@ -62,21 +64,44 @@ scarb run format

### Contract fixtures

The [fixtures folder](./tests-integrations/fixtures/) contains pre-compiled contracts used for tests (both json and casm).
The [fixtures folder](./tests-integration/fixtures/) contains pre-compiled contracts used for tests (both json and casm).

### Interface IDs

For compatibility reasons we support legacy interface IDs. But new interface IDs will follow [SNIP-5](https://github.com/ericnordelo/SNIPs/blob/feat/standard-interface-detection/SNIPS/snip-5.md#how-interfaces-are-identified)
For compatibility reasons we support legacy interface IDs. But new interface IDs will follow [SNIP-5](https://github.com/starknet-io/SNIPs/blob/main/SNIPS/snip-5.md#how-interfaces-are-identified)
Tool to calculate interface IDs: https://github.com/ericnordelo/src5-rs

### Cairo Zero SHA256 contract

The Webauthn signer is designed to work with multiple possible SHA256 implementations. The Cairo Zero variant is implemented at class hash specified as constant in the signer's source code, which can be reproduced using:

```shell
git clone https://github.com/cartridge-gg/cairo-sha256
cd cairo-sha256
git checkout 8d2ae51
git apply ../lib/signers/cairo0-sha256.patch

python3.9 -m venv ./venv
source ./venv/bin/activate
pip install cairo-lang==0.12.1

starknet-compile-deprecated --no_debug_info src/main.cairo > ../tests-integration/fixtures/argent_Sha256Cairo0.contract_class.json

# cleanup and clear whitespace diffs:
deactivate
cd ..
rm -rf cairo-sha256
scarb run format
```

## Release checklist

- Bump version if needed (new deployment in mainnet)
- Set up your .env file with the deployer info and run `yarn deploy` to declare the accounts
- Set up your .env file with the deployer info and run `scarb run deploy-account` and `scarb run deploy-multisig` to declare the accounts
- Verify the contracts if possible
- Deploy to as many environments as possible: mainnet, goerli, sepolia and integration
- Deploy to as many environments as possible: mainnet, sepolia and integration
- Update the contents of the `deployments` folder with the new addresses
- Copy relevant build artifacts from `target/release` to `deployments/artifacts`
- Copy relevant build artifacts from `target/release` to `deployments/artifacts`, include abi file.
- Tag the commit used for the release (include the same name as in the `deployments` folder for easy tracking)
- Create release in GitHub if needed
- Make this checklist better if you learned something during the process
55 changes: 55 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "alexandria_data_structures"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
dependencies = [
"alexandria_encoding",
]

[[package]]
name = "alexandria_encoding"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
dependencies = [
"alexandria_math",
"alexandria_numeric",
]

[[package]]
name = "alexandria_math"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
dependencies = [
"alexandria_data_structures",
]

[[package]]
name = "alexandria_merkle_tree"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?tag=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"

[[package]]
name = "alexandria_numeric"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad"
dependencies = [
"alexandria_math",
]

[[package]]
name = "argent"
version = "0.1.0"
dependencies = [
"alexandria_encoding",
"alexandria_math",
"alexandria_merkle_tree",
"openzeppelin",
"snforge_std",
]

[[package]]
name = "openzeppelin"
version = "0.12.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.12.0#0697004db74502ce49900edef37331dd03531356"

[[package]]
name = "snforge_std"
version = "0.20.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.20.0#423eecf7847469e353258321274394b9155d24eb"
17 changes: 13 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
[package]
name = "argent"
version = "0.1.0"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest
cairo-version = "2.6.3"

[[target.starknet-contract]]
sierra = true
casm = true
allowed-libfuncs-list.name = "audited"
build-external-contracts = ["openzeppelin::presets::account::AccountUpgradeable"]

[dependencies]
starknet = "2.4.3"
starknet = "2.6.3"
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "cairo-v2.6.0" }
alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "cairo-v2.6.0" }
alexandria_merkle_tree = { git = "https://github.com/keep-starknet-strange/alexandria.git", tag="cairo-v2.6.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.20.0" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.12.0" }

[tool.fmt]
max-line-length = 120
sort-module-level-items = true

[scripts]
test = "snforge test"
format = "scarb fmt && yarn prettier --write ."
lint = "yarn eslint ."
test-ts = "scarb --profile release build && yarn tsc && yarn mocha tests-integration/*.test.ts"
test-multisig = "scarb --profile release build && yarn tsc && yarn mocha tests-integration/multisig*.test.ts"
test-session = "scarb --profile release build && yarn tsc && yarn mocha tests-integration/session*.test.ts"
test-list = "scarb --profile release build && yarn tsc && yarn mocha --dry-run tests-integration/*.test.ts"
start-devnet = "./scripts/start-devnet.sh"
kill-devnet = "lsof -t -i tcp:5050 | xargs kill"
profile = "scarb --profile release build && node --loader ts-node/esm scripts/profile-account.ts"
deploy = "scarb --profile release build && node --loader ts-node/esm scripts/deploy-account.ts"
deploy-account = "scarb --profile release build && node --loader ts-node/esm scripts/deploy-account.ts"
deploy-multisig = "scarb --profile release build && node --loader ts-node/esm scripts/deploy-multisig.ts"
generate-signature = "node --loader ts-node/esm ./scripts/generate-signature.ts"
update-webauthn-dapp = "scarb --profile release build && cp target/release/*ArgentAccount* examples/webauthn/src/lib"
Binary file not shown.
11 changes: 8 additions & 3 deletions deployments/account.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
0x036078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f: 0.4.0 (mainnet, sepolia)
0x29927c8af6bccf3f6fda035981e765a7bdbf18a2dc0d630494f8758aa908e2b: 0.3.1 (mainnet, goerli, sepolia, integration)
0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003: 0.3.0 (mainnet, goerli-1, goerli-2, integration)
0x45bb3b296122454fb31d45c48da6143df12bcf58311dcd75193df42d79f8dd2: 0.3.0-rc2 (goerli-1, goerli-2)
0x5ff858f178257126353d03db2e50410c7cb399d9fc68b67ffe127d9b8b2a33c: 0.3.0-rc2 tweaked with version 0.3.99 (goerli-1, goerli-2)

cairo 0 clash hashes stored here https://argenthq.notion.site/argenthq/11e1b194b0304124b05f6118e450e553?v=46e893ed521f4850ba801d1747cc84ef
Older cairo 0 clash hashes stored here https://argenthq.notion.site/argenthq/11e1b194b0304124b05f6118e450e553?v=46e893ed521f4850ba801d1747cc84ef


Internal Versions:
0x7f8ac221236add990375a03a03cb30f758535a1dcebe78692ee16ef265ebc14: 0.3.1 with 5 min escape (sepolia)
0x45bb3b296122454fb31d45c48da6143df12bcf58311dcd75193df42d79f8dd2: 0.3.0-rc2 (goerli-1, goerli-2)
0x5ff858f178257126353d03db2e50410c7cb399d9fc68b67ffe127d9b8b2a33c: 0.3.0-rc2 tweaked with version 0.3.99 (goerli-1, goerli-2)
Loading

0 comments on commit 1352198

Please sign in to comment.