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

fix: Hardhat tests running on Solo #22

Merged
merged 67 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
7323710
first commit
freemanzMrojo Aug 21, 2024
a5e58e3
first commit
freemanzMrojo Aug 21, 2024
a720ea0
some tests fixed
freemanzMrojo Aug 21, 2024
c3e6178
more tests
freemanzMrojo Aug 21, 2024
fc69b65
more tests fixed
freemanzMrojo Aug 21, 2024
da009f8
added correct chainId for solo
freemanzMrojo Aug 22, 2024
a5ef094
fixed more tests
freemanzMrojo Aug 22, 2024
7925416
removed unneccessary await
freemanzMrojo Aug 22, 2024
1e6f80c
fix: leaving the code as it was
freemanzMrojo Aug 23, 2024
f9ccc55
fix: changed entrypoint contract
freemanzMrojo Aug 23, 2024
c3ece2f
more tests fixed
freemanzMrojo Aug 23, 2024
8132c9b
fix: changed entrypoint contract
freemanzMrojo Aug 23, 2024
76076fa
fix: small change
freemanzMrojo Aug 23, 2024
3cfb581
fix: getting chainid from a single place
freemanzMrojo Aug 23, 2024
e7e2d41
more tests fixed
freemanzMrojo Aug 23, 2024
72fb0e6
comment amended
freemanzMrojo Aug 23, 2024
3686b32
more changes
freemanzMrojo Aug 23, 2024
48cf32c
more tests fixed
freemanzMrojo Aug 23, 2024
fb2046a
more tests fixed
freemanzMrojo Aug 23, 2024
dca753b
ci
freemanzMrojo Aug 23, 2024
7621b0e
test
freemanzMrojo Aug 23, 2024
147cef5
renamed package scripts for tests
freemanzMrojo Aug 23, 2024
2153e97
renamed package scripts for tests
freemanzMrojo Aug 23, 2024
a857ddb
removed unused test file since the test is duplicated
freemanzMrojo Aug 23, 2024
d0ceed0
fixed helpers test
freemanzMrojo Aug 23, 2024
f8c88c2
small change
freemanzMrojo Aug 23, 2024
d86df48
using entrypoint to fund vtho
freemanzMrojo Aug 23, 2024
6fdb1cc
test cleanup
freemanzMrojo Aug 23, 2024
33f9c76
test cleanup
freemanzMrojo Aug 23, 2024
4720b9f
fixed another test
freemanzMrojo Aug 25, 2024
03d8e36
all tests passing
freemanzMrojo Aug 25, 2024
79190d7
fixed some problems
freemanzMrojo Aug 25, 2024
ca4fbe4
fixed last test
freemanzMrojo Aug 25, 2024
07bf4ee
shards config
freemanzMrojo Aug 25, 2024
190c51c
shards config
freemanzMrojo Aug 25, 2024
5f67df7
shards config
freemanzMrojo Aug 25, 2024
1a94ced
shards config
freemanzMrojo Aug 25, 2024
bd17c76
shards config
freemanzMrojo Aug 25, 2024
a3f689d
added all util files to utils folder
freemanzMrojo Aug 25, 2024
8df32d7
3rd shard
freemanzMrojo Aug 25, 2024
43cfec8
3rd shard
freemanzMrojo Aug 25, 2024
fdc7ac7
3rd shard
freemanzMrojo Aug 25, 2024
e955842
3rd shard
freemanzMrojo Aug 25, 2024
93bb595
3rd shard
freemanzMrojo Aug 25, 2024
d595346
removed only
freemanzMrojo Aug 26, 2024
da083bd
checking for failers
freemanzMrojo Aug 26, 2024
c7d3725
fail-fast added
freemanzMrojo Aug 26, 2024
c5692d1
fixed one more test
freemanzMrojo Aug 26, 2024
e21b5c9
fixed the other test
freemanzMrojo Aug 26, 2024
0cebbb9
running pipeline only on PRs
freemanzMrojo Aug 26, 2024
a421c09
fixed the other test
freemanzMrojo Aug 26, 2024
6b159b2
added network support
freemanzMrojo Aug 26, 2024
a493ebf
readme updated
freemanzMrojo Aug 26, 2024
e7c663c
readme updated
freemanzMrojo Aug 26, 2024
cd8e9cd
readme updated
freemanzMrojo Aug 26, 2024
5175d58
tests reviewed
freemanzMrojo Aug 26, 2024
1ea8d5b
adding chainId depending on the network
freemanzMrojo Aug 26, 2024
a1acb51
removed from block since it runs from solo and sometimes the block go…
freemanzMrojo Aug 26, 2024
117c583
readme updated
freemanzMrojo Aug 26, 2024
13d2d65
file renamed
freemanzMrojo Aug 26, 2024
bf2e0dc
readme updated
freemanzMrojo Aug 26, 2024
ac46542
contributing renamed
freemanzMrojo Aug 26, 2024
79a0082
removed base gasfee
freemanzMrojo Aug 26, 2024
28bce97
removed base gasfee
freemanzMrojo Aug 26, 2024
7a099fd
allowance checked already performed
freemanzMrojo Aug 26, 2024
421e472
test fixed
freemanzMrojo Aug 26, 2024
a8721aa
removed identation
freemanzMrojo Aug 26, 2024
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
88 changes: 0 additions & 88 deletions .github/workflows/build.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Account Abstraction workflow

