Skip to content

Commit

Permalink
insert commit msg here
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerkleplant committed Aug 25, 2023
1 parent f166d9d commit 34a2130
Show file tree
Hide file tree
Showing 21 changed files with 693 additions and 219 deletions.
15 changes: 15 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SelfKisserTest:test_Deployment() (gas: 10730)
SelfKisserTest:test_kill() (gas: 33315)
SelfKisserTest:test_selfKiss_Other_isLiveProtected() (gas: 35369)
SelfKisserTest:test_selfKiss_Other_isSupportedProtected() (gas: 13863)
SelfKisserTest:test_selfKiss_Self_isLiveProtected() (gas: 34944)
SelfKisserTest:test_selfKiss_Self_isSupportedProtected() (gas: 13526)
SelfKisserTest:test_support() (gas: 682328)
SelfKisserTest:test_support_RevertsIf_NotAuthorized() (gas: 572829)
SelfKisserTest:test_support_isAuthProtected() (gas: 13944)
SelfKisserTest:test_support_isLiveProtected() (gas: 35508)
SelfKisserTest:test_support_unsupport() (gas: 712207)
SelfKisserTest:test_unsupport() (gas: 665824)
SelfKisserTest:test_unsupport_isAuthProtected() (gas: 13905)
SelfKisserTest:test_unsupport_isLiveProtected() (gas: 34865)
SelfKisserTest:test_unsupport_isSupportedProtected() (gas: 437)
24 changes: 24 additions & 0 deletions .github/workflows/gas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Gas

on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: yarn install

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

- name: Check gas snapshots
run: forge snapshot --nmt "Fuzz" --check
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Check formatting
run: forge fmt --check
24 changes: 24 additions & 0 deletions .github/workflows/non-via-ir-compilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Non --via-ir Compilation

on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: yarn install

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

- name: Compile project without --via-ir
run: FOUNDRY_PROFILE=no-via-ir forge build
30 changes: 30 additions & 0 deletions .github/workflows/solc-version-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Solc Version Tests

on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: yarn install

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

- name: Run Forge tests for each supported solc version
run: >
forge test --use 0.8.16 &&
forge test --use 0.8.17 &&
forge test --use 0.8.18 &&
forge test --use 0.8.19 &&
forge test --use 0.8.20 &&
forge test --use 0.8.21
27 changes: 11 additions & 16 deletions .github/workflows/test.yml → .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
name: test
name: Unit Tests

on: workflow_dispatch

env:
FOUNDRY_PROFILE: ci
on:
push:
branches:
- main
pull_request:

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: yarn install

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

- name: Run Forge build
run: |
forge --version
forge build --sizes
run: forge build
id: build

- name: Run Forge tests
run: |
forge test -vvv
- name: Run Forge test
run: FOUNDRY_PROFILE=intense forge test -vvv
id: test
18 changes: 11 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
# Ignore broadcast logs
broadcast/

# Docs
docs/
# Forge auto-generated docs
docs_generated/

# Dotenv file
.env

# Coverate reports
# Coverage file
lcov.info

# Flattened contracts
flattened/

# Generated contract ABIs
abis/
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.6.0
[submodule "lib/chronicle-std"]
path = lib/chronicle-std
url = https://github.com/chronicleprotocol/chronicle-std
branch = v2
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# SelfKisser

> The most important relationship you'll ever have is with yourself!
>
> Make it _physical_ ;)
The `SelfKisser` is a simple contract allowing everyone to whitelist (`kiss`) themselves on a set of supported _Chronicle Protocol_ oracles. This allows easy access during e.g. hackathons.

This contract may **never be deployed to production chains**!
This contract may **never be deployed to production environments**!

## How to get physical?

Expand Down
19 changes: 17 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ ffi = true

# Compilation
solc_version = "0.8.16"
optimizer = false
via_ir = false
optimizer = true
optimizer_runs = 10_000
via_ir = true
extra_output_files = ["metadata", "irOptimized"]

[fmt]
line_length = 80
int_types = "short"
number_underscore = "preserve"
ignore = []

# Profile to compile without --via-ir
# Run via `FOUNDRY_PROFILE=no-via-ir forge ...`
[profile.no-via-ir]
via_ir = false

# Profile for intense testing
# Run via `FOUNDRY_PROFILE=intense forge t`
[profile.intense]
[profile.intense.fuzz]
runs = 10_000
[profile.intense.invariant]
runs = 10_000

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
4 changes: 4 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/

chronicle-std/=lib/chronicle-std/src/
@script/chronicle-std/=lib/chronicle-std/script/
lib/chronicle-std:src/=lib/chronicle-std/src/
lib/chronicle-std:ds-test/=lib/chronicle-std/lib/forge-std/lib/ds-test/src/
lib/chronicle-std:forge-std/=lib/chronicle-std/lib/forge-std/src/
5 changes: 2 additions & 3 deletions script/SelfKisser.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {ISelfKisser} from "src/ISelfKisser.sol";
import {SelfKisser} from "src/SelfKisser.sol";

contract SelfKisserScript is Script {

/// @dev Run via:
///
/// ```bash
Expand Down Expand Up @@ -44,7 +43,7 @@ contract SelfKisserScript is Script {
/// --sig "$(cast calldata "support(address,address)" $SELF_KISSER $ORACLE)" \
/// script/SelfKisser.s.sol:SelfKisserScript
/// ```
function support(address self, address oracle) public {
function support(address self, address oracle) public {
vm.startBroadcast();
ISelfKisser(self).support(oracle);
vm.stopBroadcast();
Expand All @@ -63,7 +62,7 @@ contract SelfKisserScript is Script {
/// --sig "$(cast calldata "unsupport(address,address)" $SELF_KISSER $ORACLE)" \
/// script/SelfKisser.s.sol:SelfKisserScript
/// ```
function unsupport(address self, address oracle) public {
function unsupport(address self, address oracle) public {
vm.startBroadcast();
ISelfKisser(self).unsupport(oracle);
vm.stopBroadcast();
Expand Down
Loading

0 comments on commit 34a2130

Please sign in to comment.