Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Solana support #8

Merged
merged 68 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
14b90db
Merge pull request #6 from SecretSaturn/main
SecretSaturn May 8, 2024
1d216d0
contract update
SecretSaturn May 18, 2024
209d945
update
SecretSaturn May 19, 2024
9c660e9
program update
SecretSaturn May 22, 2024
788b151
upgrade secret gateway contract
SecretSaturn Jun 3, 2024
d8835ca
Contract almost done & Solana relayer work
SecretSaturn Jun 19, 2024
f7f68da
Contract updates, first emitted logs, relayer progress
SecretSaturn Jun 22, 2024
a105b01
Merge branch 'main' into Solana
SecretSaturn Jun 22, 2024
309e479
Gateway into Solana working, smaller fixes all around
SecretSaturn Jun 23, 2024
a2fe60b
Relayer progress, add Anchor gen py interface
SecretSaturn Jun 23, 2024
e1ee5b9
Big update (first post execution successful)
SecretSaturn Jun 27, 2024
b065c86
Use PDA for gateway_state, add more state checks
SecretSaturn Jun 29, 2024
b770ead
Add PDA into gateway contract, adjust tests, remove redundant wallet …
SecretSaturn Jul 3, 2024
94471a0
working encryption + message passing
SecretSaturn Jul 5, 2024
f91a633
solana contract optimizations
SecretSaturn Jul 7, 2024
24d925c
Merge branch 'main' into Solana
SecretSaturn Jul 7, 2024
15054b8
RNG Contract update in progress
SecretSaturn Jul 11, 2024
2229a34
Merge branch 'main' into Solana
SecretSaturn Jul 11, 2024
e452da4
finalize RNG contract upgrade, add RNG upgrade script
SecretSaturn Jul 11, 2024
e323ca1
Contract naming changes + size optimizations
SecretSaturn Jul 11, 2024
f492d4a
CPI implementation start
SecretSaturn Jul 12, 2024
4342402
CPI implementation WIP & RNG contract fix
SecretSaturn Jul 13, 2024
a9e56a6
Finalize CPI, switch to find_program_address
SecretSaturn Jul 26, 2024
0b49c82
massive gas optimizations for solana
SecretSaturn Jul 29, 2024
d02c8b9
Contract improvements
SecretSaturn Jul 30, 2024
867eddf
code and CU improvements, add zero_copy account to fix storage
SecretSaturn Aug 4, 2024
9acff9f
Contract improvements
SecretSaturn Aug 4, 2024
e2de9d2
Contract improvements
SecretSaturn Aug 4, 2024
9a9a5f4
RNG contract improvements
SecretSaturn Aug 27, 2024
aac774d
VRF contracts upgrade
SecretSaturn Sep 3, 2024
aae6c61
Solana VRF WIP + new testing suite WIP
SecretSaturn Sep 6, 2024
e21c4b9
Solana VRF continued
SecretSaturn Sep 9, 2024
903d0c6
Merge branch 'main' into Solana
SecretSaturn Sep 10, 2024
43f8e53
Fix secret gateway tests & improve contract
SecretSaturn Sep 11, 2024
abd13f2
Update requirements.txt
SecretSaturn Sep 11, 2024
f743427
Update KV-Store example
SecretSaturn Sep 13, 2024
d9678da
Add randomness test I
SecretSaturn Sep 13, 2024
f7bd5ae
Improve solidity tests
SecretSaturn Sep 14, 2024
d12e060
swap out RNG contracts, add to gateway, add zksync gateway
SecretSaturn Sep 18, 2024
f3623d3
Merge branch 'main' into Solana
SecretSaturn Sep 19, 2024
d95c9dc
Relayer fixes
SecretSaturn Sep 19, 2024
e39896e
Move files for relayers
SecretSaturn Sep 20, 2024
5af85de
small fixes
SecretSaturn Sep 25, 2024
779ef84
Small fixes
SecretSaturn Sep 26, 2024
60e79a1
Create gateway.json
SecretSaturn Sep 26, 2024
5ba4e9f
Fix scrt sequence and add more code comments
SecretSaturn Sep 27, 2024
11a7414
fix web3 dependency
SecretSaturn Sep 27, 2024
131373c
implement Docker image with GH action
SecretSaturn Sep 29, 2024
fb77fd9
Fix gitignore
SecretSaturn Sep 29, 2024
1321a99
Merge pull request #10 from SecretSaturn/Solana-docker
SecretSaturn Sep 29, 2024
1523730
GH workflow update
SecretSaturn Sep 29, 2024
727bfb9
GH Docker image 1
SecretSaturn Sep 29, 2024
5500b2c
GH Docker image 2
SecretSaturn Sep 29, 2024
a09b692
docker compose fix
SecretSaturn Sep 29, 2024
3662b8f
Make docker image build dependent on passing test
SecretSaturn Sep 30, 2024
bf86a3a
add more commenting to relayer and secret gateway & CI improvements
SecretSaturn Oct 1, 2024
d6d9a85
Add Edexa
SecretSaturn Oct 2, 2024
38e766e
Fix web3py to 7.X and add comments for base_interface
SecretSaturn Oct 2, 2024
0f6c655
config.yml default to false
SecretSaturn Oct 4, 2024
948c513
Add POA middleware fix + improve error handling
SecretSaturn Oct 4, 2024
8d970dd
Unify the EVM and Solana gateways
SecretSaturn Oct 7, 2024
dd4ea73
Update pulsar-3 gateway code_hash
SecretSaturn Oct 8, 2024
dadefcc
Improve TX handling on SCRT side
SecretSaturn Oct 8, 2024
079309b
Solana Contract improvements, more test fixes
SecretSaturn Oct 9, 2024
38e3a93
Fix send test
SecretSaturn Oct 9, 2024
92527a2
Fix all solana tests, fix small contract errors
SecretSaturn Oct 10, 2024
633f164
Logging improvements
SecretSaturn Oct 10, 2024
16a9202
Fix all remaining tests and fix randomness request
SecretSaturn Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: Continuous Integration

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "TNLS-Relayers/**"
- "TNLS-Gateways/public-gateway/**"
- "TNLS-Gateways/secret/**"
- ".github/workflows/ci.yml"
pull_request:
branches:
- main
paths:
- "TNLS-Relayers/**"
- "TNLS-Gateways/public-gateway/**"
- "TNLS-Gateways/secret/**"
- ".github/workflows/ci.yml"