on:
workflow_dispatch:
pull_request:
branches:
- vechain

jobs:
call-workflow-hardhat-tests:
uses: ./.github/workflows/test-contracts.yml
with:
shard-matrix: "{ \"shard\": [1,2,3] }"
secrets: inherit



47 changes: 47 additions & 0 deletions .github/workflows/test-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Account abstraction contract tests

on:
workflow_call:
inputs:
shard-matrix:
required: true
type: string

jobs:
run-tests-and-build-report:
name: Test Smart Contracts with Hardhat
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
packages: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.shard-matrix) }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node v20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'
always-auth: true
scope: '@vechain'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: yarn install

- name: Smart contract tests
run: yarn test:shard${{ matrix.shard }}:compose:v2



File renamed without changes.
65 changes: 38 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
# VeChain Account Abstraction contracts

Implementation of contracts for [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) account abstraction via alternative mempool.

This project is based on [eth-infinitism v0.6.0 implementation](https://github.com/eth-infinitism/account-abstraction/tree/abff2aca61a8f0934e533d0d352978055fddbd96).

![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)

# Vechain Specific Changes
The changes mainly concern VTHO support, as the gas unit that is refunded.
## VeChain Specific Changes
The changes mainly concern VTHO support, as the gas unit that is prefunded.

# Test
## Test using Thor Solo

## Deploy all on Solo
The tests run using Docker Compose to bring up a Thor Solo instance. You should also install all dependencies first by running `yarn install`.

Make sure your `hardhat.config.ts` has the following line:
When using Docker Compose V1, please run the script:

```ts
vechain: {
url: VECHAIN_URL_SOLO
}
```bash
yarn test:compose:v1
```

If you have Docker Compose V2, please run this instead:

```bash
yarn test:compose:v2
```

If you need to find out first which one is your version, please execute (V1 would be the below)

And then deploy all contracts (entryPoint included)
```bash
yarn hardhat test --network vechain test/deploy-contracts.test.ts
➜ docker-compose -v
docker-compose version 1.29.2, build 5becea4c
```

## Deploy EntryPoint on Testnet
The test files are placed in separate folders (`shard1`, `shard2`...) so we can parallelise the execution in the pipelines.

## Test on networks

**DISCLAIMER**: There are over a hundred tests in this repository. Further adjustments might be required in this case (for instance, make sure that the sender account is well-funded).

### Deploy contracts on Testnet
To deploy on testnet modify the `hardhat.config.ts` with the following

```ts
vechain: {
vechain_testnet: {
url: VECHAIN_URL_TESTNET,
accounts: {
mnemonic: "your testnet mnemonic goes here"
Expand All @@ -37,14 +52,14 @@ vechain: {

And run the deployment script
```bash
yarn hardhat test --network vechain test/deploy-entrypoint.test.ts
yarn hardhat test --network vechain_testnet shard1/deploy-contracts.test.ts
```

## Deploy EntryPoint on Mainnet
### Deploy contracts on Mainnet
To deploy on testnet modify the `hardhat.config.ts` with the following

```ts
vechain: {
vechain_mainnet: {
url: VECHAIN_URL_MAINNET,
accounts: {
mnemonic: "your mainnet mnemonic goes here"
Expand All @@ -54,26 +69,22 @@ vechain: {

And run the deployment script
```bash
yarn hardhat test --network vechain test/deploy-entrypoint.test.ts
yarn hardhat test --network vechain_mainnet shard1/deploy-contracts.test.ts
```

### Run tests on a network

Update [./test/config.ts](./test/config.ts) with the addresses of the deployed contracts and
Update [./test/utils/config.ts](./test/utils/config.ts) with the addresses of the deployed contracts and then for testnet:

Run entryPoint tests:
```bash
yarn hardhat test test/entrypoint.test.ts --network vechain
yarn test:testnet
```

Run paymaster tests:
And for mainnet:
```bash
yarn hardhat test test/paymaster.test.ts --network vechain
yarn test:mainnet
```

Run simple wallet tests:
```bash
yarn hardhat test test/simple-wallet.test.ts --network vechain
```

# Resources
## Resources
- [Vitalik's post on account abstraction without Ethereum protocol changes](https://medium.com/infinitism/erc-4337-account-abstraction-without-ethereum-protocol-changes-d75c9d94dc4a)
Loading
Loading