Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Fix CI to run solidity tests #278

Merged
merged 36 commits into from
Oct 8, 2021

Conversation

yijiasu-crypto
Copy link
Contributor

Closes: #XXX

Description

This PR updates some stale code in Makefile and .github/workflows/deploy-contract.yml to make the CI works with performing solidity test on CI builds.

Some improvements:

  1. use make test-solidity in Github Actions instead of make test-contract
  2. Remove test-contract from Makefile. Contract & Solidity tests now can be run by make test-solidity.
  3. Remove installing solcjs from Makefile. This is no longer needed. Truffle inside solidity tests will handle installation of solcjs
  4. Add verbose logs parameter on yarn test to output ethermintd activities during CI test for better debugging

For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@yijiasu-crypto
Copy link
Contributor Author

This CI test is still failed since some ethermint issues haven't been fixed for the eth_getLogs RPC API.

However, the CI script itself is working well.
Reviews could see this: https://github.com/yijiasu-crypto/ethermint/pull/2/checks?check_run_id=3055077899 for the run result of CI. This run executed node test-helper.js --network ethermint --verbose-log initializable so it only tests the initializable test instead of performing all (basic test is currently failed)

Copy link
Contributor

@leejw51crypto leejw51crypto left a comment

Choose a reason for hiding this comment

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

lgtm

@fedekunze fedekunze enabled auto-merge (squash) July 13, 2021 10:12
@yijiasu-crypto
Copy link
Contributor Author

Wait for #248 to be closed to fix the broken CI test

@yijiasu-crypto
Copy link
Contributor Author

yijiasu-crypto commented Jul 15, 2021

Wait for issue #297 fixed. The test case basic failed so resulted in CI blockage

@yijiasu-crypto
Copy link
Contributor Author

Last round of CI failed at initializable-buidler (basic and initializable are passed!). The reason is still the inaccurate estimated gas. (HardHat will call eth_estimateGas to calculate the gas cost before sending the transaction, while truffle will use values in ABI definition, thus result in PASS with truffle and fail with HardHat)

Wait for #272 to be merged. It should fix this error

auto-merge was automatically disabled July 16, 2021 02:26

Head branch was pushed to by a user without write access

@yihuang
Copy link
Contributor

yihuang commented Jul 20, 2021

Last round of CI failed at initializable-buidler (basic and initializable are passed!). The reason is still the inaccurate estimated gas. (HardHat will call eth_estimateGas to calculate the gas cost before sending the transaction, while truffle will use values in ABI definition, thus result in PASS with truffle and fail with HardHat)

Wait for #272 to be merged. It should fix this error

it's merged now.

@yijiasu-crypto
Copy link
Contributor Author

Now it breaks at the incorrectly formatted error message 😂 #314

@yijiasu-crypto yijiasu-crypto mentioned this pull request Jul 26, 2021
11 tasks
@fedekunze fedekunze enabled auto-merge (squash) July 28, 2021 20:51
@fedekunze fedekunze added automerge Automatically merge PR once all prerequisites pass. Type: CI continuous integration labels Jul 28, 2021
@fedekunze
Copy link
Contributor

looks like this is still failing

@yijiasu-crypto
Copy link
Contributor Author

I am checking the EVM REVERT error logs on geth environments. Will update to #350.

Once #350 is done I think this will be passed.

@fedekunze
Copy link
Contributor

fedekunze commented Oct 1, 2021

@yijiasu-crypto seems that you are querying a height > current height? I will fix the panic

@fedekunze
Copy link
Contributor

  1. Contract: Counter
    should subtract:
    Error: Returned error: height must be greater than 0, but got 0

@yijiasu-crypto
Copy link
Contributor Author

Checking on the latest issue

  1. Contract: Counter
    should subtract:
    Error: Returned error: height must be greater than 0, but got 0

@yijiasu-crypto
Copy link
Contributor Author

Now it's no longer crashing during access getBlockNumber

@yijiasu-crypto
Copy link
Contributor Author

