Skip to content

Commit

Permalink
Goerli tests (#562)
Browse files Browse the repository at this point in the history
* updated deps

* added new methods

* added specVersion to README

* expose data from starknet errors

* clean up

* refactor to return hex

* switch realese bin build on ubuntu-20.04

* switch workflows  on ubuntu-20.04

* Revert "switch realese bin build on ubuntu-20.04"

This reverts commit 9fff367.

* switch to musl build

* use container for build

* del workflow dispatch

* try with kill in CI job

* update hurl install

* cache target

* check killing works

* added right codes

* workflow dispatch

* added test gorli declare transaction

* adding tests

* updated ci

* revert hurl install script due to errors in cargo install

* ops

* Sync the README.md with the main branch

Keep using "jsonrpc" instead of "openrpc" just to avoid the conflict with the main branch

---------

Co-authored-by: pierre-l <pierre.larger@gmail.com>
  • Loading branch information
tonypony220 and pierre-l authored Jan 22, 2024
1 parent 8fa13af commit 79f8f37
Show file tree
Hide file tree
Showing 62 changed files with 1,421 additions and 81 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,40 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: install hurl
run: |
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl_2.0.1_amd64.deb
sudo apt-get update && sudo apt-get install -y ./hurl_2.0.1_amd64.deb
# rust action deps
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: install hurl
run: |
version=4.1.0
curl --location --remote-name "https://github.com/Orange-OpenSource/hurl/releases/download/${version}/hurl_${version}_amd64.deb"
sudo apt-get update && sudo apt-get install -y ./hurl_${version}_amd64.deb
- name: build beerus
run: cargo build -p beerus-cli --release

- name: start beerus RPC
- name: start beerus RPC on MAINNET
env:
BEERUS_VERSION: "ci"
NETWORK: "mainnet"
ETH_EXECUTION_RPC: ${{ secrets.ETH_EXECUTION_RPC }}
STARKNET_RPC: ${{ secrets.STARKNET_RPC }}
ETH_EXECUTION_RPC: ${{ secrets.ETH_EXECUTION_RPC_MAINNET }}
STARKNET_RPC: ${{ secrets.STARKNET_RPC_MAINNET }}
run: ./target/release/beerus &
- name: run integration test on MAINNET
run: bash ./scripts/integration-test.sh mainnet

- name: stop RPC
run: kill $(lsof -t -i:3030)

- name: start beerus RPC on TESTNET(goerli)
env:
BEERUS_VERSION: "ci"
NETWORK: "goerli"
ETH_EXECUTION_RPC: ${{ secrets.ETH_EXECUTION_RPC_GOERLI }}
STARKNET_RPC: ${{ secrets.STARKNET_RPC_GOERLI }}
run: ./target/release/beerus &

- name: run integration test
run: bash ./scripts/integration-test.sh
- name: run integration test TESTNET(goerli)
run: bash ./scripts/integration-test.sh goerli
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: release
on:
workflow_dispatch:
push:
tags:
- '*'
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ beerus-core = { path = "../core" }
beerus-rpc = { path = "../rpc" }
clap = { version = "4.4.7", features = ["derive"] }
tracing-subscriber.workspace = true
tracing.workspace = true
tracing.workspace = true
4 changes: 2 additions & 2 deletions examples/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name = "example"
version = "0.3.0"

[dependencies]
starknet.workspace = { path = "../../" }
beerus-core = { path = "../../crates/core"}
starknet = "0.6.0"
tracing = "0.1.40"
tracing.workspace = { path = "../../" }
tracing-subscriber = "0.3.17"
eyre = "0.6.8"
async-std = { version = "1.12.0", features = ["attributes", "tokio1"] }
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions examples/rpc/goerli/starknet_call.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_call",
"params": [
{
"calldata": [],
"contract_address": "0x6d8e1f3ed72fc87aa896639a0f50a4b9e59adb24de8a42b477957e1a7996e1b",
"entry_point_selector": "0x293c9b0657d7591853c62ddc495b09ff833e04ad61f066dd7c8cc3a5b6b303d"
},
"pending"
]
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" exists
13 changes: 13 additions & 0 deletions examples/rpc/goerli/starknet_chainId.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_chainId",
"params": [],
"id": 1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" == "0x534e5f474f45524c49"
40 changes: 40 additions & 0 deletions examples/rpc/goerli/starknet_estimateFee.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_estimateFee",
"params": [
[
{
"calldata": [
"0x1",
"0x6d8e1f3ed72fc87aa896639a0f50a4b9e59adb24de8a42b477957e1a7996e1b",
"0x166d775d0cf161f1ce9b90698485f0c7a0e249af1c4b38126bddb37859737ac",
"0x0",
"0x1",
"0x1",
"0x737461726b6e6574"
],
"max_fee": "0x0",
"nonce": "0x5",
"sender_address": "0x179eaac35ef5370f1c997ed1ff088b0e52f7fec7ef38c444e9171f895e41207",
"signature": [
"0x2d1ab2a39b7356d2e71efdf7a4a1a47446de9ad7f23ceef00f7df00ca01df69",
"0x7d60831c0e4fc24fccedd2b6a0e729416c83d15accbda3f8db76f374a40b70c"
],
"type": "INVOKE",
"version": "0x100000000000000000000000000000001"
}
],
[],
{
"block_number": 930199
}
]
}
HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result[0].gas_price" exists
jsonpath "$.result[0].overall_fee" exists
39 changes: 39 additions & 0 deletions examples/rpc/goerli/starknet_estimateFeeSingle.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_estimateFeeSingle",
"params": {
"request": {
"calldata": [
"0x1",
"0x6d8e1f3ed72fc87aa896639a0f50a4b9e59adb24de8a42b477957e1a7996e1b",
"0x166d775d0cf161f1ce9b90698485f0c7a0e249af1c4b38126bddb37859737ac",
"0x0",
"0x1",
"0x1",
"0x737461726b6e6574"
],
"max_fee": "0x0",
"nonce": "0x5",
"sender_address": "0x179eaac35ef5370f1c997ed1ff088b0e52f7fec7ef38c444e9171f895e41207",
"signature": [
"0x2d1ab2a39b7356d2e71efdf7a4a1a47446de9ad7f23ceef00f7df00ca01df69",
"0x7d60831c0e4fc24fccedd2b6a0e729416c83d15accbda3f8db76f374a40b70c"
],
"type": "INVOKE",
"version": "0x100000000000000000000000000000001"
},
"simulation_flags": [],
"block_id": {
"block_number": 930151
}
},
"id": 0
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result.gas_price" exists
jsonpath "$.result.overall_fee" exists
16 changes: 16 additions & 0 deletions examples/rpc/goerli/starknet_getBalance.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_getBalance",
"params": [
"latest",
"0x88aede3875549767ad776d7e231240c3ef0eb27e036bf4ceccd4d1d7cdba90"
],
"id":1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" exists
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions examples/rpc/goerli/starknet_getClassHashAt.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_getClassHashAt",
"params": [
{
"block_number": 930000
},
"0x040688250Ef0074B4c9e1057B19F9b62139ac28179c7d35e2daE5abAD909d558"
],
"id": 1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" matches /^0x[A-Fa-f0-9]+$/
File renamed without changes.
16 changes: 16 additions & 0 deletions examples/rpc/goerli/starknet_getNonce.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_getNonce",
"params": [
"latest",
"0x88aede3875549767ad776d7e231240c3ef0eb27e036bf4ceccd4d1d7cdba90"
],
"id":1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" matches /^0x[A-Fa-f0-9]+$/
23 changes: 23 additions & 0 deletions examples/rpc/goerli/starknet_getProof.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc":"2.0",
"method":"starknet_getProof",
"params":[
{
"block_number": 930199
},
"0x049D36570D4e46f48e99674bd3fcc84644DdD6b96F7C741B1562B82f9e004dC7",
[
"0x2c401056f9582175d3219f1ac8f974b7960f2edfc8bc03197718dc8967ba1ab"
]
],
"id":1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result.state_commitment" exists
jsonpath "$.result.class_commitment" exists
jsonpath "$.result.contract_proof" exists
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions examples/rpc/goerli/starknet_getStorageAt.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_getStorageAt",
"params": [
"0x6d8e1f3ed72fc87aa896639a0f50a4b9e59adb24de8a42b477957e1a7996e1b",
"0x361458367e696363fbcc70777d07ebbd2394e89fd0adcaf147faccd1d294d60",
{
"block_number": 931343
}
]
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result" exists
15 changes: 15 additions & 0 deletions examples/rpc/goerli/starknet_getTransactionByHash.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_getTransactionByHash",
"params": [
"0x71f6f2272d068e6d73f92fcddb53555ffb923fdef395b0d2716348145f70a45"
],
"id":1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result.transaction_hash" matches /^0x[A-Fa-f0-9]+$/
15 changes: 15 additions & 0 deletions examples/rpc/goerli/starknet_getTransactionReceipt.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_getTransactionReceipt",
"params": [
"0x71f6f2272d068e6d73f92fcddb53555ffb923fdef395b0d2716348145f70a45"
]
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists
jsonpath "$.result.transaction_hash" matches /^0x[A-Fa-f0-9]+$/
15 changes: 15 additions & 0 deletions examples/rpc/goerli/starknet_getTransactionStatus.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
POST http://0.0.0.0:3030
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "starknet_getTransactionStatus",
"params": [
"0x71f6f2272d068e6d73f92fcddb53555ffb923fdef395b0d2716348145f70a45"
],
"id":1
}

HTTP 200
[Asserts]
jsonpath "$.error" not exists

File renamed without changes.
Loading

0 comments on commit 79f8f37

Please sign in to comment.