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

chore: scheduled basic e2e tests for evm testnet endpoint #2106

Merged
merged 4 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
33 changes: 33 additions & 0 deletions .github/workflows/e2e-evm-basic-testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: EVM E2E Basic Testnet (Scheduled)

on:
schedule:
- cron: "0 * * * *" # every hour at 00 min

jobs:
e2e-evm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: "just install"
run: just install
working-directory: "evm-e2e"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Implement dependency caching to improve workflow execution time.

Adding caching for dependencies can significantly reduce the workflow execution time and load on GitHub's infrastructure.

   e2e-evm:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
+
+      - uses: actions/cache@v3
+        with:
+          path: |
+            evm-e2e/.just
+            evm-e2e/node_modules
+          key: ${{ runner.os }}-evm-e2e-${{ hashFiles('evm-e2e/package-lock.json') }}
+          restore-keys: |
+            ${{ runner.os }}-evm-e2e-

       - name: "just install"
         run: just install
         working-directory: "evm-e2e"

Committable suggestion skipped: line range outside the PR's diff.

- name: "Run tests (just test-basic)"
run: just test-basic
working-directory: "evm-e2e"
env:
JSON_RPC_ENDPOINT: https://evm-rpc.testnet-1.nibiru.fi
MNEMONIC: ${{ secrets.WALLET_MNEMONIC_TESTNET }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance test execution reliability and maintainability.

Several improvements could make the test execution more robust:

  1. The RPC endpoint should be configurable via secrets
  2. Add timeout to prevent hanging tests
  3. Implement retry mechanism for transient failures
       - name: "Run tests (just test-basic)"
+        timeout-minutes: 10
+        uses: nick-fields/retry@v2
+        with:
+          timeout_minutes: 10
+          max_attempts: 3
+          command: cd evm-e2e && just test-basic
-        run: just test-basic
-        working-directory: "evm-e2e"
         env:
-          JSON_RPC_ENDPOINT: https://evm-rpc.testnet-1.nibiru.fi
+          JSON_RPC_ENDPOINT: ${{ secrets.TESTNET_RPC_ENDPOINT }}
           MNEMONIC: ${{ secrets.WALLET_MNEMONIC_TESTNET }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: "Run tests (just test-basic)"
run: just test-basic
working-directory: "evm-e2e"
env:
JSON_RPC_ENDPOINT: https://evm-rpc.testnet-1.nibiru.fi
MNEMONIC: ${{ secrets.WALLET_MNEMONIC_TESTNET }}
- name: "Run tests (just test-basic)"
timeout-minutes: 10
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: cd evm-e2e && just test-basic
env:
JSON_RPC_ENDPOINT: ${{ secrets.TESTNET_RPC_ENDPOINT }}
MNEMONIC: ${{ secrets.WALLET_MNEMONIC_TESTNET }}

- name: Send failure to slack channel
if: always()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: "failure"
notification_title: "EVM basic tests failed on Testnet"
message_format: "{emoji} *{workflow}* {status_message} Run: {run_url}"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TESTNET }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ tests for race conditions within funtoken precompile
- [#2100](https://github.com/NibiruChain/nibiru/pull/2100) - refactor: cleanup statedb and precompile sections
- [#2101](https://github.com/NibiruChain/nibiru/pull/2101) - fix(evm): tx receipt proper marshalling
- [#2105](https://github.com/NibiruChain/nibiru/pull/2105) - test(evm): precompile call with revert
- [#2106](https://github.com/NibiruChain/nibiru/pull/2106) - chore: scheduled basic e2e tests for evm testnet endpoint
- [#2107](https://github.com/NibiruChain/nibiru/pull/2107) -
feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI
- [#2108](https://github.com/NibiruChain/nibiru/pull/2108) - fix(evm): removed deprecated root key from eth_getTransactionReceipt


#### Nibiru EVM | Before Audit 1 - 2024-10-18

- [#1837](https://github.com/NibiruChain/nibiru/pull/1837) - feat(eth): protos, eth types, and evm module types
Expand Down
4 changes: 4 additions & 0 deletions evm-e2e/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ install:
test:
npm test

# Runs tx receipt tests. Used for testnet quick check.
test-basic:
npm test -- tx_receipt.test.ts

# Format
fmt:
npm run format
2 changes: 1 addition & 1 deletion evm-e2e/test/tx_receipt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Transaction Receipt Tests', () => {
let recipient = ethers.Wallet.createRandom().address;

it('simple transfer receipt', async () => {
const value = ethers.parseEther('1');
const value = ethers.parseEther('0.0001');
const tx = await account.sendTransaction({
to: recipient,
value,
Expand Down
Loading