Skip to content

Commit

Permalink
Test: Ethereum Settlement Client (#81)
Browse files Browse the repository at this point in the history
* update: settlement-client: ethereum test cases for conversion fns

* update: removed .expect from slice_u8_to_u256

* update: Eth Settlement client: tests for conversions

* update: Eth Settlement client : prepare_sidecar

* update: settlement_client: eth: prepare_sidecar tests

* chore: optimisations

* update: working test case

* update: working test #2

* update: added cfg test for update_state_with_blobs

* update: cleaner cfg(test) implemented code for update_state_and_blob_test

* chore: liniting fixes

* update: linting fixes

* docs: changelog

* update: Nonce prefetch for state_update

* update: creation of input_data works

* update: using correct input bytes

* chore: lint fix

* update: test normal transaction

* update: dummy contract and impersonation tests ready

* update: test cases for settlement client

* chore: lint fixes

* chore: fix lints

* update: Changes for PR review

* chore: fixing test cases for eth settlement client

* update: tests fix

* chore: lint fix

* chore: lint fix

* update: path fix

* update: testing anvil install on gh

* update: fixing path

* update: added Blast rpc for eth

* update: Coverage CI fixes

* update: correct Pr checks

* update: PR reviews fixes

* update: PR reviews fixes

* update: adding rationale for update_state_blob_with_impersonation_works & update_state_blob_with_dummy_contract_works

* update: cleaner test integration on update_state_with_blobs

* update: removing EthProvider

* Reworking Settlement Client Changes (#89)

Reworking Settlement Client test cases to be independent of env vars and work in minimalism.
---------

Co-authored-by: Heemank Verma <[email protected]>

* update PR reviews fixed

* update PR reviews fixed

---------

Co-authored-by: apoorvsadana <[email protected]>
  • Loading branch information
heemankv and apoorvsadana authored Aug 23, 2024
1 parent 5dfed65 commit 334b3cc
Show file tree
Hide file tree
Showing 28 changed files with 1,800 additions and 344 deletions.
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ SQS_WORKER_TRIGGER_QUEUE_URL=
AWS_S3_BUCKET_NAME=
AWS_S3_BUCKET_REGION=


# Ethereum Settlement
DEFAULT_SETTLEMENT_CLIENT_RPC=
DEFAULT_L1_CORE_CONTRACT_ADDRESS=

# Sharp Services
SHARP_CUSTOMER_ID=
SHARP_USER_CRT=
SHARP_USER_KEY=
SHARP_SERVER_CRT=
SHARP_PROOF_LAYOUT=
SHARP_PROOF_LAYOUT=

9 changes: 8 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ MADARA_RPC_URL="http://localhost:3000"
ETHEREUM_RPC_URL="http://localhost:3001"
MEMORY_PAGES_CONTRACT_ADDRESS="0x000000000000000000000000000000000001dead"
PRIVATE_KEY="0xdead"
ETHEREUM_PRIVATE_KEY="0x000000000000000000000000000000000000000000000000000000000000beef"
# Private key of Test wallet provided by Anvil
ETHEREUM_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
STARKNET_SOLIDITY_CORE_CONTRACT_ADDRESS="0x000000000000000000000000000000000002dead"

##### Config URLs #####
Expand All @@ -27,6 +28,12 @@ PROVER_SERVICE="sharp"
SETTLEMENT_LAYER="ethereum"
DATA_STORAGE="s3"
MONGODB_CONNECTION_STRING="mongodb://localhost:27017"
DEFAULT_SETTLEMENT_CLIENT_RPC="http://localhost:3000"

# Ethereum Settlement
DEFAULT_L1_CORE_CONTRACT_ADDRESS="0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4"
SHOULD_IMPERSONATE_ACCOUNT="true"
TEST_DUMMY_CONTRACT_ADDRESS="0xE5b6F5e695BA6E4aeD92B68c4CC8Df1160D69A81"

# Sharp Services
SHARP_CUSTOMER_ID="sharp_consumer_id"
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: Rust Test & Coverage

on:
workflow_dispatch:
pull_request_target:
branches:
- main
types: [opened, synchronize, reopened]
push:
branches-ignore:
- main
workflow_call:
workflow_dispatch:

jobs:
coverage:
Expand Down Expand Up @@ -40,6 +47,20 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@v2

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

- name: Check Anvil Installation
run: |
if command -v anvil &> /dev/null
then
echo "Anvil is installed. Version information:"
anvil --version
else
echo "Anvil is not installed or not in PATH"
exit 1
fi
- name: Install cargo-llvm-cov & nextest
uses: taiki-e/install-action@cargo-llvm-cov

Expand All @@ -50,11 +71,9 @@ jobs:
run: |
wget -P ./crates/prover-services/sharp-service/tests/artifacts https://madara-orchestrator-sharp-pie.s3.amazonaws.com/238996-SN.zip
- name: Clean workspace
run: |
cargo clean --doc
- name: Run tests llvm-cov
- name: Run llvm-cov tests
env:
ETHEREUM_BLAST_RPC_URL: ${{ secrets.ETHEREUM_BLAST_RPC_URL }}
run: cargo llvm-cov nextest --release --lcov --output-path lcov.info --test-threads=1

- name: Coveralls
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linters-cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Task - Linters Cargo
on:
workflow_dispatch:
workflow_call:
push:

jobs:
cargo-lint:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Task - Linters
on:
workflow_dispatch:
workflow_call:
push:

jobs:
prettier:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
name: Workflow - Pull Request

on:
workflow_dispatch:
pull_request:
pull_request_target:
branches: [main]
push:
branches: [main]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rust-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Task - Build Rust
on:
workflow_dispatch:
workflow_call:
push:

jobs:
rust_build:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Added

- Tests for Settlement client.
- Worker queues to listen for trigger events.
- Tests for prover client.
- Added Rust Cache for Coverage Test CI.
Expand Down
Loading

0 comments on commit 334b3cc

Please sign in to comment.