"height must be greater than 0, but got 0" -> This error is not issued on the truffle side or test side. The test suite passed on ganache.

It looks like the error comes from ethermint or tendermint side. Could you check? @fedekunze

@yijiasu-crypto
Copy link
Contributor Author

all tests are now passed (ran locally) except the basic test !!

Getting this error: height must be greater than 0, but got 0

Comment on lines +146 to +151
// it('can receive ETH from contract [@skip-on-coverage]', async () => {
// const receipt = await ethSender.sendEth(proxy.address, { value })

assertAmountOfEvents(receipt, 'ProxyDeposit', { decodeForAbi: proxy.abi })
assertEvent(receipt, 'ProxyDeposit', { decodeForAbi: proxy.abi, expectedArgs: { sender: ethSender.address, value } })
})
// assertAmountOfEvents(receipt, 'ProxyDeposit', { decodeForAbi: proxy.abi })
// assertEvent(receipt, 'ProxyDeposit', { decodeForAbi: proxy.abi, expectedArgs: { sender: ethSender.address, value } })
// })
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@fedekunze
Copy link
Contributor

@yijiasu-crypto can you point me to the test?

@yijiasu-crypto
Copy link
Contributor Author

Crashed here: https://github.com/yijiasu-crypto/ethermint/blob/5d919d3cf56ad6fc4eba6bbf8ef1a97ab523d9dc/tests/solidity/suites/basic/test/counter.js#L79

the estimateGas test is now removed so it does not matter if it fails.

@yijiasu-crypto
Copy link
Contributor Author

yijiasu-crypto commented Oct 6, 2021

It looks like ethermint returns an error when call eth_getLogs with fromBlock=0

This RPC call is successful under a ganache environment. Please take a look at detailed RPC logs below.

