Skip to content

Commit

Permalink
Merge branch 'master' into shef-protonet-validator-network
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-kava committed Sep 24, 2024
2 parents 44dc38c + ee4fc56 commit d6fab27
Show file tree
Hide file tree
Showing 17 changed files with 844 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
run: make docker-build test-e2e
test-e2e-evm:
runs-on: ubuntu-latest
env:
KAVA_TAG: local
steps:
- name: Checkout current commit
uses: actions/checkout@v4
Expand All @@ -58,6 +60,9 @@ jobs:
- name: Install npm dependencies
run: npm install
working-directory: tests/e2e-evm
- name: Run test suite against hardhat network
run: npm run compile
working-directory: tests/e2e-evm
- name: Run test suite against hardhat network
run: npm run test-hardhat
working-directory: tests/e2e-evm
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ jobs:
- name: Install npm dependencies
run: npm install
working-directory: tests/e2e-evm
- name: Run solhint
run: npm run solhint
working-directory: tests/e2e-evm
- name: Compile contracts and create artifcats
run: npm run compile
working-directory: tests/e2e-evm
- name: Run linter
run: npm run lint
working-directory: tests/e2e-evm
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e-evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ npx hardhat test --network hardhat
```
npx hardhat test --network kvtool
```

## Running CI Locally

With act installed, the following commands will run the lint and e2e CI jobs locally.

```
act -W '.github/workflows/ci-lint.yml' -j e2e-evm-lint
act -W '.github/workflows/ci-default.yml' -j test-e2e-evm --bind
```

The `--bind` flag is required for volume mounts of docker containers correctly mount. Without this flag, volumes are mounted as an empty directory.
78 changes: 78 additions & 0 deletions tests/e2e-evm/contracts/ABI_BasicTests.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// solhint-disable one-contract-per-file
// solhint-disable no-empty-blocks
// solhint-disable payable-fallback

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

//
// Normal noop functions only with nonpayable, payable, view, and pure modifiers
//
interface NoopNoReceiveNoFallback {
function noopNonpayable() external;
function noopPayable() external payable;
function noopView() external view;
function noopPure() external pure;
}
contract NoopNoReceiveNoFallbackMock is NoopNoReceiveNoFallback {
function noopNonpayable() external {}
function noopPayable() external payable {}
function noopView() external view {}
function noopPure() external pure {}
}

//
// Added receive function (always payable)
//
interface NoopReceiveNoFallback is NoopNoReceiveNoFallback {
receive() external payable;
}
contract NoopReceiveNoFallbackMock is NoopReceiveNoFallback, NoopNoReceiveNoFallbackMock {
receive() external payable {}
}

//
// Added receive function and payable fallback
//
interface NoopReceivePayableFallback is NoopNoReceiveNoFallback {
receive() external payable;
fallback() external payable;
}
contract NoopReceivePayableFallbackMock is NoopReceivePayableFallback, NoopNoReceiveNoFallbackMock {
receive() external payable {}
fallback() external payable {}
}

//
// Added receive function and non-payable fallback
//
interface NoopReceiveNonpayableFallback is NoopNoReceiveNoFallback {
receive() external payable;
fallback() external;
}
contract NoopReceiveNonpayableFallbackMock is NoopReceiveNonpayableFallback, NoopNoReceiveNoFallbackMock {
receive() external payable {}
fallback() external {}
}

//
// Added payable fallback and no receive function
//
// solc-ignore-next-line missing-receive
interface NoopNoReceivePayableFallback is NoopNoReceiveNoFallback {
fallback() external payable;
}
// solc-ignore-next-line missing-receive
contract NoopNoReceivePayableFallbackMock is NoopNoReceivePayableFallback, NoopNoReceiveNoFallbackMock {
fallback() external payable {}
}

//
// Added non-payable fallback and no receive function
//
interface NoopNoReceiveNonpayableFallback is NoopNoReceiveNoFallback {
fallback() external;
}
contract NoopNoReceiveNonpayableFallbackMock is NoopNoReceiveNonpayableFallback, NoopNoReceiveNoFallbackMock {
fallback() external {}
}
6 changes: 5 additions & 1 deletion tests/e2e-evm/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
//...tseslint.configs.recommendedTypeChecked,
{
rules: {
eqeqeq: ["error", "smart"],
},
},
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
Expand Down
8 changes: 7 additions & 1 deletion tests/e2e-evm/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { HardhatUserConfig, extendEnvironment } from "hardhat/config";
import "@nomicfoundation/hardhat-viem";
import { parseEther } from "viem";
import { extendViem } from "./test/extend";
import { extendViem } from "./test/extensions/viem";
import chai from "chai";
import chaiAsPromised from "chai-as-promised";
import "hardhat-ignore-warnings";

//
// Chai setup
Expand Down Expand Up @@ -56,6 +57,11 @@ const config: HardhatUserConfig = {
chainId: 31337, // The default hardhat network chain id
hardfork: "berlin", // The current hardfork of kava mainnet
accounts: accounts,
//
// This is required for hardhat-viem to have the same behavior
// for reverted transactions as on Kava.
//
throwOnTransactionFailures: false,
},
kvtool: {
chainId: 8888, // The evm chain id of the kvtool network
Expand Down
Loading

0 comments on commit d6fab27

Please sign in to comment.