-
Notifications
You must be signed in to change notification settings - Fork 241
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: push0 opcode is not tested #1273
Conversation
- shanghai hardfork introduces push0 opcode, can be enabled in solc
WalkthroughThe updates across the various files primarily involve a shift in the Solidity version from 0.8.10 to 0.8.21, suggesting an alignment with the latest compiler features and optimizations. There's also a new Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ? TipsChat with CodeRabbit Bot (
|
Signed-off-by: yihuang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (11)
- CHANGELOG.md (1 hunks)
- integration_tests/contracts/contracts/CosmosToken.sol (1 hunks)
- integration_tests/contracts/contracts/Gravity.sol (1 hunks)
- integration_tests/contracts/contracts/ICosmosToken.sol (1 hunks)
- integration_tests/contracts/contracts/TestBlackListERC20.sol (1 hunks)
- integration_tests/contracts/contracts/TestCRC20.sol (1 hunks)
- integration_tests/contracts/contracts/TestERC20A.sol (1 hunks)
- integration_tests/contracts/contracts/TestERC20Utility.sol (1 hunks)
- integration_tests/contracts/contracts/TestERC21Source.sol (1 hunks)
- integration_tests/contracts/contracts/TestMaliciousSupply.sol (1 hunks)
- integration_tests/contracts/hardhat.config.ts (1 hunks)
Files skipped from review due to trivial changes (3)
- integration_tests/contracts/contracts/ICosmosToken.sol
- integration_tests/contracts/contracts/TestBlackListERC20.sol
- integration_tests/contracts/contracts/TestERC20Utility.sol
Additional comments: 7
integration_tests/contracts/contracts/TestERC20A.sol (1)
- 1-1: Ensure that the contract
TestERC20A
has been thoroughly tested with the updated Solidity version0.8.21
to prevent any unexpected behavior due to changes in the compiler.integration_tests/contracts/hardhat.config.ts (1)
- 7-12: Confirm that the Hardhat configuration changes, including the Solidity version upgrade to
0.8.21
and theevmVersion
set to "shanghai", are compatible with the entire project and do not introduce any breaking changes.integration_tests/contracts/contracts/TestMaliciousSupply.sol (1)
- 1-1: Ensure that the contract
TestMaliciousSupply
has been thoroughly tested with the updated Solidity version0.8.21
to prevent any unexpected behavior due to changes in the compiler, especially given the contract's purpose for testing edge cases.integration_tests/contracts/contracts/TestCRC20.sol (1)
- 1-1: Ensure that the contract
TestCRC20
has been thoroughly tested with the updated Solidity version0.8.21
to prevent any unexpected behavior due to changes in the compiler.integration_tests/contracts/contracts/CosmosToken.sol (1)
- 1-1: Ensure that the contract
CosmosToken
has been thoroughly tested with the updated Solidity version0.8.21
to prevent any unexpected behavior due to changes in the compiler.integration_tests/contracts/contracts/TestERC21Source.sol (1)
- 1-1: Ensure that the contract
TestERC21Source
has been thoroughly tested with the updated Solidity version0.8.21
to prevent any unexpected behavior due to changes in the compiler.integration_tests/contracts/contracts/Gravity.sol (1)
- 1-4: Ensure that the contract
Gravity
has been thoroughly tested with the updated Solidity version0.8.21
and the new imports from the "@openzeppelin/contracts" library to prevent any unexpected behavior due to changes in the compiler and new dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (5)
- integration_tests/conftest.py (1 hunks)
- integration_tests/test_basic.py (2 hunks)
- integration_tests/test_ibc_rly_gas.py (1 hunks)
- integration_tests/test_pruned_node.py (1 hunks)
- integration_tests/utils.py (2 hunks)
Additional comments: 4
integration_tests/conftest.py (1)
- 14-14: The addition of the "unmarked" marker to the pytest configuration is a good practice to handle tests without specific markers. Ensure that this new configuration is documented and that the team is aware of its usage.
integration_tests/test_pruned_node.py (1)
- 49-49: The decrement of
exp_gas_used
by 1 should reflect an accurate expectation of gas usage for the transaction. Verify that this change is consistent with the gas costs observed after thepush0
opcode update.integration_tests/test_basic.py (2)
54-54: The addition of
assert receipt.gasUsed == 21000
assumes that the gas used for the transaction will always be exactly 21000. This is a common amount for a simple ETH transfer, but it may not hold true for all environments or future updates. Consider verifying if this value should be hardcoded or if it should allow for some variance.63-63: The addition of
exp_gas_used=633810
as an argument to thedeploy_contract
function call seems to be a specific expectation for the gas used during contract deployment. Ensure that this value is accurate and consider if it should be a constant or derived from some configuration, especially since gas usage can change with contract complexity or EVM changes.
Signed-off-by: yihuang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- CHANGELOG.md (1 hunks)
- integration_tests/test_basic.py (2 hunks)
- integration_tests/utils.py (2 hunks)
Files skipped from review due to trivial changes (1)
- CHANGELOG.md
Files skipped from review as they are similar to previous changes (2)
- integration_tests/test_basic.py
- integration_tests/utils.py
* Problem: there are flaky integration tests wait for first block * add missing markers
- shanghai hardfork introduces push0 opcode, can be enabled in solc Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> enlarge gas gap assert some exact gas number fix python lint test upgrade test push0 opcode in upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (5)
- integration_tests/conftest.py (2 hunks)
- integration_tests/contracts/contracts/Greeter.sol (1 hunks)
- integration_tests/contracts/hardhat.config.ts (1 hunks)
- integration_tests/test_min_gas_price.py (4 hunks)
- integration_tests/test_upgrade.py (2 hunks)
Files skipped from review due to trivial changes (2)
- integration_tests/contracts/contracts/Greeter.sol
- integration_tests/contracts/hardhat.config.ts
Files skipped from review as they are similar to previous changes (1)
- integration_tests/conftest.py
Additional comments: 7
integration_tests/test_min_gas_price.py (4)
6-6: The addition of
wait_for_new_blocks
to the import statement is noted. Ensure that this function is used appropriately within the test cases.29-29: The change in the directory name from "min-gas-price-gt" to "min-gas-price-lte" is observed. Confirm that this change aligns with the intended test environment setup and that no references to the old directory name remain in the codebase or documentation.
68-68: The addition of
wait_for_new_blocks
before thetest_dynamic_fee_tx
function is appropriate to ensure the blockchain state is ready for the test. This is a good practice to avoid flaky tests due to timing issues.106-106: Similarly, the addition of
wait_for_new_blocks
before thetest_base_fee_adjustment
function is a good practice to ensure the blockchain state is consistent before running the test.integration_tests/test_upgrade.py (3)
127-131: The conditional block checking for
testnet
and asserting the absence of support for thePUSH0
opcode before the upgrade is a good addition. It ensures that the test environment correctly reflects the capabilities of the system before and after the upgrade.191-193: The conditional block checking for
testnet
and deploying a new contract to verify support for thePUSH0
opcode after the upgrade is a good validation step. It confirms that the upgrade has taken effect and the new opcode is now supported.195-197: The JSON-RPC query assertions are correct and ensure that the state of the blockchain before the upgrade is still accessible and consistent after the upgrade.
Signed-off-by: yihuang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- integration_tests/test_upgrade.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- integration_tests/test_upgrade.py
Signed-off-by: yihuang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- integration_tests/test_basic.py (2 hunks)
- integration_tests/test_upgrade.py (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- integration_tests/test_basic.py
- integration_tests/test_upgrade.py
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)
Summary by CodeRabbit
Documentation
New Features
push0
opcode in integration tests for enhanced smart contract capabilities.Bug Fixes
Tests