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

Problem: no integration test for EIP-1559 feature #249

Merged
merged 6 commits into from
Jan 17, 2022

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Dec 10, 2021

Closes: #245

Solution:

  • enable eip-1559 in integration test devnets
  • test dynamic fee tx and the fee calculation logic
  • test base fee adjustment

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

@codecov
Copy link

codecov bot commented Dec 10, 2021

Codecov Report

Merging #249 (c7f4ba5) into main (3ea70c5) will increase coverage by 19.54%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #249       +/-   ##
===========================================
+ Coverage   21.51%   41.06%   +19.54%     
===========================================
  Files          27       30        +3     
  Lines        1729     1505      -224     
===========================================
+ Hits          372      618      +246     
+ Misses       1324      841      -483     
- Partials       33       46       +13     
Impacted Files Coverage Δ
x/cronos/genesis.go 61.53% <ø> (-38.47%) ⬇️
x/cronos/handler.go 100.00% <ø> (ø)
x/cronos/keeper/evm.go 58.00% <ø> (+6.27%) ⬆️
x/cronos/keeper/evm_hooks.go 80.00% <ø> (ø)
x/cronos/keeper/evm_log_handlers.go 83.50% <ø> (ø)
x/cronos/keeper/gravity_hooks.go 0.00% <ø> (ø)
x/cronos/keeper/grpc_query.go 0.00% <ø> (ø)
x/cronos/keeper/ibc.go 83.20% <ø> (+5.01%) ⬆️
x/cronos/keeper/ibc_hooks.go 50.00% <ø> (-8.83%) ⬇️
x/cronos/keeper/keeper.go 64.89% <ø> (-29.45%) ⬇️
... and 28 more

go.mod Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@yihuang yihuang force-pushed the eip-1559 branch 4 times, most recently from 4dc76b3 to d89eb97 Compare January 17, 2022 05:59
@yihuang yihuang marked this pull request as ready for review January 17, 2022 06:00
@yihuang yihuang requested a review from a team as a code owner January 17, 2022 06:00
@yihuang yihuang requested review from calvinaco and devashishdxt and removed request for a team January 17, 2022 06:00
Closes: crypto-org-chain#245

Solution:
- enable eip-1559 in integration test devnets
- test dynamic fee tx and the fee calculation logic
- test base fee adjustment

lower initial base fee

fix statesync test

fix gravity test

fix base fee adjustment
@yihuang yihuang force-pushed the eip-1559 branch 2 times, most recently from 899eb73 to 8a34e92 Compare January 17, 2022 07:08
@@ -69,7 +69,7 @@ def test_events(cluster, suspend_capture):
def test_minimal_gas_price(cronos):
w3 = cronos.w3
gas_price = w3.eth.gas_price
assert gas_price == 5000000000000
# assert gas_price == 5000000000000
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

gas price is not fixed now.

Copy link
Contributor

Choose a reason for hiding this comment

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

specifying unit would be useful

Copy link
Collaborator Author

@yihuang yihuang Jan 17, 2022

Choose a reason for hiding this comment

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

specifying unit would be useful

this assertion is removed because gas_price result is not constant anymore.

@@ -12,6 +12,13 @@ in
import sources.nixpkgs {
overlays = [
(_: pkgs: dapptools) # use released version to hit the binary cache
(_: pkgs: {
go-ethereum = pkgs.callPackage ./go-ethereum.nix {
Copy link
Collaborator Author

@yihuang yihuang Jan 17, 2022

Choose a reason for hiding this comment

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

to replace to a newer version to test eip-1559 logic.

elasticity_multiplier = 2
gas_target = gas_limit // elasticity_multiplier

delta = parent_fee * (gas_target - gas_used) // gas_target // change_denominator
Copy link
Contributor

Choose a reason for hiding this comment

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

some explanation for parent_fee?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I linked the eip-1559 spec, it's basically the same code as the spec.

@@ -137,6 +137,30 @@ def wait_for_ipc(path, timeout=40.0):
)


def w3_wait_for_block(w3, height, timeout=240):
for i in range(timeout * 2):
Copy link
Contributor

Choose a reason for hiding this comment

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

why multiply with 2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because it sleep 0.5 seconds, multiply the loop count with 2 make total time closer to timeout as seconds.

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

@yihuang yihuang merged commit 948a286 into crypto-org-chain:main Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: no integration test for EIP-1559 feature
2 participants