Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
83 changes: 36 additions & 47 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,48 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
release:
types: [published]
pull_request:
branches: [ "main" ]
push:
branches:
- main

jobs:
build:
version:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Generate version tag
id: tag
run: echo "tag=$(date -u +'%-Y.%-m.%-d')-${{ github.run_number }}" >> "$GITHUB_OUTPUT"

build-and-push:
needs: version
permissions:
id-token: write
attestations: write
contents: read
packages: write
uses: NethermindEth/github-workflows/.github/workflows/docker-build-push-jfrog.yaml@stable
with:
group_name: angkor
repo_name: "angkor-oci-local-staging"
additional_tags: ${{ needs.version.outputs.tag }}

release:
needs: [version, build-and-push]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
- name: Create GitHub release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
# list of Docker images to use as base name for tags
images: |
${{ vars.DOCKERHUB_ID }}/chainbench
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
tag_name: ${{ needs.version.outputs.tag }}
generate_release_notes: true
body: |
Release ${{ needs.version.outputs.tag }}

# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Container images are available at:
```bash
docker pull nethermind.jfrog.io/angkor-oci-local-staging/chainbench:${{ needs.version.outputs.tag }}
docker pull nethermind.jfrog.io/angkor-oci-local-staging/chainbench:latest
```
134 changes: 134 additions & 0 deletions chainbench/profile/surge/general.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
from chainbench.user import EvmUser
from locust import constant_pacing, task


class SurgeProfile(EvmUser):
wait_time = constant_pacing(1)

@task(35)
def eth_call_task(self):
self.make_rpc_call(
name="eth_call",
method="eth_call",
params=[{"to": "0xE837861567a541EFbcf0a8A6C56aEb61dD7A2C20", "data": "0x20965255"}, "latest"],
)

@task(15)
def get_logs_task(self):
self.make_rpc_call(
name="eth_getLogs",
method="eth_getLogs",
params=self._get_logs_params_factory(self.rng.get_rng()),
)

@task(5)
def estimate_gas_task(self):
self.make_rpc_call(
name="eth_estimateGas",
method="eth_estimateGas",
params=[{"to": "0xE837861567a541EFbcf0a8A6C56aEb61dD7A2C20", "data": "0x20965255"}],
)

@task(10)
def get_block_by_number_task(self):
self.make_rpc_call(
name="eth_getBlockByNumber",
method="eth_getBlockByNumber",
params=self._block_params_factory(),
)

@task(8)
def get_balance_task(self):
self.make_rpc_call(
name="eth_getBalance",
method="eth_getBalance",
params=["0x0742D35Cc6634c0532925A3b844bc9e7595f3574", "latest"],
)

@task(7)
def get_transaction_receipt_task(self):
self.make_rpc_call(
name="eth_getTransactionReceipt",
method="eth_getTransactionReceipt",
params=self._transaction_by_hash_params_factory(self.rng.get_rng()),
)

@task(5)
def get_storage_at_task(self):
self.make_rpc_call(
name="eth_getStorageAt",
method="eth_getStorageAt",
params=["0x0742D35Cc6634c0532925A3b844bc9e7595f3574", "0x0", "latest"],
)

@task(5)
def get_gas_price_task(self):
self.make_rpc_call(
name="eth_gasPrice",
method="eth_gasPrice",
params=[],
)

@task(2)
def get_chain_id_task(self):
self.make_rpc_call(
name="eth_chainId",
method="eth_chainId",
params=[],
)

@task(1)
def net_version_task(self):
self.make_rpc_call(
name="net_version",
method="net_version",
params=[],
)

@task(1)
def syncing_task(self):
self.make_rpc_call(
name="eth_syncing",
method="eth_syncing",
params=[],
)

@task(1)
def get_max_priority_fee_per_gas_task(self):
self.make_rpc_call(
name="eth_maxPriorityFeePerGas",
method="eth_maxPriorityFeePerGas",
params=[],
)

@task(2)
def get_fee_history_task(self):
self.make_rpc_call(
name="eth_feeHistory",
method="eth_feeHistory",
params=["0x5", "latest", [50, 90]],
)

@task(1)
def get_block_number_task(self):
self.make_rpc_call(
name="eth_blockNumber",
method="eth_blockNumber",
params=[],
)

@task(1)
def get_block_receipts_task(self):
self.make_rpc_call(
name="eth_getBlockReceipts",
method="eth_getBlockReceipts",
params=["latest"],
)

@task(1)
def get_block_transaction_count_by_number_task(self):
self.make_rpc_call(
name="eth_getBlockTransactionCountByNumber",
method="eth_getBlockTransactionCountByNumber",
params=["latest"],
)
10 changes: 10 additions & 0 deletions chainbench/test_data/evm.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,16 @@ def get_random_contract(self, rng: RNG) -> Erc20Contract:
"0x928e4e3dFb1c39a6deE26506Cde76875E3a25ea4",
],
},
763375: {
"name": "surge-testnet",
"start_block": 1,
"contract_addresses": [],
},
560048: {
"name": "ethereum-hoodi-testnet",
"start_block": 1,
"contract_addresses": [],
},
}


Expand Down