Skip to content

Commit 6882d6e

Browse files
Feat/railgun gas benchmark (#2)
* feat: initial railgun send benchmark * feat: construct tx and use snapshot - Pull structs from railgun contracts - Partly construct calldata - Do not compare against real tx in test * fix: CI - fmt - add CI secret * fix: correctly add submodule * feat: use actual private transfer * fix: run CI on main Co-authored-by: Nico Serrano <nnicosp@hotmail.com> * feat: license & pin deps --------- Co-authored-by: Nico Serrano <nnicosp@hotmail.com>
1 parent 526226e commit 6882d6e

13 files changed

Lines changed: 225 additions & 139 deletions

File tree

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ETH_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY

.github/workflows/test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
permissions: {}
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
workflow_dispatch:
10+
11+
env:
12+
FOUNDRY_PROFILE: ci
13+
14+
jobs:
15+
check:
16+
name: Foundry project
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@v5
22+
with:
23+
persist-credentials: false
24+
submodules: recursive
25+
26+
- name: Install Foundry
27+
uses: foundry-rs/foundry-toolchain@v1
28+
29+
- name: Show Forge version
30+
run: forge --version
31+
32+
- name: Run Forge fmt
33+
run: forge fmt --check
34+
35+
- name: Run Forge build
36+
run: forge build --sizes
37+
38+
- name: Run Forge tests
39+
run: forge test -vvv
40+
env:
41+
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}

.gitignore

Lines changed: 5 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,7 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
1+
# Foundry
2+
/cache
3+
/out
84

9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
22-
coverage
23-
*.lcov
24-
25-
# nyc test coverage
26-
.nyc_output
27-
28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
33-
34-
# node-waf configuration
35-
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
39-
40-
# Dependency directories
41-
node_modules/
42-
jspm_packages/
43-
44-
# Snowpack dependency directory (https://snowpack.dev/)
45-
web_modules/
46-
47-
# TypeScript cache
48-
*.tsbuildinfo
49-
50-
# Optional npm cache directory
51-
.npm
52-
53-
# Optional eslint cache
54-
.eslintcache
55-
56-
# Optional stylelint cache
57-
.stylelintcache
58-
59-
# Optional REPL history
60-
.node_repl_history
61-
62-
# Output of 'npm pack'
63-
*.tgz
64-
65-
# Yarn Integrity file
66-
.yarn-integrity
67-
68-
# dotenv environment variable files
5+
# Environment
696
.env
70-
.env.*
71-
!.env.example
72-
73-
# parcel-bundler cache (https://parceljs.org/)
74-
.cache
75-
.parcel-cache
76-
77-
# Next.js build output
78-
.next
79-
out
80-
81-
# Nuxt.js build / generate output
82-
.nuxt
83-
dist
84-
85-
# Gatsby files
86-
.cache/
87-
# Comment in the public line in if your project uses Gatsby and not Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
92-
.vuepress/dist
93-
94-
# vuepress v2.x temp and cache directory
95-
.temp
96-
.cache
97-
98-
# Sveltekit cache directory
99-
.svelte-kit/
100-
101-
# vitepress build output
102-
**/.vitepress/dist
103-
104-
# vitepress cache directory
105-
**/.vitepress/cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
112-
113-
# FuseBox cache
114-
.fusebox/
115-
116-
# DynamoDB Local files
117-
.dynamodb/
118-
119-
# Firebase cache directory
120-
.firebase/
121-
122-
# TernJS port file
123-
.tern-port
124-
125-
# Stores VSCode versions used for testing VSCode extensions
126-
.vscode-test
127-
128-
# yarn v3
129-
.pnp.*
130-
.yarn/*
131-
!.yarn/patches
132-
!.yarn/plugins
133-
!.yarn/releases
134-
!.yarn/sdks
135-
!.yarn/versions
136-
137-
# Vite logs files
138-
vite.config.js.timestamp-*
139-
vite.config.ts.timestamp-*
7+
.claude

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/contract"]
5+
path = lib/contract
6+
url = https://github.com/Railgun-Privacy/contract

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"[solidity]": {
3+
"editor.defaultFormatter": "JuanBlanco.solidity",
4+
"editor.formatOnSave": true
5+
},
6+
"solidity.formatter": "forge"
7+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# private-transfers-benchmarks
2-
A set of adapters to run structured benchmarks for private transfers protocols
2+
3+
## Test
4+
5+
`forge test -vv`

foundry.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"lib/contract": {
3+
"rev": "9ec09123eb140fdaaf3a5ff1f29d634c353630cd"
4+
},
5+
"lib/forge-std": {
6+
"tag": {
7+
"name": "v1.14.0",
8+
"rev": "1801b0541f4fda118a10798fd3486bb7051c5dd6"
9+
}
10+
}
11+
}

foundry.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[profile.default]
2+
src = "src"
3+
out = "out"
4+
libs = ["lib"]
5+
solc = "0.8.28"
6+
remappings = ["@railgun/=lib/contract/contracts/"]
7+
8+
[rpc_endpoints]
9+
mainnet = "${ETH_RPC_URL}"

lib/contract

Submodule contract added at 9ec0912

0 commit comments

Comments
 (0)