RPC traffic from ethermint:

   > {
   >   "jsonrpc": "2.0",
   >   "id": 689,
   >   "method": "eth_getLogs",
   >   "params": [
   >     {
   >       "fromBlock": "0x0",
   >       "toBlock": "latest",
   >       "address": "0x5740b613cc08a8ed765a898e82aa62e49137b5f8",
   >       "topics": []
   >     }
   >   ]
   > }
 <   {
 <     "jsonrpc": "2.0",
 <     "id": 689,
 <     "error": {
 <       "code": -32000,
 <       "message": "height must be greater than 0, but got 0"
 <     }

RPC traffic from ganache:

   > {
   >   "jsonrpc": "2.0",
   >   "id": 84,
   >   "method": "eth_getLogs",
   >   "params": [
   >     {
   >       "fromBlock": "0x0",
   >       "toBlock": "latest",
   >       "address": "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9",
   >       "topics": []
   >     }
   >   ]
   > }
 <   {
 <     "jsonrpc": "2.0",
 <     "id": 84,
 <     "result": [
 <       {
 <         "removed": false,
 <         "logIndex": "0x0",
 <         "transactionIndex": "0x0",
 <         "transactionHash": "0xd992d48954bccdc7ca4ef8e6bbaf2f80530cccd1f80780dad92243d7bceeabf4",
 <         "blockHash": "0xc57e3f3dc622dc4e61987b134b48d2f93de216a4be653ff04d4982832f53c227",
 <         "blockNumber": "0x8",
 <         "address": "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9",
 <         "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
 <         "topics": [
 <           "0x64a55044d1f2eddebe1b90e8e2853e8e96931cefadbfa0b2ceb34bee36061941"
 <         ]
 <       },
 <       {
 <         "removed": false,
 <         "logIndex": "0x1",
 <         "transactionIndex": "0x0",
 <         "transactionHash": "0xd992d48954bccdc7ca4ef8e6bbaf2f80530cccd1f80780dad92243d7bceeabf4",
 <         "blockHash": "0xc57e3f3dc622dc4e61987b134b48d2f93de216a4be653ff04d4982832f53c227",
 <         "blockNumber": "0x8",
 <         "address": "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9",
 <         "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
 <         "topics": [
 <           "0x938d2ee5be9cfb0f7270ee2eff90507e94b37625d9d2b3a61c97d30a4560b829"
 <         ]
 <       },
 <       {
 <         "removed": false,
 <         "logIndex": "0x0",
 <         "transactionIndex": "0x0",
 <         "transactionHash": "0xdea3ed00ab21f57f8866721084411936c22d9c16992d5fa98585124e977dcdbb",
 <         "blockHash": "0xf54a1b408c565a316b303785ad36078bea791aab79e1085f12e4976e8a9517d5",
 <         "blockNumber": "0x9",
 <         "address": "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9",
 <         "data": "0x0000000000000000000000000000000000000000000000000000000000000000",
 <         "topics": [
 <           "0x938d2ee5be9cfb0f7270ee2eff90507e94b37625d9d2b3a61c97d30a4560b829"
 <         ]
 <       }
 <     ]
 <   }

@yijiasu-crypto
Copy link
Contributor Author

@fedekunze please take a look at the latest diagnosis I posted above

@fedekunze fedekunze removed the automerge Automatically merge PR once all prerequisites pass. label Oct 6, 2021
@codecov
Copy link

codecov bot commented Oct 6, 2021

Codecov Report

Merging #278 (2d853bd) into main (bc8c87c) will decrease coverage by 5.30%.
The diff coverage is n/a.

❗ Current head 2d853bd differs from pull request most recent head 3ca1367. Consider uploading reports for the commit 3ca1367 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #278      +/-   ##
==========================================
- Coverage   55.88%   50.58%   -5.31%     
==========================================
  Files          63       50      -13     
  Lines        5518     4928     -590     
==========================================
- Hits         3084     2493     -591     
- Misses       2271     2328      +57     
+ Partials      163      107      -56     
Impacted Files Coverage Δ
x/evm/types/dynamic_fee_tx.go 0.00% <0.00%> (-89.68%) ⬇️
x/evm/types/access_list.go 23.33% <0.00%> (-76.67%) ⬇️
types/validation.go 33.33% <0.00%> (-66.67%) ⬇️
x/evm/types/tracer.go 0.00% <0.00%> (-46.43%) ⬇️
x/evm/types/params.go 64.78% <0.00%> (-35.22%) ⬇️
x/evm/types/legacy_tx.go 73.21% <0.00%> (-26.79%) ⬇️
x/evm/types/chain_config.go 76.61% <0.00%> (-23.39%) ⬇️
x/evm/types/tx_data.go 74.35% <0.00%> (-9.74%) ⬇️
x/evm/types/genesis.go 91.17% <0.00%> (-8.83%) ⬇️
x/evm/keeper/state_transition.go 58.47% <0.00%> (-8.72%) ⬇️
... and 42 more

@yijiasu-crypto
Copy link
Contributor Author

PR #650 could fix the stuck issue. Wait for that to be merged and test again on this PR

@fedekunze fedekunze enabled auto-merge (squash) October 8, 2021 13:36
@fedekunze fedekunze merged commit e9ab624 into evmos:main Oct 8, 2021
fedekunze added a commit that referenced this pull request Oct 8, 2021
* Fix CI

* Remove verbose-log to reduce size

* update timeout

* rm deploy contract action

* Update test-helper.js

* Update workflow

* Update workflow

* fix gas estimate amount

* Update test.yml

* fix error assert issue

* ignore bad test case

* remove estimate gas test

* Change fromBlock to 1 (TEMP, Reverse Required)

* bump timeout

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
fedekunze added a commit that referenced this pull request Oct 8, 2021
* ci: add bencher config (#652)

Add bencher config with global +-10% threshold for improvements and regressions

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* fix conflicts

* evm: fix panic when transaction is reverted (#650)

* fix panic when transaction is reverted

* update changelog

* Update x/evm/keeper/context_stack.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* rpc: test fix (#608)

* fix rpc tests with net namespace

* skip personal test

* skip rpc pending test

* fix endpoint

* fix rpc pending test

* fix missing gas param in some rpc tests

* fix eth_getproof when the block number is equal to pending or latest

* fix rpc tests filter subscribe failed

* lint

* remove unused linter

* fix PendingTransactionFilter and TestEth_GetFilterChanges_BlockFilter

* fix eth_estimateGas

* fix TestEth_EstimateGas_ContractDeployment

* skip TestEth_ExportAccount_WithStorage

* remove sleep in rpc test

* Update changelog

* add test-rpc in github action

* bump golangci-lint version to v1.42.1

* release: v0.7.1 cherry-picks

* changelog

* ci: fix solidity tests (#278)

* Fix CI

* Remove verbose-log to reduce size

* update timeout

* rm deploy contract action

* Update test-helper.js

* Update workflow

* Update workflow

* fix gas estimate amount

* Update test.yml

* fix error assert issue

* ignore bad test case

* remove estimate gas test

* Change fromBlock to 1 (TEMP, Reverse Required)

* bump timeout

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>

Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>
Co-authored-by: Thomas Nguy <81727899+thomas-nguy@users.noreply.github.com>
Co-authored-by: JayT106 <JayT106@users.noreply.github.com>
Co-authored-by: Yijia Su <85918228+yijiasu-crypto@users.noreply.github.com>
Co-authored-by: yihuang <huang@crypto.com>
mmsqe added a commit to mmsqe/ethermint that referenced this pull request Aug 2, 2023
* integrate with sdk V47 & ibc-go V7

* update proto-gen and proto files

* fix e2e tests

* tmp

* working tmp

* fix rebase conflict

* fix merge conflict

* fix test

* recover makefile changes

* fix lint

* fix protoc-gen-tool script

* update tendermint dependency

* update btcsuite/btcutil path

* update gomod2nix

* fix Makefile,regen proto files and remove third_party proto

* update gomod2nix

* fix lint

* update nix

* replace cometbft tm-db

update to sdk v0.47.2

newer btcutil

* algo -> key-type

* set mempool

* set chainId

* update protobuf

* fix import

* fix test

* debug test

* update nix

* fix btcsuite

* make proto-gen follow by UPGRADING.md

* fix sync issue with latest blk

for more info, see https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#replaces

* disable depguard

* gogo/protobuf -> cosmos/gogoproto

* no pass chain_id after setup

ethermintd config chain-id

* fix lint

* fix err msg due to empty version check fix

for more info, see https://github.com/cosmos/cosmos-sdk/pull/13355/files

* add the crisis store in store upgrades

* fix lint

* add consensus upgrade

* migrate consensus parameters

* fix lint

* allow flag overwrite chainId

* fix ConsensusParams

fix evm

* fix lint

* add paramKeyTable

* add change log

* err code change due to nested msg check

* fix lint

* cleanup mod

* add nil check for consParams.Block

* Revert "fix ConsensusParams"

This reverts commit b739244.

* sdk to v0.47.3 and ibc-go to v7.1.0

* point to logger fix

* get consParams from keeper if not in ctx

* point back cometbft

* fix broadcast mode

* fix lint

* update default params for test

* cleanup deps

* fix ibc client route in gov router

* fix broadcast mode

* fix ibctm

for more info, see https://github.com/cosmos/ibc-go/blob/v7.2.0/docs/migrations/v6-to-v7.md#chains

* point to sdk cp fix

* Update rpc/backend/utils.go

Co-authored-by: yihuang <huang@crypto.com>
Signed-off-by: mmsqe <mavis@crypto.com>

* Update rpc/types/utils.go

Co-authored-by: yihuang <huang@crypto.com>
Signed-off-by: mmsqe <mavis@crypto.com>

* fix build

* revert get params by consensusparamkeeper

* keep validator err msg

* Revert "keep validator err msg"

This reverts commit 20253ce.

* test with more retries

* add expect_cb

* fix hooks

* rm RandomizedParams ProposalContents

* prune expire state

---------

Signed-off-by: mmsqe <mavis@crypto.com>
Co-authored-by: jay tseng <jay.tseng@crypto.com>
Co-authored-by: yihuang <huang@crypto.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: CI continuous integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants