Skip to content

Commit

Permalink
chore: cleaning up
Browse files Browse the repository at this point in the history
trying act

chore: on push

feat: reusable ci

chore: updating ci for testing

update rec

del

chore: add workspaces tests

dafuq

order

deps

depend submodule on unittest

trigger

trigger

fix linting

individual workspaces

spacing

adding linting to submodules
  • Loading branch information
zeroknots committed Feb 16, 2024
1 parent 02b3ba8 commit 31681cd
Show file tree
Hide file tree
Showing 21 changed files with 652 additions and 596 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
- push
- pull_request

jobs:
lint:
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-lint.yaml@main"

build:
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-build.yaml@main"

test-unit:
needs: ["build"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test.yaml@main"
with:
foundry-fuzz-runs: 5000
foundry-profile: "test"
match-path: "test/**/*.sol"
name: "Unit tests"

lint-safe7579:
needs: ["lint", "test-unit"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-lint-workspaces.yaml@main"
with:
match-workspace: "@rhinestone/safe7579"

test-safe7579:
needs: ["build", "test-unit"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-workspaces.yaml@main"
with:
match-workspace: "@rhinestone/safe7579"

lint-sessionkeymanager:
needs: ["lint", "test-unit"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-lint-workspaces.yaml@main"
with:
match-workspace: "@rhinestone/sessionkeymanager"

test-sessionkeymanager:
needs: ["build", "test-unit"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-workspaces.yaml@main"
with:
match-workspace: "@rhinestone/sessionkeymanager"

lint-modulekit-examples:
needs: ["lint", "test-unit"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-lint-workspaces.yaml@main"
with:
match-workspace: "@rhinestone/modulekit-examples"

test-modulekit-examples:
needs: ["build", "test-unit"]
uses: "rhinestonewtf/reusable-workflows/.github/workflows/forge-test-workspaces.yaml@main"
with:
match-workspace: "@rhinestone/modulekit-examples"
58 changes: 58 additions & 0 deletions .github/workflows/forge-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Build a Forge project"

on:
workflow_call:
inputs:
cache-path:
default: |
cache
node_modules
out
out-optimized
required: false
type: "string"

save-cache:
default: true
required: false
type: boolean

store-artifacts:
default: true
required: false
type: boolean

jobs:
forge-build:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install NodeJS"
uses: actions/setup-node@v3
with:
node-version: 21

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8.15
run_install: false

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Show the Forge config"
run: "forge config"

- name: "Build the production contracts"
run: "forge build"

- name: "Add summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
34 changes: 34 additions & 0 deletions .github/workflows/pnpm.yaml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
- push
- pull_request

jobs:
cache-and-install:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8.15
run_install: false

- name: Install dependencies
run: pnpm i

- name: Build ModuleKit
run: pnpm build

- name: run modulekit tests
run: pnpm test
34 changes: 0 additions & 34 deletions .github/workflows/test.yml

This file was deleted.

Empty file removed .gitmodules
Empty file.
5 changes: 4 additions & 1 deletion examples/test/AutoSaving/AutoSavings.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import "solmate/test/utils/mocks/MockERC20.sol";
import "solmate/test/utils/mocks/MockERC4626.sol";
import { AutoSavingToVault } from "src/AutoSaving/AutoSavings.sol";

import { MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR } from "@rhinestone/modulekit/src/external/ERC7579.sol";
import {
MODULE_TYPE_VALIDATOR,
MODULE_TYPE_EXECUTOR
} from "@rhinestone/modulekit/src/external/ERC7579.sol";

import "forge-std/console2.sol";

Expand Down
8 changes: 0 additions & 8 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ libs = ["lib"]
fs_permissions = [{ access = "read", path = "out-optimized" }, { access = "read-write", path = "gas_calculations" }]
allow_paths = ["*", "/"]

[profile.accounts]
src = "accounts"
out = "out"
libs = ["lib"]
#via_ir = true
fs_permissions = [{ access = "read", path = "out-optimized" }, { access = "read-write", path = "gas_calculations" }]
allow_paths = ["*", "/"]

[rpc_endpoints]
mainnet = "https://rpc.ankr.com/eth"

Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
},
"workspaces": [
"packages/**",
"examples/**",
"examples/",
"accounts/**"
],
"dependencies": {
"@prb/math": "^4.0.2",
"erc4337-validation": "github:rhinestonewtf/erc4337-validation"
},
"dependencies": {},
"devDependencies": {
"ds-test": "github:dapphub/ds-test",
"forge-std": "github:foundry-rs/forge-std",
"@openzeppelin/contracts": "5.0.1",
"@prb/math": "^4.0.2",
"@rhinestone/sessionkeymanager": "workspace:*",
"erc4337-validation": "github:rhinestonewtf/erc4337-validation",
"@rhinestone/safe7579": "workspace:*",
"@ERC4337/account-abstraction": "github:kopy-kat/account-abstraction#develop",
"@ERC4337/account-abstraction-v0.6": "github:eth-infinitism/account-abstraction#v0.6.0",
Expand Down Expand Up @@ -57,6 +56,8 @@
"repository": "github.com/rhinestonewtf/modulekit",
"scripts": {
"build": "forge build",
"fmt": "forge fmt",
"fmt:check": "forge fmt --check",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"build:smt": "FOUNDRY_PROFILE=smt forge build",
"clean": "rm -rf artifacts broadcast cache docs out out-optimized out-svg",
Expand Down
7 changes: 7 additions & 0 deletions packages/SessionKeyManager/bytecode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
bytecode=$(jq ".bytecode" out/SessionKeyManager.sol/SessionKeyManager.json | jq ".object" | sed s/\"0x/hex\"/g)

echo "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
bytes constant SESSIONKEYMANAGER_BYTECODE = $bytecode;" > src/SessionKeyManagerBytecode.sol
21 changes: 21 additions & 0 deletions packages/SessionKeyManager/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
via_ir = true
fs_permissions = [{ access = "read", path = "out-optimized" }, { access = "read-write", path = "gas_calculations" }]
allow_paths = ["*", "/"]

[rpc_endpoints]
mainnet = "https://rpc.ankr.com/eth"


[fmt]
bracket_spacing = true
int_types = "long"
line_length = 100
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
10 changes: 9 additions & 1 deletion packages/SessionKeyManager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
},
"devDependencies": {
"@rhinestone/modulekit": "workspace:*",
"ds-test": "github:dapphub/ds-test",
"@ERC4337/account-abstraction": "github:kopy-kat/account-abstraction#develop",
"@ERC4337/account-abstraction-v0.6": "github:eth-infinitism/account-abstraction#v0.6.0",
"sentinellist": "github:zeroknots/sentinellist",
"erc7579": "github:erc7579/erc7579-implementation",
"forge-std": "github:foundry-rs/forge-std",
"solady": "github:vectorized/solady",
"solhint": "^4.1.1",
"prettier": "^2.8.8"
Expand All @@ -37,7 +43,9 @@
"repository": "github.com/rhinestonewtf/modulekit-examples",
"scripts": {
"fmt": "forge fmt",
"build": "forge build",
"fmt:check": "forge fmt --check",
"build": "forge build && ./bytecode.sh",
"bytecode": "./bytescode.sh",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"build:smt": "FOUNDRY_PROFILE=smt forge build",
"clean": "rm -rf artifacts broadcast cache docs out out-optimized out-svg",
Expand Down
9 changes: 9 additions & 0 deletions packages/SessionKeyManager/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
solady/=node_modules/solady/
@rhinestone/=node_modules/@rhinestone/
erc7579/=node_modules/erc7579/src/
@ERC4337/=node_modules/@ERC4337/
account-abstraction/=node_modules/@ERC4337/account-abstraction/contracts/
account-abstraction-v0.6/=node_modules/@ERC4337/account-abstraction-v0.6/contracts/
forge-std/=node_modules/forge-std/src/
ds-test/=node_modules/ds-test/src/
sentinellist/=node_modules/sentinellist/src/
14 changes: 7 additions & 7 deletions packages/SessionKeyManager/src/ISessionKeyManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ pragma solidity ^0.8.23;

import { ISessionValidationModule } from "./ISessionValidationModule.sol";


interface ISessionKeyManager {
type ValidationData is uint256;
struct SessionData {
uint48 validUntil;
uint48 validAfter;
ISessionValidationModule sessionValidationModule;
bytes sessionKeyData;
}

struct SessionData {
uint48 validUntil;
uint48 validAfter;
ISessionValidationModule sessionValidationModule;
bytes sessionKeyData;
}

struct UserOperation {
address sender;
Expand Down
Loading

0 comments on commit 31681cd

Please sign in to comment.