jobs:
foundry_tests:
name: Foundry 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: Install forge dependencies
working-directory: TNLS-Gateways/public-gateway
run: forge install

- name: Run tests
working-directory: TNLS-Gateways/public-gateway
run: forge test -vvv

- name: Check gas snapshots
working-directory: TNLS-Gateways/public-gateway
run: forge snapshot --check --tolerance 1

secret_unit_tests:
name: Secret Gateway Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- uses: mozilla-actions/[email protected]

- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Run Unit Tests
working-directory: TNLS-Gateways/secret
run: cargo test --release

secret_integration_tests:
name: Secret Gateway Integration Tests
runs-on: ubuntu-latest
needs: secret_unit_tests
services:
secret:
image: ghcr.io/scrtlabs/localsecret:v1.13.3
ports:
- 1317:1317
- 5000:5000
- 9091:9091
- 26657:26657
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- uses: mozilla-actions/[email protected]

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: wasm32-unknown-unknown

- name: Install dependencies
working-directory: TNLS-Gateways/secret
run: npm --prefix tests/ install

- name: Install latest Binaryen
run: |
BINARYEN_VERSION=version_118
wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz
tar -xzf binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz
sudo mv binaryen-${BINARYEN_VERSION} /usr/local/binaryen
echo "/usr/local/binaryen/bin" >> $GITHUB_PATH

- name: Verify installation
run: wasm-opt --version

- name: Build wasm contract
working-directory: TNLS-Gateways/secret
run: make build-mainnet

- name: Run integration tests
working-directory: TNLS-Gateways/secret
run: make integration-test

build_and_push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs:
- foundry_tests
- secret_integration_tests
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: secretpath
IMAGE_TAG: latest
DOCKER_BUILDKIT: 1
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
working-directory: TNLS-Relayers
run: |
docker compose build --pull
docker compose push
42 changes: 0 additions & 42 deletions .github/workflows/Foundry_tests.yml

This file was deleted.

117 changes: 0 additions & 117 deletions .github/workflows/Secret_gateway_tests.yml

This file was deleted.

8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
.idea
TNLS-Relayers/etherscan_api_key.txt
TNLS-Relayers/infura_api_endpoint.txt
*/*/*/infura_api_endpoint.txt
*/.*
*/venv
*/__pycache__
.DS_Store
Expand All @@ -24,11 +20,13 @@ TNLS-Gateways/secret/contract.wasm
TNLS-Gateways/secret/contract.wasm.gz
.env
__pycache__/
*.example
TNLS-Gateways/public-gateway/broadcast/*
TNLS-Gateways/public-gateway/lib/*
*.gz
TNLS-Samples/RNG/contract.wasm.gz
/TNLS-Gateways/solana-gateway/node_modules
/venv
/TNLS-Gateways/solana-gateway/.anchor/program-logs
/secret-deploy/node_modules
/secret-deploy/secret_gateway.log
/secret-deploy/secret_sample.log
20 changes: 15 additions & 5 deletions TNLS-Gateways/public-gateway/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
ContractTest:testFail_CannotPreExecutionWithoutValidPayloadSig() (gas: 61787)
ContractTest:testFail_PostExecutionWithoutMapStoredAddressSignatures() (gas: 83236)
ContractTest:test_PostExecution() (gas: 84170)
ContractTest:test_PostExecutionExplicitValues() (gas: 2787283)
ContractTest:test_PreExecution() (gas: 64465)
ContractTest:test_EstimateRequestPrice() (gas: 10900)
ContractTest:test_OwnerFunctions() (gas: 44469)
ContractTest:test_PostExecution() (gas: 99534)
ContractTest:test_PostExecutionWithoutValidSignature() (gas: 94618)
ContractTest:test_PostExecution_InvalidPacketHash() (gas: 88078)
ContractTest:test_PostExecution_Reexecution() (gas: 107644)
ContractTest:test_PreExecution() (gas: 80573)
ContractTest:test_RecoverSigner() (gas: 24861)
ContractTest:test_RequestRandomness() (gas: 88250)
ContractTest:test_RequestRandomness_Limits() (gas: 86674)
ContractTest:test_RequestRandomness_PaidCallbackFeeTooLow() (gas: 26826)
ContractTest:test_Send_GasRefund() (gas: 77266)
ContractTest:test_Send_InvalidPayloadHash() (gas: 37302)
ContractTest:test_TaskCompletionOrder() (gas: 173468)
ContractTest:test_TasksFromMultipleUsers() (gas: 135553)
Loading